Completed
Branch FET/your-org-country-input (2d1c9e)
by
unknown
09:36 queued 15s
created
admin_pages/general_settings/OrganizationSettings.php 2 patches
Indentation   +577 added lines, -577 removed lines patch added patch discarded remove patch
@@ -43,605 +43,605 @@
 block discarded – undo
43 43
 class OrganizationSettings extends FormHandler
44 44
 {
45 45
 
46
-    /**
47
-     * @var EE_Organization_Config
48
-     */
49
-    protected $organization_config;
46
+	/**
47
+	 * @var EE_Organization_Config
48
+	 */
49
+	protected $organization_config;
50 50
 
51
-    /**
52
-     * @var EE_Core_Config
53
-     */
54
-    protected $core_config;
51
+	/**
52
+	 * @var EE_Core_Config
53
+	 */
54
+	protected $core_config;
55 55
 
56 56
 
57
-    /**
58
-     * @var EE_Network_Core_Config
59
-     */
60
-    protected $network_core_config;
57
+	/**
58
+	 * @var EE_Network_Core_Config
59
+	 */
60
+	protected $network_core_config;
61 61
 
62
-    /**
63
-     * Form constructor.
64
-     *
65
-     * @param EE_Registry             $registry
66
-     * @param EE_Organization_Config  $organization_config
67
-     * @param EE_Core_Config          $core_config
68
-     * @param EE_Network_Core_Config $network_core_config
69
-     * @throws InvalidArgumentException
70
-     * @throws InvalidDataTypeException
71
-     * @throws DomainException
72
-     */
73
-    public function __construct(
74
-        EE_Registry $registry,
75
-        EE_Organization_Config $organization_config,
76
-        EE_Core_Config $core_config,
77
-        EE_Network_Core_Config $network_core_config
78
-    ) {
79
-        $this->organization_config = $organization_config;
80
-        $this->core_config = $core_config;
81
-        $this->network_core_config = $network_core_config;
82
-        parent::__construct(
83
-            esc_html__('Your Organization Settings', 'event_espresso'),
84
-            esc_html__('Your Organization Settings', 'event_espresso'),
85
-            'organization_settings',
86
-            '',
87
-            FormHandler::DO_NOT_SETUP_FORM,
88
-            $registry
89
-        );
90
-    }
62
+	/**
63
+	 * Form constructor.
64
+	 *
65
+	 * @param EE_Registry             $registry
66
+	 * @param EE_Organization_Config  $organization_config
67
+	 * @param EE_Core_Config          $core_config
68
+	 * @param EE_Network_Core_Config $network_core_config
69
+	 * @throws InvalidArgumentException
70
+	 * @throws InvalidDataTypeException
71
+	 * @throws DomainException
72
+	 */
73
+	public function __construct(
74
+		EE_Registry $registry,
75
+		EE_Organization_Config $organization_config,
76
+		EE_Core_Config $core_config,
77
+		EE_Network_Core_Config $network_core_config
78
+	) {
79
+		$this->organization_config = $organization_config;
80
+		$this->core_config = $core_config;
81
+		$this->network_core_config = $network_core_config;
82
+		parent::__construct(
83
+			esc_html__('Your Organization Settings', 'event_espresso'),
84
+			esc_html__('Your Organization Settings', 'event_espresso'),
85
+			'organization_settings',
86
+			'',
87
+			FormHandler::DO_NOT_SETUP_FORM,
88
+			$registry
89
+		);
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * creates and returns the actual form
95
-     *
96
-     * @return EE_Form_Section_Proper
97
-     * @throws EE_Error
98
-     * @throws InvalidArgumentException
99
-     * @throws InvalidDataTypeException
100
-     * @throws InvalidInterfaceException
101
-     * @throws ReflectionException
102
-     */
103
-    public function generate()
104
-    {
105
-        $has_sub_regions = EEM_State::instance()->count(
106
-            array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
107
-        );
108
-        $form = new EE_Form_Section_Proper(
109
-            array(
110
-                'name'            => 'organization_settings',
111
-                'html_id'         => 'organization_settings',
112
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
113
-                'subsections'     => array(
114
-                    'contact_information_hdr'        => new EE_Form_Section_HTML(
115
-                        EEH_HTML::h2(
116
-                            esc_html__('Contact Information', 'event_espresso')
117
-                            . ' '
118
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
119
-                            '',
120
-                            'contact-information-hdr'
121
-                        )
122
-                    ),
123
-                    'organization_name'      => new EE_Text_Input(
124
-                        array(
125
-                            'html_name' => 'organization_name',
126
-                            'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
127
-                            'html_help_text'  => esc_html__(
128
-                                'Displayed on all emails and invoices.',
129
-                                'event_espresso'
130
-                            ),
131
-                            'default'         => $this->organization_config->get_pretty('name'),
132
-                            'required'        => false,
133
-                        )
134
-                    ),
135
-                    'organization_address_1'      => new EE_Text_Input(
136
-                        array(
137
-                            'html_name' => 'organization_address_1',
138
-                            'html_label_text' => esc_html__('Street Address', 'event_espresso'),
139
-                            'default'         => $this->organization_config->get_pretty('address_1'),
140
-                            'required'        => false,
141
-                        )
142
-                    ),
143
-                    'organization_address_2'      => new EE_Text_Input(
144
-                        array(
145
-                            'html_name' => 'organization_address_2',
146
-                            'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
147
-                            'default'         => $this->organization_config->get_pretty('address_2'),
148
-                            'required'        => false,
149
-                        )
150
-                    ),
151
-                    'organization_city'      => new EE_Text_Input(
152
-                        array(
153
-                            'html_name' => 'organization_city',
154
-                            'html_label_text' => esc_html__('City', 'event_espresso'),
155
-                            'default'         => $this->organization_config->get_pretty('city'),
156
-                            'required'        => false,
157
-                        )
158
-                    ),
159
-                    'organization_country'      => new EE_Country_Select_Input(
160
-                        null,
161
-                        array(
162
-                            EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
163
-                            'html_name'       => 'organization_country',
164
-                            'html_label_text' => esc_html__('Country', 'event_espresso'),
165
-                            'default'         => $this->organization_config->CNT_ISO,
166
-                            'required'        => false,
167
-                            'html_help_text'  => sprintf(
168
-                                esc_html__(
169
-                                    '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
170
-                                    'event_espresso'
171
-                                ),
172
-                                '<span class="reminder-spn">',
173
-                                '</span>'
174
-                            ),
175
-                        )
176
-                    ),
177
-                    'organization_state' => new EE_State_Select_Input(
178
-                        null,
179
-                        array(
180
-                            'html_name'       => 'organization_state',
181
-                            'html_label_text' => esc_html__('State/Province', 'event_espresso'),
182
-                            'default'         => $this->organization_config->STA_ID,
183
-                            'required'        => false,
184
-                            'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
185
-                                ? sprintf(
186
-                                    esc_html__(
187
-                                        'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
188
-                                        'event_espresso'
189
-                                    ),
190
-                                    '<span class="reminder-spn">',
191
-                                    '</span>',
192
-                                    '<br />'
193
-                                )
194
-                                : '',
195
-                        )
196
-                    ),
197
-                    'organization_zip'      => new EE_Text_Input(
198
-                        array(
199
-                            'html_name' => 'organization_zip',
200
-                            'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
201
-                            'default'         => $this->organization_config->get_pretty('zip'),
202
-                            'required'        => false,
203
-                        )
204
-                    ),
205
-                    'organization_email'      => new EE_Text_Input(
206
-                        array(
207
-                            'html_name' => 'organization_email',
208
-                            'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
209
-                            'html_help_text'  => sprintf(
210
-                                esc_html__(
211
-                                    'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
212
-                                    'event_espresso'
213
-                                ),
214
-                                '<code>[CO_FORMATTED_EMAIL]</code>',
215
-                                '<code>[CO_EMAIL]</code>'
216
-                            ),
217
-                            'default'         => $this->organization_config->get_pretty('email'),
218
-                            'required'        => false,
219
-                        )
220
-                    ),
221
-                    'organization_phone'      => new EE_Text_Input(
222
-                        array(
223
-                            'html_name' => 'organization_phone',
224
-                            'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
225
-                            'html_help_text'  => esc_html__(
226
-                                'The phone number for your organization.',
227
-                                'event_espresso'
228
-                            ),
229
-                            'default'         => $this->organization_config->get_pretty('phone'),
230
-                            'required'        => false,
231
-                        )
232
-                    ),
233
-                    'organization_vat'      => new EE_Text_Input(
234
-                        array(
235
-                            'html_name' => 'organization_vat',
236
-                            'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
237
-                            'html_help_text'  => esc_html__(
238
-                                'The VAT/Tax Number may be displayed on invoices and receipts.',
239
-                                'event_espresso'
240
-                            ),
241
-                            'default'         => $this->organization_config->get_pretty('vat'),
242
-                            'required'        => false,
243
-                        )
244
-                    ),
245
-                    'company_logo_hdr'        => new EE_Form_Section_HTML(
246
-                        EEH_HTML::h2(
247
-                            esc_html__('Company Logo', 'event_espresso')
248
-                            . ' '
249
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
250
-                            '',
251
-                            'company-logo-hdr'
252
-                        )
253
-                    ),
254
-                    'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
255
-                        array(
256
-                            'html_name' => 'organization_logo_url',
257
-                            'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
258
-                            'html_help_text'  => esc_html__(
259
-                                'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
260
-                                'event_espresso'
261
-                            ),
262
-                            'default'         => $this->organization_config->get_pretty('logo_url'),
263
-                            'required'        => false,
264
-                        )
265
-                    ),
266
-                    'social_links_hdr'        => new EE_Form_Section_HTML(
267
-                        EEH_HTML::h2(
268
-                            esc_html__('Social Links', 'event_espresso')
269
-                            . ' '
270
-                            . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
271
-                            . EEH_HTML::br()
272
-                            . EEH_HTML::p(
273
-                                esc_html__(
274
-                                    'Enter any links to social accounts for your organization here',
275
-                                    'event_espresso'
276
-                                ),
277
-                                '',
278
-                                'description'
279
-                            ),
280
-                            '',
281
-                            'social-links-hdr'
282
-                        )
283
-                    ),
284
-                    'organization_facebook'      => new EE_Text_Input(
285
-                        array(
286
-                            'html_name' => 'organization_facebook',
287
-                            'html_label_text' => esc_html__('Facebook', 'event_espresso'),
288
-                            'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
289
-                            'default'         => $this->organization_config->get_pretty('facebook'),
290
-                            'required'        => false,
291
-                        )
292
-                    ),
293
-                    'organization_twitter'      => new EE_Text_Input(
294
-                        array(
295
-                            'html_name' => 'organization_twitter',
296
-                            'html_label_text' => esc_html__('Twitter', 'event_espresso'),
297
-                            'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
298
-                            'default'         => $this->organization_config->get_pretty('twitter'),
299
-                            'required'        => false,
300
-                        )
301
-                    ),
302
-                    'organization_linkedin'      => new EE_Text_Input(
303
-                        array(
304
-                            'html_name' => 'organization_linkedin',
305
-                            'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
306
-                            'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
307
-                            'default'         => $this->organization_config->get_pretty('linkedin'),
308
-                            'required'        => false,
309
-                        )
310
-                    ),
311
-                    'organization_pinterest'      => new EE_Text_Input(
312
-                        array(
313
-                            'html_name' => 'organization_pinterest',
314
-                            'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
315
-                            'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
316
-                            'default'         => $this->organization_config->get_pretty('pinterest'),
317
-                            'required'        => false,
318
-                        )
319
-                    ),
320
-                    'organization_google'      => new EE_Text_Input(
321
-                        array(
322
-                            'html_name' => 'organization_google',
323
-                            'html_label_text' => esc_html__('Google+', 'event_espresso'),
324
-                            'other_html_attributes' => ' placeholder="google.com/+profilename"',
325
-                            'default'         => $this->organization_config->get_pretty('google'),
326
-                            'required'        => false,
327
-                        )
328
-                    ),
329
-                    'organization_instagram'      => new EE_Text_Input(
330
-                        array(
331
-                            'html_name' => 'organization_instagram',
332
-                            'html_label_text' => esc_html__('Instagram', 'event_espresso'),
333
-                            'other_html_attributes' => ' placeholder="instagram.com/handle"',
334
-                            'default'         => $this->organization_config->get_pretty('instagram'),
335
-                            'required'        => false,
336
-                        )
337
-                    ),
338
-                ),
339
-            )
340
-        );
341
-        if (is_main_site()) {
342
-            $form->add_subsections(
343
-                array(
344
-                    'site_license_key_hdr' => new EE_Form_Section_HTML(
345
-                        EEH_HTML::h2(
346
-                            esc_html__('Your Event Espresso License Key', 'event_espresso')
347
-                            . ' '
348
-                            . EEH_HTML::span(
349
-                                EEH_Template::get_help_tab_link('site_license_key_info'),
350
-                                'help_tour_activation'
351
-                            ),
352
-                            '',
353
-                            'site-license-key-hdr'
354
-                        )
355
-                    ),
356
-                    'site_license_key' => $this->getSiteLicenseKeyField()
357
-                )
358
-            );
359
-            $form->add_subsections(
360
-                array(
361
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(
362
-                        $this->uxipOptinText()
363
-                    ),
364
-                    'ueip_optin' => new EE_Checkbox_Multi_Input(
365
-                        array(
366
-                            true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
367
-                        ),
368
-                        array(
369
-                            'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
370
-                            'html_label_text' => esc_html__(
371
-                                'UXIP Opt In?',
372
-                                'event_espresso'
373
-                            ),
374
-                            'default'         => isset($this->core_config->ee_ueip_optin)
375
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
376
-                                : false,
377
-                            'required'        => false,
378
-                        )
379
-                    ),
380
-                ),
381
-                'organization_instagram',
382
-                false
383
-            );
384
-        }
385
-        return $form;
386
-    }
93
+	/**
94
+	 * creates and returns the actual form
95
+	 *
96
+	 * @return EE_Form_Section_Proper
97
+	 * @throws EE_Error
98
+	 * @throws InvalidArgumentException
99
+	 * @throws InvalidDataTypeException
100
+	 * @throws InvalidInterfaceException
101
+	 * @throws ReflectionException
102
+	 */
103
+	public function generate()
104
+	{
105
+		$has_sub_regions = EEM_State::instance()->count(
106
+			array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
107
+		);
108
+		$form = new EE_Form_Section_Proper(
109
+			array(
110
+				'name'            => 'organization_settings',
111
+				'html_id'         => 'organization_settings',
112
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
113
+				'subsections'     => array(
114
+					'contact_information_hdr'        => new EE_Form_Section_HTML(
115
+						EEH_HTML::h2(
116
+							esc_html__('Contact Information', 'event_espresso')
117
+							. ' '
118
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
119
+							'',
120
+							'contact-information-hdr'
121
+						)
122
+					),
123
+					'organization_name'      => new EE_Text_Input(
124
+						array(
125
+							'html_name' => 'organization_name',
126
+							'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
127
+							'html_help_text'  => esc_html__(
128
+								'Displayed on all emails and invoices.',
129
+								'event_espresso'
130
+							),
131
+							'default'         => $this->organization_config->get_pretty('name'),
132
+							'required'        => false,
133
+						)
134
+					),
135
+					'organization_address_1'      => new EE_Text_Input(
136
+						array(
137
+							'html_name' => 'organization_address_1',
138
+							'html_label_text' => esc_html__('Street Address', 'event_espresso'),
139
+							'default'         => $this->organization_config->get_pretty('address_1'),
140
+							'required'        => false,
141
+						)
142
+					),
143
+					'organization_address_2'      => new EE_Text_Input(
144
+						array(
145
+							'html_name' => 'organization_address_2',
146
+							'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
147
+							'default'         => $this->organization_config->get_pretty('address_2'),
148
+							'required'        => false,
149
+						)
150
+					),
151
+					'organization_city'      => new EE_Text_Input(
152
+						array(
153
+							'html_name' => 'organization_city',
154
+							'html_label_text' => esc_html__('City', 'event_espresso'),
155
+							'default'         => $this->organization_config->get_pretty('city'),
156
+							'required'        => false,
157
+						)
158
+					),
159
+					'organization_country'      => new EE_Country_Select_Input(
160
+						null,
161
+						array(
162
+							EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
163
+							'html_name'       => 'organization_country',
164
+							'html_label_text' => esc_html__('Country', 'event_espresso'),
165
+							'default'         => $this->organization_config->CNT_ISO,
166
+							'required'        => false,
167
+							'html_help_text'  => sprintf(
168
+								esc_html__(
169
+									'%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
170
+									'event_espresso'
171
+								),
172
+								'<span class="reminder-spn">',
173
+								'</span>'
174
+							),
175
+						)
176
+					),
177
+					'organization_state' => new EE_State_Select_Input(
178
+						null,
179
+						array(
180
+							'html_name'       => 'organization_state',
181
+							'html_label_text' => esc_html__('State/Province', 'event_espresso'),
182
+							'default'         => $this->organization_config->STA_ID,
183
+							'required'        => false,
184
+							'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
185
+								? sprintf(
186
+									esc_html__(
187
+										'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
188
+										'event_espresso'
189
+									),
190
+									'<span class="reminder-spn">',
191
+									'</span>',
192
+									'<br />'
193
+								)
194
+								: '',
195
+						)
196
+					),
197
+					'organization_zip'      => new EE_Text_Input(
198
+						array(
199
+							'html_name' => 'organization_zip',
200
+							'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
201
+							'default'         => $this->organization_config->get_pretty('zip'),
202
+							'required'        => false,
203
+						)
204
+					),
205
+					'organization_email'      => new EE_Text_Input(
206
+						array(
207
+							'html_name' => 'organization_email',
208
+							'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
209
+							'html_help_text'  => sprintf(
210
+								esc_html__(
211
+									'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
212
+									'event_espresso'
213
+								),
214
+								'<code>[CO_FORMATTED_EMAIL]</code>',
215
+								'<code>[CO_EMAIL]</code>'
216
+							),
217
+							'default'         => $this->organization_config->get_pretty('email'),
218
+							'required'        => false,
219
+						)
220
+					),
221
+					'organization_phone'      => new EE_Text_Input(
222
+						array(
223
+							'html_name' => 'organization_phone',
224
+							'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
225
+							'html_help_text'  => esc_html__(
226
+								'The phone number for your organization.',
227
+								'event_espresso'
228
+							),
229
+							'default'         => $this->organization_config->get_pretty('phone'),
230
+							'required'        => false,
231
+						)
232
+					),
233
+					'organization_vat'      => new EE_Text_Input(
234
+						array(
235
+							'html_name' => 'organization_vat',
236
+							'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
237
+							'html_help_text'  => esc_html__(
238
+								'The VAT/Tax Number may be displayed on invoices and receipts.',
239
+								'event_espresso'
240
+							),
241
+							'default'         => $this->organization_config->get_pretty('vat'),
242
+							'required'        => false,
243
+						)
244
+					),
245
+					'company_logo_hdr'        => new EE_Form_Section_HTML(
246
+						EEH_HTML::h2(
247
+							esc_html__('Company Logo', 'event_espresso')
248
+							. ' '
249
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
250
+							'',
251
+							'company-logo-hdr'
252
+						)
253
+					),
254
+					'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
255
+						array(
256
+							'html_name' => 'organization_logo_url',
257
+							'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
258
+							'html_help_text'  => esc_html__(
259
+								'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
260
+								'event_espresso'
261
+							),
262
+							'default'         => $this->organization_config->get_pretty('logo_url'),
263
+							'required'        => false,
264
+						)
265
+					),
266
+					'social_links_hdr'        => new EE_Form_Section_HTML(
267
+						EEH_HTML::h2(
268
+							esc_html__('Social Links', 'event_espresso')
269
+							. ' '
270
+							. EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
271
+							. EEH_HTML::br()
272
+							. EEH_HTML::p(
273
+								esc_html__(
274
+									'Enter any links to social accounts for your organization here',
275
+									'event_espresso'
276
+								),
277
+								'',
278
+								'description'
279
+							),
280
+							'',
281
+							'social-links-hdr'
282
+						)
283
+					),
284
+					'organization_facebook'      => new EE_Text_Input(
285
+						array(
286
+							'html_name' => 'organization_facebook',
287
+							'html_label_text' => esc_html__('Facebook', 'event_espresso'),
288
+							'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
289
+							'default'         => $this->organization_config->get_pretty('facebook'),
290
+							'required'        => false,
291
+						)
292
+					),
293
+					'organization_twitter'      => new EE_Text_Input(
294
+						array(
295
+							'html_name' => 'organization_twitter',
296
+							'html_label_text' => esc_html__('Twitter', 'event_espresso'),
297
+							'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
298
+							'default'         => $this->organization_config->get_pretty('twitter'),
299
+							'required'        => false,
300
+						)
301
+					),
302
+					'organization_linkedin'      => new EE_Text_Input(
303
+						array(
304
+							'html_name' => 'organization_linkedin',
305
+							'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
306
+							'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
307
+							'default'         => $this->organization_config->get_pretty('linkedin'),
308
+							'required'        => false,
309
+						)
310
+					),
311
+					'organization_pinterest'      => new EE_Text_Input(
312
+						array(
313
+							'html_name' => 'organization_pinterest',
314
+							'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
315
+							'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
316
+							'default'         => $this->organization_config->get_pretty('pinterest'),
317
+							'required'        => false,
318
+						)
319
+					),
320
+					'organization_google'      => new EE_Text_Input(
321
+						array(
322
+							'html_name' => 'organization_google',
323
+							'html_label_text' => esc_html__('Google+', 'event_espresso'),
324
+							'other_html_attributes' => ' placeholder="google.com/+profilename"',
325
+							'default'         => $this->organization_config->get_pretty('google'),
326
+							'required'        => false,
327
+						)
328
+					),
329
+					'organization_instagram'      => new EE_Text_Input(
330
+						array(
331
+							'html_name' => 'organization_instagram',
332
+							'html_label_text' => esc_html__('Instagram', 'event_espresso'),
333
+							'other_html_attributes' => ' placeholder="instagram.com/handle"',
334
+							'default'         => $this->organization_config->get_pretty('instagram'),
335
+							'required'        => false,
336
+						)
337
+					),
338
+				),
339
+			)
340
+		);
341
+		if (is_main_site()) {
342
+			$form->add_subsections(
343
+				array(
344
+					'site_license_key_hdr' => new EE_Form_Section_HTML(
345
+						EEH_HTML::h2(
346
+							esc_html__('Your Event Espresso License Key', 'event_espresso')
347
+							. ' '
348
+							. EEH_HTML::span(
349
+								EEH_Template::get_help_tab_link('site_license_key_info'),
350
+								'help_tour_activation'
351
+							),
352
+							'',
353
+							'site-license-key-hdr'
354
+						)
355
+					),
356
+					'site_license_key' => $this->getSiteLicenseKeyField()
357
+				)
358
+			);
359
+			$form->add_subsections(
360
+				array(
361
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(
362
+						$this->uxipOptinText()
363
+					),
364
+					'ueip_optin' => new EE_Checkbox_Multi_Input(
365
+						array(
366
+							true => __('Yes! I want to help improve Event Espresso!', 'event_espresso')
367
+						),
368
+						array(
369
+							'html_name' => EE_Core_Config::OPTION_NAME_UXIP,
370
+							'html_label_text' => esc_html__(
371
+								'UXIP Opt In?',
372
+								'event_espresso'
373
+							),
374
+							'default'         => isset($this->core_config->ee_ueip_optin)
375
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
376
+								: false,
377
+							'required'        => false,
378
+						)
379
+					),
380
+				),
381
+				'organization_instagram',
382
+				false
383
+			);
384
+		}
385
+		return $form;
386
+	}
387 387
 
