Completed
Branch FET/country-currency-settings (9351cc)
by
unknown
28:00 queued 18:57
created
core/db_classes/EE_Question_Form_Input.class.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      *
376 376
      * @access public
377 377
      * @param \EE_Question_Option $QSO EE_Question_Option
378
-     * @return boolean
378
+     * @return boolean|null
379 379
      */
380 380
     public function add_temp_option(EE_Question_Option $QSO)
381 381
     {
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
      *
389 389
      * @access public
390 390
      * @param    string $property
391
-     * @param    mixed  $value
392
-     * @return mixed
391
+     * @param    boolean  $value
392
+     * @return boolean|null
393 393
      */
394 394
     public function set($property = null, $value = null)
395 395
     {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
      *    get_meta
438 438
      *
439 439
      * @access public
440
-     * @param mixed $key
440
+     * @param string $key
441 441
      * @return mixed
442 442
      */
443 443
     public function get_meta($key = false)
Please login to merge, or discard this patch.
Indentation   +431 added lines, -431 removed lines patch added patch discarded remove patch
@@ -13,435 +13,435 @@
 block discarded – undo
13 13
 class EE_Question_Form_Input
14 14
 {
15 15
 
16
-    /**
17
-     *    EE_Question object
18
-     *
19
-     * @access private
20
-     * @var object
21
-     */
22
-    private $_QST = null;
23
-
24
-    /**
25
-     *    EE_Answer object
26
-     *
27
-     * @access private
28
-     * @var object
29
-     */
30
-    private $_ANS = null;
31
-
32
-    /**
33
-     *    $_QST_meta
34
-     * @access private
35
-     * @var array
36
-     */
37
-    private $_QST_meta = array();
38
-
39
-    /**
40
-     *    $QST_input_name
41
-     * @access private
42
-     * @var string
43
-     */
44
-    private $QST_input_name = '';
45
-
46
-    /**
47
-     *    $QST_input_id
48
-     * @access private
49
-     * @var string
50
-     */
51
-    private $QST_input_id = '';
52
-
53
-    /**
54
-     *    $QST_input_class
55
-     * @access private
56
-     * @var string
57
-     */
58
-    private $QST_input_class = '';
59
-
60
-    /**
61
-     * @var bool $QST_disabled
62
-     */
63
-    private $QST_disabled = false;
64
-
65
-
66
-    /**
67
-     * constructor for questions
68
-     *
69
-     * @param \EE_Question $QST EE_Question object
70
-     * @param \EE_Answer   $ANS EE_Answer object
71
-     * @param array        $q_meta
72
-     * @access public
73
-     * @return \EE_Question_Form_Input
74
-     */
75
-    public function __construct(EE_Question $QST = null, EE_Answer $ANS = null, $q_meta = array())
76
-    {
77
-        if (empty($QST) || empty($ANS)) {
78
-            EE_Error::add_error(
79
-                __('An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso'),
80
-                __FILE__,
81
-                __FUNCTION__,
82
-                __LINE__
83
-            );
84
-            return null;
85
-        }
86
-        $this->_QST = $QST;
87
-        $this->_ANS = $ANS;
88
-        $this->set_question_form_input_meta($q_meta);
89
-        $this->set_question_form_input_init();
90
-    }
91
-
92
-
93
-    /**
94
-     * sets meta data for the question form input
95
-     *
96
-     * @access public
97
-     * @param array $q_meta
98
-     * @return void
99
-     */
100
-    public function set_question_form_input_meta($q_meta = array())
101
-    {
102
-        $default_q_meta = array(
103
-            'att_nmbr'       => 1,
104
-            'ticket_id'      => '',
105
-            'date'           => '',
106
-            'time'           => '',
107
-            'input_name'     => '',
108
-            'input_id'       => '',
109
-            'input_class'    => '',
110
-            'input_prefix'   => 'qstn',
111
-            'append_qstn_id' => true,
112
-            'htmlentities'   => true,
113
-            'allow_null'     => false,
114
-        );
115
-        $this->_QST_meta = array_merge($default_q_meta, $q_meta);
116
-    }
117
-
118
-
119
-    /**
120
-     * set_question_form_input_init
121
-     *
122
-     * @access public
123
-     * @return void
124
-     */
125
-    public function set_question_form_input_init()
126
-    {
127
-        $qstn_id = $this->_QST->system_ID() ? $this->_QST->system_ID() : $this->_QST->ID();
128
-        $this->_set_input_name($qstn_id);
129
-        $this->_set_input_id($qstn_id);
130
-        $this->_set_input_class($qstn_id);
131
-        $this->set_question_form_input_answer($qstn_id);
132
-    }
133
-
134
-
135
-    /**
136
-     * set_input_name
137
-     *
138
-     * @access private
139
-     * @param $qstn_id
140
-     * @return void
141
-     */
142
-    private function _set_input_name($qstn_id)
143
-    {
144
-        if (! empty($qstn_id)) {
145
-            $ANS_ID = $this->get('ANS_ID');
146
-            $qstn_id = ! empty($ANS_ID) ? '[' . $qstn_id . '][' . $ANS_ID . ']' : '[' . $qstn_id . ']';
147
-        }
148
-        $this->QST_input_name = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
149
-            ? $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'] . $qstn_id
150
-            : $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'];
151
-    }
152
-
153
-
154
-    /**
155
-     * get property values for question form input
156
-     *
157
-     * @access public
158
-     * @param    string $property
159
-     * @return mixed
160
-     */
161
-    public function get($property = null)
162
-    {
163
-        if (! empty($property)) {
164
-            if (EEM_Question::instance()->has_field($property)) {
165
-                return $this->_QST->get($property);
166
-            } elseif (EEM_Answer::instance()->has_field($property)) {
167
-                return $this->_ANS->get($property);
168
-            } elseif ($this->_question_form_input_property_exists(__CLASS__, $property)) {
169
-                return $this->{$property};
170
-            }
171
-        }
172
-        return null;
173
-    }
174
-
175
-
176
-    /**
177
-     *    _question_form_input_property_exists
178
-     *
179
-     * @access private
180
-     * @param    string $classname
181
-     * @param    string $property
182
-     * @return boolean
183
-     */
184
-    private function _question_form_input_property_exists($classname, $property)
185
-    {
186
-        // first try regular property exists method which works as expected in PHP 5.3+
187
-        $prop = EEH_Class_Tools::has_property($classname, $property);
188
-        if (! $prop) {
189
-            // use reflection for < PHP 5.3 as a double check when property is not found, possible due to access restriction
190
-            $reflector = new ReflectionClass($classname);
191
-            $prop = $reflector->hasProperty($property);
192
-        }
193
-        return $prop;
194
-    }
195
-
196
-
197
-    /**
198
-     * set_input_id
199
-     *
200
-     * @access private
201
-     * @param $qstn_id
202
-     * @return void
203
-     */
204
-    private function _set_input_id($qstn_id)
205
-    {
206
-        $input_id = isset($this->_QST_meta['input_id']) && ! empty($this->_QST_meta['input_id'])
207
-            ? $this->_QST_meta['input_id']
208
-            : sanitize_key(strip_tags($this->_QST->get('QST_display_text')));
209
-        $this->QST_input_id = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
210
-            ? $input_id . '-' . $qstn_id
211
-            : $input_id;
212
-    }
213
-
214
-
215
-    /**
216
-     * set_input_class
217
-     *
218
-     * @access private
219
-     * @return void
220
-     */
221
-    private function _set_input_class()
222
-    {
223
-        $this->QST_input_class = isset($this->_QST_meta['input_class']) ? $this->_QST_meta['input_class'] : '';
224
-    }
225
-
226
-
227
-    /**
228
-     * set_question_form_input_answer
229
-     *
230
-     * @access public
231
-     * @param mixed    int | string    $qstn_id
232
-     * @return void
233
-     */
234
-    public function set_question_form_input_answer($qstn_id)
235
-    {
236
-        // check for answer in $_REQUEST in case we are reprocessing a form after an error
237
-        if (isset($this->_QST_meta['EVT_ID'])
238
-            && isset($this->_QST_meta['att_nmbr'])
239
-            && isset($this->_QST_meta['date'])
240
-            && isset($this->_QST_meta['time'])
241
-            && isset($this->_QST_meta['price_id'])
242
-        ) {
243
-            if (isset($_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ])
244
-            ) {
245
-                $answer = $_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ];
246
-                $this->_ANS->set('ANS_value', $answer);
247
-            }
248
-        }
249
-    }
250
-
251
-
252
-    /**
253
-     *        generate_question_form_inputs_for_object
254
-     *
255
-     * @access    protected
256
-     * @param bool|object $object $object
257
-     * @param    array    $input_types
258
-     * @return        array
259
-     */
260
-    public static function generate_question_form_inputs_for_object($object = false, $input_types = array())
261
-    {
262
-        if (! is_object($object)) {
263
-            return false;
264
-        }
265
-        $inputs = array();
266
-        $fields = $object->get_model()->field_settings(false);
267
-        // $pk = $object->ID(); <<< NO!
268
-        // EEH_Debug_Tools::printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
269
-        // EEH_Debug_Tools::printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
270
-        // EEH_Debug_Tools::printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
271
-        foreach ($fields as $field_ID => $field) {
272
-            if ($field instanceof EE_Model_Field_Base) {
273
-                // echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
274
-                // EEH_Debug_Tools::printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
275
-                if (isset($input_types[ $field_ID ])) {
276
-                    // get saved value for field
277
-                    $value = $object->get($field_ID);
278
-                    // echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
279
-                    // if no saved value, then use default
280
-                    $value = $value !== null ? $value : $field->get_default_value();
281
-                    // if ( $field_ID == 'CNT_active' )
282
-                    // echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
283
-                    // determine question type
284
-                    $type = isset($input_types[ $field_ID ]) ? $input_types[ $field_ID ]['type'] : 'TEXT';
285
-                    // input name
286
-                    $input_name = isset($input_types[ $field_ID ]) && isset($input_types[ $field_ID ]['input_name'])
287
-                        ? $input_types[ $field_ID ]['input_name'] . '[' . $field_ID . ']'
288
-                        : $field_ID;
289
-                    // css class for input
290
-                    $class = isset($input_types[ $field_ID ]['class']) && ! empty($input_types[ $field_ID ]['class'])
291
-                        ? ' ' . $input_types[ $field_ID ]['class']
292
-                        : '';
293
-                    // whether to apply htmlentities to answer
294
-                    $htmlentities = isset($input_types[ $field_ID ]['htmlentities'])
295
-                        ? $input_types[ $field_ID ]['htmlentities']
296
-                        : true;
297
-                    // whether to apply htmlentities to answer
298
-                    $label_b4 = isset($input_types[ $field_ID ]['label_b4'])
299
-                        ? $input_types[ $field_ID ]['label_b4']
300
-                        : false;
301
-                    // whether to apply htmlentities to answer
302
-                    $use_desc_4_label = isset($input_types[ $field_ID ]['use_desc_4_label'])
303
-                        ? $input_types[ $field_ID ]['use_desc_4_label']
304
-                        : false;
305
-                    // whether input is disabled
306
-                    $disabled = isset($input_types[ $field_ID ]['disabled'])
307
-                        ? $input_types[ $field_ID ]['disabled']
308
-                        : false;
309
-
310
-                    // create EE_Question_Form_Input object
311
-                    $QFI = new EE_Question_Form_Input(
312
-                        EE_Question::new_instance(
313
-                            array(
314
-                                'QST_ID'           => 0,
315
-                                'QST_display_text' => $field->get_nicename(),
316
-                                'QST_type'         => $type,
317
-                            )
318
-                        ),
319
-                        EE_Answer::new_instance(
320
-                            array(
321
-                                'ANS_ID'    => 0,
322
-                                'QST_ID'    => 0,
323
-                                'REG_ID'    => 0,
324
-                                'ANS_value' => $value,
325
-                            )
326
-                        ),
327
-                        array(
328
-                            'input_id'         => $field_ID . '-' . $object->ID(),
329
-                            'input_name'       => $input_name,
330
-                            'input_class'      => $field_ID . $class,
331
-                            'input_prefix'     => '',
332
-                            'append_qstn_id'   => false,
333
-                            'htmlentities'     => $htmlentities,
334
-                            'label_b4'         => $label_b4,
335
-                            'use_desc_4_label' => $use_desc_4_label,
336
-                        )
337
-                    );
338
-                    // does question type have options ?
339
-                    if (in_array($type, array('DROPDOWN', 'RADIO_BTN', 'CHECKBOX'))
340
-                        && isset($input_types[ $field_ID ])
341
-                        && isset($input_types[ $field_ID ]['options'])
342
-                    ) {
343
-                        foreach ($input_types[ $field_ID ]['options'] as $option) {
344
-                            $option = stripslashes_deep($option);
345
-                            $option_id = ! empty($option['id']) ? $option['id'] : 0;
346
-                            $QSO = EE_Question_Option::new_instance(
347
-                                array(
348
-                                    'QSO_value'   => (string) $option_id,
349
-                                    'QSO_desc'    => $option['text'],
350
-                                    'QSO_deleted' => false,
351
-                                )
352
-                            );
353
-                            // all QST (and ANS) properties can be accessed indirectly thru QFI
354
-                            $QFI->add_temp_option($QSO);
355
-                        }
356
-                    }
357
-                    // we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
358
-                    if ($disabled || $field_ID == $object->get_model()->primary_key_name()) {
359
-                        $QFI->set('QST_disabled', true);
360
-                    }
361
-                    // EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
362
-                    $inputs[ $field_ID ] = $QFI;
363
-                    // if ( $field_ID == 'CNT_active' ) {
364
-                    // EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
365
-                    // }
366
-                }
367
-            }
368
-        }
369
-        return $inputs;
370
-    }
371
-
372
-
373
-    /**
374
-     *    add_temp_option
375
-     *
376
-     * @access public
377
-     * @param \EE_Question_Option $QSO EE_Question_Option
378
-     * @return boolean
379
-     */
380
-    public function add_temp_option(EE_Question_Option $QSO)
381
-    {
382
-        $this->_QST->add_temp_option($QSO);
383
-    }
384
-
385
-
386
-    /**
387
-     * set property values for question form input
388
-     *
389
-     * @access public
390
-     * @param    string $property
391
-     * @param    mixed  $value
392
-     * @return mixed
393
-     */
394
-    public function set($property = null, $value = null)
395
-    {
396
-        if (! empty($property)) {
397
-            if (EEM_Question::instance()->has_field($property)) {
398
-                $this->_QST->set($property, $value);
399
-            } elseif (EEM_Answer::instance()->has_field($property)) {
400
-                $this->_ANS->set($property, $value);
401
-            } elseif ($this->_question_form_input_property_exists(__CLASS__, $property)) {
402
-                // echo "<hr>$property is a prop of QFI";
403
-                $this->{$property} = $value;
404
-                return true;
405
-            }
406
-        }
407
-        return null;
408
-    }
409
-
410
-
411
-    /**
412
-     *    _question_form_input_property_exists
413
-     *
414
-     * @access public
415
-     * @param boolean      $notDeletedOptionsOnly            1
416
-     *                                                       whether to return ALL options, or only the ones which have
417
-     *                                                       not yet been deleted
418
-     * @param string|array $selected_value_to_always_include , when retrieving options to an ANSWERED question,
419
-     *                                                       we want to usually only show non-deleted options AND the
420
-     *                                                       value that was selected for the answer, whether it was
421
-     *                                                       trashed or not.
422
-     * @return EE_Question_Option
423
-     */
424
-    public function options($notDeletedOptionsOnly = true, $selected_value_to_always_include = null)
425
-    {
426
-        $temp_options = $this->_QST->temp_options();
427
-        return ! empty($temp_options)
428
-            ? $temp_options
429
-            : $this->_QST->options(
430
-                $notDeletedOptionsOnly,
431
-                $selected_value_to_always_include
432
-            );
433
-    }
434
-
435
-
436
-    /**
437
-     *    get_meta
438
-     *
439
-     * @access public
440
-     * @param mixed $key
441
-     * @return mixed
442
-     */
443
-    public function get_meta($key = false)
444
-    {
445
-        return $key && isset($this->_QST_meta[ $key ]) ? $this->_QST_meta[ $key ] : false;
446
-    }
16
+	/**
17
+	 *    EE_Question object
18
+	 *
19
+	 * @access private
20
+	 * @var object
21
+	 */
22
+	private $_QST = null;
23
+
24
+	/**
25
+	 *    EE_Answer object
26
+	 *
27
+	 * @access private
28
+	 * @var object
29
+	 */
30
+	private $_ANS = null;
31
+
32
+	/**
33
+	 *    $_QST_meta
34
+	 * @access private
35
+	 * @var array
36
+	 */
37
+	private $_QST_meta = array();
38
+
39
+	/**
40
+	 *    $QST_input_name
41
+	 * @access private
42
+	 * @var string
43
+	 */
44
+	private $QST_input_name = '';
45
+
46
+	/**
47
+	 *    $QST_input_id
48
+	 * @access private
49
+	 * @var string
50
+	 */
51
+	private $QST_input_id = '';
52
+
53
+	/**
54
+	 *    $QST_input_class
55
+	 * @access private
56
+	 * @var string
57
+	 */
58
+	private $QST_input_class = '';
59
+
60
+	/**
61
+	 * @var bool $QST_disabled
62
+	 */
63
+	private $QST_disabled = false;
64
+
65
+
66
+	/**
67
+	 * constructor for questions
68
+	 *
69
+	 * @param \EE_Question $QST EE_Question object
70
+	 * @param \EE_Answer   $ANS EE_Answer object
71
+	 * @param array        $q_meta
72
+	 * @access public
73
+	 * @return \EE_Question_Form_Input
74
+	 */
75
+	public function __construct(EE_Question $QST = null, EE_Answer $ANS = null, $q_meta = array())
76
+	{
77
+		if (empty($QST) || empty($ANS)) {
78
+			EE_Error::add_error(
79
+				__('An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso'),
80
+				__FILE__,
81
+				__FUNCTION__,
82
+				__LINE__
83
+			);
84
+			return null;
85
+		}
86
+		$this->_QST = $QST;
87
+		$this->_ANS = $ANS;
88
+		$this->set_question_form_input_meta($q_meta);
89
+		$this->set_question_form_input_init();
90
+	}
91
+
92
+
93
+	/**
94
+	 * sets meta data for the question form input
95
+	 *
96
+	 * @access public
97
+	 * @param array $q_meta
98
+	 * @return void
99
+	 */
100
+	public function set_question_form_input_meta($q_meta = array())
101
+	{
102
+		$default_q_meta = array(
103
+			'att_nmbr'       => 1,
104
+			'ticket_id'      => '',
105
+			'date'           => '',
106
+			'time'           => '',
107
+			'input_name'     => '',
108
+			'input_id'       => '',
109
+			'input_class'    => '',
110
+			'input_prefix'   => 'qstn',
111
+			'append_qstn_id' => true,
112
+			'htmlentities'   => true,
113
+			'allow_null'     => false,
114
+		);
115
+		$this->_QST_meta = array_merge($default_q_meta, $q_meta);
116
+	}
117
+
118
+
119
+	/**
120
+	 * set_question_form_input_init
121
+	 *
122
+	 * @access public
123
+	 * @return void
124
+	 */
125
+	public function set_question_form_input_init()
126
+	{
127
+		$qstn_id = $this->_QST->system_ID() ? $this->_QST->system_ID() : $this->_QST->ID();
128
+		$this->_set_input_name($qstn_id);
129
+		$this->_set_input_id($qstn_id);
130
+		$this->_set_input_class($qstn_id);
131
+		$this->set_question_form_input_answer($qstn_id);
132
+	}
133
+
134
+
135
+	/**
136
+	 * set_input_name
137
+	 *
138
+	 * @access private
139
+	 * @param $qstn_id
140
+	 * @return void
141
+	 */
142
+	private function _set_input_name($qstn_id)
143
+	{
144
+		if (! empty($qstn_id)) {
145
+			$ANS_ID = $this->get('ANS_ID');
146
+			$qstn_id = ! empty($ANS_ID) ? '[' . $qstn_id . '][' . $ANS_ID . ']' : '[' . $qstn_id . ']';
147
+		}
148
+		$this->QST_input_name = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
149
+			? $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'] . $qstn_id
150
+			: $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'];
151
+	}
152
+
153
+
154
+	/**
155
+	 * get property values for question form input
156
+	 *
157
+	 * @access public
158
+	 * @param    string $property
159
+	 * @return mixed
160
+	 */
161
+	public function get($property = null)
162
+	{
163
+		if (! empty($property)) {
164
+			if (EEM_Question::instance()->has_field($property)) {
165
+				return $this->_QST->get($property);
166
+			} elseif (EEM_Answer::instance()->has_field($property)) {
167
+				return $this->_ANS->get($property);
168
+			} elseif ($this->_question_form_input_property_exists(__CLASS__, $property)) {
169
+				return $this->{$property};
170
+			}
171
+		}
172
+		return null;
173
+	}
174
+
175
+
176
+	/**
177
+	 *    _question_form_input_property_exists
178
+	 *
179
+	 * @access private
180
+	 * @param    string $classname
181
+	 * @param    string $property
182
+	 * @return boolean
183
+	 */
184
+	private function _question_form_input_property_exists($classname, $property)
185
+	{
186
+		// first try regular property exists method which works as expected in PHP 5.3+
187
+		$prop = EEH_Class_Tools::has_property($classname, $property);
188
+		if (! $prop) {
189
+			// use reflection for < PHP 5.3 as a double check when property is not found, possible due to access restriction
190
+			$reflector = new ReflectionClass($classname);
191
+			$prop = $reflector->hasProperty($property);
192
+		}
193
+		return $prop;
194
+	}
195
+
196
+
197
+	/**
198
+	 * set_input_id
199
+	 *
200
+	 * @access private
201
+	 * @param $qstn_id
202
+	 * @return void
203
+	 */
204
+	private function _set_input_id($qstn_id)
205
+	{
206
+		$input_id = isset($this->_QST_meta['input_id']) && ! empty($this->_QST_meta['input_id'])
207
+			? $this->_QST_meta['input_id']
208
+			: sanitize_key(strip_tags($this->_QST->get('QST_display_text')));
209
+		$this->QST_input_id = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
210
+			? $input_id . '-' . $qstn_id
211
+			: $input_id;
212
+	}
213
+
214
+
215
+	/**
216
+	 * set_input_class
217
+	 *
218
+	 * @access private
219
+	 * @return void
220
+	 */
221
+	private function _set_input_class()
222
+	{
223
+		$this->QST_input_class = isset($this->_QST_meta['input_class']) ? $this->_QST_meta['input_class'] : '';
224
+	}
225
+
226
+
227
+	/**
228
+	 * set_question_form_input_answer
229
+	 *
230
+	 * @access public
231
+	 * @param mixed    int | string    $qstn_id
232
+	 * @return void
233
+	 */
234
+	public function set_question_form_input_answer($qstn_id)
235
+	{
236
+		// check for answer in $_REQUEST in case we are reprocessing a form after an error
237
+		if (isset($this->_QST_meta['EVT_ID'])
238
+			&& isset($this->_QST_meta['att_nmbr'])
239
+			&& isset($this->_QST_meta['date'])
240
+			&& isset($this->_QST_meta['time'])
241
+			&& isset($this->_QST_meta['price_id'])
242
+		) {
243
+			if (isset($_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ])
244
+			) {
245
+				$answer = $_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ];
246
+				$this->_ANS->set('ANS_value', $answer);
247
+			}
248
+		}
249
+	}
250
+
251
+
252
+	/**
253
+	 *        generate_question_form_inputs_for_object
254
+	 *
255
+	 * @access    protected
256
+	 * @param bool|object $object $object
257
+	 * @param    array    $input_types
258
+	 * @return        array
259
+	 */
260
+	public static function generate_question_form_inputs_for_object($object = false, $input_types = array())
261
+	{
262
+		if (! is_object($object)) {
263
+			return false;
264
+		}
265
+		$inputs = array();
266
+		$fields = $object->get_model()->field_settings(false);
267
+		// $pk = $object->ID(); <<< NO!
268
+		// EEH_Debug_Tools::printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
269
+		// EEH_Debug_Tools::printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
270
+		// EEH_Debug_Tools::printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
271
+		foreach ($fields as $field_ID => $field) {
272
+			if ($field instanceof EE_Model_Field_Base) {
273
+				// echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
274
+				// EEH_Debug_Tools::printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
275
+				if (isset($input_types[ $field_ID ])) {
276
+					// get saved value for field
277
+					$value = $object->get($field_ID);
278
+					// echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
279
+					// if no saved value, then use default
280
+					$value = $value !== null ? $value : $field->get_default_value();
281
+					// if ( $field_ID == 'CNT_active' )
282
+					// echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
283
+					// determine question type
284
+					$type = isset($input_types[ $field_ID ]) ? $input_types[ $field_ID ]['type'] : 'TEXT';
285
+					// input name
286
+					$input_name = isset($input_types[ $field_ID ]) && isset($input_types[ $field_ID ]['input_name'])
287
+						? $input_types[ $field_ID ]['input_name'] . '[' . $field_ID . ']'
288
+						: $field_ID;
289
+					// css class for input
290
+					$class = isset($input_types[ $field_ID ]['class']) && ! empty($input_types[ $field_ID ]['class'])
291
+						? ' ' . $input_types[ $field_ID ]['class']
292
+						: '';
293
+					// whether to apply htmlentities to answer
294
+					$htmlentities = isset($input_types[ $field_ID ]['htmlentities'])
295
+						? $input_types[ $field_ID ]['htmlentities']
296
+						: true;
297
+					// whether to apply htmlentities to answer
298
+					$label_b4 = isset($input_types[ $field_ID ]['label_b4'])
299
+						? $input_types[ $field_ID ]['label_b4']
300
+						: false;
301
+					// whether to apply htmlentities to answer
302
+					$use_desc_4_label = isset($input_types[ $field_ID ]['use_desc_4_label'])
303
+						? $input_types[ $field_ID ]['use_desc_4_label']
304
+						: false;
305
+					// whether input is disabled
306
+					$disabled = isset($input_types[ $field_ID ]['disabled'])
307
+						? $input_types[ $field_ID ]['disabled']
308
+						: false;
309
+
310
+					// create EE_Question_Form_Input object
311
+					$QFI = new EE_Question_Form_Input(
312
+						EE_Question::new_instance(
313
+							array(
314
+								'QST_ID'           => 0,
315
+								'QST_display_text' => $field->get_nicename(),
316
+								'QST_type'         => $type,
317
+							)
318
+						),
319
+						EE_Answer::new_instance(
320
+							array(
321
+								'ANS_ID'    => 0,
322
+								'QST_ID'    => 0,
323
+								'REG_ID'    => 0,
324
+								'ANS_value' => $value,
325
+							)
326
+						),
327
+						array(
328
+							'input_id'         => $field_ID . '-' . $object->ID(),
329
+							'input_name'       => $input_name,
330
+							'input_class'      => $field_ID . $class,
331
+							'input_prefix'     => '',
332
+							'append_qstn_id'   => false,
333
+							'htmlentities'     => $htmlentities,
334
+							'label_b4'         => $label_b4,
335
+							'use_desc_4_label' => $use_desc_4_label,
336
+						)
337
+					);
338
+					// does question type have options ?
339
+					if (in_array($type, array('DROPDOWN', 'RADIO_BTN', 'CHECKBOX'))
340
+						&& isset($input_types[ $field_ID ])
341
+						&& isset($input_types[ $field_ID ]['options'])
342
+					) {
343
+						foreach ($input_types[ $field_ID ]['options'] as $option) {
344
+							$option = stripslashes_deep($option);
345
+							$option_id = ! empty($option['id']) ? $option['id'] : 0;
346
+							$QSO = EE_Question_Option::new_instance(
347
+								array(
348
+									'QSO_value'   => (string) $option_id,
349
+									'QSO_desc'    => $option['text'],
350
+									'QSO_deleted' => false,
351
+								)
352
+							);
353
+							// all QST (and ANS) properties can be accessed indirectly thru QFI
354
+							$QFI->add_temp_option($QSO);
355
+						}
356
+					}
357
+					// we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
358
+					if ($disabled || $field_ID == $object->get_model()->primary_key_name()) {
359
+						$QFI->set('QST_disabled', true);
360
+					}
361
+					// EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
362
+					$inputs[ $field_ID ] = $QFI;
363
+					// if ( $field_ID == 'CNT_active' ) {
364
+					// EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
365
+					// }
366
+				}
367
+			}
368
+		}
369
+		return $inputs;
370
+	}
371
+
372
+
373
+	/**
374
+	 *    add_temp_option
375
+	 *
376
+	 * @access public
377
+	 * @param \EE_Question_Option $QSO EE_Question_Option
378
+	 * @return boolean
379
+	 */
380
+	public function add_temp_option(EE_Question_Option $QSO)
381
+	{
382
+		$this->_QST->add_temp_option($QSO);
383
+	}
384
+
385
+
386
+	/**
387
+	 * set property values for question form input
388
+	 *
389
+	 * @access public
390
+	 * @param    string $property
391
+	 * @param    mixed  $value
392
+	 * @return mixed
393
+	 */
394
+	public function set($property = null, $value = null)
395
+	{
396
+		if (! empty($property)) {
397
+			if (EEM_Question::instance()->has_field($property)) {
398
+				$this->_QST->set($property, $value);
399
+			} elseif (EEM_Answer::instance()->has_field($property)) {
400
+				$this->_ANS->set($property, $value);
401
+			} elseif ($this->_question_form_input_property_exists(__CLASS__, $property)) {
402
+				// echo "<hr>$property is a prop of QFI";
403
+				$this->{$property} = $value;
404
+				return true;
405
+			}
406
+		}
407
+		return null;
408
+	}
409
+
410
+
411
+	/**
412
+	 *    _question_form_input_property_exists
413
+	 *
414
+	 * @access public
415
+	 * @param boolean      $notDeletedOptionsOnly            1
416
+	 *                                                       whether to return ALL options, or only the ones which have
417
+	 *                                                       not yet been deleted
418
+	 * @param string|array $selected_value_to_always_include , when retrieving options to an ANSWERED question,
419
+	 *                                                       we want to usually only show non-deleted options AND the
420
+	 *                                                       value that was selected for the answer, whether it was
421
+	 *                                                       trashed or not.
422
+	 * @return EE_Question_Option
423
+	 */
424
+	public function options($notDeletedOptionsOnly = true, $selected_value_to_always_include = null)
425
+	{
426
+		$temp_options = $this->_QST->temp_options();
427
+		return ! empty($temp_options)
428
+			? $temp_options
429
+			: $this->_QST->options(
430
+				$notDeletedOptionsOnly,
431
+				$selected_value_to_always_include
432
+			);
433
+	}
434
+
435
+
436
+	/**
437
+	 *    get_meta
438
+	 *
439
+	 * @access public
440
+	 * @param mixed $key
441
+	 * @return mixed
442
+	 */
443
+	public function get_meta($key = false)
444
+	{
445
+		return $key && isset($this->_QST_meta[ $key ]) ? $this->_QST_meta[ $key ] : false;
446
+	}
447 447
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
      */
