Passed
Push — master ( ccb079...7f3bcc )
by Paul
07:26
created
config/styles/divi.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'input',
6
-        'input_checkbox' => 'input',
7
-        'input_radio' => 'input',
8
-        'label' => 'et_pb_contact_form_label',
9
-        'select' => 'et_pb_contact_select input',
10
-        'textarea' => 'et_pb_contact_message input',
11
-    ],
12
-    'validation' => [
13
-        'field_error_class' => 'et_contact_error',
14
-        'input_error_class' => 'et_contact_error',
15
-    ],
4
+	'fields' => [
5
+		'input' => 'input',
6
+		'input_checkbox' => 'input',
7
+		'input_radio' => 'input',
8
+		'label' => 'et_pb_contact_form_label',
9
+		'select' => 'et_pb_contact_select input',
10
+		'textarea' => 'et_pb_contact_message input',
11
+	],
12
+	'validation' => [
13
+		'field_error_class' => 'et_contact_error',
14
+		'input_error_class' => 'et_contact_error',
15
+	],
16 16
 ];
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -12,163 +12,163 @@
 block discarded – undo
12 12
 
13 13
 class SettingsController extends Controller
14 14
 {
15
-    /**
16
-     * @param mixed $input
17
-     * @return array
18
-     * @callback register_setting
19
-     */
20
-    public function callbackRegisterSettings($input)
21
-    {
22
-        $settings = Arr::consolidateArray($input);
23
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
-            $options = $this->sanitizeGeneral($input, $options);
26
-            $options = $this->sanitizeLicenses($input, $options);
27
-            $options = $this->sanitizeSubmissions($input, $options);
28
-            $options = $this->sanitizeTranslations($input, $options);
29
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
32
-            }
33
-            return $options;
34
-        }
35
-        return $input;
36
-    }
15
+	/**
16
+	 * @param mixed $input
17
+	 * @return array
18
+	 * @callback register_setting
19
+	 */
20
+	public function callbackRegisterSettings($input)
21
+	{
22
+		$settings = Arr::consolidateArray($input);
23
+		if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
+			$options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
+			$options = $this->sanitizeGeneral($input, $options);
26
+			$options = $this->sanitizeLicenses($input, $options);
27
+			$options = $this->sanitizeSubmissions($input, $options);
28
+			$options = $this->sanitizeTranslations($input, $options);
29
+			$options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
+			if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
+				glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
32
+			}
33
+			return $options;
34
+		}
35
+		return $input;
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     * @action admin_init
41
-     */
42
-    public function registerSettings()
43
-    {
44
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
45
-            'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
-        ]);
47
-    }
38
+	/**
39
+	 * @return void
40
+	 * @action admin_init
41
+	 */
42
+	public function registerSettings()
43
+	{
44
+		register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
45
+			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
+		]);
47
+	}
48 48
 
49
-    /**
50
-     * @return array
51
-     */
52
-    protected function sanitizeGeneral(array $input, array $options)
53
-    {
54
-        $key = 'settings.general';
55
-        $inputForm = Arr::get($input, $key);
56
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
-            $options = Arr::set($options, $key.'.multilingual', '');
58
-        }
59
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
62
-        }
63
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
64
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
65
-        return $options;
66
-    }
49
+	/**
50
+	 * @return array
51
+	 */
52
+	protected function sanitizeGeneral(array $input, array $options)
53
+	{
54
+		$key = 'settings.general';
55
+		$inputForm = Arr::get($input, $key);
56
+		if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
+			$options = Arr::set($options, $key.'.multilingual', '');
58
+		}
59
+		if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
+			$defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
+			$options = Arr::set($options, $key.'.notification_message', $defaultValue);
62
+		}
63
+		$defaultValue = Arr::get($inputForm, 'notifications', []);
64
+		$options = Arr::set($options, $key.'.notifications', $defaultValue);
65
+		return $options;
66
+	}
67 67
 
68
-    /**
69
-     * @return array
70
-     */
71
-    protected function sanitizeLicenses(array $input, array $options)
72
-    {
73
-        $key = 'settings.licenses';
74
-        $licenses = Arr::consolidateArray(Arr::get($input, $key));
75
-        foreach ($licenses as $slug => &$license) {
76
-            if (empty($license)) {
77
-                continue;
78
-            }
79
-            $license = $this->verifyLicense($license, $slug);
80
-        }
81
-        $options = Arr::set($options, $key, $licenses);
82
-        return $options;
83
-    }
68
+	/**
69
+	 * @return array
70
+	 */
71
+	protected function sanitizeLicenses(array $input, array $options)
72
+	{
73
+		$key = 'settings.licenses';
74
+		$licenses = Arr::consolidateArray(Arr::get($input, $key));
75
+		foreach ($licenses as $slug => &$license) {
76
+			if (empty($license)) {
77
+				continue;
78
+			}
79
+			$license = $this->verifyLicense($license, $slug);
80
+		}
81
+		$options = Arr::set($options, $key, $licenses);
82
+		return $options;
83
+	}
84 84
 