388 388
 
389
-    /**
390
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
391
-     * returns a string of HTML that can be directly echoed in a template
392
-     *
393
-     * @return string
394
-     * @throws EE_Error
395
-     * @throws InvalidArgumentException
396
-     * @throws InvalidDataTypeException
397
-     * @throws InvalidInterfaceException
398
-     * @throws LogicException
399
-     */
400
-    public function display()
401
-    {
402
-        $this->form()->enqueue_js();
403
-        return parent::display();
404
-    }
389
+	/**
390
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
391
+	 * returns a string of HTML that can be directly echoed in a template
392
+	 *
393
+	 * @return string
394
+	 * @throws EE_Error
395
+	 * @throws InvalidArgumentException
396
+	 * @throws InvalidDataTypeException
397
+	 * @throws InvalidInterfaceException
398
+	 * @throws LogicException
399
+	 */
400
+	public function display()
401
+	{
402
+		$this->form()->enqueue_js();
403
+		return parent::display();
404
+	}
405 405
 
406 406
 
407
-    /**
408
-     * handles processing the form submission
409
-     * returns true or false depending on whether the form was processed successfully or not
410
-     *
411
-     * @param array $form_data
412
-     * @return bool
413
-     * @throws InvalidFormSubmissionException
414
-     * @throws EE_Error
415
-     * @throws LogicException
416
-     * @throws InvalidArgumentException
417
-     * @throws InvalidDataTypeException
418
-     * @throws ReflectionException
419
-     */
420
-    public function process($form_data = array())
421
-    {
422
-        // process form
423
-        $valid_data = (array) parent::process($form_data);
424
-        if (empty($valid_data)) {
425
-            return false;
426
-        }
407
+	/**
408
+	 * handles processing the form submission
409
+	 * returns true or false depending on whether the form was processed successfully or not
410
+	 *
411
+	 * @param array $form_data
412
+	 * @return bool
413
+	 * @throws InvalidFormSubmissionException
414
+	 * @throws EE_Error
415
+	 * @throws LogicException
416
+	 * @throws InvalidArgumentException
417
+	 * @throws InvalidDataTypeException
418
+	 * @throws ReflectionException
419
+	 */
420
+	public function process($form_data = array())
421
+	{
422
+		// process form
423
+		$valid_data = (array) parent::process($form_data);
424
+		if (empty($valid_data)) {
425
+			return false;
426
+		}
427 427
 
428
-        if (is_main_site()) {
429
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
430
-                ? sanitize_text_field($form_data['ee_site_license_key'])
431
-                : $this->network_core_config->site_license_key;
432
-        }
433
-        $this->organization_config->name = isset($form_data['organization_name'])
434
-            ? sanitize_text_field($form_data['organization_name'])
435
-            : $this->organization_config->name;
436
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
437
-            ? sanitize_text_field($form_data['organization_address_1'])
438
-            : $this->organization_config->address_1;
439
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
440
-            ? sanitize_text_field($form_data['organization_address_2'])
441
-            : $this->organization_config->address_2;
442
-        $this->organization_config->city = isset($form_data['organization_city'])
443
-            ? sanitize_text_field($form_data['organization_city'])
444
-            : $this->organization_config->city;
445
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
446
-            ? absint($form_data['organization_state'])
447
-            : $this->organization_config->STA_ID;
448
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
449
-            ? sanitize_text_field($form_data['organization_country'])
450
-            : $this->organization_config->CNT_ISO;
451
-        $this->organization_config->zip = isset($form_data['organization_zip'])
452
-            ? sanitize_text_field($form_data['organization_zip'])
453
-            : $this->organization_config->zip;
454
-        $this->organization_config->email = isset($form_data['organization_email'])
455
-            ? sanitize_email($form_data['organization_email'])
456
-            : $this->organization_config->email;
457
-        $this->organization_config->vat = isset($form_data['organization_vat'])
458
-            ? sanitize_text_field($form_data['organization_vat'])
459
-            : $this->organization_config->vat;
460
-        $this->organization_config->phone = isset($form_data['organization_phone'])
461
-            ? sanitize_text_field($form_data['organization_phone'])
462
-            : $this->organization_config->phone;
463
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
464
-            ? esc_url_raw($form_data['organization_logo_url'])
465
-            : $this->organization_config->logo_url;
466
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
467
-            ? esc_url_raw($form_data['organization_facebook'])
468
-            : $this->organization_config->facebook;
469
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
470
-            ? esc_url_raw($form_data['organization_twitter'])
471
-            : $this->organization_config->twitter;
472
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
473
-            ? esc_url_raw($form_data['organization_linkedin'])
474
-            : $this->organization_config->linkedin;
475
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
476
-            ? esc_url_raw($form_data['organization_pinterest'])
477
-            : $this->organization_config->pinterest;
478
-        $this->organization_config->google = isset($form_data['organization_google'])
479
-            ? esc_url_raw($form_data['organization_google'])
480
-            : $this->organization_config->google;
481
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
482
-            ? esc_url_raw($form_data['organization_instagram'])
483
-            : $this->organization_config->instagram;
484
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
485
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
486
-            : false;
487
-        $this->core_config->ee_ueip_has_notified = true;
428
+		if (is_main_site()) {
429
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
430
+				? sanitize_text_field($form_data['ee_site_license_key'])
431
+				: $this->network_core_config->site_license_key;
432
+		}
433
+		$this->organization_config->name = isset($form_data['organization_name'])
434
+			? sanitize_text_field($form_data['organization_name'])
435
+			: $this->organization_config->name;
436
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
437
+			? sanitize_text_field($form_data['organization_address_1'])
438
+			: $this->organization_config->address_1;
439
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
440
+			? sanitize_text_field($form_data['organization_address_2'])
441
+			: $this->organization_config->address_2;
442
+		$this->organization_config->city = isset($form_data['organization_city'])
443
+			? sanitize_text_field($form_data['organization_city'])
444
+			: $this->organization_config->city;
445
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
446
+			? absint($form_data['organization_state'])
447
+			: $this->organization_config->STA_ID;
448
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
449
+			? sanitize_text_field($form_data['organization_country'])
450
+			: $this->organization_config->CNT_ISO;
451
+		$this->organization_config->zip = isset($form_data['organization_zip'])
452
+			? sanitize_text_field($form_data['organization_zip'])
453
+			: $this->organization_config->zip;
454
+		$this->organization_config->email = isset($form_data['organization_email'])
455
+			? sanitize_email($form_data['organization_email'])
456
+			: $this->organization_config->email;
457
+		$this->organization_config->vat = isset($form_data['organization_vat'])
458
+			? sanitize_text_field($form_data['organization_vat'])
459
+			: $this->organization_config->vat;
460
+		$this->organization_config->phone = isset($form_data['organization_phone'])
461
+			? sanitize_text_field($form_data['organization_phone'])
462
+			: $this->organization_config->phone;
463
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
464
+			? esc_url_raw($form_data['organization_logo_url'])
465
+			: $this->organization_config->logo_url;
466
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
467
+			? esc_url_raw($form_data['organization_facebook'])
468
+			: $this->organization_config->facebook;
469
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
470
+			? esc_url_raw($form_data['organization_twitter'])
471
+			: $this->organization_config->twitter;
472
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
473
+			? esc_url_raw($form_data['organization_linkedin'])
474
+			: $this->organization_config->linkedin;
475
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
476
+			? esc_url_raw($form_data['organization_pinterest'])
477
+			: $this->organization_config->pinterest;
478
+		$this->organization_config->google = isset($form_data['organization_google'])
479
+			? esc_url_raw($form_data['organization_google'])
480
+			: $this->organization_config->google;
481
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
482
+			? esc_url_raw($form_data['organization_instagram'])
483
+			: $this->organization_config->instagram;
484
+		$this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
485
+			? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
486
+			: false;
487
+		$this->core_config->ee_ueip_has_notified = true;
488 488
 
489
-        $this->registry->CFG->currency = new EE_Currency_Config(
490
-            $this->organization_config->CNT_ISO
491
-        );
492
-        /** @var EE_Country $country */
493
-        $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
494
-        if ($country instanceof EE_Country) {
495
-            $country->set('CNT_active', 1);
496
-            $country->save();
497
-            $this->getCountrySubRegions($country);
498
-        }
499
-        return true;
500
-    }
489
+		$this->registry->CFG->currency = new EE_Currency_Config(
490
+			$this->organization_config->CNT_ISO
491
+		);
492
+		/** @var EE_Country $country */
493
+		$country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
494
+		if ($country instanceof EE_Country) {
495
+			$country->set('CNT_active', 1);
496
+			$country->save();
497
+			$this->getCountrySubRegions($country);
498
+		}
499
+		return true;
500
+	}
501 501
 