142 142
     private function _set_input_name($qstn_id)
143 143
     {
144
-        if (! empty($qstn_id)) {
144
+        if ( ! empty($qstn_id)) {
145 145
             $ANS_ID = $this->get('ANS_ID');
146
-            $qstn_id = ! empty($ANS_ID) ? '[' . $qstn_id . '][' . $ANS_ID . ']' : '[' . $qstn_id . ']';
146
+            $qstn_id = ! empty($ANS_ID) ? '['.$qstn_id.']['.$ANS_ID.']' : '['.$qstn_id.']';
147 147
         }
148 148
         $this->QST_input_name = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
149
-            ? $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'] . $qstn_id
150
-            : $this->_QST_meta['input_prefix'] . $this->_QST_meta['input_name'];
149
+            ? $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'].$qstn_id
150
+            : $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'];
151 151
     }
152 152
 
153 153
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function get($property = null)
162 162
     {
163
-        if (! empty($property)) {
163
+        if ( ! empty($property)) {
164 164
             if (EEM_Question::instance()->has_field($property)) {
165 165
                 return $this->_QST->get($property);
166 166
             } elseif (EEM_Answer::instance()->has_field($property)) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         // first try regular property exists method which works as expected in PHP 5.3+
187 187
         $prop = EEH_Class_Tools::has_property($classname, $property);
188
-        if (! $prop) {
188
+        if ( ! $prop) {
189 189
             // use reflection for < PHP 5.3 as a double check when property is not found, possible due to access restriction
190 190
             $reflector = new ReflectionClass($classname);
191 191
             $prop = $reflector->hasProperty($property);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             ? $this->_QST_meta['input_id']
208 208
             : sanitize_key(strip_tags($this->_QST->get('QST_display_text')));
209 209
         $this->QST_input_id = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id)
210
-            ? $input_id . '-' . $qstn_id
210
+            ? $input_id.'-'.$qstn_id
211 211
             : $input_id;
212 212
     }
213 213
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
             && isset($this->_QST_meta['time'])
241 241
             && isset($this->_QST_meta['price_id'])
242 242
         ) {
243
-            if (isset($_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ])
243
+            if (isset($_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id])
244 244
             ) {
245
-                $answer = $_REQUEST['qstn'][ $this->_QST_meta['EVT_ID'] ][ $this->_QST_meta['att_nmbr'] ][ $this->_QST_meta['date'] ][ $this->_QST_meta['time'] ][ $this->_QST_meta['price_id'] ][ $qstn_id ];
245
+                $answer = $_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id];
246 246
                 $this->_ANS->set('ANS_value', $answer);
247 247
             }
248 248
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      */
260 260
     public static function generate_question_form_inputs_for_object($object = false, $input_types = array())
261 261
     {
262
-        if (! is_object($object)) {
262
+        if ( ! is_object($object)) {
263 263
             return false;
264 264
         }
265 265
         $inputs = array();
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             if ($field instanceof EE_Model_Field_Base) {
273 273
                 // echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
274 274
                 // EEH_Debug_Tools::printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
275
-                if (isset($input_types[ $field_ID ])) {
275
+                if (isset($input_types[$field_ID])) {
276 276
                     // get saved value for field
277 277
                     $value = $object->get($field_ID);
278 278
                     // echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
@@ -281,30 +281,30 @@  discard block
 block discarded – undo
281 281
                     // if ( $field_ID == 'CNT_active' )
282 282
                     // echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
283 283
                     // determine question type
284
-                    $type = isset($input_types[ $field_ID ]) ? $input_types[ $field_ID ]['type'] : 'TEXT';
284
+                    $type = isset($input_types[$field_ID]) ? $input_types[$field_ID]['type'] : 'TEXT';
285 285
                     // input name
286
-                    $input_name = isset($input_types[ $field_ID ]) && isset($input_types[ $field_ID ]['input_name'])
287
-                        ? $input_types[ $field_ID ]['input_name'] . '[' . $field_ID . ']'
286
+                    $input_name = isset($input_types[$field_ID]) && isset($input_types[$field_ID]['input_name'])
287
+                        ? $input_types[$field_ID]['input_name'].'['.$field_ID.']'
288 288
                         : $field_ID;
289 289
                     // css class for input
290
-                    $class = isset($input_types[ $field_ID ]['class']) && ! empty($input_types[ $field_ID ]['class'])
291
-                        ? ' ' . $input_types[ $field_ID ]['class']
290
+                    $class = isset($input_types[$field_ID]['class']) && ! empty($input_types[$field_ID]['class'])
291
+                        ? ' '.$input_types[$field_ID]['class']
292 292
                         : '';
293 293
                     // whether to apply htmlentities to answer
294
-                    $htmlentities = isset($input_types[ $field_ID ]['htmlentities'])
295
-                        ? $input_types[ $field_ID ]['htmlentities']
294
+                    $htmlentities = isset($input_types[$field_ID]['htmlentities'])
295
+                        ? $input_types[$field_ID]['htmlentities']
296 296
                         : true;
297 297
                     // whether to apply htmlentities to answer
298
-                    $label_b4 = isset($input_types[ $field_ID ]['label_b4'])
299
-                        ? $input_types[ $field_ID ]['label_b4']
298
+                    $label_b4 = isset($input_types[$field_ID]['label_b4'])
299
+                        ? $input_types[$field_ID]['label_b4']
300 300
                         : false;
301 301
                     // whether to apply htmlentities to answer
302
-                    $use_desc_4_label = isset($input_types[ $field_ID ]['use_desc_4_label'])
303
-                        ? $input_types[ $field_ID ]['use_desc_4_label']
302
+                    $use_desc_4_label = isset($input_types[$field_ID]['use_desc_4_label'])
303
+                        ? $input_types[$field_ID]['use_desc_4_label']
304 304
                         : false;
305 305
                     // whether input is disabled
306
-                    $disabled = isset($input_types[ $field_ID ]['disabled'])
307
-                        ? $input_types[ $field_ID ]['disabled']
306
+                    $disabled = isset($input_types[$field_ID]['disabled'])
307
+                        ? $input_types[$field_ID]['disabled']
308 308
                         : false;
309 309
 
310 310
                     // create EE_Question_Form_Input object
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
                             )
326 326
                         ),
327 327
                         array(
328
-                            'input_id'         => $field_ID . '-' . $object->ID(),
328
+                            'input_id'         => $field_ID.'-'.$object->ID(),
329 329
                             'input_name'       => $input_name,
330
-                            'input_class'      => $field_ID . $class,
330
+                            'input_class'      => $field_ID.$class,
331 331
                             'input_prefix'     => '',
332 332
                             'append_qstn_id'   => false,
333 333
                             'htmlentities'     => $htmlentities,
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
                     );
338 338
                     // does question type have options ?
339 339
                     if (in_array($type, array('DROPDOWN', 'RADIO_BTN', 'CHECKBOX'))
340
-                        && isset($input_types[ $field_ID ])
341
-                        && isset($input_types[ $field_ID ]['options'])
340
+                        && isset($input_types[$field_ID])
341
+                        && isset($input_types[$field_ID]['options'])
342 342
                     ) {
343
-                        foreach ($input_types[ $field_ID ]['options'] as $option) {
343
+                        foreach ($input_types[$field_ID]['options'] as $option) {
344 344
                             $option = stripslashes_deep($option);
345 345
                             $option_id = ! empty($option['id']) ? $option['id'] : 0;
346 346
                             $QSO = EE_Question_Option::new_instance(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                         $QFI->set('QST_disabled', true);
360 360
                     }
361 361
                     // EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
362
-                    $inputs[ $field_ID ] = $QFI;
362
+                    $inputs[$field_ID] = $QFI;
363 363
                     // if ( $field_ID == 'CNT_active' ) {
364 364
                     // EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
365 365
                     // }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      */
394 394
     public function set($property = null, $value = null)
395 395
     {
396
-        if (! empty($property)) {
396
+        if ( ! empty($property)) {
397 397
             if (EEM_Question::instance()->has_field($property)) {
398 398
                 $this->_QST->set($property, $value);
399 399
             } elseif (EEM_Answer::instance()->has_field($property)) {
@@ -442,6 +442,6 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function get_meta($key = false)
444 444
     {
445
-        return $key && isset($this->_QST_meta[ $key ]) ? $this->_QST_meta[ $key ] : false;
445
+        return $key && isset($this->_QST_meta[$key]) ? $this->_QST_meta[$key] : false;
446 446
     }
447 447
 }
Please login to merge, or discard this patch.
admin_pages/general_settings/OrganizationSettings.php 1 patch
Indentation   +481 added lines, -481 removed lines patch added patch discarded remove patch
@@ -40,506 +40,506 @@
 block discarded – undo
40 40
 class OrganizationSettings extends FormHandler
41 41
 {
42 42
 
43
-    /**
44
-     * @var EE_Organization_Config
45
-     */
46
-    protected $organization_config;
43
+	/**
44
+	 * @var EE_Organization_Config
45
+	 */
46
+	protected $organization_config;
47 47
 
48
-    /**
49
-     * @var EE_Core_Config
50
-     */
51
-    protected $core_config;
48
+	/**
49
+	 * @var EE_Core_Config
50
+	 */
51
+	protected $core_config;
52 52
 
53 53
 
54
-    /**
55
-     * @var EE_Network_Core_Config
56
-     */
57
-    protected $network_core_config;
54
+	/**
55
+	 * @var EE_Network_Core_Config
56
+	 */
57
+	protected $network_core_config;
58 58
 
59
-    /**
60
-     * Form constructor.
61
-     *
62
-     * @param EE_Registry             $registry
63
-     * @param EE_Organization_Config  $organization_config
64
-     * @param EE_Core_Config          $core_config
65
-     * @param EE_Network_Core_Config $network_core_config
66
-     * @throws InvalidArgumentException
67
-     * @throws InvalidDataTypeException
68
-     * @throws DomainException
69
-     */
70
-    public function __construct(
71
-        EE_Registry $registry,
72
-        EE_Organization_Config $organization_config,
73
-        EE_Core_Config $core_config,
74
-        EE_Network_Core_Config $network_core_config
75
-    ) {
76
-        $this->organization_config = $organization_config;
77
-        $this->core_config = $core_config;
78
-        $this->network_core_config = $network_core_config;
79
-        parent::__construct(
80
-            esc_html__('Your Organization Settings', 'event_espresso'),
81
-            esc_html__('Your Organization Settings', 'event_espresso'),
82
-            'organization_settings',
83
-            '',
84
-            FormHandler::DO_NOT_SETUP_FORM,
85
-            $registry
86
-        );
87
-    }
59
+	/**
60
+	 * Form constructor.
61
+	 *
62
+	 * @param EE_Registry             $registry
63
+	 * @param EE_Organization_Config  $organization_config
64
+	 * @param EE_Core_Config          $core_config
65
+	 * @param EE_Network_Core_Config $network_core_config
66
+	 * @throws InvalidArgumentException
67
+	 * @throws InvalidDataTypeException
68
+	 * @throws DomainException
69
+	 */
70
+	public function __construct(
71
+		EE_Registry $registry,
72
+		EE_Organization_Config $organization_config,
73
+		EE_Core_Config $core_config,
74
+		EE_Network_Core_Config $network_core_config
75
+	) {
76
+		$this->organization_config = $organization_config;
77
+		$this->core_config = $core_config;
78
+		$this->network_core_config = $network_core_config;
79
+		parent::__construct(
80
+			esc_html__('Your Organization Settings', 'event_espresso'),
81
+			esc_html__('Your Organization Settings', 'event_espresso'),
82
+			'organization_settings',
83
+			'',
84
+			FormHandler::DO_NOT_SETUP_FORM,
85
+			$registry
86
+		);
87
+	}
88 88
 
89 89
 
90 90
 
91
-    /**
92
-     * creates and returns the actual form
93
-     *
94
-     * @return EE_Form_Section_Proper
95
-     * @throws EE_Error
96
-     */
97
-    public function generate()
98
-    {
99
-        $form = new EE_Form_Section_Proper(
100
-            array(
101
-                'name'            => 'organization_settings',
102
-                'html_id'         => 'organization_settings',
103
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
104
-                'subsections'     => array(
105
-                    'contact_information_hdr'        => new EE_Form_Section_HTML(
106
-                        EEH_HTML::h2(
107
-                            esc_html__('Contact Information', 'event_espresso')
108
-                            . ' '
109
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
110
-                            '',
111
-                            'contact-information-hdr'
112
-                        )
113
-                    ),
114
-                    'organization_name'      => new EE_Text_Input(
115
-                        array(
116
-                            'html_name' => 'organization_name',
117
-                            'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
118
-                            'html_help_text'  => esc_html__(
119
-                                'Displayed on all emails and invoices.',
120
-                                'event_espresso'
121
-                            ),
122
-                            'default'         => $this->organization_config->get_pretty('name'),
123
-                            'required'        => false,
124
-                        )
125
-                    ),
126
-                    'organization_address_1'      => new EE_Text_Input(
127
-                        array(
128
-                            'html_name' => 'organization_address_1',
129
-                            'html_label_text' => esc_html__('Street Address', 'event_espresso'),
130
-                            'default'         => $this->organization_config->get_pretty('address_1'),
131
-                            'required'        => false,
132
-                        )
133
-                    ),
134
-                    'organization_address_2'      => new EE_Text_Input(
135
-                        array(
136
-                            'html_name' => 'organization_address_2',
137
-                            'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
138
-                            'default'         => $this->organization_config->get_pretty('address_2'),
139
-                            'required'        => false,
140
-                        )
141
-                    ),
142
-                    'organization_city'      => new EE_Text_Input(
143
-                        array(
144
-                            'html_name' => 'organization_city',
145
-                            'html_label_text' => esc_html__('City', 'event_espresso'),
146
-                            'default'         => $this->organization_config->get_pretty('city'),
147
-                            'required'        => false,
148
-                        )
149
-                    ),
150
-                    'organization_state'      => new EE_State_Select_Input(
151
-                        null,
152
-                        array(
153
-                            'html_name' => 'organization_state',
154
-                            'html_label_text' => esc_html__('State/Province', 'event_espresso'),
155
-                            'default'         => $this->organization_config->STA_ID,
156
-                            'required'        => false,
157
-                        )
158
-                    ),
159
-                    'organization_country'      => new EE_Country_Select_Input(
160
-                        null,
161
-                        array(
162
-                            'html_name' => 'organization_country',
163
-                            'html_label_text' => esc_html__('Country', 'event_espresso'),
164
-                            'default'         => $this->organization_config->CNT_ISO,
165
-                            'required'        => false,
166
-                            'html_help_text' => sprintf(
167
-                                esc_html__(
168
-                                    '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
169
-                                    'event_espresso'
170
-                                ),
171
-                                '<span class="reminder-spn">',
172
-                                '</span>'
173
-                            ),
174
-                        )
175
-                    ),
176
-                    'organization_zip'      => new EE_Text_Input(
177
-                        array(
178
-                            'html_name' => 'organization_zip',
179
-                            'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
180
-                            'default'         => $this->organization_config->get_pretty('zip'),
181
-                            'required'        => false,
182
-                        )
183
-                    ),
184
-                    'organization_email'      => new EE_Text_Input(
185
-                        array(
186
-                            'html_name' => 'organization_email',
187
-                            'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
188
-                            'html_help_text'  => sprintf(
189
-                                esc_html__(
190
-                                    'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
191
-                                    'event_espresso'
192
-                                ),
193
-                                '<code>[CO_FORMATTED_EMAIL]</code>',
194
-                                '<code>[CO_EMAIL]</code>'
195
-                            ),
196
-                            'default'         => $this->organization_config->get_pretty('email'),
197
-                            'required'        => false,
198
-                        )
199
-                    ),
200
-                    'organization_phone'      => new EE_Text_Input(
201
-                        array(
202
-                            'html_name' => 'organization_phone',
203
-                            'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
204
-                            'html_help_text'  => esc_html__(
205
-                                'The phone number for your organization.',
206
-                                'event_espresso'
207
-                            ),
208
-                            'default'         => $this->organization_config->get_pretty('phone'),
209
-                            'required'        => false,
210
-                        )
211
-                    ),
212
-                    'organization_vat'      => new EE_Text_Input(
213
-                        array(
214
-                            'html_name' => 'organization_vat',
215
-                            'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
216
-                            'html_help_text'  => esc_html__(
217
-                                'The VAT/Tax Number may be displayed on invoices and receipts.',
218
-                                'event_espresso'
219
-                            ),
220
-                            'default'         => $this->organization_config->get_pretty('vat'),
221
-                            'required'        => false,
222
-                        )
223
-                    ),
224
-                    'company_logo_hdr'        => new EE_Form_Section_HTML(
225
-                        EEH_HTML::h2(
226
-                            esc_html__('Company Logo', 'event_espresso')
227
-                            . ' '
228
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
229
-                            '',
230
-                            'company-logo-hdr'
231
-                        )
232
-                    ),
233
-                    'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
234
-                        array(
235
-                            'html_name' => 'organization_logo_url',
236
-                            'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
237
-                            'html_help_text'  => esc_html__(
238
-                                'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
239
-                                'event_espresso'
240
-                            ),
241
-                            'default'         => $this->organization_config->get_pretty('logo_url'),
242
-                            'required'        => false,
243
-                        )
244
-                    ),
245
-                    'social_links_hdr'        => new EE_Form_Section_HTML(
246
-                        EEH_HTML::h2(
247
-                            esc_html__('Social Links', 'event_espresso')
248
-                            . ' '
249
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
250
-                            . EEH_HTML::br()
251
-                            . EEH_HTML::p(
252
-                                esc_html__(
253
-                                    'Enter any links to social accounts for your organization here',
254
-                                    'event_espresso'
255
-                                ),
256
-                                '',
257
-                                'description'
258
-                            ),
259
-                            '',
260
-                            'social-links-hdr'
261
-                        )
262
-                    ),
263
-                    'organization_facebook'      => new EE_Text_Input(
264
-                        array(
265
-                            'html_name' => 'organization_facebook',
266
-                            'html_label_text' => esc_html__('Facebook', 'event_espresso'),
267
-                            'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
268
-                            'default'         => $this->organization_config->get_pretty('facebook'),
269
-                            'required'        => false,
270
-                        )
271
-                    ),
272
-                    'organization_twitter'      => new EE_Text_Input(
273
-                        array(
274
-                            'html_name' => 'organization_twitter',
275
-                            'html_label_text' => esc_html__('Twitter', 'event_espresso'),
276
-                            'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
277
-                            'default'         => $this->organization_config->get_pretty('twitter'),
278
-                            'required'        => false,
279
-                        )
280
-                    ),
281
-                    'organization_linkedin'      => new EE_Text_Input(
282
-                        array(
283
-                            'html_name' => 'organization_linkedin',
284
-                            'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
285
-                            'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
286
-                            'default'         => $this->organization_config->get_pretty('linkedin'),
287
-                            'required'        => false,
288
-                        )
289
-                    ),
290
-                    'organization_pinterest'      => new EE_Text_Input(
291
-                        array(
292
-                            'html_name' => 'organization_pinterest',
293
-                            'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
294
-                            'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
295
-                            'default'         => $this->organization_config->get_pretty('pinterest'),
296
-                            'required'        => false,
297
-                        )
298
-                    ),
299
-                    'organization_google'      => new EE_Text_Input(
300
-                        array(
301
-                            'html_name' => 'organization_google',
302
-                            'html_label_text' => esc_html__('Google+', 'event_espresso'),
303
-                            'other_html_attributes' => ' placeholder="google.com/+profilename"',
304
-                            'default'         => $this->organization_config->get_pretty('google'),
305
-                            'required'        => false,
306
-                        )
307
-                    ),
308
-                    'organization_instagram'      => new EE_Text_Input(
309
-                        array(
310
-                            'html_name' => 'organization_instagram',
311
-                            'html_label_text' => esc_html__('Instagram', 'event_espresso'),
312
-                            'other_html_attributes' => ' placeholder="instagram.com/handle"',
313
-                            'default'         => $this->organization_config->get_pretty('instagram'),
314
-                            'required'        => false,
315
-                        )
316
-                    ),
317
-                ),
318
-            )
319
-        );
320
-        if (is_main_site()) {
321
-            $form->add_subsections(
322
-                array(
323
-                    'site_license_key_hdr' => new EE_Form_Section_HTML(
324
-                        EEH_HTML::h2(
325
-                            esc_html__('Your Event Espresso License Key', 'event_espresso')
326
-                            . ' '
327
-                            . EEH_HTML::span(
328
-                                EEH_Template::get_help_tab_link('site_license_key_info'),
329
-                                'help_tour_activation'
330
-                            ),
331
-                            '',
332
-                            'site-license-key-hdr'
333
-                        )
334
-                    ),
335
-                    'site_license_key' => $this->getSiteLicenseKeyField()
336
-                )
337
-            );
338
-            $form->add_subsections(
339
-                array(
340
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(
341
-                        $this->uxipOptinText()
342
-                    ),
343
-                    'ueip_optin' => new EE_Checkbox_Multi_Input(
344
-                        array(
345
-                            true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
346
-                        ),
347
-                        array(
348
-                            'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
349
-                            'html_label_text' => esc_html__(
350
-                                'UXIP Opt In?',
351
-                                'event_espresso'
352
-                            ),
353
-                            'default'         => isset($this->core_config->ee_ueip_optin)
354
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
355
-                                : false,
356
-                            'required'        => false,
357
-                        )
358
-                    ),
359
-                ),
360
-                'organization_instagram',
361
-                false
362
-            );
363
-        }
364
-        return $form;
365
-    }
91
+	/**
92
+	 * creates and returns the actual form
93
+	 *
94
+	 * @return EE_Form_Section_Proper
95
+	 * @throws EE_Error
96
+	 */
97
+	public function generate()
98
+	{
99
+		$form = new EE_Form_Section_Proper(
100
+			array(
101
+				'name'            => 'organization_settings',
102
+				'html_id'         => 'organization_settings',
103
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
104
+				'subsections'     => array(
105
+					'contact_information_hdr'        => new EE_Form_Section_HTML(
106
+						EEH_HTML::h2(
107
+							esc_html__('Contact Information', 'event_espresso')
108
+							. ' '
109
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
110
+							'',
111
+							'contact-information-hdr'
112
+						)
113
+					),
114
+					'organization_name'      => new EE_Text_Input(
115
+						array(
116
+							'html_name' => 'organization_name',
117
+							'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
118
+							'html_help_text'  => esc_html__(
119
+								'Displayed on all emails and invoices.',
120
+								'event_espresso'
121
+							),
122
+							'default'         => $this->organization_config->get_pretty('name'),
123
+							'required'        => false,
124
+						)
125
+					),
126
+					'organization_address_1'      => new EE_Text_Input(
127
+						array(
128
+							'html_name' => 'organization_address_1',
129
+							'html_label_text' => esc_html__('Street Address', 'event_espresso'),
130
+							'default'         => $this->organization_config->get_pretty('address_1'),
131
+							'required'        => false,
132
+						)
133
+					),
134
+					'organization_address_2'      => new EE_Text_Input(
135
+						array(
136
+							'html_name' => 'organization_address_2',
137
+							'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
138
+							'default'         => $this->organization_config->get_pretty('address_2'),
139
+							'required'        => false,
140
+						)
141
+					),
142
+					'organization_city'      => new EE_Text_Input(
143
+						array(
144
+							'html_name' => 'organization_city',
145
+							'html_label_text' => esc_html__('City', 'event_espresso'),
146
+							'default'         => $this->organization_config->get_pretty('city'),
147
+							'required'        => false,
148
+						)
149
+					),
150
+					'organization_state'      => new EE_State_Select_Input(
151
+						null,
152
+						array(
153
+							'html_name' => 'organization_state',
154
+							'html_label_text' => esc_html__('State/Province', 'event_espresso'),
155
+							'default'         => $this->organization_config->STA_ID,
156
+							'required'        => false,
157
+						)
158
+					),
159
+					'organization_country'      => new EE_Country_Select_Input(
160
+						null,
161
+						array(
162
+							'html_name' => 'organization_country',
163
+							'html_label_text' => esc_html__('Country', 'event_espresso'),
164
+							'default'         => $this->organization_config->CNT_ISO,
165
+							'required'        => false,
166
+							'html_help_text' => sprintf(
167
+								esc_html__(
168
+									'%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
169
+									'event_espresso'
170
+								),
171
+								'<span class="reminder-spn">',
172
+								'</span>'
173
+							),
174
+						)
175
+					),
176
+					'organization_zip'      => new EE_Text_Input(
177
+						array(
178
+							'html_name' => 'organization_zip',
179
+							'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
180
+							'default'         => $this->organization_config->get_pretty('zip'),
181
+							'required'        => false,
182
+						)
183
+					),
184
+					'organization_email'      => new EE_Text_Input(
185
+						array(
186
+							'html_name' => 'organization_email',
187
+							'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
188
+							'html_help_text'  => sprintf(
189
+								esc_html__(
190
+									'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
191
+									'event_espresso'
192
+								),
193
+								'<code>[CO_FORMATTED_EMAIL]</code>',
194
+								'<code>[CO_EMAIL]</code>'
195
+							),
196
+							'default'         => $this->organization_config->get_pretty('email'),
197
+							'required'        => false,
198
+						)
199
+					),
200
+					'organization_phone'      => new EE_Text_Input(
201
+						array(
202
+							'html_name' => 'organization_phone',
203
+							'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
204
+							'html_help_text'  => esc_html__(
205
+								'The phone number for your organization.',
206
+								'event_espresso'
207
+							),
208
+							'default'         => $this->organization_config->get_pretty('phone'),
209
+							'required'        => false,
210
+						)
211
+					),
212
+					'organization_vat'      => new EE_Text_Input(
213
+						array(
214
+							'html_name' => 'organization_vat',
215
+							'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
216
+							'html_help_text'  => esc_html__(
217
+								'The VAT/Tax Number may be displayed on invoices and receipts.',
218
+								'event_espresso'
219
+							),
220
+							'default'         => $this->organization_config->get_pretty('vat'),
221
+							'required'        => false,
222
+						)
223
+					),
224
+					'company_logo_hdr'        => new EE_Form_Section_HTML(
225
+						EEH_HTML::h2(
226
+							esc_html__('Company Logo', 'event_espresso')
227
+							. ' '
228
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
229
+							'',
230
+							'company-logo-hdr'
231
+						)
232
+					),
233
+					'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
234
+						array(
235
+							'html_name' => 'organization_logo_url',
236
+							'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
237
+							'html_help_text'  => esc_html__(
238
+								'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
239
+								'event_espresso'
240
+							),
241
+							'default'         => $this->organization_config->get_pretty('logo_url'),
242
+							'required'        => false,
243
+						)
244
+					),
245
+					'social_links_hdr'        => new EE_Form_Section_HTML(
246
+						EEH_HTML::h2(
247
+							esc_html__('Social Links', 'event_espresso')
248
+							. ' '
249
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
250
+							. EEH_HTML::br()
251
+							. EEH_HTML::p(
252
+								esc_html__(
253
+									'Enter any links to social accounts for your organization here',
254
+									'event_espresso'
255
+								),
256
+								'',
257
+								'description'
258
+							),
259
+							'',
260
+							'social-links-hdr'
261
+						)
262
+					),
263
+					'organization_facebook'      => new EE_Text_Input(
264
+						array(
265
+							'html_name' => 'organization_facebook',
266
+							'html_label_text' => esc_html__('Facebook', 'event_espresso'),
267
+							'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
268
+							'default'         => $this->organization_config->get_pretty('facebook'),
269
+							'required'        => false,
270
+						)
271
+					),
272
+					'organization_twitter'      => new EE_Text_Input(
273
+						array(
274
+							'html_name' => 'organization_twitter',
275
+							'html_label_text' => esc_html__('Twitter', 'event_espresso'),
276
+							'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
277
+							'default'         => $this->organization_config->get_pretty('twitter'),
278
+							'required'        => false,
279
+						)
280
+					),
281
+					'organization_linkedin'      => new EE_Text_Input(
282
+						array(
283
+							'html_name' => 'organization_linkedin',
284
+							'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
285
+							'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
286
+							'default'         => $this->organization_config->get_pretty('linkedin'),
287
+							'required'        => false,
288
+						)
289
+					),
290
+					'organization_pinterest'      => new EE_Text_Input(
291
+						array(
292
+							'html_name' => 'organization_pinterest',
293
+							'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
294
+							'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
295
+							'default'         => $this->organization_config->get_pretty('pinterest'),
296
+							'required'        => false,
297
+						)
298
+					),
299
+					'organization_google'      => new EE_Text_Input(
300
+						array(
301
+							'html_name' => 'organization_google',
302
+							'html_label_text' => esc_html__('Google+', 'event_espresso'),
303
+							'other_html_attributes' => ' placeholder="google.com/+profilename"',
304
+							'default'         => $this->organization_config->get_pretty('google'),
305
+							'required'        => false,
306
+						)
307
+					),
308
+					'organization_instagram'      => new EE_Text_Input(
309
+						array(
310
+							'html_name' => 'organization_instagram',
311
+							'html_label_text' => esc_html__('Instagram', 'event_espresso'),
312
+							'other_html_attributes' => ' placeholder="instagram.com/handle"',
313
+							'default'         => $this->organization_config->get_pretty('instagram'),
314
+							'required'        => false,
315
+						)
316
+					),
317
+				),
318
+			)
319
+		);
320
+		if (is_main_site()) {
321
+			$form->add_subsections(
322
+				array(
323
+					'site_license_key_hdr' => new EE_Form_Section_HTML(
324
+						EEH_HTML::h2(
325
+							esc_html__('Your Event Espresso License Key', 'event_espresso')
326
+							. ' '
327
+							. EEH_HTML::span(
328
+								EEH_Template::get_help_tab_link('site_license_key_info'),
329
+								'help_tour_activation'
330
+							),
331
+							'',
332
+							'site-license-key-hdr'
333
+						)
334
+					),
335
+					'site_license_key' => $this->getSiteLicenseKeyField()
336
+				)
337
+			);
338
+			$form->add_subsections(
339
+				array(
340
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(
341
+						$this->uxipOptinText()
342
+					),
343
+					'ueip_optin' => new EE_Checkbox_Multi_Input(
344
+						array(
345
+							true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
346
+						),
347
+						array(
348
+							'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
349
+							'html_label_text' => esc_html__(
350
+								'UXIP Opt In?',
351
+								'event_espresso'
352
+							),
353
+							'default'         => isset($this->core_config->ee_ueip_optin)
354
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
355
+								: false,
356
+							'required'        => false,
357
+						)
358
+					),
359
+				),
360
+				'organization_instagram',
361
+				false
362
+			);
363
+		}
364
+		return $form;
365
+	}
366 366
 
367 367
 
368
-    /**
369
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
370
-     * returns a string of HTML that can be directly echoed in a template
371
-     *
372
-     * @return string
373
-     * @throws EE_Error
374
-     * @throws InvalidArgumentException
375
-     * @throws InvalidDataTypeException
376
-     * @throws InvalidInterfaceException
377
-     * @throws LogicException
378
-     */
379
-    public function display()
380
-    {
381
-        $this->form()->enqueue_js();
382
-        return parent::display();
383
-    }
368
+	/**
369
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
370
+	 * returns a string of HTML that can be directly echoed in a template
371
+	 *
372
+	 * @return string
373
+	 * @throws EE_Error
374
+	 * @throws InvalidArgumentException
375
+	 * @throws InvalidDataTypeException
376
+	 * @throws InvalidInterfaceException
377
+	 * @throws LogicException
378
+	 */
379
+	public function display()
380
+	{
381
+		$this->form()->enqueue_js();
382
+		return parent::display();
383
+	}
384 384
 
385 385
 
386
-    /**
387
-     * handles processing the form submission
388
-     * returns true or false depending on whether the form was processed successfully or not
389
-     *
390
-     * @param array $form_data
391
-     * @return bool
392
-     * @throws InvalidFormSubmissionException
393
-     * @throws EE_Error
394
-     * @throws LogicException
395
-     * @throws InvalidArgumentException
396
-     * @throws InvalidDataTypeException
397
-     */
398
-    public function process($form_data = array())
399
-    {
400
-        // process form
401
-        $valid_data = (array) parent::process($form_data);
402
-        if (empty($valid_data)) {
403
-            return false;
404
-        }
386
+	/**
387
+	 * handles processing the form submission
388
+	 * returns true or false depending on whether the form was processed successfully or not
389
+	 *
390
+	 * @param array $form_data
391
+	 * @return bool
392
+	 * @throws InvalidFormSubmissionException
393
+	 * @throws EE_Error
394
+	 * @throws LogicException
395
+	 * @throws InvalidArgumentException
396
+	 * @throws InvalidDataTypeException
397
+	 */
398
+	public function process($form_data = array())
399
+	{
400
+		// process form
401
+		$valid_data = (array) parent::process($form_data);
402
+		if (empty($valid_data)) {
403
+			return false;
404
+		}
405 405
 
406
-        if (is_main_site()) {
407
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
408
-                ? sanitize_text_field($form_data['ee_site_license_key'])
409
-                : $this->network_core_config->site_license_key;
410
-        }
411
-        $this->organization_config->name = isset($form_data['organization_name'])
412
-            ? sanitize_text_field($form_data['organization_name'])
413
-            : $this->organization_config->name;
414
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
415
-            ? sanitize_text_field($form_data['organization_address_1'])
416
-            : $this->organization_config->address_1;
417
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
418
-            ? sanitize_text_field($form_data['organization_address_2'])
419
-            : $this->organization_config->address_2;
420
-        $this->organization_config->city = isset($form_data['organization_city'])
421
-            ? sanitize_text_field($form_data['organization_city'])
422
-            : $this->organization_config->city;
423
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
424
-            ? absint($form_data['organization_state'])
425
-            : $this->organization_config->STA_ID;
426
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
427
-            ? sanitize_text_field($form_data['organization_country'])
428
-            : $this->organization_config->CNT_ISO;
429
-        $this->organization_config->zip = isset($form_data['organization_zip'])
430
-            ? sanitize_text_field($form_data['organization_zip'])
431
-            : $this->organization_config->zip;
432
-        $this->organization_config->email = isset($form_data['organization_email'])
433
-            ? sanitize_email($form_data['organization_email'])
434
-            : $this->organization_config->email;
435
-        $this->organization_config->vat = isset($form_data['organization_vat'])
436
-            ? sanitize_text_field($form_data['organization_vat'])
437
-            : $this->organization_config->vat;
438
-        $this->organization_config->phone = isset($form_data['organization_phone'])
439
-            ? sanitize_text_field($form_data['organization_phone'])
440
-            : $this->organization_config->phone;
441
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
442
-            ? esc_url_raw($form_data['organization_logo_url'])
443
-            : $this->organization_config->logo_url;
444
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
445
-            ? esc_url_raw($form_data['organization_facebook'])
446
-            : $this->organization_config->facebook;
447
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
448
-            ? esc_url_raw($form_data['organization_twitter'])
449
-            : $this->organization_config->twitter;
450
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
451
-            ? esc_url_raw($form_data['organization_linkedin'])
452
-            : $this->organization_config->linkedin;
453
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
454
-            ? esc_url_raw($form_data['organization_pinterest'])
455
-            : $this->organization_config->pinterest;
456
-        $this->organization_config->google = isset($form_data['organization_google'])
457
-            ? esc_url_raw($form_data['organization_google'])
458
-            : $this->organization_config->google;
459
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
460
-            ? esc_url_raw($form_data['organization_instagram'])
461
-            : $this->organization_config->instagram;
462
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
463
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
464
-            : false;
465
-        $this->core_config->ee_ueip_has_notified = true;
406
+		if (is_main_site()) {
407
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
408
+				? sanitize_text_field($form_data['ee_site_license_key'])
409
+				: $this->network_core_config->site_license_key;
410
+		}
411
+		$this->organization_config->name = isset($form_data['organization_name'])
412
+			? sanitize_text_field($form_data['organization_name'])
413
+			: $this->organization_config->name;
414
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
415
+			? sanitize_text_field($form_data['organization_address_1'])
416
+			: $this->organization_config->address_1;
417
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
418
+			? sanitize_text_field($form_data['organization_address_2'])
419
+			: $this->organization_config->address_2;
420
+		$this->organization_config->city = isset($form_data['organization_city'])
421
+			? sanitize_text_field($form_data['organization_city'])
422
+			: $this->organization_config->city;
423
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
424
+			? absint($form_data['organization_state'])
425
+			: $this->organization_config->STA_ID;
426
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
427
+			? sanitize_text_field($form_data['organization_country'])
428
+			: $this->organization_config->CNT_ISO;
429
+		$this->organization_config->zip = isset($form_data['organization_zip'])
430
+			? sanitize_text_field($form_data['organization_zip'])
431
+			: $this->organization_config->zip;
432
+		$this->organization_config->email = isset($form_data['organization_email'])
433
+			? sanitize_email($form_data['organization_email'])
434
+			: $this->organization_config->email;
435
+		$this->organization_config->vat = isset($form_data['organization_vat'])
436
+			? sanitize_text_field($form_data['organization_vat'])
437
+			: $this->organization_config->vat;
438
+		$this->organization_config->phone = isset($form_data['organization_phone'])
439
+			? sanitize_text_field($form_data['organization_phone'])
440
+			: $this->organization_config->phone;
441
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
442
+			? esc_url_raw($form_data['organization_logo_url'])
443
+			: $this->organization_config->logo_url;
444
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
445
+			? esc_url_raw($form_data['organization_facebook'])
446
+			: $this->organization_config->facebook;
447
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
448
+			? esc_url_raw($form_data['organization_twitter'])
449
+			: $this->organization_config->twitter;
450
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
451
+			? esc_url_raw($form_data['organization_linkedin'])
452
+			: $this->organization_config->linkedin;
453
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
454
+			? esc_url_raw($form_data['organization_pinterest'])
455
+			: $this->organization_config->pinterest;
456
+		$this->organization_config->google = isset($form_data['organization_google'])
457
+			? esc_url_raw($form_data['organization_google'])
458
+			: $this->organization_config->google;
459
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
460
+			? esc_url_raw($form_data['organization_instagram'])
461
+			: $this->organization_config->instagram;
462
+		$this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
463
+			? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
464
+			: false;
465
+		$this->core_config->ee_ueip_has_notified = true;
466 466
 
467
-        $this->registry->CFG->currency = new EE_Currency_Config(
468
-            $this->organization_config->CNT_ISO
469
-        );
470
-        return true;
471
-    }
467
+		$this->registry->CFG->currency = new EE_Currency_Config(
468
+			$this->organization_config->CNT_ISO
469
+		);
470
+		return true;
471
+	}
472 472
 
473 473
 
474
-    /**
475
-     * @return string
476
-     */
477
-    private function uxipOptinText()
478
-    {
479
-        ob_start();
480
-        Stats::optinText(false);
481
-        return ob_get_clean();
482
-    }
474
+	/**
475
+	 * @return string
476
+	 */
477
+	private function uxipOptinText()
478
+	{
479
+		ob_start();
480
+		Stats::optinText(false);
481
+		return ob_get_clean();
482
+	}
483 483
 
484 484
 
485
-    /**
486
-     * Return whether the site license key has been verified or not.
487
-     * @return bool
488
-     */
489
-    private function licenseKeyVerified()
490
-    {
491
-        if (empty($this->network_core_config->site_license_key)) {
492
-            return false;
493
-        }
494
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
495
-        $verify_fail = get_option($ver_option_key, false);
496
-        return $verify_fail === false
497
-                  || (! empty($this->network_core_config->site_license_key)
498
-                        && $verify_fail === false
499
-                  );
500
-    }
485
+	/**
486
+	 * Return whether the site license key has been verified or not.
487
+	 * @return bool
488
+	 */
489
+	private function licenseKeyVerified()
490
+	{
491
+		if (empty($this->network_core_config->site_license_key)) {
492
+			return false;
493
+		}
494
+		$ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
495
+		$verify_fail = get_option($ver_option_key, false);
496
+		return $verify_fail === false
497
+				  || (! empty($this->network_core_config->site_license_key)
498
+						&& $verify_fail === false
499
+				  );
500
+	}
501 501
 
502 502
 
503
-    /**
504
-     * @return EE_Text_Input
505
-     */
506
-    private function getSiteLicenseKeyField()
507
-    {
508
-        $text_input = new EE_Text_Input(
509
-            array(
510
-                'html_name' => 'ee_site_license_key',
511
-                'html_id' => 'site_license_key',
512
-                'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
513
-                /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
514
-                'html_help_text'  => sprintf(
515
-                    esc_html__(
516
-                        'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
517
-                        'event_espresso'
518
-                    ),
519
-                    '<strong>',
520
-                    '</strong>'
521
-                ),
522
-                /** phpcs:enable */
523
-                'default'         => isset($this->network_core_config->site_license_key)
524
-                    ? $this->network_core_config->site_license_key
525
-                    : '',
526
-                'required'        => false,
527
-                'form_html_filter' => new VsprintfFilter(
528
-                    '%2$s %1$s',
529
-                    array($this->getValidationIndicator())
530
-                )
531
-            )
532
-        );
533
-        return $text_input;
534
-    }
503
+	/**
504
+	 * @return EE_Text_Input
505
+	 */
506
+	private function getSiteLicenseKeyField()
507
+	{
508
+		$text_input = new EE_Text_Input(
509
+			array(
510
+				'html_name' => 'ee_site_license_key',
511
+				'html_id' => 'site_license_key',
512
+				'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
513
+				/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
514
+				'html_help_text'  => sprintf(
515
+					esc_html__(
516
+						'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
517
+						'event_espresso'
518
+					),
519
+					'<strong>',
520
+					'</strong>'
521
+				),
522
+				/** phpcs:enable */
523
+				'default'         => isset($this->network_core_config->site_license_key)
524
+					? $this->network_core_config->site_license_key
525
+					: '',
526
+				'required'        => false,
527
+				'form_html_filter' => new VsprintfFilter(
528
+					'%2$s %1$s',
529
+					array($this->getValidationIndicator())
530
+				)
531
+			)
532
+		);
533
+		return $text_input;
534
+	}
535 535
 
536 536
 
537
-    /**
538
-     * @return string
539
-     */
540
-    private function getValidationIndicator()
541
-    {
542
-        $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
543
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
544
-    }
537
+	/**
538
+	 * @return string
539
+	 */
540
+	private function getValidationIndicator()
541
+	{
542
+		$verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
543
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
544
+	}
545 545
 }
Please login to merge, or discard this patch.
general_settings/templates/country_details_settings.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 <table id="general-setting-country-details-tbl" class="form-table">
9 9
     <tbody>
10 10
     <?php
11
-    foreach ($inputs as $ID => $input) {
12
-        echo EEH_Form_Fields::generate_form_input($input);
13
-    }
14
-    ?>
11
+	foreach ($inputs as $ID => $input) {
12
+		echo EEH_Form_Fields::generate_form_input($input);
13
+	}
14
+	?>
15 15
     <tr>
16 16
         <th></th>
17 17
         <td>
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
                 <p>
20 20
                     <span class="reminder-spn">
21 21
                         <?php printf(
22
-                            esc_html__(
23
-                                'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.',
24
-                                'event_espresso'
25
-                            ),
26
-                            $CNT_name_for_site
27
-                        ); ?>
22
+							esc_html__(
23
+								'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.',
24
+								'event_espresso'
25
+							),
26
+							$CNT_name_for_site
27
+						); ?>
28 28
                     </span>
29 29
                 </p>
30 30
             <?php } ?>
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 2 patches
Indentation   +1307 added lines, -1307 removed lines patch added patch discarded remove patch
@@ -21,1322 +21,1322 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * _question_group
26
-     * holds the specific question group object for the question group details screen
27
-     *
28
-     * @var object
29
-     */
30
-    protected $_question_group;
31
-
32
-
33
-    /**
34
-     * Initialize basic properties.
35
-     */
36
-    protected function _init_page_props()
37
-    {
38
-        $this->page_slug = GEN_SET_PG_SLUG;
39
-        $this->page_label = GEN_SET_LABEL;
40
-        $this->_admin_base_url = GEN_SET_ADMIN_URL;
41
-        $this->_admin_base_path = GEN_SET_ADMIN;
42
-    }
43
-
44
-
45
-    /**
46
-     * Set ajax hooks
47
-     */
48
-    protected function _ajax_hooks()
49
-    {
50
-        add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
-        add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
-        add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
-        add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
-    }
55
-
56
-
57
-    /**
58
-     * More page properties initialization.
59
-     */
60
-    protected function _define_page_props()
61
-    {
62
-        $this->_admin_page_title = GEN_SET_LABEL;
63
-        $this->_labels = array(
64
-            'publishbox' => __('Update Settings', 'event_espresso'),
65
-        );
66
-    }
67
-
68
-
69
-    /**
70
-     * Set page routes property.
71
-     */
72
-    protected function _set_page_routes()
73
-    {
74
-        $this->_page_routes = array(
75
-
76
-            'critical_pages'                => array(
77
-                'func'       => '_espresso_page_settings',
78
-                'capability' => 'manage_options',
79
-            ),
80
-            'update_espresso_page_settings' => array(
81
-                'func'       => '_update_espresso_page_settings',
82
-                'capability' => 'manage_options',
83
-                'noheader'   => true,
84
-            ),
85
-            'default'                       => array(
86
-                'func'       => '_your_organization_settings',
87
-                'capability' => 'manage_options',
88
-            ),
89
-
90
-            'update_your_organization_settings' => array(
91
-                'func'       => '_update_your_organization_settings',
92
-                'capability' => 'manage_options',
93
-                'noheader'   => true,
94
-            ),
95
-
96
-            'admin_option_settings' => array(
97
-                'func'       => '_admin_option_settings',
98
-                'capability' => 'manage_options',
99
-            ),
100
-
101
-            'update_admin_option_settings' => array(
102
-                'func'       => '_update_admin_option_settings',
103
-                'capability' => 'manage_options',
104
-                'noheader'   => true,
105
-            ),
106
-
107
-            'country_settings' => array(
108
-                'func'       => '_country_settings',
109
-                'capability' => 'manage_options',
110
-            ),
111
-
112
-            'update_country_settings' => array(
113
-                'func'       => '_update_country_settings',
114
-                'capability' => 'manage_options',
115
-                'noheader'   => true,
116
-            ),
117
-
118
-            'display_country_settings' => array(
119
-                'func'       => 'display_country_settings',
120
-                'capability' => 'manage_options',
121
-                'noheader'   => true,
122
-            ),
123
-
124
-            'add_new_state' => array(
125
-                'func'       => 'add_new_state',
126
-                'capability' => 'manage_options',
127
-                'noheader'   => true,
128
-            ),
129
-
130
-            'delete_state' => array(
131
-                'func'       => 'delete_state',
132
-                'capability' => 'manage_options',
133
-                'noheader'   => true,
134
-            ),
135
-            'privacy_settings' => array(
136
-                'func' => 'privacySettings',
137
-                'capability' => 'manage_options',
138
-            ),
139
-            'update_privacy_settings' => array(
140
-                'func' => 'updatePrivacySettings',
141
-                'capability' => 'manage_options',
142
-                'noheader' => true,
143
-                'headers_sent_route' => 'privacy_settings'
144
-            )
145
-        );
146
-    }
147
-
148
-
149
-    /**
150
-     * Set page configuration property
151
-     */
152
-    protected function _set_page_config()
153
-    {
154
-        $this->_page_config = array(
155
-            'critical_pages'        => array(
156
-                'nav'           => array(
157
-                    'label' => __('Critical Pages', 'event_espresso'),
158
-                    'order' => 50,
159
-                ),
160
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
161
-                'help_tabs'     => array(
162
-                    'general_settings_critical_pages_help_tab' => array(
163
-                        'title'    => __('Critical Pages', 'event_espresso'),
164
-                        'filename' => 'general_settings_critical_pages',
165
-                    ),
166
-                ),
167
-                'help_tour'     => array('Critical_Pages_Help_Tour'),
168
-                'require_nonce' => false,
169
-            ),
170
-            'default'               => array(
171
-                'nav'           => array(
172
-                    'label' => __('Your Organization', 'event_espresso'),
173
-                    'order' => 20,
174
-                ),
175
-                'help_tabs'     => array(
176
-                    'general_settings_your_organization_help_tab' => array(
177
-                        'title'    => __('Your Organization', 'event_espresso'),
178
-                        'filename' => 'general_settings_your_organization',
179
-                    ),
180
-                ),
181
-                'help_tour'     => array('Your_Organization_Help_Tour'),
182
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
183
-                'require_nonce' => false,
184
-            ),
185
-            'admin_option_settings' => array(
186
-                'nav'           => array(
187
-                    'label' => __('Admin Options', 'event_espresso'),
188
-                    'order' => 60,
189
-                ),
190
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
191
-                'help_tabs'     => array(
192
-                    'general_settings_admin_options_help_tab' => array(
193
-                        'title'    => __('Admin Options', 'event_espresso'),
194
-                        'filename' => 'general_settings_admin_options',
195
-                    ),
196
-                ),
197
-                'help_tour'     => array('Admin_Options_Help_Tour'),
198
-                'require_nonce' => false,
199
-            ),
200
-            'country_settings'      => array(
201
-                'nav'           => array(
202
-                    'label' => __('Countries', 'event_espresso'),
203
-                    'order' => 70,
204
-                ),
205
-                'help_tabs'     => array(
206
-                    'general_settings_countries_help_tab' => array(
207
-                        'title'    => __('Countries', 'event_espresso'),
208
-                        'filename' => 'general_settings_countries',
209
-                    ),
210
-                ),
211
-                'help_tour'     => array('Countries_Help_Tour'),
212
-                'require_nonce' => false,
213
-            ),
214
-            'privacy_settings' => array(
215
-                'nav' => array(
216
-                    'label' => esc_html__('Privacy', 'event_espresso'),
217
-                    'order' => 80
218
-                ),
219
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
220
-                'require_nonce' => false
221
-            )
222
-        );
223
-    }
224
-
225
-
226
-    protected function _add_screen_options()
227
-    {
228
-    }
229
-
230
-    protected function _add_feature_pointers()
231
-    {
232
-    }
233
-
234
-
235
-    /**
236
-     * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
237
-     */
238
-    public function load_scripts_styles()
239
-    {
240
-        // styles
241
-        wp_enqueue_style('espresso-ui-theme');
242
-        // scripts
243
-        wp_enqueue_script('ee_admin_js');
244
-    }
245
-
246
-
247
-    /**
248
-     * Execute logic running on `admin_init`
249
-     */
250
-    public function admin_init()
251
-    {
252
-        EE_Registry::$i18n_js_strings['invalid_server_response'] = __(
253
-            'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
254
-            'event_espresso'
255
-        );
256
-        EE_Registry::$i18n_js_strings['error_occurred'] = __(
257
-            'An error occurred! Please refresh the page and try again.',
258
-            'event_espresso'
259
-        );
260
-        EE_Registry::$i18n_js_strings['confirm_delete_state'] = __(
261
-            'Are you sure you want to delete this State / Province?',
262
-            'event_espresso'
263
-        );
264
-        $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
265
-        EE_Registry::$i18n_js_strings['ajax_url'] = admin_url(
266
-            'admin-ajax.php?page=espresso_general_settings',
267
-            $protocol
268
-        );
269
-    }
270
-
271
-    public function admin_notices()
272
-    {
273
-    }
274
-
275
-    public function admin_footer_scripts()
276
-    {
277
-    }
278
-
279
-
280
-    /**
281
-     * Enqueue scripts and styles for the default route.
282
-     */
283
-    public function load_scripts_styles_default()
284
-    {
285
-        // styles
286
-        wp_enqueue_style('thickbox');
287
-        // scripts
288
-        wp_enqueue_script('media-upload');
289
-        wp_enqueue_script('thickbox');
290
-        wp_register_script(
291
-            'organization_settings',
292
-            GEN_SET_ASSETS_URL . 'your_organization_settings.js',
293
-            array('jquery', 'media-upload', 'thickbox'),
294
-            EVENT_ESPRESSO_VERSION,
295
-            true
296
-        );
297
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
298
-        wp_enqueue_script('organization_settings');
299
-        wp_enqueue_style('organization-css');
300
-        $confirm_image_delete = array(
301
-            'text' => __(
302
-                'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
303
-                'event_espresso'
304
-            ),
305
-        );
306
-        wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
307
-    }
308
-
309
-
310
-    /**
311
-     * Enqueue scripts and styles for the country settings route.
312
-     */
313
-    public function load_scripts_styles_country_settings()
314
-    {
315
-        // scripts
316
-        wp_register_script(
317
-            'gen_settings_countries',
318
-            GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
319
-            array('ee_admin_js'),
320
-            EVENT_ESPRESSO_VERSION,
321
-            true
322
-        );
323
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
324
-        wp_enqueue_script('gen_settings_countries');
325
-        wp_enqueue_style('organization-css');
326
-    }
327
-
328
-
329
-    /*************        Espresso Pages        *************/
330
-    /**
331
-     * _espresso_page_settings
332
-     *
333
-     * @throws \EE_Error
334
-     * @throws DomainException
335
-     * @throws DomainException
336
-     * @throws InvalidDataTypeException
337
-     * @throws InvalidArgumentException
338
-     */
339
-    protected function _espresso_page_settings()
340
-    {
341
-        // Check to make sure all of the main pages are setup properly,
342
-        // if not create the default pages and display an admin notice
343
-        EEH_Activation::verify_default_pages_exist();
344
-        $this->_transient_garbage_collection();
345
-        $this->_template_args['values'] = $this->_yes_no_values;
346
-        $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
347
-            ? EE_Registry::instance()->CFG->core->reg_page_id
348
-            : null;
349
-        $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
350
-            ? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
351
-            : false;
352
-        $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
353
-            ? EE_Registry::instance()->CFG->core->txn_page_id
354
-            : null;
355
-        $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
356
-            ? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
357
-            : false;
358
-        $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
359
-            ? EE_Registry::instance()->CFG->core->thank_you_page_id
360
-            : null;
361
-        $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
362
-            ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
363
-            : false;
364
-        $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
365
-            ? EE_Registry::instance()->CFG->core->cancel_page_id
366
-            : null;
367
-        $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
368
-            ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
369
-            : false;
370
-        $this->_set_add_edit_form_tags('update_espresso_page_settings');
371
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
372
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
373
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
374
-            $this->_template_args,
375
-            true
376
-        );
377
-        $this->display_admin_page_with_sidebar();
378
-    }
379
-
380
-
381
-    /**
382
-     * Handler for updating espresso page settings.
383
-     *
384
-     * @throws EE_Error
385
-     */
386
-    protected function _update_espresso_page_settings()
387
-    {
388
-        // capture incoming request data && set page IDs
389
-        EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
390
-            ? absint($this->_req_data['reg_page_id'])
391
-            : EE_Registry::instance()->CFG->core->reg_page_id;
392
-        EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
393
-            ? absint($this->_req_data['txn_page_id'])
394
-            : EE_Registry::instance()->CFG->core->txn_page_id;
395
-        EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
396
-            ? absint($this->_req_data['thank_you_page_id'])
397
-            : EE_Registry::instance()->CFG->core->thank_you_page_id;
398
-        EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
399
-            ? absint($this->_req_data['cancel_page_id'])
400
-            : EE_Registry::instance()->CFG->core->cancel_page_id;
401
-
402
-        EE_Registry::instance()->CFG->core = apply_filters(
403
-            'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
404
-            EE_Registry::instance()->CFG->core,
405
-            $this->_req_data
406
-        );
407
-        $what = __('Critical Pages & Shortcodes', 'event_espresso');
408
-        $this->_redirect_after_action(
409
-            $this->_update_espresso_configuration(
410
-                $what,
411
-                EE_Registry::instance()->CFG->core,
412
-                __FILE__,
413
-                __FUNCTION__,
414
-                __LINE__
415
-            ),
416
-            $what,
417
-            '',
418
-            array(
419
-                'action' => 'critical_pages',
420
-            ),
421
-            true
422
-        );
423
-    }
424
-
425
-
426
-    /*************        Your Organization        *************/
427
-
428
-
429
-    /**
430
-     * @throws DomainException
431
-     * @throws EE_Error
432
-     * @throws InvalidArgumentException
433
-     * @throws InvalidDataTypeException
434
-     * @throws InvalidInterfaceException
435
-     */
436
-    protected function _your_organization_settings()
437
-    {
438
-        $this->_template_args['admin_page_content'] = '';
439
-        try {
440
-            $organization_settings_form = new OrganizationSettings(
441
-                EE_Registry::instance(),
442
-                EE_Registry::instance()->CFG->organization,
443
-                EE_Registry::instance()->CFG->core,
444
-                EE_Registry::instance()->NET_CFG->core
445
-            );
446
-            $this->_template_args['admin_page_content'] = $organization_settings_form->display();
447
-        } catch (Exception $e) {
448
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
449
-        }
450
-        $this->_set_add_edit_form_tags('update_your_organization_settings');
451
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
452
-        $this->display_admin_page_with_sidebar();
453
-    }
454
-
455
-
456
-
457
-    /**
458
-     * Handler for updating organization settings.
459
-     *
460
-     * @throws EE_Error
461
-     */
462
-    protected function _update_your_organization_settings()
463
-    {
464
-        try {
465
-            $organization_settings_form = new OrganizationSettings(
466
-                EE_Registry::instance(),
467
-                EE_Registry::instance()->CFG->organization,
468
-                EE_Registry::instance()->CFG->core,
469
-                EE_Registry::instance()->NET_CFG->core
470
-            );
471
-            $success = $organization_settings_form->process($this->_req_data);
472
-            EE_Registry::instance()->CFG = apply_filters(
473
-                'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
474
-                EE_Registry::instance()->CFG
475
-            );
476
-        } catch (Exception $e) {
477
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
478
-            $success = false;
479
-        }
480
-
481
-        if ($success) {
482
-            $success = $this->_update_espresso_configuration(
483
-                esc_html__('Your Organization Settings', 'event_espresso'),
484
-                EE_Registry::instance()->CFG,
485
-                __FILE__,
486
-                __FUNCTION__,
487
-                __LINE__
488
-            );
489
-        }
490
-
491
-        $this->_redirect_after_action($success, '', '', array('action' => 'default'), true);
492
-    }
493
-
494
-
495
-
496
-    /*************        Admin Options        *************/
497
-
498
-
499
-    /**
500
-     * _admin_option_settings
501
-     *
502
-     * @throws \EE_Error
503
-     * @throws \LogicException
504
-     */
505
-    protected function _admin_option_settings()
506
-    {
507
-        $this->_template_args['admin_page_content'] = '';
508
-        try {
509
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
510
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
511
-            $this->_template_args['values'] = $this->_yes_no_values;
512
-            // also need to account for the do_action that was in the old template
513
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
514
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
515
-        } catch (Exception $e) {
516
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
517
-        }
518
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
519
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
520
-        $this->display_admin_page_with_sidebar();
521
-    }
522
-
523
-
524
-    /**
525
-     * _update_admin_option_settings
526
-     *
527
-     * @throws \EE_Error
528
-     * @throws InvalidDataTypeException
529
-     * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
530
-     * @throws \InvalidArgumentException
531
-     * @throws \LogicException
532
-     */
533
-    protected function _update_admin_option_settings()
534
-    {
535
-        try {
536
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
537
-            $admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
538
-            EE_Registry::instance()->CFG->admin = apply_filters(
539
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
540
-                EE_Registry::instance()->CFG->admin
541
-            );
542
-        } catch (Exception $e) {
543
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
544
-        }
545
-        $this->_redirect_after_action(
546
-            apply_filters(
547
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
548
-                $this->_update_espresso_configuration(
549
-                    'Admin Options',
550
-                    EE_Registry::instance()->CFG->admin,
551
-                    __FILE__,
552
-                    __FUNCTION__,
553
-                    __LINE__
554
-                )
555
-            ),
556
-            'Admin Options',
557
-            'updated',
558
-            array('action' => 'admin_option_settings')
559
-        );
560
-    }
561
-
562
-
563
-    /*************        Countries        *************/
564
-
565
-
566
-    /**
567
-     * Output Country Settings view.
568
-     *
569
-     * @throws DomainException
570
-     * @throws EE_Error
571
-     */
572
-    protected function _country_settings()
573
-    {
574
-        $CNT_ISO_for_site = isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
575
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
576
-            : 'US';
577
-        $CNT_ISO = isset($this->_req_data['country'])
578
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
579
-            : $CNT_ISO_for_site;
580
-
581
-        // load field generator helper
582
-
583
-        $this->_template_args['values'] = $this->_yes_no_values;
584
-
585
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
586
-            EE_Question::new_instance(
587
-                array(
588
-                    'QST_ID'           => 0,
589
-                    'QST_display_text' => __('Select Country', 'event_espresso'),
590
-                    'QST_system'       => 'admin-country',
591
-                )
592
-            ),
593
-            EE_Answer::new_instance(
594
-                array(
595
-                    'ANS_ID'    => 0,
596
-                    'ANS_value' => $CNT_ISO,
597
-                )
598
-            ),
599
-            array(
600
-                'input_id'       => 'country',
601
-                'input_name'     => 'country',
602
-                'input_prefix'   => '',
603
-                'append_qstn_id' => false,
604
-            )
605
-        );
606
-
607
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
608
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
609
-        $this->_template_args['country_details_settings'] = $this->display_country_settings();
610
-        $this->_template_args['country_states_settings'] = $this->display_country_states();
611
-
612
-        $this->_set_add_edit_form_tags('update_country_settings');
613
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
614
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
615
-            GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
616
-            $this->_template_args,
617
-            true
618
-        );
619
-        $this->display_admin_page_with_no_sidebar();
620
-    }
621
-
622
-
623
-    /**
624
-     *        display_country_settings
625
-     *
626
-     * @access    public
627
-     * @param    string $CNT_ISO
628
-     * @return mixed string | array
629
-     * @throws DomainException
630
-     */
631
-    public function display_country_settings($CNT_ISO = '')
632
-    {
633
-        $CNT_ISO_for_site = isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
634
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
635
-            : 'US';
636
-
637
-        $CNT_ISO = isset($this->_req_data['country'])
638
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
639
-            : $CNT_ISO;
640
-        if (! $CNT_ISO) {
641
-            return '';
642
-        }
643
-
644
-        // for ajax
645
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
646
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
647
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
648
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
649
-        /** @var EE_Country $country */
650
-        $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
651
-
652
-        $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site;
653
-        $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
654
-        $this->_template_args['CNT_name_for_site'] = EEM_Country::instance()->get_one_by_ID($CNT_ISO_for_site)->name();
655
-
656
-        $country_input_types = array(
657
-            'CNT_active'      => array(
658
-                'type'             => 'RADIO_BTN',
659
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
660
-                'class'            => '',
661
-                'options'          => $this->_yes_no_values,
662
-                'use_desc_4_label' => true,
663
-            ),
664
-            'CNT_ISO'         => array(
665
-                'type'       => 'TEXT',
666
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
667
-                'class'      => 'small-text',
668
-            ),
669
-            'CNT_ISO3'        => array(
670
-                'type'       => 'TEXT',
671
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
672
-                'class'      => 'small-text',
673
-            ),
674
-            'RGN_ID'          => array(
675
-                'type'       => 'TEXT',
676
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
677
-                'class'      => 'small-text',
678
-            ),
679
-            'CNT_name'        => array(
680
-                'type'       => 'TEXT',
681
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
682
-                'class'      => 'regular-text',
683
-            ),
684
-            'CNT_cur_code'    => array(
685
-                'type'       => 'TEXT',
686
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
687
-                'class'      => 'small-text',
688
-                'disabled'   => $CNT_cur_disabled
689
-            ),
690
-            'CNT_cur_single'  => array(
691
-                'type'       => 'TEXT',
692
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
693
-                'class'      => 'medium-text',
694
-                'disabled' => $CNT_cur_disabled
695
-            ),
696
-            'CNT_cur_plural'  => array(
697
-                'type'       => 'TEXT',
698
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
699
-                'class'      => 'medium-text',
700
-                'disabled' => $CNT_cur_disabled
701
-            ),
702
-            'CNT_cur_sign'    => array(
703
-                'type'         => 'TEXT',
704
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
705
-                'class'        => 'small-text',
706
-                'htmlentities' => false,
707
-                'disabled' => $CNT_cur_disabled
708
-            ),
709
-            'CNT_cur_sign_b4' => array(
710
-                'type'             => 'RADIO_BTN',
711
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
712
-                'class'            => '',
713
-                'options'          => $this->_yes_no_values,
714
-                'use_desc_4_label' => true,
715
-                'disabled' => $CNT_cur_disabled
716
-            ),
717
-            'CNT_cur_dec_plc' => array(
718
-                'type'       => 'RADIO_BTN',
719
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
720
-                'class'      => '',
721
-                'options'    => array(
722
-                    array('id' => 0, 'text' => ''),
723
-                    array('id' => 1, 'text' => ''),
724
-                    array('id' => 2, 'text' => ''),
725
-                    array('id' => 3, 'text' => ''),
726
-                ),
727
-                'disabled' => $CNT_cur_disabled
728
-            ),
729
-            'CNT_cur_dec_mrk' => array(
730
-                'type'             => 'RADIO_BTN',
731
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
732
-                'class'            => '',
733
-                'options'          => array(
734
-                    array(
735
-                        'id'   => ',',
736
-                        'text' => __(', (comma)', 'event_espresso'),
737
-                    ),
738
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')),
739
-                ),
740
-                'use_desc_4_label' => true,
741
-                'disabled' => $CNT_cur_disabled
742
-            ),
743
-            'CNT_cur_thsnds'  => array(
744
-                'type'             => 'RADIO_BTN',
745
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
746
-                'class'            => '',
747
-                'options'          => array(
748
-                    array(
749
-                        'id'   => ',',
750
-                        'text' => __(', (comma)', 'event_espresso'),
751
-                    ),
752
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')),
753
-                ),
754
-                'use_desc_4_label' => true,
755
-                'disabled' => $CNT_cur_disabled
756
-            ),
757
-            'CNT_tel_code'    => array(
758
-                'type'       => 'TEXT',
759
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
760
-                'class'      => 'small-text',
761
-            ),
762
-            'CNT_is_EU'       => array(
763
-                'type'             => 'RADIO_BTN',
764
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
765
-                'class'            => '',
766
-                'options'          => $this->_yes_no_values,
767
-                'use_desc_4_label' => true,
768
-            ),
769
-        );
770
-        $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
771
-            $country,
772
-            $country_input_types
773
-        );
774
-        $country_details_settings = EEH_Template::display_template(
775
-            GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
776
-            $this->_template_args,
777
-            true
778
-        );
779
-
780
-        if (defined('DOING_AJAX')) {
781
-            $notices = EE_Error::get_notices(false, false, false);
782
-            echo wp_json_encode(
783
-                array(
784
-                    'return_data' => $country_details_settings,
785
-                    'success'     => $notices['success'],
786
-                    'errors'      => $notices['errors'],
787
-                )
788
-            );
789
-            die();
790
-        } else {
791
-            return $country_details_settings;
792
-        }
793
-    }
794
-
795
-
796
-    /**
797
-     *        display_country_states
798
-     *
799
-     * @access    public
800
-     * @param    string $CNT_ISO
801
-     * @return string
802
-     * @throws DomainException
803
-     */
804
-    public function display_country_states($CNT_ISO = '')
805
-    {
806
-
807
-        $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
808
-
809
-        if (! $CNT_ISO) {
810
-            return '';
811
-        }
812
-        // for ajax
813
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
814
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
815
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
816
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
817
-        $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
818
-
819
-        if ($states) {
820
-            foreach ($states as $STA_ID => $state) {
821
-                if ($state instanceof EE_State) {
822
-                    // STA_abbrev    STA_name    STA_active
823
-                    $state_input_types = array(
824
-                        'STA_abbrev' => array(
825
-                            'type'       => 'TEXT',
826
-                            'input_name' => 'states[' . $STA_ID . ']',
827
-                            'class'      => 'mid-text',
828
-                        ),
829
-                        'STA_name'   => array(
830
-                            'type'       => 'TEXT',
831
-                            'input_name' => 'states[' . $STA_ID . ']',
832
-                            'class'      => 'regular-text',
833
-                        ),
834
-                        'STA_active' => array(
835
-                            'type'             => 'RADIO_BTN',
836
-                            'input_name'       => 'states[' . $STA_ID . ']',
837
-                            'options'          => $this->_yes_no_values,
838
-                            'use_desc_4_label' => true,
839
-                        ),
840
-                    );
841
-                    $this->_template_args['states'][ $STA_ID ]['inputs'] =
842
-                        EE_Question_Form_Input::generate_question_form_inputs_for_object(
843
-                            $state,
844
-                            $state_input_types
845
-                        );
846
-                    $query_args = array(
847
-                        'action'     => 'delete_state',
848
-                        'STA_ID'     => $STA_ID,
849
-                        'CNT_ISO'    => $CNT_ISO,
850
-                        'STA_abbrev' => $state->abbrev(),
851
-                    );
852
-                    $this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
853
-                        EE_Admin_Page::add_query_args_and_nonce(
854
-                            $query_args,
855
-                            GEN_SET_ADMIN_URL
856
-                        );
857
-                }
858
-            }
859
-        } else {
860
-            $this->_template_args['states'] = false;
861
-        }
862
-
863
-        $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
864
-            array('action' => 'add_new_state'),
865
-            GEN_SET_ADMIN_URL
866
-        );
867
-
868
-        $state_details_settings = EEH_Template::display_template(
869
-            GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
870
-            $this->_template_args,
871
-            true
872
-        );
873
-
874
-        if (defined('DOING_AJAX')) {
875
-            $notices = EE_Error::get_notices(false, false, false);
876
-            echo wp_json_encode(
877
-                array(
878
-                    'return_data' => $state_details_settings,
879
-                    'success'     => $notices['success'],
880
-                    'errors'      => $notices['errors'],
881
-                )
882
-            );
883
-            die();
884
-        } else {
885
-            return $state_details_settings;
886
-        }
887
-    }
888
-
889
-
890
-    /**
891
-     *        add_new_state
892
-     *
893
-     * @access    public
894
-     * @return void
895
-     * @throws EE_Error
896
-     */
897
-    public function add_new_state()
898
-    {
899
-
900
-        $success = true;
901
-
902
-        $CNT_ISO = isset($this->_req_data['CNT_ISO'])
903
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
904
-            : false;
905
-        if (! $CNT_ISO) {
906
-            EE_Error::add_error(
907
-                __('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
908
-                __FILE__,
909
-                __FUNCTION__,
910
-                __LINE__
911
-            );
912
-            $success = false;
913
-        }
914
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
915
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
916
-            : false;
917
-        if (! $STA_abbrev) {
918
-            EE_Error::add_error(
919
-                __('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
920
-                __FILE__,
921
-                __FUNCTION__,
922
-                __LINE__
923
-            );
924
-            $success = false;
925
-        }
926
-        $STA_name = isset($this->_req_data['STA_name'])
927
-            ? sanitize_text_field($this->_req_data['STA_name'])
928
-            : false;
929
-        if (! $STA_name) {
930
-            EE_Error::add_error(
931
-                __('No State name or an invalid State name was received.', 'event_espresso'),
932
-                __FILE__,
933
-                __FUNCTION__,
934
-                __LINE__
935
-            );
936
-            $success = false;
937
-        }
938
-
939
-        if ($success) {
940
-            $cols_n_values = array(
941
-                'CNT_ISO'    => $CNT_ISO,
942
-                'STA_abbrev' => $STA_abbrev,
943
-                'STA_name'   => $STA_name,
944
-                'STA_active' => true,
945
-            );
946
-            $success = EEM_State::instance()->insert($cols_n_values);
947
-            EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
948
-        }
949
-
950
-        if (defined('DOING_AJAX')) {
951
-            $notices = EE_Error::get_notices(false, false, false);
952
-            echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
953
-            die();
954
-        } else {
955
-            $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
956
-        }
957
-    }
958
-
959
-
960
-    /**
961
-     *        delete_state
962
-     *
963
-     * @access    public
964
-     * @return        boolean
965
-     * @throws EE_Error
966
-     * @throws EE_Error
967
-     */
968
-    public function delete_state()
969
-    {
970
-        $CNT_ISO = isset($this->_req_data['CNT_ISO'])
971
-            ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
972
-            : false;
973
-        $STA_ID = isset($this->_req_data['STA_ID'])
974
-            ? sanitize_text_field($this->_req_data['STA_ID'])
975
-            : false;
976
-        $STA_abbrev = isset($this->_req_data['STA_abbrev'])
977
-            ? sanitize_text_field($this->_req_data['STA_abbrev'])
978
-            : false;
979
-        if (! $STA_ID) {
980
-            EE_Error::add_error(
981
-                __('No State ID or an invalid State ID was received.', 'event_espresso'),
982
-                __FILE__,
983
-                __FUNCTION__,
984
-                __LINE__
985
-            );
986
-            return false;
987
-        }
988
-
989
-        $success = EEM_State::instance()->delete_by_ID($STA_ID);
990
-        if ($success !== false) {
991
-            do_action(
992
-                'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
993
-                $CNT_ISO,
994
-                $STA_ID,
995
-                array('STA_abbrev' => $STA_abbrev)
996
-            );
997
-            EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
998
-        }
999
-        if (defined('DOING_AJAX')) {
1000
-            $notices = EE_Error::get_notices(false, false);
1001
-            $notices['return_data'] = true;
1002
-            echo wp_json_encode($notices);
1003
-            die();
1004
-        } else {
1005
-            $this->_redirect_after_action(
1006
-                $success,
1007
-                'State',
1008
-                'deleted',
1009
-                array('action' => 'country_settings')
1010
-            );
1011
-        }
1012
-    }
1013
-
1014
-
1015
-    /**
1016
-     *        _update_country_settings
1017
-     *
1018
-     * @access    protected
1019
-     * @return void
1020
-     * @throws EE_Error
1021
-     */
1022
-    protected function _update_country_settings()
1023
-    {
1024
-        // grab the country ISO code
1025
-        $CNT_ISO = isset($this->_req_data['country'])
1026
-            ? strtoupper(sanitize_text_field($this->_req_data['country']))
1027
-            : false;
1028
-        if (! $CNT_ISO) {
1029
-            EE_Error::add_error(
1030
-                __('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1031
-                __FILE__,
1032
-                __FUNCTION__,
1033
-                __LINE__
1034
-            );
1035
-
1036
-            return;
1037
-        }
1038
-        $cols_n_values = array();
1039
-        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1040
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1041
-            : false;
1042
-        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1043
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1044
-            : null;
1045
-        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1046
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1047
-            : null;
1048
-        $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1049
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code']))
1050
-            : 'USD';
1051
-        $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1052
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1053
-            : 'dollar';
1054
-        $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1055
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1056
-            : 'dollars';
1057
-        $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1058
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1059
-            : '$';
1060
-        $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1061
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1062
-            : true;
1063
-        $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1064
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1065
-            : 2;
1066
-        $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1067
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1068
-            : '.';
1069
-        $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1070
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1071
-            : ',';
1072
-        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1073
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1074
-            : null;
1075
-        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1076
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1077
-            : false;
1078
-        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1079
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1080
-            : false;
1081
-        // allow filtering of country data
1082
-        $cols_n_values = apply_filters(
1083
-            'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1084
-            $cols_n_values
1085
-        );
1086
-
1087
-        // where values
1088
-        $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
1089
-        // run the update
1090
-        $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1091
-
1092
-        if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1093
-            // allow filtering of states data
1094
-            $states = apply_filters(
1095
-                'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1096
-                $this->_req_data['states']
1097
-            );
1098
-
1099
-            // loop thru state data ( looks like : states[75][STA_name] )
1100
-            foreach ($states as $STA_ID => $state) {
1101
-                $cols_n_values = array(
1102
-                    'CNT_ISO'    => $CNT_ISO,
1103
-                    'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1104
-                    'STA_name'   => sanitize_text_field($state['STA_name']),
1105
-                    'STA_active' => (bool) absint($state['STA_active']),
1106
-                );
1107
-                // where values
1108
-                $where_cols_n_values = array(array('STA_ID' => $STA_ID));
1109
-                // run the update
1110
-                $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1111
-                if ($success !== false) {
1112
-                    do_action(
1113
-                        'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1114
-                        $CNT_ISO,
1115
-                        $STA_ID,
1116
-                        $cols_n_values
1117
-                    );
1118
-                }
1119
-            }
1120
-        }
1121
-        // check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1122
-        if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1123
-            && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1124
-        ) {
1125
-            EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1126
-            EE_Registry::instance()->CFG->update_espresso_config();
1127
-        }
1128
-
1129
-        if ($success !== false) {
1130
-            EE_Error::add_success(
1131
-                esc_html__('Country Settings updated successfully.', 'event_espresso')
1132
-            );
1133
-        }
1134
-        $this->_redirect_after_action(
1135
-            $success,
1136
-            '',
1137
-            '',
1138
-            array('action' => 'country_settings', 'country' => $CNT_ISO),
1139
-            true
1140
-        );
1141
-    }
1142
-
1143
-
1144
-    /**
1145
-     *        form_form_field_label_wrap
1146
-     *
1147
-     * @access        public
1148
-     * @param        string $label
1149
-     * @return        string
1150
-     */
1151
-    public function country_form_field_label_wrap($label, $required_text)
1152
-    {
1153
-        return '
24
+	/**
25
+	 * _question_group
26
+	 * holds the specific question group object for the question group details screen
27
+	 *
28
+	 * @var object
29
+	 */
30
+	protected $_question_group;
31
+
32
+
33
+	/**
34
+	 * Initialize basic properties.
35
+	 */
36
+	protected function _init_page_props()
37
+	{
38
+		$this->page_slug = GEN_SET_PG_SLUG;
39
+		$this->page_label = GEN_SET_LABEL;
40
+		$this->_admin_base_url = GEN_SET_ADMIN_URL;
41
+		$this->_admin_base_path = GEN_SET_ADMIN;
42
+	}
43
+
44
+
45
+	/**
46
+	 * Set ajax hooks
47
+	 */
48
+	protected function _ajax_hooks()
49
+	{
50
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
+	}
55
+
56
+
57
+	/**
58
+	 * More page properties initialization.
59
+	 */
60
+	protected function _define_page_props()
61
+	{
62
+		$this->_admin_page_title = GEN_SET_LABEL;
63
+		$this->_labels = array(
64
+			'publishbox' => __('Update Settings', 'event_espresso'),
65
+		);
66
+	}
67
+
68
+
69
+	/**
70
+	 * Set page routes property.
71
+	 */
72
+	protected function _set_page_routes()
73
+	{
74
+		$this->_page_routes = array(
75
+
76
+			'critical_pages'                => array(
77
+				'func'       => '_espresso_page_settings',
78
+				'capability' => 'manage_options',
79
+			),
80
+			'update_espresso_page_settings' => array(
81
+				'func'       => '_update_espresso_page_settings',
82
+				'capability' => 'manage_options',
83
+				'noheader'   => true,
84
+			),
85
+			'default'                       => array(
86
+				'func'       => '_your_organization_settings',
87
+				'capability' => 'manage_options',
88
+			),
89
+
90
+			'update_your_organization_settings' => array(
91
+				'func'       => '_update_your_organization_settings',
92
+				'capability' => 'manage_options',
93
+				'noheader'   => true,
94
+			),
95
+
96
+			'admin_option_settings' => array(
97
+				'func'       => '_admin_option_settings',
98
+				'capability' => 'manage_options',
99
+			),
100
+
101
+			'update_admin_option_settings' => array(
102
+				'func'       => '_update_admin_option_settings',
103
+				'capability' => 'manage_options',
104
+				'noheader'   => true,
105
+			),
106
+
107
+			'country_settings' => array(
108
+				'func'       => '_country_settings',
109
+				'capability' => 'manage_options',
110
+			),
111
+
112
+			'update_country_settings' => array(
113
+				'func'       => '_update_country_settings',
114
+				'capability' => 'manage_options',
115
+				'noheader'   => true,
116
+			),
117
+
118
+			'display_country_settings' => array(
119
+				'func'       => 'display_country_settings',
120
+				'capability' => 'manage_options',
121
+				'noheader'   => true,
122
+			),
123
+
124
+			'add_new_state' => array(
125
+				'func'       => 'add_new_state',
126
+				'capability' => 'manage_options',
127
+				'noheader'   => true,
128
+			),
129
+
130
+			'delete_state' => array(
131
+				'func'       => 'delete_state',
132
+				'capability' => 'manage_options',
133
+				'noheader'   => true,
134
+			),
135
+			'privacy_settings' => array(
136
+				'func' => 'privacySettings',
137
+				'capability' => 'manage_options',
138
+			),
139
+			'update_privacy_settings' => array(
140
+				'func' => 'updatePrivacySettings',
141
+				'capability' => 'manage_options',
142
+				'noheader' => true,
143
+				'headers_sent_route' => 'privacy_settings'
144
+			)
145
+		);
146
+	}
147
+
148
+
149
+	/**
150
+	 * Set page configuration property
151
+	 */
152
+	protected function _set_page_config()
153
+	{
154
+		$this->_page_config = array(
155
+			'critical_pages'        => array(
156
+				'nav'           => array(
157
+					'label' => __('Critical Pages', 'event_espresso'),
158
+					'order' => 50,
159
+				),
160
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
161
+				'help_tabs'     => array(
162
+					'general_settings_critical_pages_help_tab' => array(
163
+						'title'    => __('Critical Pages', 'event_espresso'),
164
+						'filename' => 'general_settings_critical_pages',
165
+					),
166
+				),
167
+				'help_tour'     => array('Critical_Pages_Help_Tour'),
168
+				'require_nonce' => false,
169
+			),
170
+			'default'               => array(
171
+				'nav'           => array(
172
+					'label' => __('Your Organization', 'event_espresso'),
173
+					'order' => 20,
174
+				),
175
+				'help_tabs'     => array(
176
+					'general_settings_your_organization_help_tab' => array(
177
+						'title'    => __('Your Organization', 'event_espresso'),
178
+						'filename' => 'general_settings_your_organization',
179
+					),
180
+				),
181
+				'help_tour'     => array('Your_Organization_Help_Tour'),
182
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
183
+				'require_nonce' => false,
184
+			),
185
+			'admin_option_settings' => array(
186
+				'nav'           => array(
187
+					'label' => __('Admin Options', 'event_espresso'),
188
+					'order' => 60,
189
+				),
190
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
191
+				'help_tabs'     => array(
192
+					'general_settings_admin_options_help_tab' => array(
193
+						'title'    => __('Admin Options', 'event_espresso'),
194
+						'filename' => 'general_settings_admin_options',
195
+					),
196
+				),
197
+				'help_tour'     => array('Admin_Options_Help_Tour'),
198
+				'require_nonce' => false,
199
+			),
200
+			'country_settings'      => array(
201
+				'nav'           => array(
202
+					'label' => __('Countries', 'event_espresso'),
203
+					'order' => 70,
204
+				),
205
+				'help_tabs'     => array(
206
+					'general_settings_countries_help_tab' => array(
207
+						'title'    => __('Countries', 'event_espresso'),
208
+						'filename' => 'general_settings_countries',
209
+					),
210
+				),
211
+				'help_tour'     => array('Countries_Help_Tour'),
212
+				'require_nonce' => false,
213
+			),
214
+			'privacy_settings' => array(
215
+				'nav' => array(
216
+					'label' => esc_html__('Privacy', 'event_espresso'),
217
+					'order' => 80
218
+				),
219
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
220
+				'require_nonce' => false
221
+			)
222
+		);
223
+	}
224
+
225
+
226
+	protected function _add_screen_options()
227
+	{
228
+	}
229
+
230
+	protected function _add_feature_pointers()
231
+	{
232
+	}
233
+
234
+
235
+	/**
236
+	 * Enqueue global scripts and styles for all routes in the General Settings Admin Pages.
237
+	 */
238
+	public function load_scripts_styles()
239
+	{
240
+		// styles
241
+		wp_enqueue_style('espresso-ui-theme');
242
+		// scripts
243
+		wp_enqueue_script('ee_admin_js');
244
+	}
245
+
246
+
247
+	/**
248
+	 * Execute logic running on `admin_init`
249
+	 */
250
+	public function admin_init()
251
+	{
252
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __(
253
+			'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
254
+			'event_espresso'
255
+		);
256
+		EE_Registry::$i18n_js_strings['error_occurred'] = __(
257
+			'An error occurred! Please refresh the page and try again.',
258
+			'event_espresso'
259
+		);
260
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __(
261
+			'Are you sure you want to delete this State / Province?',
262
+			'event_espresso'
263
+		);
264
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
265
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url(
266
+			'admin-ajax.php?page=espresso_general_settings',
267
+			$protocol
268
+		);
269
+	}
270
+
271
+	public function admin_notices()
272
+	{
273
+	}
274
+
275
+	public function admin_footer_scripts()
276
+	{
277
+	}
278
+
279
+
280
+	/**
281
+	 * Enqueue scripts and styles for the default route.
282
+	 */
283
+	public function load_scripts_styles_default()
284
+	{
285
+		// styles
286
+		wp_enqueue_style('thickbox');
287
+		// scripts
288
+		wp_enqueue_script('media-upload');
289
+		wp_enqueue_script('thickbox');
290
+		wp_register_script(
291
+			'organization_settings',
292
+			GEN_SET_ASSETS_URL . 'your_organization_settings.js',
293
+			array('jquery', 'media-upload', 'thickbox'),
294
+			EVENT_ESPRESSO_VERSION,
295
+			true
296
+		);
297
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
298
+		wp_enqueue_script('organization_settings');
299
+		wp_enqueue_style('organization-css');
300
+		$confirm_image_delete = array(
301
+			'text' => __(
302
+				'Do you really want to delete this image? Please remember to save your settings to complete the removal.',
303
+				'event_espresso'
304
+			),
305
+		);
306
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
307
+	}
308
+
309
+
310
+	/**
311
+	 * Enqueue scripts and styles for the country settings route.
312
+	 */
313
+	public function load_scripts_styles_country_settings()
314
+	{
315
+		// scripts
316
+		wp_register_script(
317
+			'gen_settings_countries',
318
+			GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
319
+			array('ee_admin_js'),
320
+			EVENT_ESPRESSO_VERSION,
321
+			true
322
+		);
323
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
324
+		wp_enqueue_script('gen_settings_countries');
325
+		wp_enqueue_style('organization-css');
326
+	}
327
+
328
+
329
+	/*************        Espresso Pages        *************/
330
+	/**
331
+	 * _espresso_page_settings
332
+	 *
333
+	 * @throws \EE_Error
334
+	 * @throws DomainException
335
+	 * @throws DomainException
336
+	 * @throws InvalidDataTypeException
337
+	 * @throws InvalidArgumentException
338
+	 */
339
+	protected function _espresso_page_settings()
340
+	{
341
+		// Check to make sure all of the main pages are setup properly,
342
+		// if not create the default pages and display an admin notice
343
+		EEH_Activation::verify_default_pages_exist();
344
+		$this->_transient_garbage_collection();
345
+		$this->_template_args['values'] = $this->_yes_no_values;
346
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
347
+			? EE_Registry::instance()->CFG->core->reg_page_id
348
+			: null;
349
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id)
350
+			? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
351
+			: false;
352
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
353
+			? EE_Registry::instance()->CFG->core->txn_page_id
354
+			: null;
355
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id)
356
+			? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
357
+			: false;
358
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
359
+			? EE_Registry::instance()->CFG->core->thank_you_page_id
360
+			: null;
361
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
362
+			? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
363
+			: false;
364
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
365
+			? EE_Registry::instance()->CFG->core->cancel_page_id
366
+			: null;
367
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
368
+			? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
369
+			: false;
370
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
371
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
372
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
373
+			GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
374
+			$this->_template_args,
375
+			true
376
+		);
377
+		$this->display_admin_page_with_sidebar();
378
+	}
379
+
380
+
381
+	/**
382
+	 * Handler for updating espresso page settings.
383
+	 *
384
+	 * @throws EE_Error
385
+	 */
386
+	protected function _update_espresso_page_settings()
387
+	{
388
+		// capture incoming request data && set page IDs
389
+		EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
390
+			? absint($this->_req_data['reg_page_id'])
391
+			: EE_Registry::instance()->CFG->core->reg_page_id;
392
+		EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
393
+			? absint($this->_req_data['txn_page_id'])
394
+			: EE_Registry::instance()->CFG->core->txn_page_id;
395
+		EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
396
+			? absint($this->_req_data['thank_you_page_id'])
397
+			: EE_Registry::instance()->CFG->core->thank_you_page_id;
398
+		EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
399
+			? absint($this->_req_data['cancel_page_id'])
400
+			: EE_Registry::instance()->CFG->core->cancel_page_id;
401
+
402
+		EE_Registry::instance()->CFG->core = apply_filters(
403
+			'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
404
+			EE_Registry::instance()->CFG->core,
405
+			$this->_req_data
406
+		);
407
+		$what = __('Critical Pages & Shortcodes', 'event_espresso');
408
+		$this->_redirect_after_action(
409
+			$this->_update_espresso_configuration(
410
+				$what,
411
+				EE_Registry::instance()->CFG->core,
412
+				__FILE__,
413
+				__FUNCTION__,
414
+				__LINE__
415
+			),
416
+			$what,
417
+			'',
418
+			array(
419
+				'action' => 'critical_pages',
420
+			),
421
+			true
422
+		);
423
+	}
424
+
425
+
426
+	/*************        Your Organization        *************/
427
+
428
+
429
+	/**
430
+	 * @throws DomainException
431
+	 * @throws EE_Error
432
+	 * @throws InvalidArgumentException
433
+	 * @throws InvalidDataTypeException
434
+	 * @throws InvalidInterfaceException
435
+	 */
436
+	protected function _your_organization_settings()
437
+	{
438
+		$this->_template_args['admin_page_content'] = '';
439
+		try {
440
+			$organization_settings_form = new OrganizationSettings(
441
+				EE_Registry::instance(),
442
+				EE_Registry::instance()->CFG->organization,
443
+				EE_Registry::instance()->CFG->core,
444
+				EE_Registry::instance()->NET_CFG->core
445
+			);
446
+			$this->_template_args['admin_page_content'] = $organization_settings_form->display();
447
+		} catch (Exception $e) {
448
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
449
+		}
450
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
451
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
452
+		$this->display_admin_page_with_sidebar();
453
+	}
454
+
455
+
456
+
457
+	/**
458
+	 * Handler for updating organization settings.
459
+	 *
460
+	 * @throws EE_Error
461
+	 */
462
+	protected function _update_your_organization_settings()
463
+	{
464
+		try {
465
+			$organization_settings_form = new OrganizationSettings(
466
+				EE_Registry::instance(),
467
+				EE_Registry::instance()->CFG->organization,
468
+				EE_Registry::instance()->CFG->core,
469
+				EE_Registry::instance()->NET_CFG->core
470
+			);
471
+			$success = $organization_settings_form->process($this->_req_data);
472
+			EE_Registry::instance()->CFG = apply_filters(
473
+				'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
474
+				EE_Registry::instance()->CFG
475
+			);
476
+		} catch (Exception $e) {
477
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
478
+			$success = false;
479
+		}
480
+
481
+		if ($success) {
482
+			$success = $this->_update_espresso_configuration(
483
+				esc_html__('Your Organization Settings', 'event_espresso'),
484
+				EE_Registry::instance()->CFG,
485
+				__FILE__,
486
+				__FUNCTION__,
487
+				__LINE__
488
+			);
489
+		}
490
+
491
+		$this->_redirect_after_action($success, '', '', array('action' => 'default'), true);
492
+	}
493
+
494
+
495
+
496
+	/*************        Admin Options        *************/
497
+
498
+
499
+	/**
500
+	 * _admin_option_settings
501
+	 *
502
+	 * @throws \EE_Error
503
+	 * @throws \LogicException
504
+	 */
505
+	protected function _admin_option_settings()
506
+	{
507
+		$this->_template_args['admin_page_content'] = '';
508
+		try {
509
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
510
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
511
+			$this->_template_args['values'] = $this->_yes_no_values;
512
+			// also need to account for the do_action that was in the old template
513
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
514
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
515
+		} catch (Exception $e) {
516
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
517
+		}
518
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
519
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
520
+		$this->display_admin_page_with_sidebar();
521
+	}
522
+
523
+
524
+	/**
525
+	 * _update_admin_option_settings
526
+	 *
527
+	 * @throws \EE_Error
528
+	 * @throws InvalidDataTypeException
529
+	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
530
+	 * @throws \InvalidArgumentException
531
+	 * @throws \LogicException
532
+	 */
533
+	protected function _update_admin_option_settings()
534
+	{
535
+		try {
536
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
537
+			$admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
538
+			EE_Registry::instance()->CFG->admin = apply_filters(
539
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
540
+				EE_Registry::instance()->CFG->admin
541
+			);
542
+		} catch (Exception $e) {
543
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
544
+		}
545
+		$this->_redirect_after_action(
546
+			apply_filters(
547
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
548
+				$this->_update_espresso_configuration(
549
+					'Admin Options',
550
+					EE_Registry::instance()->CFG->admin,
551
+					__FILE__,
552
+					__FUNCTION__,
553
+					__LINE__
554
+				)
555
+			),
556
+			'Admin Options',
557
+			'updated',
558
+			array('action' => 'admin_option_settings')
559
+		);
560
+	}
561
+
562
+
563
+	/*************        Countries        *************/
564
+
565
+
566
+	/**
567
+	 * Output Country Settings view.
568
+	 *
569
+	 * @throws DomainException
570
+	 * @throws EE_Error
571
+	 */
572
+	protected function _country_settings()
573
+	{
574
+		$CNT_ISO_for_site = isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
575
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
576
+			: 'US';
577
+		$CNT_ISO = isset($this->_req_data['country'])
578
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
579
+			: $CNT_ISO_for_site;
580
+
581
+		// load field generator helper
582
+
583
+		$this->_template_args['values'] = $this->_yes_no_values;
584
+
585
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
586
+			EE_Question::new_instance(
587
+				array(
588
+					'QST_ID'           => 0,
589
+					'QST_display_text' => __('Select Country', 'event_espresso'),
590
+					'QST_system'       => 'admin-country',
591
+				)
592
+			),
593
+			EE_Answer::new_instance(
594
+				array(
595
+					'ANS_ID'    => 0,
596
+					'ANS_value' => $CNT_ISO,
597
+				)
598
+			),
599
+			array(
600
+				'input_id'       => 'country',
601
+				'input_name'     => 'country',
602
+				'input_prefix'   => '',
603
+				'append_qstn_id' => false,
604
+			)
605
+		);
606
+
607
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
608
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
609
+		$this->_template_args['country_details_settings'] = $this->display_country_settings();
610
+		$this->_template_args['country_states_settings'] = $this->display_country_states();
611
+
612
+		$this->_set_add_edit_form_tags('update_country_settings');
613
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
614
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
615
+			GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
616
+			$this->_template_args,
617
+			true
618
+		);
619
+		$this->display_admin_page_with_no_sidebar();
620
+	}
621
+
622
+
623
+	/**
624
+	 *        display_country_settings
625
+	 *
626
+	 * @access    public
627
+	 * @param    string $CNT_ISO
628
+	 * @return mixed string | array
629
+	 * @throws DomainException
630
+	 */
631
+	public function display_country_settings($CNT_ISO = '')
632
+	{
633
+		$CNT_ISO_for_site = isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
634
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
635
+			: 'US';
636
+
637
+		$CNT_ISO = isset($this->_req_data['country'])
638
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
639
+			: $CNT_ISO;
640
+		if (! $CNT_ISO) {
641
+			return '';
642
+		}
643
+
644
+		// for ajax
645
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
646
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
647
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
648
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
649
+		/** @var EE_Country $country */
650
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
651
+
652
+		$CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site;
653
+		$this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled;
654
+		$this->_template_args['CNT_name_for_site'] = EEM_Country::instance()->get_one_by_ID($CNT_ISO_for_site)->name();
655
+
656
+		$country_input_types = array(
657
+			'CNT_active'      => array(
658
+				'type'             => 'RADIO_BTN',
659
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
660
+				'class'            => '',
661
+				'options'          => $this->_yes_no_values,
662
+				'use_desc_4_label' => true,
663
+			),
664
+			'CNT_ISO'         => array(
665
+				'type'       => 'TEXT',
666
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
667
+				'class'      => 'small-text',
668
+			),
669
+			'CNT_ISO3'        => array(
670
+				'type'       => 'TEXT',
671
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
672
+				'class'      => 'small-text',
673
+			),
674
+			'RGN_ID'          => array(
675
+				'type'       => 'TEXT',
676
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
677
+				'class'      => 'small-text',
678
+			),
679
+			'CNT_name'        => array(
680
+				'type'       => 'TEXT',
681
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
682
+				'class'      => 'regular-text',
683
+			),
684
+			'CNT_cur_code'    => array(
685
+				'type'       => 'TEXT',
686
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
687
+				'class'      => 'small-text',
688
+				'disabled'   => $CNT_cur_disabled
689
+			),
690
+			'CNT_cur_single'  => array(
691
+				'type'       => 'TEXT',
692
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
693
+				'class'      => 'medium-text',
694
+				'disabled' => $CNT_cur_disabled
695
+			),
696
+			'CNT_cur_plural'  => array(
697
+				'type'       => 'TEXT',
698
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
699
+				'class'      => 'medium-text',
700
+				'disabled' => $CNT_cur_disabled
701
+			),
702
+			'CNT_cur_sign'    => array(
703
+				'type'         => 'TEXT',
704
+				'input_name'   => 'cntry[' . $CNT_ISO . ']',
705
+				'class'        => 'small-text',
706
+				'htmlentities' => false,
707
+				'disabled' => $CNT_cur_disabled
708
+			),
709
+			'CNT_cur_sign_b4' => array(
710
+				'type'             => 'RADIO_BTN',
711
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
712
+				'class'            => '',
713
+				'options'          => $this->_yes_no_values,
714
+				'use_desc_4_label' => true,
715
+				'disabled' => $CNT_cur_disabled
716
+			),
717
+			'CNT_cur_dec_plc' => array(
718
+				'type'       => 'RADIO_BTN',
719
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
720
+				'class'      => '',
721
+				'options'    => array(
722
+					array('id' => 0, 'text' => ''),
723
+					array('id' => 1, 'text' => ''),
724
+					array('id' => 2, 'text' => ''),
725
+					array('id' => 3, 'text' => ''),
726
+				),
727
+				'disabled' => $CNT_cur_disabled
728
+			),
729
+			'CNT_cur_dec_mrk' => array(
730
+				'type'             => 'RADIO_BTN',
731
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
732
+				'class'            => '',
733
+				'options'          => array(
734
+					array(
735
+						'id'   => ',',
736
+						'text' => __(', (comma)', 'event_espresso'),
737
+					),
738
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')),
739
+				),
740
+				'use_desc_4_label' => true,
741
+				'disabled' => $CNT_cur_disabled
742
+			),
743
+			'CNT_cur_thsnds'  => array(
744
+				'type'             => 'RADIO_BTN',
745
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
746
+				'class'            => '',
747
+				'options'          => array(
748
+					array(
749
+						'id'   => ',',
750
+						'text' => __(', (comma)', 'event_espresso'),
751
+					),
752
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')),
753
+				),
754
+				'use_desc_4_label' => true,
755
+				'disabled' => $CNT_cur_disabled
756
+			),
757
+			'CNT_tel_code'    => array(
758
+				'type'       => 'TEXT',
759
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
760
+				'class'      => 'small-text',
761
+			),
762
+			'CNT_is_EU'       => array(
763
+				'type'             => 'RADIO_BTN',
764
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
765
+				'class'            => '',
766
+				'options'          => $this->_yes_no_values,
767
+				'use_desc_4_label' => true,
768
+			),
769
+		);
770
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object(
771
+			$country,
772
+			$country_input_types
773
+		);
774
+		$country_details_settings = EEH_Template::display_template(
775
+			GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
776
+			$this->_template_args,
777
+			true
778
+		);
779
+
780
+		if (defined('DOING_AJAX')) {
781
+			$notices = EE_Error::get_notices(false, false, false);
782
+			echo wp_json_encode(
783
+				array(
784
+					'return_data' => $country_details_settings,
785
+					'success'     => $notices['success'],
786
+					'errors'      => $notices['errors'],
787
+				)
788
+			);
789
+			die();
790
+		} else {
791
+			return $country_details_settings;
792
+		}
793
+	}
794
+
795
+
796
+	/**
797
+	 *        display_country_states
798
+	 *
799
+	 * @access    public
800
+	 * @param    string $CNT_ISO
801
+	 * @return string
802
+	 * @throws DomainException
803
+	 */
804
+	public function display_country_states($CNT_ISO = '')
805
+	{
806
+
807
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
808
+
809
+		if (! $CNT_ISO) {
810
+			return '';
811
+		}
812
+		// for ajax
813
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
814
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
815
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
816
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
817
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
818
+
819
+		if ($states) {
820
+			foreach ($states as $STA_ID => $state) {
821
+				if ($state instanceof EE_State) {
822
+					// STA_abbrev    STA_name    STA_active
823
+					$state_input_types = array(
824
+						'STA_abbrev' => array(
825
+							'type'       => 'TEXT',
826
+							'input_name' => 'states[' . $STA_ID . ']',
827
+							'class'      => 'mid-text',
828
+						),
829
+						'STA_name'   => array(
830
+							'type'       => 'TEXT',
831
+							'input_name' => 'states[' . $STA_ID . ']',
832
+							'class'      => 'regular-text',
833
+						),
834
+						'STA_active' => array(
835
+							'type'             => 'RADIO_BTN',
836
+							'input_name'       => 'states[' . $STA_ID . ']',
837
+							'options'          => $this->_yes_no_values,
838
+							'use_desc_4_label' => true,
839
+						),
840
+					);
841
+					$this->_template_args['states'][ $STA_ID ]['inputs'] =
842
+						EE_Question_Form_Input::generate_question_form_inputs_for_object(
843
+							$state,
844
+							$state_input_types
845
+						);
846
+					$query_args = array(
847
+						'action'     => 'delete_state',
848
+						'STA_ID'     => $STA_ID,
849
+						'CNT_ISO'    => $CNT_ISO,
850
+						'STA_abbrev' => $state->abbrev(),
851
+					);
852
+					$this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
853
+						EE_Admin_Page::add_query_args_and_nonce(
854
+							$query_args,
855
+							GEN_SET_ADMIN_URL
856
+						);
857
+				}
858
+			}
859
+		} else {
860
+			$this->_template_args['states'] = false;
861
+		}
862
+
863
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(
864
+			array('action' => 'add_new_state'),
865
+			GEN_SET_ADMIN_URL
866
+		);
867
+
868
+		$state_details_settings = EEH_Template::display_template(
869
+			GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
870
+			$this->_template_args,
871
+			true
872
+		);
873
+
874
+		if (defined('DOING_AJAX')) {
875
+			$notices = EE_Error::get_notices(false, false, false);
876
+			echo wp_json_encode(
877
+				array(
878
+					'return_data' => $state_details_settings,
879
+					'success'     => $notices['success'],
880
+					'errors'      => $notices['errors'],
881
+				)
882
+			);
883
+			die();
884
+		} else {
885
+			return $state_details_settings;
886
+		}
887
+	}
888
+
889
+
890
+	/**
891
+	 *        add_new_state
892
+	 *
893
+	 * @access    public
894
+	 * @return void
895
+	 * @throws EE_Error
896
+	 */
897
+	public function add_new_state()
898
+	{
899
+
900
+		$success = true;
901
+
902
+		$CNT_ISO = isset($this->_req_data['CNT_ISO'])
903
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
904
+			: false;
905
+		if (! $CNT_ISO) {
906
+			EE_Error::add_error(
907
+				__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
908
+				__FILE__,
909
+				__FUNCTION__,
910
+				__LINE__
911
+			);
912
+			$success = false;
913
+		}
914
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
915
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
916
+			: false;
917
+		if (! $STA_abbrev) {
918
+			EE_Error::add_error(
919
+				__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
920
+				__FILE__,
921
+				__FUNCTION__,
922
+				__LINE__
923
+			);
924
+			$success = false;
925
+		}
926
+		$STA_name = isset($this->_req_data['STA_name'])
927
+			? sanitize_text_field($this->_req_data['STA_name'])
928
+			: false;
929
+		if (! $STA_name) {
930
+			EE_Error::add_error(
931
+				__('No State name or an invalid State name was received.', 'event_espresso'),
932
+				__FILE__,
933
+				__FUNCTION__,
934
+				__LINE__
935
+			);
936
+			$success = false;
937
+		}
938
+
939
+		if ($success) {
940
+			$cols_n_values = array(
941
+				'CNT_ISO'    => $CNT_ISO,
942
+				'STA_abbrev' => $STA_abbrev,
943
+				'STA_name'   => $STA_name,
944
+				'STA_active' => true,
945
+			);
946
+			$success = EEM_State::instance()->insert($cols_n_values);
947
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
948
+		}
949
+
950
+		if (defined('DOING_AJAX')) {
951
+			$notices = EE_Error::get_notices(false, false, false);
952
+			echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
953
+			die();
954
+		} else {
955
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
956
+		}
957
+	}
958
+
959
+
960
+	/**
961
+	 *        delete_state
962
+	 *
963
+	 * @access    public
964
+	 * @return        boolean
965
+	 * @throws EE_Error
966
+	 * @throws EE_Error
967
+	 */
968
+	public function delete_state()
969
+	{
970
+		$CNT_ISO = isset($this->_req_data['CNT_ISO'])
971
+			? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
972
+			: false;
973
+		$STA_ID = isset($this->_req_data['STA_ID'])
974
+			? sanitize_text_field($this->_req_data['STA_ID'])
975
+			: false;
976
+		$STA_abbrev = isset($this->_req_data['STA_abbrev'])
977
+			? sanitize_text_field($this->_req_data['STA_abbrev'])
978
+			: false;
979
+		if (! $STA_ID) {
980
+			EE_Error::add_error(
981
+				__('No State ID or an invalid State ID was received.', 'event_espresso'),
982
+				__FILE__,
983
+				__FUNCTION__,
984
+				__LINE__
985
+			);
986
+			return false;
987
+		}
988
+
989
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
990
+		if ($success !== false) {
991
+			do_action(
992
+				'AHEE__General_Settings_Admin_Page__delete_state__state_deleted',
993
+				$CNT_ISO,
994
+				$STA_ID,
995
+				array('STA_abbrev' => $STA_abbrev)
996
+			);
997
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
998
+		}
999
+		if (defined('DOING_AJAX')) {
1000
+			$notices = EE_Error::get_notices(false, false);
1001
+			$notices['return_data'] = true;
1002
+			echo wp_json_encode($notices);
1003
+			die();
1004
+		} else {
1005
+			$this->_redirect_after_action(
1006
+				$success,
1007
+				'State',
1008
+				'deleted',
1009
+				array('action' => 'country_settings')
1010
+			);
1011
+		}
1012
+	}
1013
+
1014
+
1015
+	/**
1016
+	 *        _update_country_settings
1017
+	 *
1018
+	 * @access    protected
1019
+	 * @return void
1020
+	 * @throws EE_Error
1021
+	 */
1022
+	protected function _update_country_settings()
1023
+	{
1024
+		// grab the country ISO code
1025
+		$CNT_ISO = isset($this->_req_data['country'])
1026
+			? strtoupper(sanitize_text_field($this->_req_data['country']))
1027
+			: false;
1028
+		if (! $CNT_ISO) {
1029
+			EE_Error::add_error(
1030
+				__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1031
+				__FILE__,
1032
+				__FUNCTION__,
1033
+				__LINE__
1034
+			);
1035
+
1036
+			return;
1037
+		}
1038
+		$cols_n_values = array();
1039
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1040
+			? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1041
+			: false;
1042
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1043
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1044
+			: null;
1045
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1046
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1047
+			: null;
1048
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1049
+			? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code']))
1050
+			: 'USD';
1051
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1052
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1053
+			: 'dollar';
1054
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1055
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1056
+			: 'dollars';
1057
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1058
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1059
+			: '$';
1060
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1061
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1062
+			: true;
1063
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1064
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1065
+			: 2;
1066
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1067
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1068
+			: '.';
1069
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1070
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1071
+			: ',';
1072
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1073
+			? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1074
+			: null;
1075
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1076
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1077
+			: false;
1078
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1079
+			? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1080
+			: false;
1081
+		// allow filtering of country data
1082
+		$cols_n_values = apply_filters(
1083
+			'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
1084
+			$cols_n_values
1085
+		);
1086
+
1087
+		// where values
1088
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
1089
+		// run the update
1090
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
1091
+
1092
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
1093
+			// allow filtering of states data
1094
+			$states = apply_filters(
1095
+				'FHEE__General_Settings_Admin_Page___update_country_settings__states',
1096
+				$this->_req_data['states']
1097
+			);
1098
+
1099
+			// loop thru state data ( looks like : states[75][STA_name] )
1100
+			foreach ($states as $STA_ID => $state) {
1101
+				$cols_n_values = array(
1102
+					'CNT_ISO'    => $CNT_ISO,
1103
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
1104
+					'STA_name'   => sanitize_text_field($state['STA_name']),
1105
+					'STA_active' => (bool) absint($state['STA_active']),
1106
+				);
1107
+				// where values
1108
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
1109
+				// run the update
1110
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
1111
+				if ($success !== false) {
1112
+					do_action(
1113
+						'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved',
1114
+						$CNT_ISO,
1115
+						$STA_ID,
1116
+						$cols_n_values
1117
+					);
1118
+				}
1119
+			}
1120
+		}
1121
+		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
1122
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO)
1123
+			&& $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO
1124
+		) {
1125
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
1126
+			EE_Registry::instance()->CFG->update_espresso_config();
1127
+		}
1128
+
1129
+		if ($success !== false) {
1130
+			EE_Error::add_success(
1131
+				esc_html__('Country Settings updated successfully.', 'event_espresso')
1132
+			);
1133
+		}
1134
+		$this->_redirect_after_action(
1135
+			$success,
1136
+			'',
1137
+			'',
1138
+			array('action' => 'country_settings', 'country' => $CNT_ISO),
1139
+			true
1140
+		);
1141
+	}
1142
+
1143
+
1144
+	/**
1145
+	 *        form_form_field_label_wrap
1146
+	 *
1147
+	 * @access        public
1148
+	 * @param        string $label
1149
+	 * @return        string
1150
+	 */
1151
+	public function country_form_field_label_wrap($label, $required_text)
1152
+	{
1153
+		return '
1154 1154
 			<tr>
1155 1155
 				<th>
1156 1156
 					' . $label . '
1157 1157
 				</th>';
1158
-    }
1159
-
1160
-
1161
-    /**
1162
-     *        form_form_field_input__wrap
1163
-     *
1164
-     * @access        public
1165
-     * @param        string $label
1166
-     * @return        string
1167
-     */
1168
-    public function country_form_field_input__wrap($input, $label)
1169
-    {
1170
-        return '
1158
+	}
1159
+
1160
+
1161
+	/**
1162
+	 *        form_form_field_input__wrap
1163
+	 *
1164
+	 * @access        public
1165
+	 * @param        string $label
1166
+	 * @return        string
1167
+	 */
1168
+	public function country_form_field_input__wrap($input, $label)
1169
+	{
1170
+		return '
1171 1171
 				<td class="general-settings-country-input-td">
1172 1172
 					' . $input . '
1173 1173
 				</td>
1174 1174
 			</tr>';
1175
-    }
1176
-
1177
-
1178
-    /**
1179
-     *        form_form_field_label_wrap
1180
-     *
1181
-     * @access        public
1182
-     * @param        string $label
1183
-     * @param        string $required_text
1184
-     * @return        string
1185
-     */
1186
-    public function state_form_field_label_wrap($label, $required_text)
1187
-    {
1188
-        return $required_text;
1189
-    }
1190
-
1191
-
1192
-    /**
1193
-     *        form_form_field_input__wrap
1194
-     *
1195
-     * @access        public
1196
-     * @param        string $label
1197
-     * @return        string
1198
-     */
1199
-    public function state_form_field_input__wrap($input, $label)
1200
-    {
1201
-        return '
1175
+	}
1176
+
1177
+
1178
+	/**
1179
+	 *        form_form_field_label_wrap
1180
+	 *
1181
+	 * @access        public
1182
+	 * @param        string $label
1183
+	 * @param        string $required_text
1184
+	 * @return        string
1185
+	 */
1186
+	public function state_form_field_label_wrap($label, $required_text)
1187
+	{
1188
+		return $required_text;
1189
+	}
1190
+
1191
+
1192
+	/**
1193
+	 *        form_form_field_input__wrap
1194
+	 *
1195
+	 * @access        public
1196
+	 * @param        string $label
1197
+	 * @return        string
1198
+	 */
1199
+	public function state_form_field_input__wrap($input, $label)
1200
+	{
1201
+		return '
1202 1202
 				<td class="general-settings-country-state-input-td">
1203 1203
 					' . $input . '
1204 1204
 				</td>';
1205
-    }
1206
-
1207
-
1208
-    /***********/
1209
-
1210
-
1211
-    /**
1212
-     * displays edit and view links for critical EE pages
1213
-     *
1214
-     * @access public
1215
-     * @param int $ee_page_id
1216
-     * @return string
1217
-     */
1218
-    public static function edit_view_links($ee_page_id)
1219
-    {
1220
-        $links = '<a href="'
1221
-                 . add_query_arg(
1222
-                     array('post' => $ee_page_id, 'action' => 'edit'),
1223
-                     admin_url('post.php')
1224
-                 )
1225
-                 . '" >'
1226
-                 . __('Edit', 'event_espresso')
1227
-                 . '</a>';
1228
-        $links .= ' &nbsp;|&nbsp; ';
1229
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1230
-
1231
-        return $links;
1232
-    }
1233
-
1234
-
1235
-    /**
1236
-     * displays page and shortcode status for critical EE pages
1237
-     *
1238
-     * @param WP page object $ee_page
1239
-     * @return string
1240
-     */
1241
-    public static function page_and_shortcode_status($ee_page, $shortcode)
1242
-    {
1243
-
1244
-        // page status
1245
-        if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1246
-            $pg_colour = 'green';
1247
-            $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1248
-        } else {
1249
-            $pg_colour = 'red';
1250
-            $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1251
-        }
1252
-
1253
-        // shortcode status
1254
-        if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1255
-            $sc_colour = 'green';
1256
-            $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1257
-        } else {
1258
-            $sc_colour = 'red';
1259
-            $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1260
-        }
1261
-
1262
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1263
-               . $pg_status
1264
-               . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1265
-    }
1266
-
1267
-
1268
-    /**
1269
-     * generates a dropdown of all parent pages - copied from WP core
1270
-     *
1271
-     * @param int $default
1272
-     * @param int $parent
1273
-     * @param int $level
1274
-     */
1275
-    public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1276
-    {
1277
-        global $wpdb;
1278
-        $items = $wpdb->get_results(
1279
-            $wpdb->prepare(
1280
-                "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1281
-                $parent
1282
-            )
1283
-        );
1284
-
1285
-        if ($items) {
1286
-            foreach ($items as $item) {
1287
-                $pad = str_repeat('&nbsp;', $level * 3);
1288
-                if ($item->ID == $default) {
1289
-                    $current = ' selected="selected"';
1290
-                } else {
1291
-                    $current = '';
1292
-                }
1293
-
1294
-                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad "
1295
-                     . esc_html($item->post_title)
1296
-                     . "</option>";
1297
-                parent_dropdown($default, $item->ID, $level + 1);
1298
-            }
1299
-        }
1300
-    }
1301
-
1302
-
1303
-    /**
1304
-     * Loads the scripts for the privacy settings form
1305
-     */
1306
-    public function load_scripts_styles_privacy_settings()
1307
-    {
1308
-        $form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1309
-        $form_handler->enqueueStylesAndScripts();
1310
-    }
1311
-
1312
-
1313
-    /**
1314
-     * display the privacy settings form
1315
-     */
1316
-    public function privacySettings()
1317
-    {
1318
-        $this->_set_add_edit_form_tags('update_privacy_settings');
1319
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
1320
-        $form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1321
-        $this->_template_args['admin_page_content'] = $form_handler->display();
1322
-        $this->display_admin_page_with_sidebar();
1323
-    }
1324
-
1325
-
1326
-    /**
1327
-     * Update the privacy settings from form data
1328
-     *
1329
-     * @throws EE_Error
1330
-     */
1331
-    public function updatePrivacySettings()
1332
-    {
1333
-        $form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1334
-        $success = $form_handler->process($this->get_request_data());
1335
-        $this->_redirect_after_action(
1336
-            $success,
1337
-            esc_html__('Registration Form Options', 'event_espresso'),
1338
-            'updated',
1339
-            array('action' => 'privacy_settings')
1340
-        );
1341
-    }
1205
+	}
1206
+
1207
+
1208
+	/***********/
1209
+
1210
+
1211
+	/**
1212
+	 * displays edit and view links for critical EE pages
1213
+	 *
1214
+	 * @access public
1215
+	 * @param int $ee_page_id
1216
+	 * @return string
1217
+	 */
1218
+	public static function edit_view_links($ee_page_id)
1219
+	{
1220
+		$links = '<a href="'
1221
+				 . add_query_arg(
1222
+					 array('post' => $ee_page_id, 'action' => 'edit'),
1223
+					 admin_url('post.php')
1224
+				 )
1225
+				 . '" >'
1226
+				 . __('Edit', 'event_espresso')
1227
+				 . '</a>';
1228
+		$links .= ' &nbsp;|&nbsp; ';
1229
+		$links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1230
+
1231
+		return $links;
1232
+	}
1233
+
1234
+
1235
+	/**
1236
+	 * displays page and shortcode status for critical EE pages
1237
+	 *
1238
+	 * @param WP page object $ee_page
1239
+	 * @return string
1240
+	 */
1241
+	public static function page_and_shortcode_status($ee_page, $shortcode)
1242
+	{
1243
+
1244
+		// page status
1245
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1246
+			$pg_colour = 'green';
1247
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1248
+		} else {
1249
+			$pg_colour = 'red';
1250
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1251
+		}
1252
+
1253
+		// shortcode status
1254
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1255
+			$sc_colour = 'green';
1256
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1257
+		} else {
1258
+			$sc_colour = 'red';
1259
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1260
+		}
1261
+
1262
+		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1263
+			   . $pg_status
1264
+			   . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1265
+	}
1266
+
1267
+
1268
+	/**
1269
+	 * generates a dropdown of all parent pages - copied from WP core
1270
+	 *
1271
+	 * @param int $default
1272
+	 * @param int $parent
1273
+	 * @param int $level
1274
+	 */
1275
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1276
+	{
1277
+		global $wpdb;
1278
+		$items = $wpdb->get_results(
1279
+			$wpdb->prepare(
1280
+				"SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1281
+				$parent
1282
+			)
1283
+		);
1284
+
1285
+		if ($items) {
1286
+			foreach ($items as $item) {
1287
+				$pad = str_repeat('&nbsp;', $level * 3);
1288
+				if ($item->ID == $default) {
1289
+					$current = ' selected="selected"';
1290
+				} else {
1291
+					$current = '';
1292
+				}
1293
+
1294
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad "
1295
+					 . esc_html($item->post_title)
1296
+					 . "</option>";
1297
+				parent_dropdown($default, $item->ID, $level + 1);
1298
+			}
1299
+		}
1300
+	}
1301
+
1302
+
1303
+	/**
1304
+	 * Loads the scripts for the privacy settings form
1305
+	 */
1306
+	public function load_scripts_styles_privacy_settings()
1307
+	{
1308
+		$form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1309
+		$form_handler->enqueueStylesAndScripts();
1310
+	}
1311
+
1312
+
1313
+	/**
1314
+	 * display the privacy settings form
1315
+	 */
1316
+	public function privacySettings()
1317
+	{
1318
+		$this->_set_add_edit_form_tags('update_privacy_settings');
1319
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
1320
+		$form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1321
+		$this->_template_args['admin_page_content'] = $form_handler->display();
1322
+		$this->display_admin_page_with_sidebar();
1323
+	}
1324
+
1325
+
1326
+	/**
1327
+	 * Update the privacy settings from form data
1328
+	 *
1329
+	 * @throws EE_Error
1330
+	 */
1331
+	public function updatePrivacySettings()
1332
+	{
1333
+		$form_handler = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler');
1334
+		$success = $form_handler->process($this->get_request_data());
1335
+		$this->_redirect_after_action(
1336
+			$success,
1337
+			esc_html__('Registration Form Options', 'event_espresso'),
1338
+			'updated',
1339
+			array('action' => 'privacy_settings')
1340
+		);
1341
+	}
1342 1342
 }
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
         wp_enqueue_script('thickbox');
