Completed
Branch dependabot/composer/tijsverkoy... (491ea6)
by
unknown
32:00 queued 25:42
created
caffeinated/modules/recaptcha/EED_Recaptcha.module.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
         define(
135 135
             'RECAPTCHA_BASE_PATH',
136
-            rtrim(str_replace(array('\\', '/'), '/', plugin_dir_path(__FILE__)), '/') . '/'
136
+            rtrim(str_replace(array('\\', '/'), '/', plugin_dir_path(__FILE__)), '/').'/'
137 137
         );
138 138
         define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
139 139
     }
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
     {
188 188
         wp_register_script(
189 189
             'espresso_recaptcha',
190
-            RECAPTCHA_BASE_URL . 'scripts/espresso_recaptcha.js',
190
+            RECAPTCHA_BASE_URL.'scripts/espresso_recaptcha.js',
191 191
             array('single_page_checkout'),
192 192
             EVENT_ESPRESSO_VERSION,
193 193
             true
194 194
         );
195 195
         wp_register_script(
196 196
             'google_recaptcha',
197
-            'https://www.google.com/recaptcha/api.js?hl=' . EED_Recaptcha::$config->recaptcha_language,
197
+            'https://www.google.com/recaptcha/api.js?hl='.EED_Recaptcha::$config->recaptcha_language,
198 198
             array('espresso_recaptcha'),
199 199
             EVENT_ESPRESSO_VERSION,
200 200
             true
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         if (EED_Recaptcha::useRecaptcha() && ! EED_Recaptcha::$_not_a_robot) {
254 254
             // only display if they have NOT passed the test yet
255 255
             EEH_Template::display_template(
256
-                RECAPTCHA_BASE_PATH . '/templates/recaptcha.template.php',
256
+                RECAPTCHA_BASE_PATH.'/templates/recaptcha.template.php',
257 257
                 array(
258 258
                     'recaptcha_publickey' => EED_Recaptcha::$config->recaptcha_publickey,
259 259
                     'recaptcha_theme'     => EED_Recaptcha::$config->recaptcha_theme,
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
299 299
         // verify recaptcha
300 300
         EED_Recaptcha::_get_recaptcha_response();
301
-        if (! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
301
+        if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
302 302
             $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
303 303
             EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
304 304
         }
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
     private static function _process_recaptcha_response()
376 376
     {
377 377
         // verify library is loaded
378
-        if (! class_exists('\ReCaptcha\ReCaptcha')) {
379
-            require_once RECAPTCHA_BASE_PATH . '/autoload.php';
378
+        if ( ! class_exists('\ReCaptcha\ReCaptcha')) {
379
+            require_once RECAPTCHA_BASE_PATH.'/autoload.php';
380 380
         }
381 381
         // The response from reCAPTCHA
382 382
         EED_Recaptcha::_get_recaptcha_response();
Please login to merge, or discard this patch.
Indentation   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -17,382 +17,382 @@
 block discarded – undo
17 17
  */
18 18
 class EED_Recaptcha extends EED_Module
19 19
 {
20
-    /**
21
-     * @var EE_Registration_Config $config
22
-     */
23
-    private static $config;
24
-
25
-    /**
26
-     * @type bool $_not_a_robot
27
-     */
28
-    private static $_not_a_robot;
29
-
30
-    /**
31
-     * @type string $_recaptcha_response
32
-     */
33
-    private static $_recaptcha_response;
34
-
35
-
36
-    /**
37
-     * @return EED_Module|EED_Recaptcha
38
-     */
39
-    public static function instance()
40
-    {
41
-        return parent::get_instance(__CLASS__);
42
-    }
43
-
44
-
45
-    /**
46
-     * set_hooks - for hooking into EE Core, other modules, etc
47
-     *
48
-     * @return void
49
-     * @throws InvalidArgumentException
50
-     * @throws InvalidInterfaceException
51
-     * @throws InvalidDataTypeException
52
-     */
53
-    public static function set_hooks()
54
-    {
55
-        EED_Recaptcha::$config = EE_Registry::instance()->CFG->registration;
56
-        // use_captcha ?
57
-        if (
58
-            EED_Recaptcha::useRecaptcha()
59
-            && EED_Recaptcha::notPaymentOptionsRevisit()
60
-        ) {
61
-            EED_Recaptcha::set_definitions();
62
-            EED_Recaptcha::enqueue_styles_and_scripts();
63
-            add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
64
-            add_action(
65
-                'AHEE__before_spco_whats_next_buttons',
66
-                array('EED_Recaptcha', 'display_recaptcha'),
67
-                10,
68
-                0
69
-            );
70
-            add_filter(
71
-                'FHEE__EED_Single_Page_Checkout__init___continue_reg',
72
-                array('EED_Recaptcha', 'not_a_robot')
73
-            );
74
-            add_filter(
75
-                'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
76
-                array('EED_Recaptcha', 'not_a_robot')
77
-            );
78
-            add_filter(
79
-                'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
80
-                array('EED_Recaptcha', 'recaptcha_response')
81
-            );
82
-            add_filter(
83
-                'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
84
-                array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method')
85
-            );
86
-        }
87
-    }
88
-
89
-
90
-    /**
91
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
92
-     *
93
-     * @return void
94
-     * @throws InvalidArgumentException
95
-     * @throws InvalidInterfaceException
96
-     * @throws InvalidDataTypeException
97
-     */
98
-    public static function set_hooks_admin()
99
-    {
100
-        EED_Recaptcha::$config = EE_Registry::instance()->CFG->registration;
101
-        EED_Recaptcha::set_definitions();
102
-        // use_captcha ?
103
-        if (
104
-            EED_Recaptcha::useRecaptcha()
105
-            && EED_Recaptcha::notPaymentOptionsRevisit()
106
-            && EED_Recaptcha::getRequest()->getRequestParam('step', '') !== ''
107
-        ) {
108
-            EED_Recaptcha::enqueue_styles_and_scripts();
109
-            add_filter(
110
-                'FHEE__EED_Single_Page_Checkout__init___continue_reg',
111
-                array('EED_Recaptcha', 'not_a_robot')
112
-            );
113
-            add_filter(
114
-                'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
115
-                array('EED_Recaptcha', 'not_a_robot')
116
-            );
117
-            add_filter(
118
-                'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
119
-                array('EED_Recaptcha', 'recaptcha_response')
120
-            );
121
-        }
122
-    }
123
-
124
-
125
-    /**
126
-     * @return void
127
-     */
128
-    public static function set_definitions()
129
-    {
130
-        if (is_user_logged_in()) {
131
-            EED_Recaptcha::$_not_a_robot = true;
132
-        }
133
-        define(
134
-            'RECAPTCHA_BASE_PATH',
135
-            rtrim(str_replace(array('\\', '/'), '/', plugin_dir_path(__FILE__)), '/') . '/'
136
-        );
137
-        define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
138
-    }
139
-
140
-
141
-    /**
142
-     * @return void
143
-     */
144
-    public static function set_late_hooks()
145
-    {
146
-        add_filter(
147
-            'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
148
-            array('EED_Recaptcha', 'not_a_robot')
149
-        );
150
-    }
151
-
152
-
153
-    /**
154
-     * @return boolean
155
-     */
156
-    public static function useRecaptcha()
157
-    {
158
-        return EED_Recaptcha::$config->use_captcha
159
-               && EED_Recaptcha::$config->recaptcha_theme !== 'invisible';
160
-    }
161
-
162
-
163
-    /**
164
-     * @return boolean
165
-     * @throws InvalidArgumentException
166
-     * @throws InvalidInterfaceException
167
-     * @throws InvalidDataTypeException
168
-     */
169
-    public static function notPaymentOptionsRevisit()
170
-    {
171
-        $request = EED_Recaptcha::getRequest();
172
-        return ! (
173
-            $request->getRequestParam('step', '') === 'payment_options'
174
-            && $request->getRequestParam('revisit', false, 'bool') === true
175
-        );
176
-    }
177
-
178
-
179
-    /**
180
-     * @return void
181
-     * @throws InvalidArgumentException
182
-     * @throws InvalidInterfaceException
183
-     * @throws InvalidDataTypeException
184
-     */
185
-    public static function enqueue_styles_and_scripts()
186
-    {
187
-        wp_register_script(
188
-            'espresso_recaptcha',
189
-            RECAPTCHA_BASE_URL . 'scripts/espresso_recaptcha.js',
190
-            array('single_page_checkout'),
191
-            EVENT_ESPRESSO_VERSION,
192
-            true
193
-        );
194
-        wp_register_script(
195
-            'google_recaptcha',
196
-            'https://www.google.com/recaptcha/api.js?hl=' . EED_Recaptcha::$config->recaptcha_language,
197
-            array('espresso_recaptcha'),
198
-            EVENT_ESPRESSO_VERSION,
199
-            true
200
-        );
201
-        EE_Registry::$i18n_js_strings['no_SPCO_error'] = __(
202
-            'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.',
203
-            'event_espresso'
204
-        );
205
-        EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __(
206
-            'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.',
207
-            'event_espresso'
208
-        );
209
-        EE_Registry::$i18n_js_strings['recaptcha_fail'] = __(
210
-            'Please complete the anti-spam test before proceeding.',
211
-            'event_espresso'
212
-        );
213
-    }
214
-
215
-
216
-    /**
217
-     * @param WP $WP
218
-     */
219
-    public function run($WP)
220
-    {
221
-    }
222
-
223
-
224
-    /**
225
-     * @return boolean
226
-     * @throws InvalidArgumentException
227
-     * @throws InvalidInterfaceException
228
-     * @throws InvalidDataTypeException
229
-     */
230
-    public static function not_a_robot()
231
-    {
232
-        return is_bool(EED_Recaptcha::$_not_a_robot)
233
-            ? EED_Recaptcha::$_not_a_robot
234
-            : EED_Recaptcha::recaptcha_passed();
235
-    }
236
-
237
-
238
-    /**
239
-     * @return void
240
-     * @throws DomainException
241
-     * @throws InvalidArgumentException
242
-     * @throws InvalidInterfaceException
243
-     * @throws InvalidDataTypeException
244
-     */
245
-    public static function display_recaptcha()
246
-    {
247
-        // logged in means you have already passed a turing test of sorts
248
-        if (is_user_logged_in()) {
249
-            return;
250
-        }
251
-        // don't display if not using recaptcha or user is logged in
252
-        if (EED_Recaptcha::useRecaptcha() && ! EED_Recaptcha::$_not_a_robot) {
253
-            // only display if they have NOT passed the test yet
254
-            EEH_Template::display_template(
255
-                RECAPTCHA_BASE_PATH . '/templates/recaptcha.template.php',
256
-                array(
257
-                    'recaptcha_publickey' => EED_Recaptcha::$config->recaptcha_publickey,
258
-                    'recaptcha_theme'     => EED_Recaptcha::$config->recaptcha_theme,
259
-                    'recaptcha_type'      => EED_Recaptcha::$config->recaptcha_type,
260
-                )
261
-            );
262
-            wp_enqueue_script('google_recaptcha');
263
-        }
264
-    }
265
-
266
-
267
-    /**
268
-     * @return array
269
-     * @throws InvalidArgumentException
270
-     * @throws InvalidInterfaceException
271
-     * @throws InvalidDataTypeException
272
-     */
273
-    public static function bypass_recaptcha_for_spco_load_payment_method()
274
-    {
275
-        return array(
276
-            'EESID'  => EE_Registry::instance()->SSN->id(),
277
-            'step'   => 'payment_options',
278
-            'action' => 'switch_spco_billing_form',
279
-        );
280
-    }
281
-
282
-
283
-    /**
284
-     * @return boolean
285
-     * @throws InvalidArgumentException
286
-     * @throws InvalidInterfaceException
287
-     * @throws InvalidDataTypeException
288
-     */
289
-    public static function recaptcha_passed()
290
-    {
291
-        // logged in means you have already passed a turing test of sorts
292
-        if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
293
-            return true;
294
-        }
295
-        // was test already passed?
296
-        $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
297
-        $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
298
-        // verify recaptcha
299
-        EED_Recaptcha::_get_recaptcha_response();
300
-        if (! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
301
-            $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
302
-            EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
303
-        }
304
-        EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
305
-        return $recaptcha_passed;
306
-    }
307
-
308
-
309
-    /**
310
-     * @param array $recaptcha_response
311
-     * @return array
312
-     */
313
-    public static function recaptcha_response($recaptcha_response = array())
314
-    {
315
-        if (EED_Recaptcha::_bypass_recaptcha()) {
316
-            $recaptcha_response['bypass_recaptcha'] = true;
317
-            $recaptcha_response['recaptcha_passed'] = true;
318
-        } else {
319
-            $recaptcha_response['recaptcha_passed'] = EED_Recaptcha::$_not_a_robot;
320
-        }
321
-        return $recaptcha_response;
322
-    }
323
-
324
-
325
-    /**
326
-     * @return boolean
327
-     */
328
-    private static function _bypass_recaptcha()
329
-    {
330
-        // an array of key value pairs that must match exactly with the incoming request,
331
-        // in order to bypass recaptcha for the current request ONLY
332
-        $bypass_request_params_array = (array) apply_filters(
333
-            'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
334
-            array()
335
-        );
336
-        // does $bypass_request_params_array have any values ?
337
-        if (empty($bypass_request_params_array)) {
338
-            return false;
339
-        }
340
-        $request = EED_Recaptcha::getRequest();
341
-        // initially set bypass to TRUE
342
-        $bypass_recaptcha = true;
343
-        foreach ($bypass_request_params_array as $key => $value) {
344
-            // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE,
345
-            // otherwise carry over it's value. This way, one missed setting results in no bypass
346
-            $bypass_recaptcha = $request->getRequestParam($key) === $value
347
-                ? $bypass_recaptcha
348
-                : false;
349
-        }
350
-        return $bypass_recaptcha;
351
-    }
352
-
353
-
354
-    /**
355
-     * @return void
356
-     * @throws InvalidArgumentException
357
-     * @throws InvalidInterfaceException
358
-     * @throws InvalidDataTypeException
359
-     */
360
-    private static function _get_recaptcha_response()
361
-    {
362
-        EED_Recaptcha::$_recaptcha_response = EED_Recaptcha::getRequest()->getRequestParam(
363
-            'g-recaptcha-response'
364
-        );
365
-    }
366
-
367
-
368
-    /**
369
-     * @return boolean
370
-     * @throws InvalidArgumentException
371
-     * @throws InvalidInterfaceException
372
-     * @throws InvalidDataTypeException
373
-     */
374
-    private static function _process_recaptcha_response()
375
-    {
376
-        // verify library is loaded
377
-        if (! class_exists('\ReCaptcha\ReCaptcha')) {
378
-            require_once RECAPTCHA_BASE_PATH . '/autoload.php';
379
-        }
380
-        // The response from reCAPTCHA
381
-        EED_Recaptcha::_get_recaptcha_response();
382
-        $recaptcha_response = EED_Recaptcha::$_recaptcha_response;
383
-        // Was there a reCAPTCHA response?
384
-        if ($recaptcha_response) {
385
-            // if allow_url_fopen is Off, then set a different request method
386
-            $request_method = ! ini_get('allow_url_fopen') ? new SocketPost() : null;
387
-            $recaptcha = new ReCaptcha(
388
-                EED_Recaptcha::$config->recaptcha_privatekey,
389
-                $request_method
390
-            );
391
-            $recaptcha_response = $recaptcha->verify(
392
-                EED_Recaptcha::$_recaptcha_response,
393
-                EED_Recaptcha::getRequest()->getServerParam('REMOTE_ADDR')
394
-            );
395
-        }
396
-        return $recaptcha_response instanceof Response && $recaptcha_response->isSuccess();
397
-    }
20
+	/**
21
+	 * @var EE_Registration_Config $config
22
+	 */
23
+	private static $config;
24
+
25
+	/**
26
+	 * @type bool $_not_a_robot
27
+	 */
28
+	private static $_not_a_robot;
29
+
30
+	/**
31
+	 * @type string $_recaptcha_response
32
+	 */
33
+	private static $_recaptcha_response;
34
+
35
+
36
+	/**
37
+	 * @return EED_Module|EED_Recaptcha
38
+	 */
39
+	public static function instance()
40
+	{
41
+		return parent::get_instance(__CLASS__);
42
+	}
43
+
44
+
45
+	/**
46
+	 * set_hooks - for hooking into EE Core, other modules, etc
47
+	 *
48
+	 * @return void
49
+	 * @throws InvalidArgumentException
50
+	 * @throws InvalidInterfaceException
51
+	 * @throws InvalidDataTypeException
52
+	 */
53
+	public static function set_hooks()
54
+	{
55
+		EED_Recaptcha::$config = EE_Registry::instance()->CFG->registration;
56
+		// use_captcha ?
57
+		if (
58
+			EED_Recaptcha::useRecaptcha()
59
+			&& EED_Recaptcha::notPaymentOptionsRevisit()
60
+		) {
61
+			EED_Recaptcha::set_definitions();
62
+			EED_Recaptcha::enqueue_styles_and_scripts();
63
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
64
+			add_action(
65
+				'AHEE__before_spco_whats_next_buttons',
66
+				array('EED_Recaptcha', 'display_recaptcha'),
67
+				10,
68
+				0
69
+			);
70
+			add_filter(
71
+				'FHEE__EED_Single_Page_Checkout__init___continue_reg',
72
+				array('EED_Recaptcha', 'not_a_robot')
73
+			);
74
+			add_filter(
75
+				'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
76
+				array('EED_Recaptcha', 'not_a_robot')
77
+			);
78
+			add_filter(
79
+				'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
80
+				array('EED_Recaptcha', 'recaptcha_response')
81
+			);
82
+			add_filter(
83
+				'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
84
+				array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method')
85
+			);
86
+		}
87
+	}
88
+
89
+
90
+	/**
91
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
92
+	 *
93
+	 * @return void
94
+	 * @throws InvalidArgumentException
95
+	 * @throws InvalidInterfaceException
96
+	 * @throws InvalidDataTypeException
97
+	 */
98
+	public static function set_hooks_admin()
99
+	{
100
+		EED_Recaptcha::$config = EE_Registry::instance()->CFG->registration;
101
+		EED_Recaptcha::set_definitions();
102
+		// use_captcha ?
103
+		if (
104
+			EED_Recaptcha::useRecaptcha()
105
+			&& EED_Recaptcha::notPaymentOptionsRevisit()
106
+			&& EED_Recaptcha::getRequest()->getRequestParam('step', '') !== ''
107
+		) {
108
+			EED_Recaptcha::enqueue_styles_and_scripts();
109
+			add_filter(
110
+				'FHEE__EED_Single_Page_Checkout__init___continue_reg',
111
+				array('EED_Recaptcha', 'not_a_robot')
112
+			);
113
+			add_filter(
114
+				'FHEE__EE_SPCO_Reg_Step__set_completed___completed',
115
+				array('EED_Recaptcha', 'not_a_robot')
116
+			);
117
+			add_filter(
118
+				'FHEE__EE_SPCO_JSON_Response___toString__JSON_response',
119
+				array('EED_Recaptcha', 'recaptcha_response')
120
+			);
121
+		}
122
+	}
123
+
124
+
125
+	/**
126
+	 * @return void
127
+	 */
128
+	public static function set_definitions()
129
+	{
130
+		if (is_user_logged_in()) {
131
+			EED_Recaptcha::$_not_a_robot = true;
132
+		}
133
+		define(
134
+			'RECAPTCHA_BASE_PATH',
135
+			rtrim(str_replace(array('\\', '/'), '/', plugin_dir_path(__FILE__)), '/') . '/'
136
+		);
137
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
138
+	}
139
+
140
+
141
+	/**
142
+	 * @return void
143
+	 */
144
+	public static function set_late_hooks()
145
+	{
146
+		add_filter(
147
+			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
148
+			array('EED_Recaptcha', 'not_a_robot')
149
+		);
150
+	}
151
+
152
+
153
+	/**
154
+	 * @return boolean
155
+	 */
156
+	public static function useRecaptcha()
157
+	{
158
+		return EED_Recaptcha::$config->use_captcha
159
+			   && EED_Recaptcha::$config->recaptcha_theme !== 'invisible';
160
+	}
161
+
162
+
163
+	/**
164
+	 * @return boolean
165
+	 * @throws InvalidArgumentException
166
+	 * @throws InvalidInterfaceException
167
+	 * @throws InvalidDataTypeException
168
+	 */
169
+	public static function notPaymentOptionsRevisit()
170
+	{
171
+		$request = EED_Recaptcha::getRequest();
172
+		return ! (
173
+			$request->getRequestParam('step', '') === 'payment_options'
174
+			&& $request->getRequestParam('revisit', false, 'bool') === true
175
+		);
176
+	}
177
+
178
+
179
+	/**
180
+	 * @return void
181
+	 * @throws InvalidArgumentException
182
+	 * @throws InvalidInterfaceException
183
+	 * @throws InvalidDataTypeException
184
+	 */
185
+	public static function enqueue_styles_and_scripts()
186
+	{
187
+		wp_register_script(
188
+			'espresso_recaptcha',
189
+			RECAPTCHA_BASE_URL . 'scripts/espresso_recaptcha.js',
190
+			array('single_page_checkout'),
191
+			EVENT_ESPRESSO_VERSION,
192
+			true
193
+		);
194
+		wp_register_script(
195
+			'google_recaptcha',
196
+			'https://www.google.com/recaptcha/api.js?hl=' . EED_Recaptcha::$config->recaptcha_language,
197
+			array('espresso_recaptcha'),
198
+			EVENT_ESPRESSO_VERSION,
199
+			true
200
+		);
201
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __(
202
+			'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.',
203
+			'event_espresso'
204
+		);
205
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __(
206
+			'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.',
207
+			'event_espresso'
208
+		);
209
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __(
210
+			'Please complete the anti-spam test before proceeding.',
211
+			'event_espresso'
212
+		);
213
+	}
214
+
215
+
216
+	/**
217
+	 * @param WP $WP
218
+	 */
219
+	public function run($WP)
220
+	{
221
+	}
222
+
223
+
224
+	/**
225
+	 * @return boolean
226
+	 * @throws InvalidArgumentException
227
+	 * @throws InvalidInterfaceException
228
+	 * @throws InvalidDataTypeException
229
+	 */
230
+	public static function not_a_robot()
231
+	{
232
+		return is_bool(EED_Recaptcha::$_not_a_robot)
233
+			? EED_Recaptcha::$_not_a_robot
234
+			: EED_Recaptcha::recaptcha_passed();
235
+	}
236
+
237
+
238
+	/**
239
+	 * @return void
240
+	 * @throws DomainException
241
+	 * @throws InvalidArgumentException
242
+	 * @throws InvalidInterfaceException
243
+	 * @throws InvalidDataTypeException
244
+	 */
245
+	public static function display_recaptcha()
246
+	{
247
+		// logged in means you have already passed a turing test of sorts
248
+		if (is_user_logged_in()) {
249
+			return;
250
+		}
251
+		// don't display if not using recaptcha or user is logged in
252
+		if (EED_Recaptcha::useRecaptcha() && ! EED_Recaptcha::$_not_a_robot) {
253
+			// only display if they have NOT passed the test yet
254
+			EEH_Template::display_template(
255
+				RECAPTCHA_BASE_PATH . '/templates/recaptcha.template.php',
256
+				array(
257
+					'recaptcha_publickey' => EED_Recaptcha::$config->recaptcha_publickey,
258
+					'recaptcha_theme'     => EED_Recaptcha::$config->recaptcha_theme,
259
+					'recaptcha_type'      => EED_Recaptcha::$config->recaptcha_type,
260
+				)
261
+			);
262
+			wp_enqueue_script('google_recaptcha');
263
+		}
264
+	}
265
+
266
+
267
+	/**
268
+	 * @return array
269
+	 * @throws InvalidArgumentException
270
+	 * @throws InvalidInterfaceException
271
+	 * @throws InvalidDataTypeException
272
+	 */
273
+	public static function bypass_recaptcha_for_spco_load_payment_method()
274
+	{
275
+		return array(
276
+			'EESID'  => EE_Registry::instance()->SSN->id(),
277
+			'step'   => 'payment_options',
278
+			'action' => 'switch_spco_billing_form',
279
+		);
280
+	}
281
+
282
+
283
+	/**
284
+	 * @return boolean
285
+	 * @throws InvalidArgumentException
286
+	 * @throws InvalidInterfaceException
287
+	 * @throws InvalidDataTypeException
288
+	 */
289
+	public static function recaptcha_passed()
290
+	{
291
+		// logged in means you have already passed a turing test of sorts
292
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
293
+			return true;
294
+		}
295
+		// was test already passed?
296
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
297
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
298
+		// verify recaptcha
299
+		EED_Recaptcha::_get_recaptcha_response();
300
+		if (! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
301
+			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
302
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
303
+		}
304
+		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
305
+		return $recaptcha_passed;
306
+	}
307
+
308
+
309
+	/**
310
+	 * @param array $recaptcha_response
311
+	 * @return array
312
+	 */
313
+	public static function recaptcha_response($recaptcha_response = array())
314
+	{
315
+		if (EED_Recaptcha::_bypass_recaptcha()) {
316
+			$recaptcha_response['bypass_recaptcha'] = true;
317
+			$recaptcha_response['recaptcha_passed'] = true;
318
+		} else {
319
+			$recaptcha_response['recaptcha_passed'] = EED_Recaptcha::$_not_a_robot;
320
+		}
321
+		return $recaptcha_response;
322
+	}
323
+
324
+
325
+	/**
326
+	 * @return boolean
327
+	 */
328
+	private static function _bypass_recaptcha()
329
+	{
330
+		// an array of key value pairs that must match exactly with the incoming request,
331
+		// in order to bypass recaptcha for the current request ONLY
332
+		$bypass_request_params_array = (array) apply_filters(
333
+			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
334
+			array()
335
+		);
336
+		// does $bypass_request_params_array have any values ?
337
+		if (empty($bypass_request_params_array)) {
338
+			return false;
339
+		}
340
+		$request = EED_Recaptcha::getRequest();
341
+		// initially set bypass to TRUE
342
+		$bypass_recaptcha = true;
343
+		foreach ($bypass_request_params_array as $key => $value) {
344
+			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE,
345
+			// otherwise carry over it's value. This way, one missed setting results in no bypass
346
+			$bypass_recaptcha = $request->getRequestParam($key) === $value
347
+				? $bypass_recaptcha
348
+				: false;
349
+		}
350
+		return $bypass_recaptcha;
351
+	}
352
+
353
+
354
+	/**
355
+	 * @return void
356
+	 * @throws InvalidArgumentException
357
+	 * @throws InvalidInterfaceException
358
+	 * @throws InvalidDataTypeException
359
+	 */
360
+	private static function _get_recaptcha_response()
361
+	{
362
+		EED_Recaptcha::$_recaptcha_response = EED_Recaptcha::getRequest()->getRequestParam(
363
+			'g-recaptcha-response'
364
+		);
365
+	}
366
+
367
+
368
+	/**
369
+	 * @return boolean
370
+	 * @throws InvalidArgumentException
371
+	 * @throws InvalidInterfaceException
372
+	 * @throws InvalidDataTypeException
373
+	 */
374
+	private static function _process_recaptcha_response()
375
+	{
376
+		// verify library is loaded
377
+		if (! class_exists('\ReCaptcha\ReCaptcha')) {
378
+			require_once RECAPTCHA_BASE_PATH . '/autoload.php';
379
+		}
380
+		// The response from reCAPTCHA
381
+		EED_Recaptcha::_get_recaptcha_response();
382
+		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
383
+		// Was there a reCAPTCHA response?
384
+		if ($recaptcha_response) {
385
+			// if allow_url_fopen is Off, then set a different request method
386
+			$request_method = ! ini_get('allow_url_fopen') ? new SocketPost() : null;
387
+			$recaptcha = new ReCaptcha(
388
+				EED_Recaptcha::$config->recaptcha_privatekey,
389
+				$request_method
390
+			);
391
+			$recaptcha_response = $recaptcha->verify(
392
+				EED_Recaptcha::$_recaptcha_response,
393
+				EED_Recaptcha::getRequest()->getServerParam('REMOTE_ADDR')
394
+			);
395
+		}
396
+		return $recaptcha_response instanceof Response && $recaptcha_response->isSuccess();
397
+	}
398 398
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryStatesConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'State',
42
-            'fromFieldName'      => lcfirst($this->namespace) . 'States',
41
+            'toType'             => $this->namespace.'State',
42
+            'fromFieldName'      => lcfirst($this->namespace).'States',
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection",
44 44
             'connectionArgs'     => self::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -18,95 +18,95 @@
 block discarded – undo
18 18
  */
19 19
 class RootQueryStatesConnection extends AbstractRootQueryConnection
20 20
 {
21
-    /**
22
-     * StateConnection constructor.
23
-     *
24
-     * @param EEM_State               $model
25
-     */
26
-    public function __construct(EEM_State $model)
27
-    {
28
-        parent::__construct($model);
29
-    }
21
+	/**
22
+	 * StateConnection constructor.
23
+	 *
24
+	 * @param EEM_State               $model
25
+	 */
26
+	public function __construct(EEM_State $model)
27
+	{
28
+		parent::__construct($model);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @return array
34
-     */
35
-    public function config(): array
36
-    {
37
-        return [
38
-            'fromType'           => 'RootQuery',
39
-            'toType'             => $this->namespace . 'State',
40
-            'fromFieldName'      => lcfirst($this->namespace) . 'States',
41
-            'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection",
42
-            'connectionArgs'     => self::get_connection_args(),
43
-            'resolve'            => [$this, 'resolveConnection'],
44
-        ];
45
-    }
32
+	/**
33
+	 * @return array
34
+	 */
35
+	public function config(): array
36
+	{
37
+		return [
38
+			'fromType'           => 'RootQuery',
39
+			'toType'             => $this->namespace . 'State',
40
+			'fromFieldName'      => lcfirst($this->namespace) . 'States',
41
+			'connectionTypeName' => "{$this->namespace}RootQueryStatesConnection",
42
+			'connectionArgs'     => self::get_connection_args(),
43
+			'resolve'            => [$this, 'resolveConnection'],
44
+		];
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @param $entity
50
-     * @param $args
51
-     * @param $context
52
-     * @param $info
53
-     * @return StateConnectionResolver
54
-     * @throws Exception
55
-     */
56
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
-    {
58
-        return new StateConnectionResolver($entity, $args, $context, $info);
59
-    }
48
+	/**
49
+	 * @param $entity
50
+	 * @param $args
51
+	 * @param $context
52
+	 * @param $info
53
+	 * @return StateConnectionResolver
54
+	 * @throws Exception
55
+	 */
56
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
+	{
58
+		return new StateConnectionResolver($entity, $args, $context, $info);
59
+	}
60 60
 
61
-    /**
62
-     * Given an optional array of args, this returns the args to be used in the connection
63
-     *
64
-     * @param array $args The args to modify the defaults
65
-     * @return array
66
-     */
67
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
-    public static function get_connection_args(array $args = []): array
69
-    {
70
-        $newArgs = [
71
-            'orderby'      => [
72
-                'type'        => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'],
73
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
74
-            ],
75
-            'in' => [
76
-                'type'        => ['list_of' => 'ID'],
77
-                'description' => esc_html__(
78
-                    'Limit the result to the set of given state IDs.',
79
-                    'event_espresso'
80
-                ),
81
-            ],
82
-            'countryIsoIn' => [
83
-                'type'        => ['list_of' => 'String'],
84
-                'description' => esc_html__(
85
-                    'Limit the result to the set of given country ISOs.',
86
-                    'event_espresso'
87
-                ),
88
-            ],
89
-            'search' => [
90
-                'type'        => 'String',
91
-                'description' => esc_html__('The search keywords', 'event_espresso'),
92
-            ],
93
-            'activeOnly' => [
94
-                'type'        => 'Boolean',
95
-                'description' => esc_html__(
96
-                    'Limit the result to the active states.',
97
-                    'event_espresso'
98
-                ),
99
-            ],
100
-        ];
61
+	/**
62
+	 * Given an optional array of args, this returns the args to be used in the connection
63
+	 *
64
+	 * @param array $args The args to modify the defaults
65
+	 * @return array
66
+	 */
67
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
+	public static function get_connection_args(array $args = []): array
69
+	{
70
+		$newArgs = [
71
+			'orderby'      => [
72
+				'type'        => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'],
73
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
74
+			],
75
+			'in' => [
76
+				'type'        => ['list_of' => 'ID'],
77
+				'description' => esc_html__(
78
+					'Limit the result to the set of given state IDs.',
79
+					'event_espresso'
80
+				),
81
+			],
82
+			'countryIsoIn' => [
83
+				'type'        => ['list_of' => 'String'],
84
+				'description' => esc_html__(
85
+					'Limit the result to the set of given country ISOs.',
86
+					'event_espresso'
87
+				),
88
+			],
89
+			'search' => [
90
+				'type'        => 'String',
91
+				'description' => esc_html__('The search keywords', 'event_espresso'),
92
+			],
93
+			'activeOnly' => [
94
+				'type'        => 'Boolean',
95
+				'description' => esc_html__(
96
+					'Limit the result to the active states.',
97
+					'event_espresso'
98
+				),
99
+			],
100
+		];
101 101
 
102
-        $newArgs = apply_filters(
103
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__state_args',
104
-            $newArgs,
105
-            $args
106
-        );
107
-        return array_merge(
108
-            $newArgs,
109
-            $args
110
-        );
111
-    }
102
+		$newArgs = apply_filters(
103
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__state_args',
104
+			$newArgs,
105
+			$args
106
+		);
107
+		return array_merge(
108
+			$newArgs,
109
+			$args
110
+		);
111
+	}
112 112
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/connections/RootQueryCountriesConnection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     {
39 39
         return [
40 40
             'fromType'           => 'RootQuery',
41
-            'toType'             => $this->namespace . 'Country',
42
-            'fromFieldName'      => lcfirst($this->namespace . 'Countries'),
41
+            'toType'             => $this->namespace.'Country',
42
+            'fromFieldName'      => lcfirst($this->namespace.'Countries'),
43 43
             'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection",
44 44
             'connectionArgs'     => RootQueryCountriesConnection::get_connection_args(),
45 45
             'resolve'            => [$this, 'resolveConnection'],
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -18,105 +18,105 @@
 block discarded – undo
18 18
  */
19 19
 class RootQueryCountriesConnection extends AbstractRootQueryConnection
20 20
 {
21
-    /**
22
-     * CountryConnection constructor.
23
-     *
24
-     * @param EEM_Country               $model
25
-     */
26
-    public function __construct(EEM_Country $model)
27
-    {
28
-        parent::__construct($model);
29
-    }
21
+	/**
22
+	 * CountryConnection constructor.
23
+	 *
24
+	 * @param EEM_Country               $model
25
+	 */
26
+	public function __construct(EEM_Country $model)
27
+	{
28
+		parent::__construct($model);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @return array
34
-     */
35
-    public function config(): array
36
-    {
37
-        return [
38
-            'fromType'           => 'RootQuery',
39
-            'toType'             => $this->namespace . 'Country',
40
-            'fromFieldName'      => lcfirst($this->namespace . 'Countries'),
41
-            'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection",
42
-            'connectionArgs'     => RootQueryCountriesConnection::get_connection_args(),
43
-            'resolve'            => [$this, 'resolveConnection'],
44
-        ];
45
-    }
32
+	/**
33
+	 * @return array
34
+	 */
35
+	public function config(): array
36
+	{
37
+		return [
38
+			'fromType'           => 'RootQuery',
39
+			'toType'             => $this->namespace . 'Country',
40
+			'fromFieldName'      => lcfirst($this->namespace . 'Countries'),
41
+			'connectionTypeName' => "{$this->namespace}RootQueryCountriesConnection",
42
+			'connectionArgs'     => RootQueryCountriesConnection::get_connection_args(),
43
+			'resolve'            => [$this, 'resolveConnection'],
44
+		];
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @param $entity
50
-     * @param $args
51
-     * @param $context
52
-     * @param $info
53
-     * @return CountryConnectionResolver
54
-     * @throws Exception
55
-     */
56
-    public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
-    {
58
-        return new CountryConnectionResolver($entity, $args, $context, $info);
59
-    }
48
+	/**
49
+	 * @param $entity
50
+	 * @param $args
51
+	 * @param $context
52
+	 * @param $info
53
+	 * @return CountryConnectionResolver
54
+	 * @throws Exception
55
+	 */
56
+	public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver
57
+	{
58
+		return new CountryConnectionResolver($entity, $args, $context, $info);
59
+	}
60 60
 
61
-    /**
62
-     * Given an optional array of args, this returns the args to be used in the connection
63
-     *
64
-     * @param array $args The args to modify the defaults
65
-     * @return array
66
-     */
67
-    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
-    public static function get_connection_args(array $args = []): array
69
-    {
70
-        $newArgs = [
71
-            'orderby'      => [
72
-                'type'        => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'],
73
-                'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
74
-            ],
75
-            'in' => [
76
-                'type'        => ['list_of' => 'ID'],
77
-                'description' => esc_html__(
78
-                    'Limit the result to the set of given country IDs.',
79
-                    'event_espresso'
80
-                ),
81
-            ],
82
-            'isoIn' => [
83
-                'type'        => ['list_of' => 'String'],
84
-                'description' => esc_html__(
85
-                    'Limit the result to the set of given country ISOs.',
86
-                    'event_espresso'
87
-                ),
88
-            ],
89
-            'iso3In' => [
90
-                'type'        => ['list_of' => 'String'],
91
-                'description' => esc_html__(
92
-                    'Limit the result to the set of given country ISO3s.',
93
-                    'event_espresso'
94
-                ),
95
-            ],
96
-            'search' => [
97
-                'type'        => 'String',
98
-                'description' => esc_html__(
99
-                    'Limit the result to the given search query.',
100
-                    'event_espresso'
101
-                ),
102
-            ],
103
-            'activeOnly' => [
104
-                'type'        => 'Boolean',
105
-                'description' => esc_html__(
106
-                    'Limit the result to the active countries.',
107
-                    'event_espresso'
108
-                ),
109
-            ],
110
-        ];
61
+	/**
62
+	 * Given an optional array of args, this returns the args to be used in the connection
63
+	 *
64
+	 * @param array $args The args to modify the defaults
65
+	 * @return array
66
+	 */
67
+	// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
68
+	public static function get_connection_args(array $args = []): array
69
+	{
70
+		$newArgs = [
71
+			'orderby'      => [
72
+				'type'        => ['list_of' => 'EspressoCountriesConnectionOrderbyInput'],
73
+				'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'),
74
+			],
75
+			'in' => [
76
+				'type'        => ['list_of' => 'ID'],
77
+				'description' => esc_html__(
78
+					'Limit the result to the set of given country IDs.',
79
+					'event_espresso'
80
+				),
81
+			],
82
+			'isoIn' => [
83
+				'type'        => ['list_of' => 'String'],
84
+				'description' => esc_html__(
85
+					'Limit the result to the set of given country ISOs.',
86
+					'event_espresso'
87
+				),
88
+			],
89
+			'iso3In' => [
90
+				'type'        => ['list_of' => 'String'],
91
+				'description' => esc_html__(
92
+					'Limit the result to the set of given country ISO3s.',
93
+					'event_espresso'
94
+				),
95
+			],
96
+			'search' => [
97
+				'type'        => 'String',
98
+				'description' => esc_html__(
99
+					'Limit the result to the given search query.',
100
+					'event_espresso'
101
+				),
102
+			],
103
+			'activeOnly' => [
104
+				'type'        => 'Boolean',
105
+				'description' => esc_html__(
106
+					'Limit the result to the active countries.',
107
+					'event_espresso'
108
+				),
109
+			],
110
+		];
111 111
 
112
-        $newArgs = apply_filters(
113
-            'FHEE__EventEspresso_core_domain_services_graphql_connections__country_args',
114
-            $newArgs,
115
-            $args
116
-        );
117
-        return array_merge(
118
-            $newArgs,
119
-            $args
120
-        );
121
-    }
112
+		$newArgs = apply_filters(
113
+			'FHEE__EventEspresso_core_domain_services_graphql_connections__country_args',
114
+			$newArgs,
115
+			$args
116
+		);
117
+		return array_merge(
118
+			$newArgs,
119
+			$args
120
+		);
121
+	}
122 122
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/StatesConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function __construct()
24 24
     {
25
-        $this->setName($this->namespace . 'StatesConnectionOrderbyInput');
25
+        $this->setName($this->namespace.'StatesConnectionOrderbyInput');
26 26
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27 27
         parent::__construct();
28 28
     }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         return [
37 37
             new GraphQLField(
38 38
                 'field',
39
-                ['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum']
39
+                ['non_null' => $this->namespace.'StatesConnectionOrderbyEnum']
40 40
             ),
41 41
             new GraphQLField(
42 42
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
  */
17 17
 class StatesConnectionOrderbyInput extends InputBase
18 18
 {
19
-    /**
20
-     * StatesConnectionOrderbyInput constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'StatesConnectionOrderbyInput');
25
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * StatesConnectionOrderbyInput constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'StatesConnectionOrderbyInput');
25
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return GraphQLFieldInterface[]
32
-     */
33
-    protected function getFields(): array
34
-    {
35
-        return [
36
-            new GraphQLField(
37
-                'field',
38
-                ['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum']
39
-            ),
40
-            new GraphQLField(
41
-                'order',
42
-                'OrderEnum'
43
-            ),
44
-        ];
45
-    }
30
+	/**
31
+	 * @return GraphQLFieldInterface[]
32
+	 */
33
+	protected function getFields(): array
34
+	{
35
+		return [
36
+			new GraphQLField(
37
+				'field',
38
+				['non_null' => $this->namespace . 'StatesConnectionOrderbyEnum']
39
+			),
40
+			new GraphQLField(
41
+				'order',
42
+				'OrderEnum'
43
+			),
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/inputs/CountriesConnectionOrderbyInput.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function __construct()
24 24
     {
25
-        $this->setName($this->namespace . 'CountriesConnectionOrderbyInput');
25
+        $this->setName($this->namespace.'CountriesConnectionOrderbyInput');
26 26
         $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
27 27
         parent::__construct();
28 28
     }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         return [
37 37
             new GraphQLField(
38 38
                 'field',
39
-                ['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum']
39
+                ['non_null' => $this->namespace.'CountriesConnectionOrderbyEnum']
40 40
             ),
41 41
             new GraphQLField(
42 42
                 'order',
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@
 block discarded – undo
16 16
  */
17 17
 class CountriesConnectionOrderbyInput extends InputBase
18 18
 {
19
-    /**
20
-     * CountriesConnectionOrderbyInput constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->setName($this->namespace . 'CountriesConnectionOrderbyInput');
25
-        $this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
-        parent::__construct();
27
-    }
19
+	/**
20
+	 * CountriesConnectionOrderbyInput constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->setName($this->namespace . 'CountriesConnectionOrderbyInput');
25
+		$this->setDescription(esc_html__('Options for ordering the connection', 'event_espresso'));
26
+		parent::__construct();
27
+	}
28 28
 
29 29
 
30
-    /**
31
-     * @return GraphQLFieldInterface[]
32
-     */
33
-    protected function getFields(): array
34
-    {
35
-        return [
36
-            new GraphQLField(
37
-                'field',
38
-                ['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum']
39
-            ),
40
-            new GraphQLField(
41
-                'order',
42
-                'OrderEnum'
43
-            ),
44
-        ];
45
-    }
30
+	/**
31
+	 * @return GraphQLFieldInterface[]
32
+	 */
33
+	protected function getFields(): array
34
+	{
35
+		return [
36
+			new GraphQLField(
37
+				'field',
38
+				['non_null' => $this->namespace . 'CountriesConnectionOrderbyEnum']
39
+			),
40
+			new GraphQLField(
41
+				'order',
42
+				'OrderEnum'
43
+			),
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/loaders/CountryLoader.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
  */
16 16
 class CountryLoader extends AbstractLoader
17 17
 {
18
-    /**
19
-     * @return EEM_Base|EEM_Country
20
-     * @throws EE_Error
21
-     * @throws InvalidArgumentException
22
-     * @throws InvalidDataTypeException
23
-     * @throws InvalidInterfaceException
24
-     * @throws ReflectionException
25
-     */
26
-    protected function getQuery(): EEM_Base
27
-    {
28
-        return EEM_Country::instance();
29
-    }
18
+	/**
19
+	 * @return EEM_Base|EEM_Country
20
+	 * @throws EE_Error
21
+	 * @throws InvalidArgumentException
22
+	 * @throws InvalidDataTypeException
23
+	 * @throws InvalidInterfaceException
24
+	 * @throws ReflectionException
25
+	 */
26
+	protected function getQuery(): EEM_Base
27
+	{
28
+		return EEM_Country::instance();
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @param array $keys
34
-     * @return array
35
-     */
36
-    protected function getWhereParams(array $keys): array
37
-    {
38
-        return [
39
-            'CNT_ISO' => ['IN', $keys],
40
-        ];
41
-    }
32
+	/**
33
+	 * @param array $keys
34
+	 * @return array
35
+	 */
36
+	protected function getWhereParams(array $keys): array
37
+	{
38
+		return [
39
+			'CNT_ISO' => ['IN', $keys],
40
+		];
41
+	}
42 42
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/loaders/StateLoader.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
  */
16 16
 class StateLoader extends AbstractLoader
17 17
 {
18
-    /**
19
-     * @return EEM_Base|EEM_State
20
-     * @throws EE_Error
21
-     * @throws InvalidArgumentException
22
-     * @throws InvalidDataTypeException
23
-     * @throws InvalidInterfaceException
24
-     * @throws ReflectionException
25
-     */
26
-    protected function getQuery(): EEM_Base
27
-    {
28
-        return EEM_State::instance();
29
-    }
18
+	/**
19
+	 * @return EEM_Base|EEM_State
20
+	 * @throws EE_Error
21
+	 * @throws InvalidArgumentException
22
+	 * @throws InvalidDataTypeException
23
+	 * @throws InvalidInterfaceException
24
+	 * @throws ReflectionException
25
+	 */
26
+	protected function getQuery(): EEM_Base
27
+	{
28
+		return EEM_State::instance();
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @param array $keys
34
-     * @return array
35
-     */
36
-    protected function getWhereParams(array $keys): array
37
-    {
38
-        return [
39
-            'STA_ID' => ['IN', $keys],
40
-        ];
41
-    }
32
+	/**
33
+	 * @param array $keys
34
+	 * @return array
35
+	 */
36
+	protected function getWhereParams(array $keys): array
37
+	{
38
+		return [
39
+			'STA_ID' => ['IN', $keys],
40
+		];
41
+	}
42 42
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/CountriesConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'CountriesConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'CountriesConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,35 +14,35 @@
 block discarded – undo
14 14
  */
15 15
 class CountriesConnectionOrderbyEnum extends EnumBase
16 16
 {
17
-    /**
18
-     * CountriesConnectionOrderbyEnum constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->setName($this->namespace . 'CountriesConnectionOrderbyEnum');
23
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
-        parent::__construct();
25
-    }
17
+	/**
18
+	 * CountriesConnectionOrderbyEnum constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->setName($this->namespace . 'CountriesConnectionOrderbyEnum');
23
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
+		parent::__construct();
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    protected function getValues(): array
32
-    {
33
-        return [
34
-            'NAME'     => [
35
-                'value'       => 'CNT_name',
36
-                'description' => esc_html__('Order by country name', 'event_espresso'),
37
-            ],
38
-            'ISO'     => [
39
-                'value'       => 'CNT_ISO',
40
-                'description' => esc_html__('Order by country ISO', 'event_espresso'),
41
-            ],
42
-            'CNT_ISO3'     => [
43
-                'value'       => 'CNT_ISO3',
44
-                'description' => esc_html__('Order by country ISO3', 'event_espresso'),
45
-            ],
46
-        ];
47
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	protected function getValues(): array
32
+	{
33
+		return [
34
+			'NAME'     => [
35
+				'value'       => 'CNT_name',
36
+				'description' => esc_html__('Order by country name', 'event_espresso'),
37
+			],
38
+			'ISO'     => [
39
+				'value'       => 'CNT_ISO',
40
+				'description' => esc_html__('Order by country ISO', 'event_espresso'),
41
+			],
42
+			'CNT_ISO3'     => [
43
+				'value'       => 'CNT_ISO3',
44
+				'description' => esc_html__('Order by country ISO3', 'event_espresso'),
45
+			],
46
+		];
47
+	}
48 48
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/StatesConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'StatesConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'StatesConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
  */
15 15
 class StatesConnectionOrderbyEnum extends EnumBase
16 16
 {
17
-    /**
18
-     * StatesConnectionOrderbyEnum constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->setName($this->namespace . 'StatesConnectionOrderbyEnum');
23
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
-        parent::__construct();
25
-    }
17
+	/**
18
+	 * StatesConnectionOrderbyEnum constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->setName($this->namespace . 'StatesConnectionOrderbyEnum');
23
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
+		parent::__construct();
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    protected function getValues(): array
32
-    {
33
-        return [
34
-            'NAME'     => [
35
-                'value'       => 'CNT_name',
36
-                'description' => esc_html__('Order by state name', 'event_espresso'),
37
-            ],
38
-            'COUNTRY_ISO'     => [
39
-                'value'       => 'CNT_ISO',
40
-                'description' => esc_html__('Order by country ISO', 'event_espresso'),
41
-            ],
42
-        ];
43
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	protected function getValues(): array
32
+	{
33
+		return [
34
+			'NAME'     => [
35
+				'value'       => 'CNT_name',
36
+				'description' => esc_html__('Order by state name', 'event_espresso'),
37
+			],
38
+			'COUNTRY_ISO'     => [
39
+				'value'       => 'CNT_ISO',
40
+				'description' => esc_html__('Order by country ISO', 'event_espresso'),
41
+			],
42
+		];
43
+	}
44 44
 }
Please login to merge, or discard this patch.