85
-    /**
86
-     * @return array
87
-     */
88
-    protected function sanitizeSubmissions(array $input, array $options)
89
-    {
90
-        $key = 'settings.submissions';
91
-        $inputForm = Arr::get($input, $key);
92
-        $defaultValue = isset($inputForm['required'])
93
-            ? $inputForm['required']
94
-            : [];
95
-        $options = Arr::set($options, $key.'.required', $defaultValue);
96
-        return $options;
97
-    }
85
+	/**
86
+	 * @return array
87
+	 */
88
+	protected function sanitizeSubmissions(array $input, array $options)
89
+	{
90
+		$key = 'settings.submissions';
91
+		$inputForm = Arr::get($input, $key);
92
+		$defaultValue = isset($inputForm['required'])
93
+			? $inputForm['required']
94
+			: [];
95
+		$options = Arr::set($options, $key.'.required', $defaultValue);
96
+		return $options;
97
+	}
98 98
 
99
-    /**
100
-     * @return array
101
-     */
102
-    protected function sanitizeTranslations(array $input, array $options)
103
-    {
104
-        $key = 'settings.strings';
105
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
106
-        if (!empty($inputForm)) {
107
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
108
-            $allowedTags = [
109
-                'a' => ['class' => [], 'href' => [], 'target' => []],
110
-                'span' => ['class' => []],
111
-            ];
112
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
113
-                if (isset($string['s2'])) {
114
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
115
-                }
116
-                if (isset($string['p2'])) {
117
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
118
-                }
119
-            });
120
-        }
121
-        return $options;
122
-    }
99
+	/**
100
+	 * @return array
101
+	 */
102
+	protected function sanitizeTranslations(array $input, array $options)
103
+	{
104
+		$key = 'settings.strings';
105
+		$inputForm = Arr::consolidateArray(Arr::get($input, $key));
106
+		if (!empty($inputForm)) {
107
+			$options = Arr::set($options, $key, array_values(array_filter($inputForm)));
108
+			$allowedTags = [
109
+				'a' => ['class' => [], 'href' => [], 'target' => []],
110
+				'span' => ['class' => []],
111
+			];
112
+			array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
113
+				if (isset($string['s2'])) {
114
+					$string['s2'] = wp_kses($string['s2'], $allowedTags);
115
+				}
116
+				if (isset($string['p2'])) {
117
+					$string['p2'] = wp_kses($string['p2'], $allowedTags);
118
+				}
119
+			});
120
+		}
121
+		return $options;
122
+	}
123 123
 
124
-    /**
125
-     * @param string $integrationSlug
126
-     * @return bool
127
-     */
128
-    protected function hasMultilingualIntegration($integrationSlug)
129
-    {
130
-        $integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
131
-        if (!$integration) {
132
-            return false;
133
-        }
134
-        if (!$integration->isActive()) {
135
-            glsr(Notice::class)->addError(sprintf(
136
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
137
-                $integration->pluginName
138
-            ));
139
-            return false;
140
-        } elseif (!$integration->isSupported()) {
141
-            glsr(Notice::class)->addError(sprintf(
142
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
143
-                $integration->pluginName,
144
-                $integration->supportedVersion
145
-            ));
146
-            return false;
147
-        }
148
-        return true;
149
-    }
124
+	/**
125
+	 * @param string $integrationSlug
126
+	 * @return bool
127
+	 */
128
+	protected function hasMultilingualIntegration($integrationSlug)
129
+	{
130
+		$integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
131
+		if (!$integration) {
132
+			return false;
133
+		}
134
+		if (!$integration->isActive()) {
135
+			glsr(Notice::class)->addError(sprintf(
136
+				__('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
137
+				$integration->pluginName
138
+			));
139
+			return false;
140
+		} elseif (!$integration->isSupported()) {
141
+			glsr(Notice::class)->addError(sprintf(
142
+				__('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
143
+				$integration->pluginName,
144
+				$integration->supportedVersion
145
+			));
146
+			return false;
147
+		}
148
+		return true;
149
+	}
150 150
 
151
-    /**
152
-     * @param string $license
153
-     * @param string $slug
154
-     * @return string
155
-     */
156
-    protected function verifyLicense($license, $slug)
157
-    {
158
-        try {
159
-            $addon = glsr($slug);
160
-            $updater = new Updater($addon->update_url, $addon->file, [
161
-                'license' => $license,
162
-                'testedTo' => $addon->testedTo,
163
-            ]);
164
-            if (!$updater->isLicenseValid()) {
165
-                throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
166
-            }
167
-        } catch (Exception $e) {
168
-            $license = '';
169
-            glsr_log()->debug($e->getMessage());
170
-            glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
171
-        }
172
-        return $license;
173
-    }
151
+	/**
152
+	 * @param string $license
153
+	 * @param string $slug
154
+	 * @return string
155
+	 */
156
+	protected function verifyLicense($license, $slug)
157
+	{
158
+		try {
159
+			$addon = glsr($slug);
160
+			$updater = new Updater($addon->update_url, $addon->file, [
161
+				'license' => $license,
162
+				'testedTo' => $addon->testedTo,
163
+			]);
164
+			if (!$updater->isLicenseValid()) {
165
+				throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
166
+			}
167
+		} catch (Exception $e) {
168
+			$license = '';
169
+			glsr_log()->debug($e->getMessage());
170
+			glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
171
+		}
172
+		return $license;
173
+	}
174 174
 }
Please login to merge, or discard this patch.