290 290
         wp_register_script(
291 291
             'organization_settings',
292
-            GEN_SET_ASSETS_URL . 'your_organization_settings.js',
292
+            GEN_SET_ASSETS_URL.'your_organization_settings.js',
293 293
             array('jquery', 'media-upload', 'thickbox'),
294 294
             EVENT_ESPRESSO_VERSION,
295 295
             true
296 296
         );
297
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
297
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
298 298
         wp_enqueue_script('organization_settings');
299 299
         wp_enqueue_style('organization-css');
300 300
         $confirm_image_delete = array(
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
         // scripts
316 316
         wp_register_script(
317 317
             'gen_settings_countries',
318
-            GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
318
+            GEN_SET_ASSETS_URL.'gen_settings_countries.js',
319 319
             array('ee_admin_js'),
320 320
             EVENT_ESPRESSO_VERSION,
321 321
             true
322 322
         );
323
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
323
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
324 324
         wp_enqueue_script('gen_settings_countries');
325 325
         wp_enqueue_style('organization-css');
326 326
     }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         $this->_set_add_edit_form_tags('update_espresso_page_settings');
371 371
         $this->_set_publish_post_box_vars(null, false, false, null, false);
372 372
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
373
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
373
+            GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php',
374 374
             $this->_template_args,