502 502
 
503
-    /**
504
-     * @param EE_Country $country
505
-     * @return string
506
-     * @throws EE_Error
507
-     * @throws InvalidArgumentException
508
-     * @throws InvalidDataTypeException
509
-     * @throws InvalidInterfaceException
510
-     * @throws ReflectionException
511
-     */
512
-    private function getCountrySubRegions(EE_Country $country)
513
-    {
514
-        $CNT_ISO = $country->ID();
515
-        $has_sub_regions = EEM_State::instance()->count(array(array('Country.CNT_ISO' => $CNT_ISO)));
516
-        if ($has_sub_regions) {
517
-            return;
518
-        }
519
-        $json = $this->getCountryJson(
520
-            'https://raw.githubusercontent.com/astockwell/countries-and-provinces-states-regions/master/countries.json'
521
-        );
522
-        if (is_array($json)) {
523
-            foreach ($json as $country) {
524
-                if ($country->code === $CNT_ISO) {
525
-                    if($country->filename !== null) {
526
-                        $sub_regions = $this->getCountryJson(
527
-                            'https://raw.githubusercontent.com/astockwell/countries-and-provinces-states-regions/master/countries/'
528
-                            . $country->filename . '.json'
529
-                        );
530
-                        if (is_array($sub_regions)) {
531
-                            foreach ($sub_regions as $sub_region) {
532
-                                $abbrev = str_replace(
533
-                                    $CNT_ISO . '-',
534
-                                    '',
535
-                                    sanitize_text_field($sub_region->code)
536
-                                );
537
-                                if(absint($abbrev) !== 0){
538
-                                    $abbrev = sanitize_text_field($sub_region->code);
539
-                                }
540
-                                EEM_State::instance()->insert(
541
-                                    array(
542
-                                        // STA_ID	CNT_ISO	STA_abbrev	STA_name	STA_active
543
-                                        'CNT_ISO'    => $CNT_ISO,
544
-                                        'STA_abbrev' => $abbrev,
545
-                                        'STA_name'   => sanitize_text_field($sub_region->name),
546
-                                        'STA_active' => 1,
547
-                                    )
548
-                                );
549
-                            }
550
-                        }
551
-                    }
552
-                }
553
-            }
554
-        }
555
-    }
503
+	/**
504
+	 * @param EE_Country $country
505
+	 * @return string
506
+	 * @throws EE_Error
507
+	 * @throws InvalidArgumentException
508
+	 * @throws InvalidDataTypeException
509
+	 * @throws InvalidInterfaceException
510
+	 * @throws ReflectionException
511
+	 */
512
+	private function getCountrySubRegions(EE_Country $country)
513
+	{
514
+		$CNT_ISO = $country->ID();
515
+		$has_sub_regions = EEM_State::instance()->count(array(array('Country.CNT_ISO' => $CNT_ISO)));
516
+		if ($has_sub_regions) {
517
+			return;
518
+		}
519
+		$json = $this->getCountryJson(
520
+			'https://raw.githubusercontent.com/astockwell/countries-and-provinces-states-regions/master/countries.json'
521
+		);
522
+		if (is_array($json)) {
523
+			foreach ($json as $country) {
524
+				if ($country->code === $CNT_ISO) {
525
+					if($country->filename !== null) {
526
+						$sub_regions = $this->getCountryJson(
527
+							'https://raw.githubusercontent.com/astockwell/countries-and-provinces-states-regions/master/countries/'
528
+							. $country->filename . '.json'
529
+						);
530
+						if (is_array($sub_regions)) {
531
+							foreach ($sub_regions as $sub_region) {
532
+								$abbrev = str_replace(
533
+									$CNT_ISO . '-',
534
+									'',
535
+									sanitize_text_field($sub_region->code)
536
+								);
537
+								if(absint($abbrev) !== 0){
538
+									$abbrev = sanitize_text_field($sub_region->code);
539
+								}
540
+								EEM_State::instance()->insert(
541
+									array(
542
+										// STA_ID	CNT_ISO	STA_abbrev	STA_name	STA_active
543
+										'CNT_ISO'    => $CNT_ISO,
544
+										'STA_abbrev' => $abbrev,
545
+										'STA_name'   => sanitize_text_field($sub_region->name),
546
+										'STA_active' => 1,
547
+									)
548
+								);
549
+							}
550
+						}
551
+					}
552
+				}
553
+			}
554
+		}
555
+	}
556 556
 