375 375
             true
376 376
         );
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     {
535 535
         try {
536 536
             $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
537
-            $admin_options_settings_form->process($this->_req_data[ $admin_options_settings_form->slug() ]);
537
+            $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
538 538
             EE_Registry::instance()->CFG->admin = apply_filters(
539 539
                 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
540 540
                 EE_Registry::instance()->CFG->admin
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         $this->_set_add_edit_form_tags('update_country_settings');
613 613
         $this->_set_publish_post_box_vars(null, false, false, null, false);
614 614
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
615
-            GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
615
+            GEN_SET_TEMPLATE_PATH.'countries_settings.template.php',
616 616
             $this->_template_args,
617 617
             true
618 618
         );
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
         $CNT_ISO = isset($this->_req_data['country'])
638 638
             ? strtoupper(sanitize_text_field($this->_req_data['country']))
639 639
             : $CNT_ISO;
640
-        if (! $CNT_ISO) {
640
+        if ( ! $CNT_ISO) {
641 641
             return '';
642 642
         }
643 643
 
@@ -656,59 +656,59 @@  discard block
 block discarded – undo
656 656
         $country_input_types = array(
657 657
             'CNT_active'      => array(
658 658
                 'type'             => 'RADIO_BTN',
659
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
659
+                'input_name'       => 'cntry['.$CNT_ISO.']',
660 660
                 'class'            => '',
661 661
                 'options'          => $this->_yes_no_values,
662 662
                 'use_desc_4_label' => true,
663 663
             ),
664 664
             'CNT_ISO'         => array(
665 665
                 'type'       => 'TEXT',
666
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
666
+                'input_name' => 'cntry['.$CNT_ISO.']',
667 667
                 'class'      => 'small-text',
668 668
             ),
669 669
             'CNT_ISO3'        => array(
670 670
                 'type'       => 'TEXT',
671
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
671
+                'input_name' => 'cntry['.$CNT_ISO.']',
672 672
                 'class'      => 'small-text',
673 673
             ),
674 674
             'RGN_ID'          => array(
675 675
                 'type'       => 'TEXT',
676
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
676
+                'input_name' => 'cntry['.$CNT_ISO.']',
677 677
                 'class'      => 'small-text',
678 678
             ),
679 679
             'CNT_name'        => array(
680 680
                 'type'       => 'TEXT',
681
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
681
+                'input_name' => 'cntry['.$CNT_ISO.']',
682 682
                 'class'      => 'regular-text',
683 683
             ),
684 684
             'CNT_cur_code'    => array(
685 685
                 'type'       => 'TEXT',
686
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
686
+                'input_name' => 'cntry['.$CNT_ISO.']',
687 687
                 'class'      => 'small-text',
688 688
                 'disabled'   => $CNT_cur_disabled
689 689
             ),
690 690
             'CNT_cur_single'  => array(
691 691
                 'type'       => 'TEXT',
692
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
692
+                'input_name' => 'cntry['.$CNT_ISO.']',
693 693
                 'class'      => 'medium-text',
694 694
                 'disabled' => $CNT_cur_disabled
695 695
             ),
696 696
             'CNT_cur_plural'  => array(
697 697
                 'type'       => 'TEXT',
698
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
698
+                'input_name' => 'cntry['.$CNT_ISO.']',
699 699
                 'class'      => 'medium-text',
700 700
                 'disabled' => $CNT_cur_disabled
701 701
             ),
702 702
             'CNT_cur_sign'    => array(
703 703
                 'type'         => 'TEXT',
704
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
704
+                'input_name'   => 'cntry['.$CNT_ISO.']',
705 705
                 'class'        => 'small-text',
706 706
                 'htmlentities' => false,
707 707
                 'disabled' => $CNT_cur_disabled
708 708
             ),
709 709
             'CNT_cur_sign_b4' => array(
710 710
                 'type'             => 'RADIO_BTN',
711
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
711
+                'input_name'       => 'cntry['.$CNT_ISO.']',
712 712
                 'class'            => '',
713 713
                 'options'          => $this->_yes_no_values,
714 714
                 'use_desc_4_label' => true,
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
             ),
717 717
             'CNT_cur_dec_plc' => array(
718 718
                 'type'       => 'RADIO_BTN',
719
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
719
+                'input_name' => 'cntry['.$CNT_ISO.']',
720 720
                 'class'      => '',
721 721
                 'options'    => array(
722 722
                     array('id' => 0, 'text' => ''),
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
             ),
729 729
             'CNT_cur_dec_mrk' => array(
730 730
                 'type'             => 'RADIO_BTN',
731
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
731
+                'input_name'       => 'cntry['.$CNT_ISO.']',
732 732
                 'class'            => '',
733 733
                 'options'          => array(
734 734
                     array(
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
             ),
743 743
             'CNT_cur_thsnds'  => array(
744 744
                 'type'             => 'RADIO_BTN',
745
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
745
+                'input_name'       => 'cntry['.$CNT_ISO.']',
746 746
                 'class'            => '',
747 747
                 'options'          => array(
748 748
                     array(
@@ -756,12 +756,12 @@  discard block
 block discarded – undo
756 756
             ),
757 757
             'CNT_tel_code'    => array(
758 758
                 'type'       => 'TEXT',
759
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
759
+                'input_name' => 'cntry['.$CNT_ISO.']',
760 760
                 'class'      => 'small-text',
761 761
             ),
762 762
             'CNT_is_EU'       => array(
763 763
                 'type'             => 'RADIO_BTN',
764
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
764
+                'input_name'       => 'cntry['.$CNT_ISO.']',
765 765
                 'class'            => '',
766 766
                 'options'          => $this->_yes_no_values,
767 767
                 'use_desc_4_label' => true,
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $country_input_types
773 773
         );
774 774
         $country_details_settings = EEH_Template::display_template(
775
-            GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
775
+            GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php',
776 776
             $this->_template_args,
777 777
             true
778 778
         );
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 
807 807
         $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
808 808
 
809
-        if (! $CNT_ISO) {
809
+        if ( ! $CNT_ISO) {
810 810
             return '';
811 811
         }
812 812
         // for ajax
@@ -823,22 +823,22 @@  discard block
 block discarded – undo
823 823
                     $state_input_types = array(
824 824
                         'STA_abbrev' => array(
825 825
                             'type'       => 'TEXT',
826
-                            'input_name' => 'states[' . $STA_ID . ']',
826
+                            'input_name' => 'states['.$STA_ID.']',
827 827
                             'class'      => 'mid-text',
828 828
                         ),
829 829
                         'STA_name'   => array(
830 830
                             'type'       => 'TEXT',
831
-                            'input_name' => 'states[' . $STA_ID . ']',
831
+                            'input_name' => 'states['.$STA_ID.']',
832 832
                             'class'      => 'regular-text',
833 833
                         ),
834 834
                         'STA_active' => array(
835 835
                             'type'             => 'RADIO_BTN',
836
-                            'input_name'       => 'states[' . $STA_ID . ']',
836
+                            'input_name'       => 'states['.$STA_ID.']',
837 837
                             'options'          => $this->_yes_no_values,
838 838
                             'use_desc_4_label' => true,
839 839
                         ),
840 840
                     );
841
-                    $this->_template_args['states'][ $STA_ID ]['inputs'] =
841
+                    $this->_template_args['states'][$STA_ID]['inputs'] =
842 842
                         EE_Question_Form_Input::generate_question_form_inputs_for_object(
843 843
                             $state,
844 844
                             $state_input_types
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
                         'CNT_ISO'    => $CNT_ISO,
850 850
                         'STA_abbrev' => $state->abbrev(),
851 851
                     );
852
-                    $this->_template_args['states'][ $STA_ID ]['delete_state_url'] =
852
+                    $this->_template_args['states'][$STA_ID]['delete_state_url'] =
853 853
                         EE_Admin_Page::add_query_args_and_nonce(
854 854
                             $query_args,
855 855
                             GEN_SET_ADMIN_URL
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
         );
867 867
 
868 868
         $state_details_settings = EEH_Template::display_template(
869
-            GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
869
+            GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php',
870 870
             $this->_template_args,
871 871
             true
872 872
         );
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
         $CNT_ISO = isset($this->_req_data['CNT_ISO'])
903 903
             ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO']))
904 904
             : false;
905
-        if (! $CNT_ISO) {
905
+        if ( ! $CNT_ISO) {
906 906
             EE_Error::add_error(
907 907
                 __('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
908 908
                 __FILE__,
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
         $STA_abbrev = isset($this->_req_data['STA_abbrev'])
915 915
             ? sanitize_text_field($this->_req_data['STA_abbrev'])
916 916
             : false;
917
-        if (! $STA_abbrev) {
917
+        if ( ! $STA_abbrev) {
918 918
             EE_Error::add_error(
919 919
                 __('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
920 920
                 __FILE__,
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
         $STA_name = isset($this->_req_data['STA_name'])
927 927
             ? sanitize_text_field($this->_req_data['STA_name'])
928 928
             : false;
929
-        if (! $STA_name) {
929
+        if ( ! $STA_name) {
930 930
             EE_Error::add_error(
931 931
                 __('No State name or an invalid State name was received.', 'event_espresso'),
932 932
                 __FILE__,
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         $STA_abbrev = isset($this->_req_data['STA_abbrev'])
977 977
             ? sanitize_text_field($this->_req_data['STA_abbrev'])
978 978
             : false;
979
-        if (! $STA_ID) {
979
+        if ( ! $STA_ID) {
980 980
             EE_Error::add_error(
981 981
                 __('No State ID or an invalid State ID was received.', 'event_espresso'),
982 982
                 __FILE__,
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
         $CNT_ISO = isset($this->_req_data['country'])
1026 1026
             ? strtoupper(sanitize_text_field($this->_req_data['country']))
1027 1027
             : false;
1028
-        if (! $CNT_ISO) {
1028
+        if ( ! $CNT_ISO) {
1029 1029
             EE_Error::add_error(
1030 1030
                 __('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'),
1031 1031
                 __FILE__,
@@ -1036,47 +1036,47 @@  discard block
 block discarded – undo
1036 1036
             return;
1037 1037
         }
1038 1038
         $cols_n_values = array();
1039
-        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3'])
1040
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_ISO3']))
1039
+        $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])
1040
+            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']))
1041 1041
             : false;
1042
-        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1043
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['RGN_ID'])
1042
+        $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID'])
1043
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID'])
1044 1044
             : null;
1045
-        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1046
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_name'])
1045
+        $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name'])
1046
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name'])
1047 1047
             : null;
1048
-        $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code'])
1049
-            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_code']))
1048
+        $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])
1049
+            ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']))
1050 1050
             : 'USD';
1051
-        $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1052
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_single'])
1051
+        $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'])
1052
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'])
1053 1053
             : 'dollar';
1054
-        $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1055
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_plural'])
1054
+        $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'])
1055
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'])
1056 1056
             : 'dollars';
1057
-        $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1058
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign'])
1057
+        $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'])
1058
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'])
1059 1059
             : '$';
1060
-        $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1061
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_sign_b4'])
1060
+        $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'])
1061
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'])
1062 1062
             : true;
1063
-        $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1064
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_plc'])
1063
+        $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'])
1064
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'])
1065 1065
             : 2;
1066
-        $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1067
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_dec_mrk'])
1066
+        $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'])
1067
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'])
1068 1068
             : '.';
1069
-        $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1070
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_cur_thsnds'])
1069
+        $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'])
1070
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'])
1071 1071
             : ',';
1072
-        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1073
-            ? sanitize_text_field($this->_req_data['cntry'][ $CNT_ISO ]['CNT_tel_code'])
1072
+        $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'])
1073
+            ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'])
1074 1074
             : null;
1075
-        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1076
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_is_EU'])
1075
+        $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'])
1076
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'])
1077 1077
             : false;
1078
-        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1079
-            ? absint($this->_req_data['cntry'][ $CNT_ISO ]['CNT_active'])
1078
+        $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active'])
1079
+            ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active'])
1080 1080
             : false;
1081 1081
         // allow filtering of country data
1082 1082
         $cols_n_values = apply_filters(
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
         return '
1154 1154
 			<tr>
1155 1155
 				<th>
1156
-					' . $label . '
1156
+					' . $label.'
1157 1157
 				</th>';
1158 1158
     }
1159 1159
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
     {
1170 1170
         return '
1171 1171
 				<td class="general-settings-country-input-td">
1172
-					' . $input . '
1172
+					' . $input.'
1173 1173
 				</td>
1174 1174
 			</tr>';
1175 1175
     }
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
     {
1201 1201
         return '
1202 1202
 				<td class="general-settings-country-state-input-td">
1203
-					' . $input . '
1203
+					' . $input.'
1204 1204
 				</td>';
1205 1205
     }
1206 1206
 
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
                  . __('Edit', 'event_espresso')
1227 1227
                  . '</a>';
1228 1228
         $links .= ' &nbsp;|&nbsp; ';
1229
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1229
+        $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
1230 1230
 
1231 1231
         return $links;
1232 1232
     }
@@ -1259,9 +1259,9 @@  discard block
 block discarded – undo
1259 1259
             $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1260 1260
         }
1261 1261
 
1262
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>'
1262
+        return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'
1263 1263
                . $pg_status
1264
-               . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1264
+               . '</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
1265 1265
     }
1266 1266
 
1267 1267
 
Please login to merge, or discard this patch.