557 557
 
558
-    /**
559
-     * @param string $url
560
-     * @return array
561
-     */
562
-    private function getCountryJson($url='')
563
-    {
564
-        if (empty($url)) {
565
-            return array();
566
-        }
567
-        $request = wp_safe_remote_get($url);
568
-        if (is_wp_error($request)) {
569
-            return array();
570
-        }
571
-        $body = wp_remote_retrieve_body($request);
572
-        return json_decode($body);
573
-    }
558
+	/**
559
+	 * @param string $url
560
+	 * @return array
561
+	 */
562
+	private function getCountryJson($url='')
563
+	{
564
+		if (empty($url)) {
565
+			return array();
566
+		}
567
+		$request = wp_safe_remote_get($url);
568
+		if (is_wp_error($request)) {
569
+			return array();
570
+		}
571
+		$body = wp_remote_retrieve_body($request);
572
+		return json_decode($body);
573
+	}
574 574
 
575 575
 
576
-    /**
577
-     * @return string
578
-     */
579
-    private function uxipOptinText()
580
-    {
581
-        ob_start();
582
-        Stats::optinText(false);
583
-        return ob_get_clean();
584
-    }
576
+	/**
577
+	 * @return string
578
+	 */
579
+	private function uxipOptinText()
580
+	{
581
+		ob_start();
582
+		Stats::optinText(false);
583
+		return ob_get_clean();
584
+	}
585 585
 
586 586
 
587
-    /**
588
-     * Return whether the site license key has been verified or not.
589
-     * @return bool
590
-     */
591
-    private function licenseKeyVerified()
592
-    {
593
-        if (empty($this->network_core_config->site_license_key)) {
594
-            return false;
595
-        }
596
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
597
-        $verify_fail = get_option($ver_option_key, false);
598
-        return $verify_fail === false
599
-                  || (! empty($this->network_core_config->site_license_key)
600
-                        && $verify_fail === false
601
-                  );
602
-    }
587
+	/**
588
+	 * Return whether the site license key has been verified or not.
589
+	 * @return bool
590
+	 */
591
+	private function licenseKeyVerified()
592
+	{
593
+		if (empty($this->network_core_config->site_license_key)) {
594
+			return false;
595
+		}
596
+		$ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
597
+		$verify_fail = get_option($ver_option_key, false);
598
+		return $verify_fail === false
599
+				  || (! empty($this->network_core_config->site_license_key)
600
+						&& $verify_fail === false
601
+				  );
602
+	}
603 603
 
604 604
 
605
-    /**
606
-     * @return EE_Text_Input
607
-     */
608
-    private function getSiteLicenseKeyField()
609
-    {
610
-        $text_input = new EE_Text_Input(
611
-            array(
612
-                'html_name' => 'ee_site_license_key',
613
-                'html_id' => 'site_license_key',
614
-                'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
615
-                /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
616
-                'html_help_text'  => sprintf(
617
-                    esc_html__(
618
-                        '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.',
619
-                        'event_espresso'
620
-                    ),
621
-                    '<strong>',
622
-                    '</strong>'
623
-                ),
624
-                /** phpcs:enable */
625
-                'default'         => isset($this->network_core_config->site_license_key)
626
-                    ? $this->network_core_config->site_license_key
627
-                    : '',
628
-                'required'        => false,
629
-                'form_html_filter' => new VsprintfFilter(
630
-                    '%2$s %1$s',
631
-                    array($this->getValidationIndicator())
632
-                )
633
-            )
634
-        );
635
-        return $text_input;
636
-    }
605
+	/**
606
+	 * @return EE_Text_Input
607
+	 */
608
+	private function getSiteLicenseKeyField()
609
+	{
610
+		$text_input = new EE_Text_Input(
611
+			array(
612
+				'html_name' => 'ee_site_license_key',
613
+				'html_id' => 'site_license_key',
614
+				'html_label_text' => esc_html__('Support License Key', 'event_espresso'),
615
+				/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
616
+				'html_help_text'  => sprintf(
617
+					esc_html__(
618
+						'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.',
619
+						'event_espresso'
620
+					),
621
+					'<strong>',
622
+					'</strong>'
623
+				),
624
+				/** phpcs:enable */
625
+				'default'         => isset($this->network_core_config->site_license_key)
626
+					? $this->network_core_config->site_license_key
627
+					: '',
628
+				'required'        => false,
629
+				'form_html_filter' => new VsprintfFilter(
630
+					'%2$s %1$s',
631
+					array($this->getValidationIndicator())
632
+				)
633
+			)
634
+		);
635
+		return $text_input;
636
+	}
637 637
 
638 638
 
639
-    /**
640
-     * @return string
641
-     */
642
-    private function getValidationIndicator()
643
-    {
644
-        $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
645
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
646
-    }
639
+	/**
640
+	 * @return string
641
+	 */
642
+	private function getValidationIndicator()
643
+	{
644
+		$verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
645
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
646
+	}
647 647
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
         $this->organization_config->instagram = isset($form_data['organization_instagram'])
482 482
             ? esc_url_raw($form_data['organization_instagram'])
483 483
             : $this->organization_config->instagram;
484
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
485
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
484
+        $this->core_config->ee_ueip_optin = isset($form_data[EE_Core_Config::OPTION_NAME_UXIP][0])
485
+            ? filter_var($form_data[EE_Core_Config::OPTION_NAME_UXIP][0], FILTER_VALIDATE_BOOLEAN)
486 486
             : false;
487 487
         $this->core_config->ee_ueip_has_notified = true;
488 488
 
@@ -522,19 +522,19 @@  discard block
 block discarded – undo
522 522
         if (is_array($json)) {
523 523
             foreach ($json as $country) {
524 524
                 if ($country->code === $CNT_ISO) {
525
-                    if($country->filename !== null) {
525
+                    if ($country->filename !== null) {
526 526
                         $sub_regions = $this->getCountryJson(
527 527
                             'https://raw.githubusercontent.com/astockwell/countries-and-provinces-states-regions/master/countries/'
528
-                            . $country->filename . '.json'
528
+                            . $country->filename.'.json'
529 529
                         );
530 530
                         if (is_array($sub_regions)) {
531 531
                             foreach ($sub_regions as $sub_region) {
532 532
                                 $abbrev = str_replace(
533
-                                    $CNT_ISO . '-',
533
+                                    $CNT_ISO.'-',
534 534
                                     '',
535 535
                                     sanitize_text_field($sub_region->code)
536 536
                                 );
537
-                                if(absint($abbrev) !== 0){
537
+                                if (absint($abbrev) !== 0) {
538 538
                                     $abbrev = sanitize_text_field($sub_region->code);
539 539
                                 }
540 540
                                 EEM_State::instance()->insert(
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      * @param string $url
560 560
      * @return array
561 561
      */
562
-    private function getCountryJson($url='')
562
+    private function getCountryJson($url = '')
563 563
     {
564 564
         if (empty($url)) {
565 565
             return array();
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
         if (empty($this->network_core_config->site_license_key)) {
594 594
             return false;
595 595
         }
596
-        $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
596
+        $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
597 597
         $verify_fail = get_option($ver_option_key, false);
598 598
         return $verify_fail === false
599
-                  || (! empty($this->network_core_config->site_license_key)
599
+                  || ( ! empty($this->network_core_config->site_license_key)
600 600
                         && $verify_fail === false
601 601
                   );
602 602
     }
@@ -642,6 +642,6 @@  discard block
 block discarded – undo
642 642
     private function getValidationIndicator()
643 643
     {
644 644
         $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
645
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
645
+        return '<span class="dashicons dashicons-admin-network '.$verified_class.' ee-icon-size-20"></span>';
646 646
     }
647 647
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Country_Select_Input.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -14,80 +14,80 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Country_Select_Input extends EE_Select_Input
16 16
 {
17
-    /**
18
-     * $input_settings key used for detecting the "get" option
19
-     */
20
-    const OPTION_GET_KEY = 'get';
17
+	/**
18
+	 * $input_settings key used for detecting the "get" option
19
+	 */
20
+	const OPTION_GET_KEY = 'get';
21 21
 
22
-    /**
23
-     * indicates that ALL countries should be retrieved from the db for the input
24
-     */
25
-    const OPTION_GET_ALL = 'all';
22
+	/**
23
+	 * indicates that ALL countries should be retrieved from the db for the input
24
+	 */
25
+	const OPTION_GET_ALL = 'all';
26 26
 
27
-    /**
28
-     * indicates that only ACTIVE countries should be retrieved from the db for the input
29
-     */
30
-    const OPTION_GET_ACTIVE = 'active';
27
+	/**
28
+	 * indicates that only ACTIVE countries should be retrieved from the db for the input
29
+	 */
30
+	const OPTION_GET_ACTIVE = 'active';
31 31
 
32 32
 
33
-    /**
34
-     * @param array $country_options
35
-     * @param array $input_settings
36
-     * @throws EE_Error
37
-     * @throws InvalidArgumentException
38
-     * @throws InvalidDataTypeException
39
-     * @throws InvalidInterfaceException
40
-     * @throws ReflectionException
41
-     */
42
-    public function __construct($country_options = null, $input_settings = array())
43
-    {
44
-        $get = isset($input_settings[ self::OPTION_GET_KEY ])
45
-            ? $input_settings[ self::OPTION_GET_KEY ]
46
-            : self::OPTION_GET_ACTIVE;
47
-        $country_options = apply_filters(
48
-            'FHEE__EE_Country_Select_Input____construct__country_options',
49
-            $this->get_country_answer_options($country_options, $get),
50
-            $this,
51
-            $get
52
-        );
53
-        $input_settings['html_class'] = isset($input_settings['html_class'])
54
-            ? $input_settings['html_class'] . ' ee-country-select-js'
55
-            : 'ee-country-select-js';
56
-        parent::__construct($country_options, $input_settings);
57
-    }
33
+	/**
34
+	 * @param array $country_options
35
+	 * @param array $input_settings
36
+	 * @throws EE_Error
37
+	 * @throws InvalidArgumentException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws InvalidInterfaceException
40
+	 * @throws ReflectionException
41
+	 */
42
+	public function __construct($country_options = null, $input_settings = array())
43
+	{
44
+		$get = isset($input_settings[ self::OPTION_GET_KEY ])
45
+			? $input_settings[ self::OPTION_GET_KEY ]
46
+			: self::OPTION_GET_ACTIVE;
47
+		$country_options = apply_filters(
48
+			'FHEE__EE_Country_Select_Input____construct__country_options',
49
+			$this->get_country_answer_options($country_options, $get),
50
+			$this,
51
+			$get
52
+		);
53
+		$input_settings['html_class'] = isset($input_settings['html_class'])
54
+			? $input_settings['html_class'] . ' ee-country-select-js'
55
+			: 'ee-country-select-js';
56
+		parent::__construct($country_options, $input_settings);
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * get_country_answer_options
62
-     *
63
-     * @param array  $country_options
64
-     * @param string $get
65
-     * @return array
66
-     * @throws EE_Error
67
-     * @throws InvalidArgumentException
68
-     * @throws ReflectionException
69
-     * @throws InvalidDataTypeException
70
-     * @throws InvalidInterfaceException
71
-     */
72
-    public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73
-    {
74
-        // if passed something that is NOT an array
75
-        if (! is_array($country_options)) {
76
-            // get possibly cached list of countries
77
-            $countries = $get === self::OPTION_GET_ALL
78
-                ? EEM_Country::instance()->get_all_countries()
79
-                : EEM_Country::instance()->get_all_active_countries();
80
-            if (! empty($countries)) {
81
-                $country_options[''] = '';
82
-                foreach ($countries as $country) {
83
-                    if ($country instanceof EE_Country) {
84
-                        $country_options[ $country->ID() ] = $country->name();
85
-                    }
86
-                }
87
-            } else {
88
-                $country_options = array();
89
-            }
90
-        }
91
-        return $country_options;
92
-    }
60
+	/**
61
+	 * get_country_answer_options
62
+	 *
63
+	 * @param array  $country_options
64
+	 * @param string $get
65
+	 * @return array
66
+	 * @throws EE_Error
67
+	 * @throws InvalidArgumentException
68
+	 * @throws ReflectionException
69
+	 * @throws InvalidDataTypeException
70
+	 * @throws InvalidInterfaceException
71
+	 */
72
+	public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73
+	{
74
+		// if passed something that is NOT an array
75
+		if (! is_array($country_options)) {
76
+			// get possibly cached list of countries
77
+			$countries = $get === self::OPTION_GET_ALL
78
+				? EEM_Country::instance()->get_all_countries()
79
+				: EEM_Country::instance()->get_all_active_countries();
80
+			if (! empty($countries)) {
81
+				$country_options[''] = '';
82
+				foreach ($countries as $country) {
83
+					if ($country instanceof EE_Country) {
84
+						$country_options[ $country->ID() ] = $country->name();
85
+					}
86
+				}
87
+			} else {
88
+				$country_options = array();
89
+			}
90
+		}
91
+		return $country_options;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function __construct($country_options = null, $input_settings = array())
43 43
     {
44
-        $get = isset($input_settings[ self::OPTION_GET_KEY ])
45
-            ? $input_settings[ self::OPTION_GET_KEY ]
44
+        $get = isset($input_settings[self::OPTION_GET_KEY])
45
+            ? $input_settings[self::OPTION_GET_KEY]
46 46
             : self::OPTION_GET_ACTIVE;
47 47
         $country_options = apply_filters(
48 48
             'FHEE__EE_Country_Select_Input____construct__country_options',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $get
52 52
         );
53 53
         $input_settings['html_class'] = isset($input_settings['html_class'])
54
-            ? $input_settings['html_class'] . ' ee-country-select-js'
54
+            ? $input_settings['html_class'].' ee-country-select-js'
55 55
             : 'ee-country-select-js';
56 56
         parent::__construct($country_options, $input_settings);
57 57
     }
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     public function get_country_answer_options($country_options = null, $get = self::OPTION_GET_ACTIVE)
73 73
     {
74 74
         // if passed something that is NOT an array
75
-        if (! is_array($country_options)) {
75
+        if ( ! is_array($country_options)) {
76 76
             // get possibly cached list of countries
77 77
             $countries = $get === self::OPTION_GET_ALL
78 78
                 ? EEM_Country::instance()->get_all_countries()
79 79
                 : EEM_Country::instance()->get_all_active_countries();
80
-            if (! empty($countries)) {
80
+            if ( ! empty($countries)) {
81 81
                 $country_options[''] = '';
82 82
                 foreach ($countries as $country) {
83 83
                     if ($country instanceof EE_Country) {
84
-                        $country_options[ $country->ID() ] = $country->name();
84
+                        $country_options[$country->ID()] = $country->name();
85 85
                     }
86 86
                 }
87 87
             } else {
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -9,51 +9,51 @@
 block discarded – undo
9 9
 class EE_State_Select_Input extends EE_Select_Input
10 10
 {
11 11
 
12
-    /**
13
-     * @param array $state_options
14
-     * @param array $input_settings
15
-     */
16
-    public function __construct($state_options, $input_settings = array())
17
-    {
18
-        $state_options = apply_filters(
19
-            'FHEE__EE_State_Select_Input____construct__state_options',
20
-            $this->get_state_answer_options($state_options),
21
-            $this
22
-        );
23
-        $input_settings['html_class'] = isset($input_settings['html_class'])
24
-            ? $input_settings['html_class'] . ' ee-state-select-js'
25
-            : 'ee-state-select-js';
26
-        parent::__construct($state_options, $input_settings);
27
-    }
12
+	/**
13
+	 * @param array $state_options
14
+	 * @param array $input_settings
15
+	 */
16
+	public function __construct($state_options, $input_settings = array())
17
+	{
18
+		$state_options = apply_filters(
19
+			'FHEE__EE_State_Select_Input____construct__state_options',
20
+			$this->get_state_answer_options($state_options),
21
+			$this
22
+		);
23
+		$input_settings['html_class'] = isset($input_settings['html_class'])
24
+			? $input_settings['html_class'] . ' ee-state-select-js'
25
+			: 'ee-state-select-js';
26
+		parent::__construct($state_options, $input_settings);
27
+	}
28 28
 
29 29
 
30 30
 
31
-    /**
32
-     * get_state_answer_options
33
-     *
34
-     * @param array $state_options
35
-     * @return array
36
-     */
37
-    public function get_state_answer_options($state_options = null)
38
-    {
39
-        // if passed something that is NOT an array
40
-        if (! is_array($state_options) || empty($state_options)) {
41
-            // get possibly cached list of states
42
-            $states = EEM_State::instance()->get_all_active_states();
43
-        }
44
-        if(is_array($state_options) && reset($state_options) instanceof EE_State) {
45
-            $states = $state_options;
46
-            $state_options = array();
47
-        }
48
-        if (! empty($states)) {
49
-            // set the default
50
-            $state_options[''][''] = '';
51
-            foreach ($states as $state) {
52
-                if ($state instanceof EE_State) {
53
-                    $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
54
-                }
55
-            }
56
-        }
57
-        return $state_options;
58
-    }
31
+	/**
32
+	 * get_state_answer_options
33
+	 *
34
+	 * @param array $state_options
35
+	 * @return array
36
+	 */
37
+	public function get_state_answer_options($state_options = null)
38
+	{
39
+		// if passed something that is NOT an array
40
+		if (! is_array($state_options) || empty($state_options)) {
41
+			// get possibly cached list of states
42
+			$states = EEM_State::instance()->get_all_active_states();
43
+		}
44
+		if(is_array($state_options) && reset($state_options) instanceof EE_State) {
45
+			$states = $state_options;
46
+			$state_options = array();
47
+		}
48
+		if (! empty($states)) {
49
+			// set the default
50
+			$state_options[''][''] = '';
51
+			foreach ($states as $state) {
52
+				if ($state instanceof EE_State) {
53
+					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
54
+				}
55
+			}
56
+		}
57
+		return $state_options;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             $this
22 22
         );
23 23
         $input_settings['html_class'] = isset($input_settings['html_class'])
24
-            ? $input_settings['html_class'] . ' ee-state-select-js'
24
+            ? $input_settings['html_class'].' ee-state-select-js'
25 25
             : 'ee-state-select-js';
26 26
         parent::__construct($state_options, $input_settings);
27 27
     }
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
     public function get_state_answer_options($state_options = null)
38 38
     {
39 39
         // if passed something that is NOT an array
40
-        if (! is_array($state_options) || empty($state_options)) {
40
+        if ( ! is_array($state_options) || empty($state_options)) {
41 41
             // get possibly cached list of states
42 42
             $states = EEM_State::instance()->get_all_active_states();
43 43
         }
44
-        if(is_array($state_options) && reset($state_options) instanceof EE_State) {
44
+        if (is_array($state_options) && reset($state_options) instanceof EE_State) {
45 45
             $states = $state_options;
46 46
             $state_options = array();
47 47
         }
48
-        if (! empty($states)) {
48
+        if ( ! empty($states)) {
49 49
             // set the default
50 50
             $state_options[''][''] = '';
51 51
             foreach ($states as $state) {
52 52
                 if ($state instanceof EE_State) {
53
-                    $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
53
+                    $state_options[$state->country()->name()][$state->ID()] = $state->name();
54 54
                 }
55 55
             }
56 56
         }
Please login to merge, or discard this patch.