Passed
Push — feature/rebusify ( 289185...639d49 )
by Paul
04:02
created
plugin/Modules/System.php 1 patch
Indentation   +343 added lines, -343 removed lines patch added patch discarded remove patch
@@ -10,368 +10,368 @@
 block discarded – undo
10 10
 
11 11
 class System
12 12
 {
13
-    const PAD = 40;
13
+	const PAD = 40;
14 14
 
15
-    /**
16
-     * @return string
17
-     */
18
-    public function __toString()
19
-    {
20
-        return $this->get();
21
-    }
15
+	/**
16
+	 * @return string
17
+	 */
18
+	public function __toString()
19
+	{
20
+		return $this->get();
21
+	}
22 22
 
23
-    /**
24
-     * @return string
25
-     */
26
-    public function get()
27
-    {
28
-        $details = [
29
-            'plugin' => 'Plugin Details',
30
-            'addon' => 'Addon Details',
31
-            'browser' => 'Browser Details',
32
-            'server' => 'Server Details',
33
-            'php' => 'PHP Configuration',
34
-            'wordpress' => 'WordPress Configuration',
35
-            'mu-plugin' => 'Must-Use Plugins',
36
-            'multisite-plugin' => 'Network Active Plugins',
37
-            'active-plugin' => 'Active Plugins',
38
-            'inactive-plugin' => 'Inactive Plugins',
39
-            'setting' => 'Plugin Settings',
40
-            'reviews' => 'Review Counts',
41
-        ];
42
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
43
-            $methodName = glsr(Helper::class)->buildMethodName('get-'.$key.'-details');
44
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
45
-                return $carry.$this->implode(
46
-                    strtoupper($details[$key]),
47
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
48
-                );
49
-            }
50
-            return $carry;
51
-        });
52
-        return trim($systemInfo);
53
-    }
23
+	/**
24
+	 * @return string
25
+	 */
26
+	public function get()
27
+	{
28
+		$details = [
29
+			'plugin' => 'Plugin Details',
30
+			'addon' => 'Addon Details',
31
+			'browser' => 'Browser Details',
32
+			'server' => 'Server Details',
33
+			'php' => 'PHP Configuration',
34
+			'wordpress' => 'WordPress Configuration',
35
+			'mu-plugin' => 'Must-Use Plugins',
36
+			'multisite-plugin' => 'Network Active Plugins',
37
+			'active-plugin' => 'Active Plugins',
38
+			'inactive-plugin' => 'Inactive Plugins',
39
+			'setting' => 'Plugin Settings',
40
+			'reviews' => 'Review Counts',
41
+		];
42
+		$systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
43
+			$methodName = glsr(Helper::class)->buildMethodName('get-'.$key.'-details');
44
+			if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
45
+				return $carry.$this->implode(
46
+					strtoupper($details[$key]),
47
+					apply_filters('site-reviews/system/'.$key, $systemDetails)
48
+				);
49
+			}
50
+			return $carry;
51
+		});
52
+		return trim($systemInfo);
53
+	}
54 54
 
55
-    /**
56
-     * @return array
57
-     */
58
-    public function getActivePluginDetails()
59
-    {
60
-        $plugins = get_plugins();
61
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
62
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
63
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
64
-    }
55
+	/**
56
+	 * @return array
57
+	 */
58
+	public function getActivePluginDetails()
59
+	{
60
+		$plugins = get_plugins();
61
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
62
+		$inactive = array_diff_key($plugins, array_flip($activePlugins));
63
+		return $this->normalizePluginList(array_diff_key($plugins, $inactive));
64
+	}
65 65
 
66
-    /**
67
-     * @return array
68
-     */
69
-    public function getAddonDetails()
70
-    {
71
-        $details = apply_filters('site-reviews/addon/system-info', []);
72
-        ksort($details);
73
-        return $details;
74
-    }
66
+	/**
67
+	 * @return array
68
+	 */
69
+	public function getAddonDetails()
70
+	{
71
+		$details = apply_filters('site-reviews/addon/system-info', []);
72
+		ksort($details);
73
+		return $details;
74
+	}
75 75
 
76
-    /**
77
-     * @return array
78
-     */
79
-    public function getBrowserDetails()
80
-    {
81
-        $browser = new Browser();
82
-        $name = esc_attr($browser->getName());
83
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
84
-        $version = esc_attr($browser->getVersion());
85
-        return [
86
-            'Browser Name' => sprintf('%s %s', $name, $version),
87
-            'Browser UA' => $userAgent,
88
-        ];
89
-    }
76
+	/**
77
+	 * @return array
78
+	 */
79
+	public function getBrowserDetails()
80
+	{
81
+		$browser = new Browser();
82
+		$name = esc_attr($browser->getName());
83
+		$userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
84
+		$version = esc_attr($browser->getVersion());
85
+		return [
86
+			'Browser Name' => sprintf('%s %s', $name, $version),
87
+			'Browser UA' => $userAgent,
88
+		];
89
+	}
90 90
 
91
-    /**
92
-     * @return array
93
-     */
94
-    public function getInactivePluginDetails()
95
-    {
96
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
97
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
98
-        $multisitePlugins = $this->getMultisitePluginDetails();
99
-        return is_array($multisitePlugins)
100
-            ? array_diff($inactivePlugins, $multisitePlugins)
101
-            : $inactivePlugins;
102
-    }
91
+	/**
92
+	 * @return array
93
+	 */
94
+	public function getInactivePluginDetails()
95
+	{
96
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
97
+		$inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
98
+		$multisitePlugins = $this->getMultisitePluginDetails();
99
+		return is_array($multisitePlugins)
100
+			? array_diff($inactivePlugins, $multisitePlugins)
101
+			: $inactivePlugins;
102
+	}
103 103
 
104
-    /**
105
-     * @return void|array
106
-     */
107
-    public function getMuPluginDetails()
108
-    {
109
-        if (empty($plugins = get_mu_plugins())) {
110
-            return;
111
-        }
112
-        return $this->normalizePluginList($plugins);
113
-    }
104
+	/**
105
+	 * @return void|array
106
+	 */
107
+	public function getMuPluginDetails()
108
+	{
109
+		if (empty($plugins = get_mu_plugins())) {
110
+			return;
111
+		}
112
+		return $this->normalizePluginList($plugins);
113
+	}
114 114
 
115
-    /**
116
-     * @return void|array
117
-     */
118
-    public function getMultisitePluginDetails()
119
-    {
120
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
121
-        if (!is_multisite() || empty($activePlugins)) {
122
-            return;
123
-        }
124
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
125
-    }
115
+	/**
116
+	 * @return void|array
117
+	 */
118
+	public function getMultisitePluginDetails()
119
+	{
120
+		$activePlugins = (array) get_site_option('active_sitewide_plugins', []);
121
+		if (!is_multisite() || empty($activePlugins)) {
122
+			return;
123
+		}
124
+		return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
125
+	}
126 126
 
127
-    /**
128
-     * @return array
129
-     */
130
-    public function getPhpDetails()
131
-    {
132
-        $displayErrors = ini_get('display_errors')
133
-            ? 'On ('.ini_get('display_errors').')'
134
-            : 'N/A';
135
-        $intlSupport = extension_loaded('intl')
136
-            ? phpversion('intl')
137
-            : 'false';
138
-        return [
139
-            'cURL' => var_export(function_exists('curl_init'), true),
140
-            'Default Charset' => ini_get('default_charset'),
141
-            'Display Errors' => $displayErrors,
142
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
143
-            'Intl' => $intlSupport,
144
-            'IPv6' => var_export(defined('AF_INET6'), true),
145
-            'Max Execution Time' => ini_get('max_execution_time'),
146
-            'Max Input Nesting Level' => ini_get('max_input_nesting_level'),
147
-            'Max Input Vars' => ini_get('max_input_vars'),
148
-            'Memory Limit' => ini_get('memory_limit'),
149
-            'Post Max Size' => ini_get('post_max_size'),
150
-            'Sendmail Path' => ini_get('sendmail_path'),
151
-            'Session Cookie Path' => esc_html(ini_get('session.cookie_path')),
152
-            'Session Name' => esc_html(ini_get('session.name')),
153
-            'Session Save Path' => esc_html(ini_get('session.save_path')),
154
-            'Session Use Cookies' => var_export(wp_validate_boolean(ini_get('session.use_cookies')), true),
155
-            'Session Use Only Cookies' => var_export(wp_validate_boolean(ini_get('session.use_only_cookies')), true),
156
-            'Upload Max Filesize' => ini_get('upload_max_filesize'),
157
-        ];
158
-    }
127
+	/**
128
+	 * @return array
129
+	 */
130
+	public function getPhpDetails()
131
+	{
132
+		$displayErrors = ini_get('display_errors')
133
+			? 'On ('.ini_get('display_errors').')'
134
+			: 'N/A';
135
+		$intlSupport = extension_loaded('intl')
136
+			? phpversion('intl')
137
+			: 'false';
138
+		return [
139
+			'cURL' => var_export(function_exists('curl_init'), true),
140
+			'Default Charset' => ini_get('default_charset'),
141
+			'Display Errors' => $displayErrors,
142
+			'fsockopen' => var_export(function_exists('fsockopen'), true),
143
+			'Intl' => $intlSupport,
144
+			'IPv6' => var_export(defined('AF_INET6'), true),
145
+			'Max Execution Time' => ini_get('max_execution_time'),
146
+			'Max Input Nesting Level' => ini_get('max_input_nesting_level'),
147
+			'Max Input Vars' => ini_get('max_input_vars'),
148
+			'Memory Limit' => ini_get('memory_limit'),
149
+			'Post Max Size' => ini_get('post_max_size'),
150
+			'Sendmail Path' => ini_get('sendmail_path'),
151
+			'Session Cookie Path' => esc_html(ini_get('session.cookie_path')),
152
+			'Session Name' => esc_html(ini_get('session.name')),
153
+			'Session Save Path' => esc_html(ini_get('session.save_path')),
154
+			'Session Use Cookies' => var_export(wp_validate_boolean(ini_get('session.use_cookies')), true),
155
+			'Session Use Only Cookies' => var_export(wp_validate_boolean(ini_get('session.use_only_cookies')), true),
156
+			'Upload Max Filesize' => ini_get('upload_max_filesize'),
157
+		];
158
+	}
159 159
 
160
-    /**
161
-     * @return array
162
-     */
163
-    public function getReviewsDetails()
164
-    {
165
-        $counts = glsr(CountsManager::class)->getCounts();
166
-        $counts = glsr(Helper::class)->flattenArray($counts);
167
-        array_walk($counts, function (&$ratings) use ($counts) {
168
-            if (!is_array($ratings)) {
169
-                glsr_log()
170
-                    ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
171
-                    ->debug($ratings)
172
-                    ->debug($counts);
173
-                return;
174
-            }
175
-            $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
176
-        });
177
-        ksort($counts);
178
-        return $counts;
179
-    }
160
+	/**
161
+	 * @return array
162
+	 */
163
+	public function getReviewsDetails()
164
+	{
165
+		$counts = glsr(CountsManager::class)->getCounts();
166
+		$counts = glsr(Helper::class)->flattenArray($counts);
167
+		array_walk($counts, function (&$ratings) use ($counts) {
168
+			if (!is_array($ratings)) {
169
+				glsr_log()
170
+					->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
171
+					->debug($ratings)
172
+					->debug($counts);
173
+				return;
174
+			}
175
+			$ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
176
+		});
177
+		ksort($counts);
178
+		return $counts;
179
+	}
180 180
 
181
-    /**
182
-     * @return array
183
-     */
184
-    public function getServerDetails()
185
-    {
186
-        global $wpdb;
187
-        return [
188
-            'Host Name' => $this->getHostName(),
189
-            'MySQL Version' => $wpdb->db_version(),
190
-            'PHP Version' => PHP_VERSION,
191
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
192
-        ];
193
-    }
181
+	/**
182
+	 * @return array
183
+	 */
184
+	public function getServerDetails()
185
+	{
186
+		global $wpdb;
187
+		return [
188
+			'Host Name' => $this->getHostName(),
189
+			'MySQL Version' => $wpdb->db_version(),
190
+			'PHP Version' => PHP_VERSION,
191
+			'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
192
+		];
193
+	}
194 194
 
195
-    /**
196
-     * @return array
197
-     */
198
-    public function getSettingDetails()
199
-    {
200
-        $helper = glsr(Helper::class);
201
-        $settings = glsr(OptionManager::class)->get('settings', []);
202
-        $settings = $helper->flattenArray($settings, true);
203
-        $settings = $this->purgeSensitiveData($settings);
204
-        ksort($settings);
205
-        $details = [];
206
-        foreach ($settings as $key => $value) {
207
-            if ($helper->startsWith('strings', $key) && $helper->endsWith('id', $key)) {
208
-                continue;
209
-            }
210
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
211
-            $details[$key] = $value;
212
-        }
213
-        return $details;
214
-    }
195
+	/**
196
+	 * @return array
197
+	 */
198
+	public function getSettingDetails()
199
+	{
200
+		$helper = glsr(Helper::class);
201
+		$settings = glsr(OptionManager::class)->get('settings', []);
202
+		$settings = $helper->flattenArray($settings, true);
203
+		$settings = $this->purgeSensitiveData($settings);
204
+		ksort($settings);
205
+		$details = [];
206
+		foreach ($settings as $key => $value) {
207
+			if ($helper->startsWith('strings', $key) && $helper->endsWith('id', $key)) {
208
+				continue;
209
+			}
210
+			$value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
211
+			$details[$key] = $value;
212
+		}
213
+		return $details;
214
+	}
215 215
 
216
-    /**
217
-     * @return array
218
-     */
219
-    public function getPluginDetails()
220
-    {
221
-        return [
222
-            'Console level' => glsr(Console::class)->humanLevel(),
223
-            'Console size' => glsr(Console::class)->humanSize('0'),
224
-            'Last Rating Count' => date_i18n('Y-m-d H:i', glsr(OptionManager::class)->get('last_review_count')),
225
-            'Version (current)' => glsr()->version,
226
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
227
-        ];
228
-    }
216
+	/**
217
+	 * @return array
218
+	 */
219
+	public function getPluginDetails()
220
+	{
221
+		return [
222
+			'Console level' => glsr(Console::class)->humanLevel(),
223
+			'Console size' => glsr(Console::class)->humanSize('0'),
224
+			'Last Rating Count' => date_i18n('Y-m-d H:i', glsr(OptionManager::class)->get('last_review_count')),
225
+			'Version (current)' => glsr()->version,
226
+			'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
227
+		];
228
+	}
229 229
 
230
-    /**
231
-     * @return array
232
-     */
233
-    public function getWordpressDetails()
234
-    {
235
-        global $wpdb;
236
-        $theme = wp_get_theme();
237
-        return [
238
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
239
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
240
-            'Home URL' => home_url(),
241
-            'Language' => get_locale(),
242
-            'Memory Limit' => WP_MEMORY_LIMIT,
243
-            'Multisite' => var_export(is_multisite(), true),
244
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
245
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
246
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
247
-            'Post Stati' => implode(', ', get_post_stati()),
248
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
249
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
250
-            'Site URL' => site_url(),
251
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', ini_get('date.timezone').' (PHP)'),
252
-            'Version' => get_bloginfo('version'),
253
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
254
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
255
-            'WP Memory Limit' => WP_MEMORY_LIMIT,
256
-        ];
257
-    }
230
+	/**
231
+	 * @return array
232
+	 */
233
+	public function getWordpressDetails()
234
+	{
235
+		global $wpdb;
236
+		$theme = wp_get_theme();
237
+		return [
238
+			'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
239
+			'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
240
+			'Home URL' => home_url(),
241
+			'Language' => get_locale(),
242
+			'Memory Limit' => WP_MEMORY_LIMIT,
243
+			'Multisite' => var_export(is_multisite(), true),
244
+			'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
245
+			'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
246
+			'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
247
+			'Post Stati' => implode(', ', get_post_stati()),
248
+			'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
249
+			'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
250
+			'Site URL' => site_url(),
251
+			'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', ini_get('date.timezone').' (PHP)'),
252
+			'Version' => get_bloginfo('version'),
253
+			'WP Debug' => var_export(defined('WP_DEBUG'), true),
254
+			'WP Max Upload Size' => size_format(wp_max_upload_size()),
255
+			'WP Memory Limit' => WP_MEMORY_LIMIT,
256
+		];
257
+	}
258 258
 
259
-    /**
260
-     * @return string
261
-     */
262
-    protected function detectWebhostProvider()
263
-    {
264
-        $checks = [
265
-            '.accountservergroup.com' => 'Site5',
266
-            '.gridserver.com' => 'MediaTemple Grid',
267
-            '.inmotionhosting.com' => 'InMotion Hosting',
268
-            '.ovh.net' => 'OVH',
269
-            '.pair.com' => 'pair Networks',
270
-            '.stabletransit.com' => 'Rackspace Cloud',
271
-            '.stratoserver.net' => 'STRATO',
272
-            '.sysfix.eu' => 'SysFix.eu Power Hosting',
273
-            'bluehost.com' => 'Bluehost',
274
-            'DH_USER' => 'DreamHost',
275
-            'Flywheel' => 'Flywheel',
276
-            'ipagemysql.com' => 'iPage',
277
-            'ipowermysql.com' => 'IPower',
278
-            'localhost:/tmp/mysql5.sock' => 'ICDSoft',
279
-            'mysqlv5' => 'NetworkSolutions',
280
-            'PAGELYBIN' => 'Pagely',
281
-            'secureserver.net' => 'GoDaddy',
282
-            'WPE_APIKEY' => 'WP Engine',
283
-        ];
284
-        foreach ($checks as $key => $value) {
285
-            if (!$this->isWebhostCheckValid($key)) {
286
-                continue;
287
-            }
288
-            return $value;
289
-        }
290
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
291
-    }
259
+	/**
260
+	 * @return string
261
+	 */
262
+	protected function detectWebhostProvider()
263
+	{
264
+		$checks = [
265
+			'.accountservergroup.com' => 'Site5',
266
+			'.gridserver.com' => 'MediaTemple Grid',
267
+			'.inmotionhosting.com' => 'InMotion Hosting',
268
+			'.ovh.net' => 'OVH',
269
+			'.pair.com' => 'pair Networks',
270
+			'.stabletransit.com' => 'Rackspace Cloud',
271
+			'.stratoserver.net' => 'STRATO',
272
+			'.sysfix.eu' => 'SysFix.eu Power Hosting',
273
+			'bluehost.com' => 'Bluehost',
274
+			'DH_USER' => 'DreamHost',
275
+			'Flywheel' => 'Flywheel',
276
+			'ipagemysql.com' => 'iPage',
277
+			'ipowermysql.com' => 'IPower',
278
+			'localhost:/tmp/mysql5.sock' => 'ICDSoft',
279
+			'mysqlv5' => 'NetworkSolutions',
280
+			'PAGELYBIN' => 'Pagely',
281
+			'secureserver.net' => 'GoDaddy',
282
+			'WPE_APIKEY' => 'WP Engine',
283
+		];
284
+		foreach ($checks as $key => $value) {
285
+			if (!$this->isWebhostCheckValid($key)) {
286
+				continue;
287
+			}
288
+			return $value;
289
+		}
290
+		return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
291
+	}
292 292
 
293
-    /**
294
-     * @return string
295
-     */
296
-    protected function getHostName()
297
-    {
298
-        return sprintf('%s (%s)',
299
-            $this->detectWebhostProvider(),
300
-            glsr(Helper::class)->getIpAddress()
301
-        );
302
-    }
293
+	/**
294
+	 * @return string
295
+	 */
296
+	protected function getHostName()
297
+	{
298
+		return sprintf('%s (%s)',
299
+			$this->detectWebhostProvider(),
300
+			glsr(Helper::class)->getIpAddress()
301
+		);
302
+	}
303 303
 
304
-    /**
305
-     * @return array
306
-     */
307
-    protected function getWordpressPlugins()
308
-    {
309
-        $plugins = get_plugins();
310
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
311
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
312
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
313
-        return $active + $inactive;
314
-    }
304
+	/**
305
+	 * @return array
306
+	 */
307
+	protected function getWordpressPlugins()
308
+	{
309
+		$plugins = get_plugins();
310
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
311
+		$inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
312
+		$active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
313
+		return $active + $inactive;
314
+	}
315 315
 
316
-    /**
317
-     * @param string $title
318
-     * @return string
319
-     */
320
-    protected function implode($title, array $details)
321
-    {
322
-        $strings = ['['.$title.']'];
323
-        $padding = max(array_map('strlen', array_keys($details)));
324
-        $padding = max([$padding, static::PAD]);
325
-        foreach ($details as $key => $value) {
326
-            $strings[] = is_string($key)
327
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
328
-                : ' - '.$value;
329
-        }
330
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
331
-    }
316
+	/**
317
+	 * @param string $title
318
+	 * @return string
319
+	 */
320
+	protected function implode($title, array $details)
321
+	{
322
+		$strings = ['['.$title.']'];
323
+		$padding = max(array_map('strlen', array_keys($details)));
324
+		$padding = max([$padding, static::PAD]);
325
+		foreach ($details as $key => $value) {
326
+			$strings[] = is_string($key)
327
+				? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
328
+				: ' - '.$value;
329
+		}
330
+		return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
331
+	}
332 332
 
333
-    /**
334
-     * @param string $key
335
-     * @return bool
336
-     */
337
-    protected function isWebhostCheckValid($key)
338
-    {
339
-        return defined($key)
340
-            || filter_input(INPUT_SERVER, $key)
341
-            || false !== strpos(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
342
-            || false !== strpos(DB_HOST, $key)
343
-            || false !== strpos(php_uname(), $key);
344
-    }
333
+	/**
334
+	 * @param string $key
335
+	 * @return bool
336
+	 */
337
+	protected function isWebhostCheckValid($key)
338
+	{
339
+		return defined($key)
340
+			|| filter_input(INPUT_SERVER, $key)
341
+			|| false !== strpos(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
342
+			|| false !== strpos(DB_HOST, $key)
343
+			|| false !== strpos(php_uname(), $key);
344
+	}
345 345
 
346
-    /**
347
-     * @return array
348
-     */
349
-    protected function normalizePluginList(array $plugins)
350
-    {
351
-        $plugins = array_map(function ($plugin) {
352
-            return sprintf('%s v%s', glsr_get($plugin, 'Name'), glsr_get($plugin, 'Version'));
353
-        }, $plugins);
354
-        natcasesort($plugins);
355
-        return array_flip($plugins);
356
-    }
346
+	/**
347
+	 * @return array
348
+	 */
349
+	protected function normalizePluginList(array $plugins)
350
+	{
351
+		$plugins = array_map(function ($plugin) {
352
+			return sprintf('%s v%s', glsr_get($plugin, 'Name'), glsr_get($plugin, 'Version'));
353
+		}, $plugins);
354
+		natcasesort($plugins);
355
+		return array_flip($plugins);
356
+	}
357 357
 
358
-    /**
359
-     * @return array
360
-     */
361
-    protected function purgeSensitiveData(array $settings)
362
-    {
363
-        $keys = [
364
-            'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret',
365
-        ];
366
-        array_walk($settings, function (&$value, $setting) use ($keys) {
367
-            foreach ($keys as $key) {
368
-                if (!glsr(Helper::class)->startsWith($key, $setting) || empty($value)) {
369
-                    continue;
370
-                }
371
-                $value = str_repeat('•', 13);
372
-                return;
373
-            }
374
-        });
375
-        return $settings;
376
-    }
358
+	/**
359
+	 * @return array
360
+	 */
361
+	protected function purgeSensitiveData(array $settings)
362
+	{
363
+		$keys = [
364
+			'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret',
365
+		];
366
+		array_walk($settings, function (&$value, $setting) use ($keys) {
367
+			foreach ($keys as $key) {
368
+				if (!glsr(Helper::class)->startsWith($key, $setting) || empty($value)) {
369
+					continue;
370
+				}
371
+				$value = str_repeat('•', 13);
372
+				return;
373
+			}
374
+		});
375
+		return $settings;
376
+	}
377 377
 }
Please login to merge, or discard this patch.
plugin/Modules/Notification.php 1 patch
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -8,164 +8,164 @@
 block discarded – undo
8 8
 
9 9
 class Notification
10 10
 {
11
-    /**
12
-     * @var bool
13
-     */
14
-    protected $email;
11
+	/**
12
+	 * @var bool
13
+	 */
14
+	protected $email;
15 15
 
16
-    /**
17
-     * @var Review
18
-     */
19
-    protected $review;
16
+	/**
17
+	 * @var Review
18
+	 */
19
+	protected $review;
20 20
 
21
-    /**
22
-     * @var bool
23
-     */
24
-    protected $slack;
21
+	/**
22
+	 * @var bool
23
+	 */
24
+	protected $slack;
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    protected $types;
26
+	/**
27
+	 * @var array
28
+	 */
29
+	protected $types;
30 30
 
31
-    public function __construct()
32
-    {
33
-        $types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
-        $this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
-        $this->slack = in_array('slack', $types);
36
-        $this->types = $types;
37
-    }
31
+	public function __construct()
32
+	{
33
+		$types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
+		$this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
+		$this->slack = in_array('slack', $types);
36
+		$this->types = $types;
37
+	}
38 38
 
39
-    /**
40
-     * @return void
41
-     */
42
-    public function send(Review $review)
43
-    {
44
-        if (empty($this->types)) {
45
-            return;
46
-        }
47
-        $this->review = $review;
48
-        $args = [
49
-            'link' => $this->getLink(),
50
-            'title' => $this->getTitle(),
51
-        ];
52
-        $this->sendToEmail($args);
53
-        $this->sendToSlack($args);
54
-    }
39
+	/**
40
+	 * @return void
41
+	 */
42
+	public function send(Review $review)
43
+	{
44
+		if (empty($this->types)) {
45
+			return;
46
+		}
47
+		$this->review = $review;
48
+		$args = [
49
+			'link' => $this->getLink(),
50
+			'title' => $this->getTitle(),
51
+		];
52
+		$this->sendToEmail($args);
53
+		$this->sendToSlack($args);
54
+	}
55 55
 
56
-    /**
57
-     * @return Email
58
-     */
59
-    protected function buildEmail(array $args)
60
-    {
61
-        return glsr(Email::class)->compose([
62
-            'to' => $this->getEmailAddresses(),
63
-            'subject' => $args['title'],
64
-            'template' => 'email-notification',
65
-            'template-tags' => [
66
-                'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
-                'review_content' => $this->review->content,
68
-                'review_email' => $this->review->email,
69
-                'review_ip' => $this->review->ip_address,
70
-                'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
-                'review_rating' => $this->review->rating,
72
-                'review_title' => $this->review->title,
73
-            ],
74
-        ]);
75
-    }
56
+	/**
57
+	 * @return Email
58
+	 */
59
+	protected function buildEmail(array $args)
60
+	{
61
+		return glsr(Email::class)->compose([
62
+			'to' => $this->getEmailAddresses(),
63
+			'subject' => $args['title'],
64
+			'template' => 'email-notification',
65
+			'template-tags' => [
66
+				'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
+				'review_content' => $this->review->content,
68
+				'review_email' => $this->review->email,
69
+				'review_ip' => $this->review->ip_address,
70
+				'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
+				'review_rating' => $this->review->rating,
72
+				'review_title' => $this->review->title,
73
+			],
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @return Slack
79
-     */
80
-    protected function buildSlackNotification(array $args)
81
-    {
82
-        return glsr(Slack::class)->compose($this->review, [
83
-            'button_url' => $args['link'],
84
-            'fallback' => $this->buildEmail($args)->read('plaintext'),
85
-            'pretext' => $args['title'],
86
-        ]);
87
-    }
77
+	/**
78
+	 * @return Slack
79
+	 */
80
+	protected function buildSlackNotification(array $args)
81
+	{
82
+		return glsr(Slack::class)->compose($this->review, [
83
+			'button_url' => $args['link'],
84
+			'fallback' => $this->buildEmail($args)->read('plaintext'),
85
+			'pretext' => $args['title'],
86
+		]);
87
+	}
88 88
 
89
-    /**
90
-     * @return array
91
-     */
92
-    protected function getEmailAddresses()
93
-    {
94
-        $emails = [];
95
-        if (in_array('admin', $this->types)) {
96
-            $emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
-        }
98
-        if (in_array('author', $this->types)) {
99
-            $assignedPost = get_post(intval($this->review->assigned_to));
100
-            if ($assignedPost instanceof WP_Post) {
101
-                $this->email = true;
102
-                $emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
-            }
104
-        }
105
-        if (in_array('custom', $this->types)) {
106
-            $customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
-            $customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
-            $customEmails = explode(',', $customEmails);
109
-            $emails = array_merge($emails, $customEmails);
110
-        }
111
-        $emails = array_filter(array_keys(array_flip($emails)));
112
-        return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
-    }
89
+	/**
90
+	 * @return array
91
+	 */
92
+	protected function getEmailAddresses()
93
+	{
94
+		$emails = [];
95
+		if (in_array('admin', $this->types)) {
96
+			$emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
+		}
98
+		if (in_array('author', $this->types)) {
99
+			$assignedPost = get_post(intval($this->review->assigned_to));
100
+			if ($assignedPost instanceof WP_Post) {
101
+				$this->email = true;
102
+				$emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
+			}
104
+		}
105
+		if (in_array('custom', $this->types)) {
106
+			$customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
+			$customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
+			$customEmails = explode(',', $customEmails);
109
+			$emails = array_merge($emails, $customEmails);
110
+		}
111
+		$emails = array_filter(array_keys(array_flip($emails)));
112
+		return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
+	}
114 114
 
115
-    /**
116
-     * @return string
117
-     */
118
-    protected function getLink()
119
-    {
120
-        return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
-    }
115
+	/**
116
+	 * @return string
117
+	 */
118
+	protected function getLink()
119
+	{
120
+		return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
+	}
122 122
 
123
-    /**
124
-     * @return string
125
-     */
126
-    protected function getTitle()
127
-    {
128
-        $assignedTitle = get_the_title(intval($this->review->assigned_to));
129
-        $title = _nx(
130
-            'New %s-star review',
131
-            'New %s-star review of: %s',
132
-            intval(empty($assignedTitle)),
133
-            'This string differs depending on whether or not the review has been assigned to a post.',
134
-            'site-reviews'
135
-        );
136
-        $title = sprintf('[%s] %s',
137
-            wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
-            sprintf($title, $this->review->rating, $assignedTitle)
139
-        );
140
-        return apply_filters('site-reviews/notification/title', $title, $this->review);
141
-    }
123
+	/**
124
+	 * @return string
125
+	 */
126
+	protected function getTitle()
127
+	{
128
+		$assignedTitle = get_the_title(intval($this->review->assigned_to));
129
+		$title = _nx(
130
+			'New %s-star review',
131
+			'New %s-star review of: %s',
132
+			intval(empty($assignedTitle)),
133
+			'This string differs depending on whether or not the review has been assigned to a post.',
134
+			'site-reviews'
135
+		);
136
+		$title = sprintf('[%s] %s',
137
+			wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
+			sprintf($title, $this->review->rating, $assignedTitle)
139
+		);
140
+		return apply_filters('site-reviews/notification/title', $title, $this->review);
141
+	}
142 142
 
143
-    /**
144
-     * @return void
145
-     */
146
-    protected function sendToEmail(array $args)
147
-    {
148
-        $email = $this->buildEmail($args);
149
-        if (empty($email->to)) {
150
-            glsr_log()->error('Email notification was not sent (missing email address)');
151
-            return;
152
-        }
153
-        $email->send();
154
-    }
143
+	/**
144
+	 * @return void
145
+	 */
146
+	protected function sendToEmail(array $args)
147
+	{
148
+		$email = $this->buildEmail($args);
149
+		if (empty($email->to)) {
150
+			glsr_log()->error('Email notification was not sent (missing email address)');
151
+			return;
152
+		}
153
+		$email->send();
154
+	}
155 155
 
156
-    /**
157
-     * @return void
158
-     */
159
-    protected function sendToSlack(array $args)
160
-    {
161
-        if (!$this->slack) {
162
-            return;
163
-        }
164
-        $notification = $this->buildSlackNotification($args);
165
-        $result = $notification->send();
166
-        if (is_wp_error($result)) {
167
-            $notification->review = null;
168
-            glsr_log()->error($result->get_error_message())->debug($notification);
169
-        }
170
-    }
156
+	/**
157
+	 * @return void
158
+	 */
159
+	protected function sendToSlack(array $args)
160
+	{
161
+		if (!$this->slack) {
162
+			return;
163
+		}
164
+		$notification = $this->buildSlackNotification($args);
165
+		$result = $notification->send();
166
+		if (is_wp_error($result)) {
167
+			$notification->review = null;
168
+			glsr_log()->error($result->get_error_message())->debug($notification);
169
+		}
170
+	}
171 171
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Metaboxes.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@
 block discarded – undo
7 7
 
8 8
 class Metaboxes
9 9
 {
10
-    /**
11
-     * @param int $postId
12
-     * @return void
13
-     */
14
-    public function saveAssignedToMetabox($postId)
15
-    {
16
-        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-assigned-to'), 'assigned_to')) {
17
-            return;
18
-        }
19
-        $assignedTo = strval(glsr(Helper::class)->filterInput('assigned_to'));
20
-        glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
21
-    }
10
+	/**
11
+	 * @param int $postId
12
+	 * @return void
13
+	 */
14
+	public function saveAssignedToMetabox($postId)
15
+	{
16
+		if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-assigned-to'), 'assigned_to')) {
17
+			return;
18
+		}
19
+		$assignedTo = strval(glsr(Helper::class)->filterInput('assigned_to'));
20
+		glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
21
+	}
22 22
 
23
-    /**
24
-     * @param int $postId
25
-     * @return mixed
26
-     */
27
-    public function saveResponseMetabox($postId)
28
-    {
29
-        if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-response'), 'response')) {
30
-            return;
31
-        }
32
-        $response = strval(glsr(Helper::class)->filterInput('response'));
33
-        glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
34
-            'a' => ['href' => [], 'title' => []],
35
-            'em' => [],
36
-            'strong' => [],
37
-        ])));
38
-    }
23
+	/**
24
+	 * @param int $postId
25
+	 * @return mixed
26
+	 */
27
+	public function saveResponseMetabox($postId)
28
+	{
29
+		if (!wp_verify_nonce(glsr(Helper::class)->filterInput('_nonce-response'), 'response')) {
30
+			return;
31
+		}
32
+		$response = strval(glsr(Helper::class)->filterInput('response'));
33
+		glsr(Database::class)->update($postId, 'response', trim(wp_kses($response, [
34
+			'a' => ['href' => [], 'title' => []],
35
+			'em' => [],
36
+			'strong' => [],
37
+		])));
38
+	}
39 39
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Customization.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@
 block discarded – undo
7 7
 
8 8
 class Customization
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function filterEditorSettings(array $settings)
14
-    {
15
-        if ($this->isReviewEditable()) {
16
-            $settings = [
17
-                'media_buttons' => false,
18
-                'quicktags' => false,
19
-                'textarea_rows' => 12,
20
-                'tinymce' => false,
21
-            ];
22
-        }
23
-        return $settings;
24
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function filterEditorSettings(array $settings)
14
+	{
15
+		if ($this->isReviewEditable()) {
16
+			$settings = [
17
+				'media_buttons' => false,
18
+				'quicktags' => false,
19
+				'textarea_rows' => 12,
20
+				'tinymce' => false,
21
+			];
22
+		}
23
+		return $settings;
24
+	}
25 25
 
26
-    /**
27
-     * @param string $html
28
-     * @return string
29
-     */
30
-    public function filterEditorTextarea($html)
31
-    {
32
-        if ($this->isReviewEditable()) {
33
-            $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
-        }
35
-        return $html;
36
-    }
26
+	/**
27
+	 * @param string $html
28
+	 * @return string
29
+	 */
30
+	public function filterEditorTextarea($html)
31
+	{
32
+		if ($this->isReviewEditable()) {
33
+			$html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
+		}
35
+		return $html;
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function removeAutosave()
42
-    {
43
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
-            return;
45
-        }
46
-        wp_deregister_script('autosave');
47
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function removeAutosave()
42
+	{
43
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
+			return;
45
+		}
46
+		wp_deregister_script('autosave');
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     */
52
-    public function removeMetaBoxes()
53
-    {
54
-        remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
-    }
49
+	/**
50
+	 * @return void
51
+	 */
52
+	public function removeMetaBoxes()
53
+	{
54
+		remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
+	}
56 56
 
57
-    /**
58
-     * @return void
59
-     */
60
-    public function removePostTypeSupport()
61
-    {
62
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
-            return;
64
-        }
65
-        remove_post_type_support(Application::POST_TYPE, 'title');
66
-        remove_post_type_support(Application::POST_TYPE, 'editor');
67
-    }
57
+	/**
58
+	 * @return void
59
+	 */
60
+	public function removePostTypeSupport()
61
+	{
62
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
+			return;
64
+		}
65
+		remove_post_type_support(Application::POST_TYPE, 'title');
66
+		remove_post_type_support(Application::POST_TYPE, 'editor');
67
+	}
68 68
 
69
-    /**
70
-     * @return bool
71
-     */
72
-    protected function isReviewEditable()
73
-    {
74
-        $postId = intval(filter_input(INPUT_GET, 'post'));
75
-        return $postId > 0
76
-            && 'local' == glsr(Database::class)->get($postId, 'review_type')
77
-            && $this->isReviewEditor();
78
-    }
69
+	/**
70
+	 * @return bool
71
+	 */
72
+	protected function isReviewEditable()
73
+	{
74
+		$postId = intval(filter_input(INPUT_GET, 'post'));
75
+		return $postId > 0
76
+			&& 'local' == glsr(Database::class)->get($postId, 'review_type')
77
+			&& $this->isReviewEditor();
78
+	}
79 79
 
80
-    /**
81
-     * @return bool
82
-     */
83
-    protected function isReviewEditor()
84
-    {
85
-        $screen = glsr_current_screen();
86
-        return 'post' == $screen->base
87
-            && Application::POST_TYPE == $screen->id
88
-            && Application::POST_TYPE == $screen->post_type;
89
-    }
80
+	/**
81
+	 * @return bool
82
+	 */
83
+	protected function isReviewEditor()
84
+	{
85
+		$screen = glsr_current_screen();
86
+		return 'post' == $screen->base
87
+			&& Application::POST_TYPE == $screen->id
88
+			&& Application::POST_TYPE == $screen->post_type;
89
+	}
90 90
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -10,141 +10,141 @@
 block discarded – undo
10 10
 
11 11
 class Columns
12 12
 {
13
-    /**
14
-     * @param int $postId
15
-     * @return string
16
-     */
17
-    public function buildColumnAssignedTo($postId)
18
-    {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        $column = '&mdash;';
21
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
22
-            $column = glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
23
-                'href' => (string) get_the_permalink($assignedPost->ID),
24
-            ]);
25
-        }
26
-        return $column;
27
-    }
13
+	/**
14
+	 * @param int $postId
15
+	 * @return string
16
+	 */
17
+	public function buildColumnAssignedTo($postId)
18
+	{
19
+		$assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
+		$column = '&mdash;';
21
+		if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
22
+			$column = glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
23
+				'href' => (string) get_the_permalink($assignedPost->ID),
24
+			]);
25
+		}
26
+		return $column;
27
+	}
28 28
 
29
-    /**
30
-     * @param int $postId
31
-     * @return string
32
-     */
33
-    public function buildColumnPinned($postId)
34
-    {
35
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
36
-            ? 'pinned '
37
-            : '';
38
-        return glsr(Builder::class)->i([
39
-            'class' => $pinned.'dashicons dashicons-sticky',
40
-            'data-id' => $postId,
41
-        ]);
42
-    }
29
+	/**
30
+	 * @param int $postId
31
+	 * @return string
32
+	 */
33
+	public function buildColumnPinned($postId)
34
+	{
35
+		$pinned = glsr(Database::class)->get($postId, 'pinned')
36
+			? 'pinned '
37
+			: '';
38
+		return glsr(Builder::class)->i([
39
+			'class' => $pinned.'dashicons dashicons-sticky',
40
+			'data-id' => $postId,
41
+		]);
42
+	}
43 43
 
44
-    /**
45
-     * @param int $postId
46
-     * @return string
47
-     */
48
-    public function buildColumnReviewer($postId)
49
-    {
50
-        return strval(glsr(Database::class)->get($postId, 'author'));
51
-    }
44
+	/**
45
+	 * @param int $postId
46
+	 * @return string
47
+	 */
48
+	public function buildColumnReviewer($postId)
49
+	{
50
+		return strval(glsr(Database::class)->get($postId, 'author'));
51
+	}
52 52
 
53
-    /**
54
-     * @param int $postId
55
-     * @param int|null $rating
56
-     * @return string
57
-     */
58
-    public function buildColumnRating($postId)
59
-    {
60
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
61
-    }
53
+	/**
54
+	 * @param int $postId
55
+	 * @param int|null $rating
56
+	 * @return string
57
+	 */
58
+	public function buildColumnRating($postId)
59
+	{
60
+		return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
61
+	}
62 62
 
63
-    /**
64
-     * @param int $postId
65
-     * @return string
66
-     */
67
-    public function buildColumnReviewType($postId)
68
-    {
69
-        $type = glsr(Database::class)->get($postId, 'review_type');
70
-        return array_key_exists($type, glsr()->reviewTypes)
71
-            ? glsr()->reviewTypes[$type]
72
-            : __('Unsupported Type', 'site-reviews');
73
-    }
63
+	/**
64
+	 * @param int $postId
65
+	 * @return string
66
+	 */
67
+	public function buildColumnReviewType($postId)
68
+	{
69
+		$type = glsr(Database::class)->get($postId, 'review_type');
70
+		return array_key_exists($type, glsr()->reviewTypes)
71
+			? glsr()->reviewTypes[$type]
72
+			: __('Unsupported Type', 'site-reviews');
73
+	}
74 74
 
75
-    /**
76
-     * @param string $postType
77
-     * @return void
78
-     */
79
-    public function renderFilters($postType)
80
-    {
81
-        if (Application::POST_TYPE !== $postType) {
82
-            return;
83
-        }
84
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
85
-            $status = 'publish';
86
-        }
87
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
88
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
89
-        $this->renderFilterRatings($ratings);
90
-        $this->renderFilterTypes($types);
91
-    }
75
+	/**
76
+	 * @param string $postType
77
+	 * @return void
78
+	 */
79
+	public function renderFilters($postType)
80
+	{
81
+		if (Application::POST_TYPE !== $postType) {
82
+			return;
83
+		}
84
+		if (!($status = filter_input(INPUT_GET, 'post_status'))) {
85
+			$status = 'publish';
86
+		}
87
+		$ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
88
+		$types = glsr(Database::class)->getReviewsMeta('review_type', $status);
89
+		$this->renderFilterRatings($ratings);
90
+		$this->renderFilterTypes($types);
91
+	}
92 92
 
93
-    /**
94
-     * @param string $column
95
-     * @param int $postId
96
-     * @return void
97
-     */
98
-    public function renderValues($column, $postId)
99
-    {
100
-        $method = glsr(Helper::class)->buildMethodName($column, 'buildColumn');
101
-        echo method_exists($this, $method)
102
-            ? call_user_func([$this, $method], $postId)
103
-            : apply_filters('site-reviews/columns/'.$column, '', $postId);
104
-    }
93
+	/**
94
+	 * @param string $column
95
+	 * @param int $postId
96
+	 * @return void
97
+	 */
98
+	public function renderValues($column, $postId)
99
+	{
100
+		$method = glsr(Helper::class)->buildMethodName($column, 'buildColumn');
101
+		echo method_exists($this, $method)
102
+			? call_user_func([$this, $method], $postId)
103
+			: apply_filters('site-reviews/columns/'.$column, '', $postId);
104
+	}
105 105
 
106
-    /**
107
-     * @param array $ratings
108
-     * @return void
109
-     */
110
-    protected function renderFilterRatings($ratings)
111
-    {
112
-        if (empty($ratings)) {
113
-            return;
114
-        }
115
-        $ratings = array_flip(array_reverse($ratings));
116
-        array_walk($ratings, function (&$value, $key) {
117
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
118
-            $value = sprintf($label, $key);
119
-        });
120
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
121
-            'class' => 'screen-reader-text',
122
-            'for' => 'rating',
123
-        ]);
124
-        echo glsr(Builder::class)->select([
125
-            'name' => 'rating',
126
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
127
-            'value' => filter_input(INPUT_GET, 'rating'),
128
-        ]);
129
-    }
106
+	/**
107
+	 * @param array $ratings
108
+	 * @return void
109
+	 */
110
+	protected function renderFilterRatings($ratings)
111
+	{
112
+		if (empty($ratings)) {
113
+			return;
114
+		}
115
+		$ratings = array_flip(array_reverse($ratings));
116
+		array_walk($ratings, function (&$value, $key) {
117
+			$label = _n('%s star', '%s stars', $key, 'site-reviews');
118
+			$value = sprintf($label, $key);
119
+		});
120
+		echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
121
+			'class' => 'screen-reader-text',
122
+			'for' => 'rating',
123
+		]);
124
+		echo glsr(Builder::class)->select([
125
+			'name' => 'rating',
126
+			'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
127
+			'value' => filter_input(INPUT_GET, 'rating'),
128
+		]);
129
+	}
130 130
 
131
-    /**
132
-     * @param array $types
133
-     * @return void
134
-     */
135
-    protected function renderFilterTypes($types)
136
-    {
137
-        if (count(glsr()->reviewTypes) < 2) {
138
-            return;
139
-        }
140
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
141
-            'class' => 'screen-reader-text',
142
-            'for' => 'review_type',
143
-        ]);
144
-        echo glsr(Builder::class)->select([
145
-            'name' => 'review_type',
146
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
147
-            'value' => filter_input(INPUT_GET, 'review_type'),
148
-        ]);
149
-    }
131
+	/**
132
+	 * @param array $types
133
+	 * @return void
134
+	 */
135
+	protected function renderFilterTypes($types)
136
+	{
137
+		if (count(glsr()->reviewTypes) < 2) {
138
+			return;
139
+		}
140
+		echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
141
+			'class' => 'screen-reader-text',
142
+			'for' => 'review_type',
143
+		]);
144
+		echo glsr(Builder::class)->select([
145
+			'name' => 'review_type',
146
+			'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
147
+			'value' => filter_input(INPUT_GET, 'review_type'),
148
+		]);
149
+	}
150 150
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 1 patch
Indentation   +323 added lines, -323 removed lines patch added patch discarded remove patch
@@ -13,346 +13,346 @@
 block discarded – undo
13 13
 
14 14
 class ListTableController extends Controller
15 15
 {
16
-    /**
17
-     * @return void
18
-     * @action admin_action_approve
19
-     */
20
-    public function approve()
21
-    {
22
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
23
-            return;
24
-        }
25
-        check_admin_referer('approve-review_'.($postId = $this->getPostId()));
26
-        wp_update_post([
27
-            'ID' => $postId,
28
-            'post_status' => 'publish',
29
-        ]);
30
-        wp_safe_redirect(wp_get_referer());
31
-        exit;
32
-    }
16
+	/**
17
+	 * @return void
18
+	 * @action admin_action_approve
19
+	 */
20
+	public function approve()
21
+	{
22
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
23
+			return;
24
+		}
25
+		check_admin_referer('approve-review_'.($postId = $this->getPostId()));
26
+		wp_update_post([
27
+			'ID' => $postId,
28
+			'post_status' => 'publish',
29
+		]);
30
+		wp_safe_redirect(wp_get_referer());
31
+		exit;
32
+	}
33 33
 
34
-    /**
35
-     * @param array $messages
36
-     * @return array
37
-     * @filter bulk_post_updated_messages
38
-     */
39
-    public function filterBulkUpdateMessages($messages, array $counts)
40
-    {
41
-        $messages = glsr(Helper::class)->consolidateArray($messages);
42
-        $messages[Application::POST_TYPE] = [
43
-            'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'),
44
-            'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'),
45
-            'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'),
46
-            'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'),
47
-            'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'),
48
-        ];
49
-        return $messages;
50
-    }
34
+	/**
35
+	 * @param array $messages
36
+	 * @return array
37
+	 * @filter bulk_post_updated_messages
38
+	 */
39
+	public function filterBulkUpdateMessages($messages, array $counts)
40
+	{
41
+		$messages = glsr(Helper::class)->consolidateArray($messages);
42
+		$messages[Application::POST_TYPE] = [
43
+			'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'),
44
+			'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'),
45
+			'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'),
46
+			'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'),
47
+			'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'),
48
+		];
49
+		return $messages;
50
+	}
51 51
 
52
-    /**
53
-     * @param array $columns
54
-     * @return array
55
-     * @filter manage_.Application::POST_TYPE._posts_columns
56
-     */
57
-    public function filterColumnsForPostType($columns)
58
-    {
59
-        $columns = glsr(Helper::class)->consolidateArray($columns);
60
-        $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
61
-        foreach ($postTypeColumns as $key => &$value) {
62
-            if (!array_key_exists($key, $columns) || !empty($value)) {
63
-                continue;
64
-            }
65
-            $value = $columns[$key];
66
-        }
67
-        if (count(glsr(Database::class)->getReviewsMeta('review_type')) < 2) {
68
-            unset($postTypeColumns['review_type']);
69
-        }
70
-        return array_filter($postTypeColumns, 'strlen');
71
-    }
52
+	/**
53
+	 * @param array $columns
54
+	 * @return array
55
+	 * @filter manage_.Application::POST_TYPE._posts_columns
56
+	 */
57
+	public function filterColumnsForPostType($columns)
58
+	{
59
+		$columns = glsr(Helper::class)->consolidateArray($columns);
60
+		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
61
+		foreach ($postTypeColumns as $key => &$value) {
62
+			if (!array_key_exists($key, $columns) || !empty($value)) {
63
+				continue;
64
+			}
65
+			$value = $columns[$key];
66
+		}
67
+		if (count(glsr(Database::class)->getReviewsMeta('review_type')) < 2) {
68
+			unset($postTypeColumns['review_type']);
69
+		}
70
+		return array_filter($postTypeColumns, 'strlen');
71
+	}
72 72
 
73
-    /**
74
-     * @param string $status
75
-     * @param WP_Post $post
76
-     * @return string
77
-     * @filter post_date_column_status
78
-     */
79
-    public function filterDateColumnStatus($status, $post)
80
-    {
81
-        if (Application::POST_TYPE == glsr_get($post, 'post_type')) {
82
-            $status = __('Submitted', 'site-reviews');
83
-        }
84
-        return $status;
85
-    }
73
+	/**
74
+	 * @param string $status
75
+	 * @param WP_Post $post
76
+	 * @return string
77
+	 * @filter post_date_column_status
78
+	 */
79
+	public function filterDateColumnStatus($status, $post)
80
+	{
81
+		if (Application::POST_TYPE == glsr_get($post, 'post_type')) {
82
+			$status = __('Submitted', 'site-reviews');
83
+		}
84
+		return $status;
85
+	}
86 86
 
87
-    /**
88
-     * @param array $hidden
89
-     * @param WP_Screen $post
90
-     * @return array
91
-     * @filter default_hidden_columns
92
-     */
93
-    public function filterDefaultHiddenColumns($hidden, $screen)
94
-    {
95
-        if (glsr_get($screen, 'id') == 'edit-'.Application::POST_TYPE) {
96
-            $hidden = glsr(Helper::class)->consolidateArray($hidden);
97
-            $hidden = ['reviewer'];
98
-        }
99
-        return $hidden;
100
-    }
87
+	/**
88
+	 * @param array $hidden
89
+	 * @param WP_Screen $post
90
+	 * @return array
91
+	 * @filter default_hidden_columns
92
+	 */
93
+	public function filterDefaultHiddenColumns($hidden, $screen)
94
+	{
95
+		if (glsr_get($screen, 'id') == 'edit-'.Application::POST_TYPE) {
96
+			$hidden = glsr(Helper::class)->consolidateArray($hidden);
97
+			$hidden = ['reviewer'];
98
+		}
99
+		return $hidden;
100
+	}
101 101
 
102
-    /**
103
-     * @param array $postStates
104
-     * @param WP_Post $post
105
-     * @return array
106
-     * @filter display_post_states
107
-     */
108
-    public function filterPostStates($postStates, $post)
109
-    {
110
-        $postStates = glsr(Helper::class)->consolidateArray($postStates);
111
-        if (Application::POST_TYPE == glsr_get($post, 'post_type') && array_key_exists('pending', $postStates)) {
112
-            $postStates['pending'] = __('Unapproved', 'site-reviews');
113
-        }
114
-        return $postStates;
115
-    }
102
+	/**
103
+	 * @param array $postStates
104
+	 * @param WP_Post $post
105
+	 * @return array
106
+	 * @filter display_post_states
107
+	 */
108
+	public function filterPostStates($postStates, $post)
109
+	{
110
+		$postStates = glsr(Helper::class)->consolidateArray($postStates);
111
+		if (Application::POST_TYPE == glsr_get($post, 'post_type') && array_key_exists('pending', $postStates)) {
112
+			$postStates['pending'] = __('Unapproved', 'site-reviews');
113
+		}
114
+		return $postStates;
115
+	}
116 116
 
117
-    /**
118
-     * @param array $actions
119
-     * @param WP_Post $post
120
-     * @return array
121
-     * @filter post_row_actions
122
-     */
123
-    public function filterRowActions($actions, $post)
124
-    {
125
-        if (Application::POST_TYPE != glsr_get($post, 'post_type') || 'trash' == $post->post_status) {
126
-            return $actions;
127
-        }
128
-        unset($actions['inline hide-if-no-js']); //Remove Quick-edit
129
-        $rowActions = [
130
-            'approve' => esc_attr__('Approve', 'site-reviews'),
131
-            'unapprove' => esc_attr__('Unapprove', 'site-reviews'),
132
-        ];
133
-        $newActions = [];
134
-        foreach ($rowActions as $key => $text) {
135
-            $newActions[$key] = glsr(Builder::class)->a($text, [
136
-                'aria-label' => sprintf(esc_attr_x('%s this review', 'Approve the review', 'site-reviews'), $text),
137
-                'class' => 'glsr-change-status',
138
-                'href' => wp_nonce_url(
139
-                    admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID),
140
-                    $key.'-review_'.$post->ID
141
-                ),
142
-            ]);
143
-        }
144
-        return $newActions + glsr(Helper::class)->consolidateArray($actions);
145
-    }
117
+	/**
118
+	 * @param array $actions
119
+	 * @param WP_Post $post
120
+	 * @return array
121
+	 * @filter post_row_actions
122
+	 */
123
+	public function filterRowActions($actions, $post)
124
+	{
125
+		if (Application::POST_TYPE != glsr_get($post, 'post_type') || 'trash' == $post->post_status) {
126
+			return $actions;
127
+		}
128
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
129
+		$rowActions = [
130
+			'approve' => esc_attr__('Approve', 'site-reviews'),
131
+			'unapprove' => esc_attr__('Unapprove', 'site-reviews'),
132
+		];
133
+		$newActions = [];
134
+		foreach ($rowActions as $key => $text) {
135
+			$newActions[$key] = glsr(Builder::class)->a($text, [
136
+				'aria-label' => sprintf(esc_attr_x('%s this review', 'Approve the review', 'site-reviews'), $text),
137
+				'class' => 'glsr-change-status',
138
+				'href' => wp_nonce_url(
139
+					admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID),
140
+					$key.'-review_'.$post->ID
141
+				),
142
+			]);
143
+		}
144
+		return $newActions + glsr(Helper::class)->consolidateArray($actions);
145
+	}
146 146
 
147
-    /**
148
-     * @param array $columns
149
-     * @return array
150
-     * @filter manage_edit-.Application::POST_TYPE._sortable_columns
151
-     */
152
-    public function filterSortableColumns($columns)
153
-    {
154
-        $columns = glsr(Helper::class)->consolidateArray($columns);
155
-        $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
156
-        unset($postTypeColumns['cb']);
157
-        foreach ($postTypeColumns as $key => $value) {
158
-            if (glsr(Helper::class)->startsWith('taxonomy', $key)) {
159
-                continue;
160
-            }
161
-            $columns[$key] = $key;
162
-        }
163
-        return $columns;
164
-    }
147
+	/**
148
+	 * @param array $columns
149
+	 * @return array
150
+	 * @filter manage_edit-.Application::POST_TYPE._sortable_columns
151
+	 */
152
+	public function filterSortableColumns($columns)
153
+	{
154
+		$columns = glsr(Helper::class)->consolidateArray($columns);
155
+		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
156
+		unset($postTypeColumns['cb']);
157
+		foreach ($postTypeColumns as $key => $value) {
158
+			if (glsr(Helper::class)->startsWith('taxonomy', $key)) {
159
+				continue;
160
+			}
161
+			$columns[$key] = $key;
162
+		}
163
+		return $columns;
164
+	}
165 165
 
166
-    /**
167
-     * Customize the post_type status text.
168
-     * @param string $translation
169
-     * @param string $single
170
-     * @param string $plural
171
-     * @param int $number
172
-     * @param string $domain
173
-     * @return string
174
-     * @filter ngettext
175
-     */
176
-    public function filterStatusText($translation, $single, $plural, $number, $domain)
177
-    {
178
-        if ($this->canModifyTranslation($domain)) {
179
-            $strings = [
180
-                'Published' => __('Approved', 'site-reviews'),
181
-                'Pending' => __('Unapproved', 'site-reviews'),
182
-            ];
183
-            foreach ($strings as $search => $replace) {
184
-                if (false === strpos($single, $search)) {
185
-                    continue;
186
-                }
187
-                $translation = $this->getTranslation([
188
-                    'number' => $number,
189
-                    'plural' => str_replace($search, $replace, $plural),
190
-                    'single' => str_replace($search, $replace, $single),
191
-                ]);
192
-            }
193
-        }
194
-        return $translation;
195
-    }
166
+	/**
167
+	 * Customize the post_type status text.
168
+	 * @param string $translation
169
+	 * @param string $single
170
+	 * @param string $plural
171
+	 * @param int $number
172
+	 * @param string $domain
173
+	 * @return string
174
+	 * @filter ngettext
175
+	 */
176
+	public function filterStatusText($translation, $single, $plural, $number, $domain)
177
+	{
178
+		if ($this->canModifyTranslation($domain)) {
179
+			$strings = [
180
+				'Published' => __('Approved', 'site-reviews'),
181
+				'Pending' => __('Unapproved', 'site-reviews'),
182
+			];
183
+			foreach ($strings as $search => $replace) {
184
+				if (false === strpos($single, $search)) {
185
+					continue;
186
+				}
187
+				$translation = $this->getTranslation([
188
+					'number' => $number,
189
+					'plural' => str_replace($search, $replace, $plural),
190
+					'single' => str_replace($search, $replace, $single),
191
+				]);
192
+			}
193
+		}
194
+		return $translation;
195
+	}
196 196
 
197
-    /**
198
-     * @param string $columnName
199
-     * @param string $postType
200
-     * @return void
201
-     * @action bulk_edit_custom_box
202
-     */
203
-    public function renderBulkEditFields($columnName, $postType)
204
-    {
205
-        if ('assigned_to' == $columnName && Application::POST_TYPE == $postType) {
206
-            glsr()->render('partials/editor/bulk-edit-assigned-to');
207
-        }
208
-    }
197
+	/**
198
+	 * @param string $columnName
199
+	 * @param string $postType
200
+	 * @return void
201
+	 * @action bulk_edit_custom_box
202
+	 */
203
+	public function renderBulkEditFields($columnName, $postType)
204
+	{
205
+		if ('assigned_to' == $columnName && Application::POST_TYPE == $postType) {
206
+			glsr()->render('partials/editor/bulk-edit-assigned-to');
207
+		}
208
+	}
209 209
 
210
-    /**
211
-     * @param string $postType
212
-     * @return void
213
-     * @action restrict_manage_posts
214
-     */
215
-    public function renderColumnFilters($postType)
216
-    {
217
-        glsr(Columns::class)->renderFilters($postType);
218
-    }
210
+	/**
211
+	 * @param string $postType
212
+	 * @return void
213
+	 * @action restrict_manage_posts
214
+	 */
215
+	public function renderColumnFilters($postType)
216
+	{
217
+		glsr(Columns::class)->renderFilters($postType);
218
+	}
219 219
 
220
-    /**
221
-     * @param string $column
222
-     * @param string $postId
223
-     * @return void
224
-     * @action manage_posts_custom_column
225
-     */
226
-    public function renderColumnValues($column, $postId)
227
-    {
228
-        glsr(Columns::class)->renderValues($column, $postId);
229
-    }
220
+	/**
221
+	 * @param string $column
222
+	 * @param string $postId
223
+	 * @return void
224
+	 * @action manage_posts_custom_column
225
+	 */
226
+	public function renderColumnValues($column, $postId)
227
+	{
228
+		glsr(Columns::class)->renderValues($column, $postId);
229
+	}
230 230
 
231
-    /**
232
-     * @param int $postId
233
-     * @return void
234
-     * @action save_post_.Application::POST_TYPE
235
-     */
236
-    public function saveBulkEditFields($postId)
237
-    {
238
-        if (!current_user_can('edit_posts')) {
239
-            return;
240
-        }
241
-        $assignedTo = filter_input(INPUT_GET, 'assigned_to');
242
-        if ($assignedTo && get_post($assignedTo)) {
243
-            glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
244
-        }
245
-    }
231
+	/**
232
+	 * @param int $postId
233
+	 * @return void
234
+	 * @action save_post_.Application::POST_TYPE
235
+	 */
236
+	public function saveBulkEditFields($postId)
237
+	{
238
+		if (!current_user_can('edit_posts')) {
239
+			return;
240
+		}
241
+		$assignedTo = filter_input(INPUT_GET, 'assigned_to');
242
+		if ($assignedTo && get_post($assignedTo)) {
243
+			glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
244
+		}
245
+	}
246 246
 
247
-    /**
248
-     * @return void
249
-     * @action pre_get_posts
250
-     */
251
-    public function setQueryForColumn(WP_Query $query)
252
-    {
253
-        if (!$this->hasPermission($query)) {
254
-            return;
255
-        }
256
-        $this->setMetaQuery($query, [
257
-            'rating', 'review_type',
258
-        ]);
259
-        $this->setOrderby($query);
260
-    }
247
+	/**
248
+	 * @return void
249
+	 * @action pre_get_posts
250
+	 */
251
+	public function setQueryForColumn(WP_Query $query)
252
+	{
253
+		if (!$this->hasPermission($query)) {
254
+			return;
255
+		}
256
+		$this->setMetaQuery($query, [
257
+			'rating', 'review_type',
258
+		]);
259
+		$this->setOrderby($query);
260
+	}
261 261
 
262
-    /**
263
-     * @return void
264
-     * @action admin_action_unapprove
265
-     */
266
-    public function unapprove()
267
-    {
268
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
269
-            return;
270
-        }
271
-        check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
272
-        wp_update_post([
273
-            'ID' => $postId,
274
-            'post_status' => 'pending',
275
-        ]);
276
-        wp_safe_redirect(wp_get_referer());
277
-        exit;
278
-    }
262
+	/**
263
+	 * @return void
264
+	 * @action admin_action_unapprove
265
+	 */
266
+	public function unapprove()
267
+	{
268
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
269
+			return;
270
+		}
271
+		check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
272
+		wp_update_post([
273
+			'ID' => $postId,
274
+			'post_status' => 'pending',
275
+		]);
276
+		wp_safe_redirect(wp_get_referer());
277
+		exit;
278
+	}
279 279
 
280
-    /**
281
-     * Check if the translation string can be modified.
282
-     * @param string $domain
283
-     * @return bool
284
-     */
285
-    protected function canModifyTranslation($domain = 'default')
286
-    {
287
-        $screen = glsr_current_screen();
288
-        return 'default' == $domain
289
-            && 'edit' == $screen->base
290
-            && Application::POST_TYPE == $screen->post_type;
291
-    }
280
+	/**
281
+	 * Check if the translation string can be modified.
282
+	 * @param string $domain
283
+	 * @return bool
284
+	 */
285
+	protected function canModifyTranslation($domain = 'default')
286
+	{
287
+		$screen = glsr_current_screen();
288
+		return 'default' == $domain
289
+			&& 'edit' == $screen->base
290
+			&& Application::POST_TYPE == $screen->post_type;
291
+	}
292 292
 
293
-    /**
294
-     * Get the modified translation string.
295
-     * @return string
296
-     */
297
-    protected function getTranslation(array $args)
298
-    {
299
-        $defaults = [
300
-            'number' => 0,
301
-            'plural' => '',
302
-            'single' => '',
303
-            'text' => '',
304
-        ];
305
-        $args = (object) wp_parse_args($args, $defaults);
306
-        $translations = get_translations_for_domain(Application::ID);
307
-        return $args->text
308
-            ? $translations->translate($args->text)
309
-            : $translations->translate_plural($args->single, $args->plural, $args->number);
310
-    }
293
+	/**
294
+	 * Get the modified translation string.
295
+	 * @return string
296
+	 */
297
+	protected function getTranslation(array $args)
298
+	{
299
+		$defaults = [
300
+			'number' => 0,
301
+			'plural' => '',
302
+			'single' => '',
303
+			'text' => '',
304
+		];
305
+		$args = (object) wp_parse_args($args, $defaults);
306
+		$translations = get_translations_for_domain(Application::ID);
307
+		return $args->text
308
+			? $translations->translate($args->text)
309
+			: $translations->translate_plural($args->single, $args->plural, $args->number);
310
+	}
311 311
 
312
-    /**
313
-     * @return bool
314
-     */
315
-    protected function hasPermission(WP_Query $query)
316
-    {
317
-        global $pagenow;
318
-        return is_admin()
319
-            && $query->is_main_query()
320
-            && Application::POST_TYPE == $query->get('post_type')
321
-            && 'edit.php' == $pagenow;
322
-    }
312
+	/**
313
+	 * @return bool
314
+	 */
315
+	protected function hasPermission(WP_Query $query)
316
+	{
317
+		global $pagenow;
318
+		return is_admin()
319
+			&& $query->is_main_query()
320
+			&& Application::POST_TYPE == $query->get('post_type')
321
+			&& 'edit.php' == $pagenow;
322
+	}
323 323
 
324
-    /**
325
-     * @return void
326
-     */
327
-    protected function setMetaQuery(WP_Query $query, array $metaKeys)
328
-    {
329
-        foreach ($metaKeys as $key) {
330
-            if (!($value = filter_input(INPUT_GET, $key))) {
331
-                continue;
332
-            }
333
-            $metaQuery = (array) $query->get('meta_query');
334
-            $metaQuery[] = [
335
-                'key' => glsr(Helper::class)->prefixString($key, '_'),
336
-                'value' => $value,
337
-            ];
338
-            $query->set('meta_query', $metaQuery);
339
-        }
340
-    }
324
+	/**
325
+	 * @return void
326
+	 */
327
+	protected function setMetaQuery(WP_Query $query, array $metaKeys)
328
+	{
329
+		foreach ($metaKeys as $key) {
330
+			if (!($value = filter_input(INPUT_GET, $key))) {
331
+				continue;
332
+			}
333
+			$metaQuery = (array) $query->get('meta_query');
334
+			$metaQuery[] = [
335
+				'key' => glsr(Helper::class)->prefixString($key, '_'),
336
+				'value' => $value,
337
+			];
338
+			$query->set('meta_query', $metaQuery);
339
+		}
340
+	}
341 341
 
342
-    /**
343
-     * @return void
344
-     */
345
-    protected function setOrderby(WP_Query $query)
346
-    {
347
-        $orderby = $query->get('orderby');
348
-        $columns = glsr()->postTypeColumns[Application::POST_TYPE];
349
-        unset($columns['cb'], $columns['title'], $columns['date']);
350
-        if (in_array($orderby, array_keys($columns))) {
351
-            if ('reviewer' == $orderby) {
352
-                $orderby = '_author';
353
-            }
354
-            $query->set('meta_key', $orderby);
355
-            $query->set('orderby', 'meta_value');
356
-        }
357
-    }
342
+	/**
343
+	 * @return void
344
+	 */
345
+	protected function setOrderby(WP_Query $query)
346
+	{
347
+		$orderby = $query->get('orderby');
348
+		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
349
+		unset($columns['cb'], $columns['title'], $columns['date']);
350
+		if (in_array($orderby, array_keys($columns))) {
351
+			if ('reviewer' == $orderby) {
352
+				$orderby = '_author';
353
+			}
354
+			$query->set('meta_key', $orderby);
355
+			$query->set('orderby', 'meta_value');
356
+		}
357
+	}
358 358
 }
Please login to merge, or discard this patch.
plugin/Defaults/EmailDefaults.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 
8 8
 class EmailDefaults extends Defaults
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    protected function defaults()
14
-    {
15
-        $fromName = wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
16
-        $fromEmail = glsr(OptionManager::class)->getWP('admin_email');
17
-        return [
18
-            'after' => '',
19
-            'attachments' => [],
20
-            'bcc' => '',
21
-            'before' => '',
22
-            'cc' => '',
23
-            'from' => $fromName.' <'.$fromEmail.'>',
24
-            'message' => '',
25
-            'reply-to' => '',
26
-            'subject' => '',
27
-            'template' => '',
28
-            'template-tags' => [],
29
-            'to' => '',
30
-        ];
31
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	protected function defaults()
14
+	{
15
+		$fromName = wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
16
+		$fromEmail = glsr(OptionManager::class)->getWP('admin_email');
17
+		return [
18
+			'after' => '',
19
+			'attachments' => [],
20
+			'bcc' => '',
21
+			'before' => '',
22
+			'cc' => '',
23
+			'from' => $fromName.' <'.$fromEmail.'>',
24
+			'message' => '',
25
+			'reply-to' => '',
26
+			'subject' => '',
27
+			'template' => '',
28
+			'template-tags' => [],
29
+			'to' => '',
30
+		];
31
+	}
32 32
 }
Please login to merge, or discard this patch.
plugin/Database/SqlQueries.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param string $metaReviewId
21 21
 	 * @return int
22 22
 	 */
23
-    public function getPostIdFromReviewId($metaReviewId)
23
+	public function getPostIdFromReviewId($metaReviewId)
24 24
 	{
25 25
 		$postId = $this->db->get_var("
26 26
 			SELECT p.ID
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             AND m.meta_key = '_review_id'
31 31
 			AND m.meta_value = '{$metaReviewId}'
32 32
 		");
33
-        return intval($postId);
33
+		return intval($postId);
34 34
 	}
35 35
 
36 36
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param int $limit
39 39
 	 * @return array
40 40
 	 */
41
-    public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500)
41
+	public function getReviewCounts(array $args, $lastPostId = 0, $limit = 500)
42 42
 	{
43 43
 		return (array) $this->db->get_results("
44 44
 			SELECT DISTINCT p.ID, m1.meta_value AS rating, m2.meta_value AS type
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param string $metaKey
63 63
 	 * @return array
64 64
 	 */
65
-    public function getReviewCountsFor($metaKey)
65
+	public function getReviewCountsFor($metaKey)
66 66
 	{
67
-        $metaKey = glsr(Helper::class)->prefixString($metaKey);
67
+		$metaKey = glsr(Helper::class)->prefixString($metaKey);
68 68
 		return (array) $this->db->get_results("
69 69
 			SELECT DISTINCT m.meta_value AS name, COUNT(*) num_posts
70 70
 			FROM {$this->db->posts} AS p
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param string $reviewType
81 81
 	 * @return array
82 82
 	 */
83
-    public function getReviewIdsByType($reviewType)
83
+	public function getReviewIdsByType($reviewType)
84 84
 	{
85 85
 		$results = $this->db->get_col("
86 86
 			SELECT DISTINCT m1.meta_value AS review_id
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             AND m2.meta_key = '_review_type'
93 93
 			AND m2.meta_value = '{$reviewType}'
94 94
 		");
95
-        return array_keys(array_flip($results));
95
+		return array_keys(array_flip($results));
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 	 * @param int $limit
101 101
 	 * @return array
102 102
 	 */
103
-    public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100)
103
+	public function getReviewRatingsFromIds(array $postIds, $greaterThanId = 0, $limit = 100)
104 104
 	{
105
-        sort($postIds);
106
-        $postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit);
107
-        $postIds = implode(',', $postIds);
105
+		sort($postIds);
106
+		$postIds = array_slice($postIds, intval(array_search($greaterThanId, $postIds)), $limit);
107
+		$postIds = implode(',', $postIds);
108 108
 		return (array) $this->db->get_results("
109 109
 			SELECT p.ID, m.meta_value AS rating
110 110
 			FROM {$this->db->posts} AS p
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @param string $status
126 126
 	 * @return array
127 127
 	 */
128
-    public function getReviewsMeta($key, $status = 'publish')
128
+	public function getReviewsMeta($key, $status = 'publish')
129 129
 	{
130
-        $key = glsr(Helper::class)->prefixString($key);
130
+		$key = glsr(Helper::class)->prefixString($key);
131 131
 		$values = $this->db->get_col("
132 132
 			SELECT DISTINCT m.meta_value
133 133
 			FROM {$this->db->postmeta} m
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			GROUP BY p.ID -- remove duplicate meta_value entries
140 140
 			ORDER BY m.meta_id ASC -- sort by oldest meta_value
141 141
 		");
142
-        sort($values);
142
+		sort($values);
143 143
 		return $values;
144 144
 	}
145 145
 
@@ -147,34 +147,34 @@  discard block
 block discarded – undo
147 147
 	 * @param string $and
148 148
 	 * @return string
149 149
 	 */
150
-    protected function getAndForCounts(array $args, $and = '')
150
+	protected function getAndForCounts(array $args, $and = '')
151 151
 	{
152
-        $postIds = implode(',', array_filter(glsr_get($args, 'post_ids')));
153
-        $termIds = implode(',', array_filter(glsr_get($args, 'term_ids')));
154
-        if (!empty($args['type'])) {
155
-            $and.= "AND m2.meta_value = '{$args['type']}' ";
152
+		$postIds = implode(',', array_filter(glsr_get($args, 'post_ids')));
153
+		$termIds = implode(',', array_filter(glsr_get($args, 'term_ids')));
154
+		if (!empty($args['type'])) {
155
+			$and.= "AND m2.meta_value = '{$args['type']}' ";
156 156
 		}
157
-        if ($postIds) {
158
-            $and.= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
157
+		if ($postIds) {
158
+			$and.= "AND m3.meta_key = '_assigned_to' AND m3.meta_value IN ({$postIds}) ";
159 159
 		}
160
-        if ($termIds) {
161
-            $and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
160
+		if ($termIds) {
161
+			$and.= "AND tr.term_taxonomy_id IN ({$termIds}) ";
162 162
 		}
163
-        return apply_filters('site-reviews/query/and-for-counts', $and);
163
+		return apply_filters('site-reviews/query/and-for-counts', $and);
164 164
 	}
165 165
 
166 166
 	/**
167 167
 	 * @param string $innerJoin
168 168
 	 * @return string
169 169
 	 */
170
-    protected function getInnerJoinForCounts(array $args, $innerJoin = '')
170
+	protected function getInnerJoinForCounts(array $args, $innerJoin = '')
171 171
 	{
172
-        if (!empty(glsr_get($args, 'post_ids'))) {
173
-            $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
172
+		if (!empty(glsr_get($args, 'post_ids'))) {
173
+			$innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id ";
174 174
 		}
175
-        if (!empty(glsr_get($args, 'term_ids'))) {
176
-            $innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
175
+		if (!empty(glsr_get($args, 'term_ids'))) {
176
+			$innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id ";
177 177
 		}
178
-        return apply_filters('site-reviews/query/inner-join-for-counts', $innerJoin);
178
+		return apply_filters('site-reviews/query/inner-join-for-counts', $innerJoin);
179 179
 	}
180 180
 }
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -7,155 +7,155 @@
 block discarded – undo
7 7
 
8 8
 class OptionManager
9 9
 {
10
-    /**
11
-     * @var array
12
-     */
13
-    protected $options;
10
+	/**
11
+	 * @var array
12
+	 */
13
+	protected $options;
14 14
 
15
-    /**
16
-     * @return string
17
-     */
18
-    public static function databaseKey($version = null)
19
-    {
20
-        if (null === $version) {
21
-            $version = explode('.', glsr()->version);
22
-            $version = array_shift($version);
23
-        }
24
-        return glsr(Helper::class)->snakeCase(
25
-            Application::ID.'-v'.intval($version)
26
-        );
27
-    }
15
+	/**
16
+	 * @return string
17
+	 */
18
+	public static function databaseKey($version = null)
19
+	{
20
+		if (null === $version) {
21
+			$version = explode('.', glsr()->version);
22
+			$version = array_shift($version);
23
+		}
24
+		return glsr(Helper::class)->snakeCase(
25
+			Application::ID.'-v'.intval($version)
26
+		);
27
+	}
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    public function all()
33
-    {
34
-        if (empty($this->options)) {
35
-            $this->reset();
36
-        }
37
-        return $this->options;
38
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	public function all()
33
+	{
34
+		if (empty($this->options)) {
35
+			$this->reset();
36
+		}
37
+		return $this->options;
38
+	}
39 39
 
40
-    /**
41
-     * @param string $path
42
-     * @return bool
43
-     */
44
-    public function delete($path)
45
-    {
46
-        $keys = explode('.', $path);
47
-        $last = array_pop($keys);
48
-        $options = $this->all();
49
-        $pointer = &$options;
50
-        foreach ($keys as $key) {
51
-            if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
-                continue;
53
-            }
54
-            $pointer = &$pointer[$key];
55
-        }
56
-        unset($pointer[$last]);
57
-        return $this->set($options);
58
-    }
40
+	/**
41
+	 * @param string $path
42
+	 * @return bool
43
+	 */
44
+	public function delete($path)
45
+	{
46
+		$keys = explode('.', $path);
47
+		$last = array_pop($keys);
48
+		$options = $this->all();
49
+		$pointer = &$options;
50
+		foreach ($keys as $key) {
51
+			if (!isset($pointer[$key]) || !is_array($pointer[$key])) {
52
+				continue;
53
+			}
54
+			$pointer = &$pointer[$key];
55
+		}
56
+		unset($pointer[$last]);
57
+		return $this->set($options);
58
+	}
59 59
 
60
-    /**
61
-     * @param string $path
62
-     * @param mixed $fallback
63
-     * @param string $cast
64
-     * @return mixed
65
-     */
66
-    public function get($path = '', $fallback = '', $cast = '')
67
-    {
68
-        $result = glsr(Helper::class)->dataGet($this->all(), $path, $fallback);
69
-        return glsr(Helper::class)->castTo($cast, $result);
70
-    }
60
+	/**
61
+	 * @param string $path
62
+	 * @param mixed $fallback
63
+	 * @param string $cast
64
+	 * @return mixed
65
+	 */
66
+	public function get($path = '', $fallback = '', $cast = '')
67
+	{
68
+		$result = glsr(Helper::class)->dataGet($this->all(), $path, $fallback);
69
+		return glsr(Helper::class)->castTo($cast, $result);
70
+	}
71 71
 
72
-    /**
73
-     * @param string $path
74
-     * @return bool
75
-     */
76
-    public function getBool($path)
77
-    {
78
-        return 'yes' == $this->get($path)
79
-            ? true
80
-            : false;
81
-    }
72
+	/**
73
+	 * @param string $path
74
+	 * @return bool
75
+	 */
76
+	public function getBool($path)
77
+	{
78
+		return 'yes' == $this->get($path)
79
+			? true
80
+			: false;
81
+	}
82 82
 
83
-    /**
84
-     * @param string $path
85
-     * @param mixed $fallback
86
-     * @param string $cast
87
-     * @return mixed
88
-     */
89
-    public function getWP($path, $fallback = '', $cast = '')
90
-    {
91
-        $option = get_option($path, $fallback);
92
-        if (empty($option)) {
93
-            $option = $fallback;
94
-        }
95
-        return glsr(Helper::class)->castTo($cast, $option);
96
-    }
83
+	/**
84
+	 * @param string $path
85
+	 * @param mixed $fallback
86
+	 * @param string $cast
87
+	 * @return mixed
88
+	 */
89
+	public function getWP($path, $fallback = '', $cast = '')
90
+	{
91
+		$option = get_option($path, $fallback);
92
+		if (empty($option)) {
93
+			$option = $fallback;
94
+		}
95
+		return glsr(Helper::class)->castTo($cast, $option);
96
+	}
97 97
 
98
-    /**
99
-     * @return string
100
-     */
101
-    public function json()
102
-    {
103
-        return json_encode($this->all());
104
-    }
98
+	/**
99
+	 * @return string
100
+	 */
101
+	public function json()
102
+	{
103
+		return json_encode($this->all());
104
+	}
105 105
 
106
-    /**
107
-     * @return array
108
-     */
109
-    public function normalize(array $options = [])
110
-    {
111
-        $options = wp_parse_args(
112
-            glsr(Helper::class)->flattenArray($options),
113
-            glsr(DefaultsManager::class)->defaults()
114
-        );
115
-        array_walk($options, function (&$value) {
116
-            if (!is_string($value)) {
117
-                return;
118
-            }
119
-            $value = wp_kses($value, wp_kses_allowed_html('post'));
120
-        });
121
-        return glsr(Helper::class)->convertDotNotationArray($options);
122
-    }
106
+	/**
107
+	 * @return array
108
+	 */
109
+	public function normalize(array $options = [])
110
+	{
111
+		$options = wp_parse_args(
112
+			glsr(Helper::class)->flattenArray($options),
113
+			glsr(DefaultsManager::class)->defaults()
114
+		);
115
+		array_walk($options, function (&$value) {
116
+			if (!is_string($value)) {
117
+				return;
118
+			}
119
+			$value = wp_kses($value, wp_kses_allowed_html('post'));
120
+		});
121
+		return glsr(Helper::class)->convertDotNotationArray($options);
122
+	}
123 123
 
124
-    /**
125
-     * @return bool
126
-     */
127
-    public function isRecaptchaEnabled()
128
-    {
129
-        $integration = $this->get('settings.submissions.recaptcha.integration');
130
-        return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131
-    }
124
+	/**
125
+	 * @return bool
126
+	 */
127
+	public function isRecaptchaEnabled()
128
+	{
129
+		$integration = $this->get('settings.submissions.recaptcha.integration');
130
+		return 'all' == $integration || ('guest' == $integration && !is_user_logged_in());
131
+	}
132 132
 
133
-    /**
134
-     * @return array
135
-     */
136
-    public function reset()
137
-    {
138
-        $options = $this->getWP(static::databaseKey(), []);
139
-        if (!is_array($options) || empty($options)) {
140
-            delete_option(static::databaseKey());
141
-            $options = wp_parse_args(glsr()->defaults, ['settings' => []]);
142
-        }
143
-        $this->options = $options;
144
-    }
133
+	/**
134
+	 * @return array
135
+	 */
136
+	public function reset()
137
+	{
138
+		$options = $this->getWP(static::databaseKey(), []);
139
+		if (!is_array($options) || empty($options)) {
140
+			delete_option(static::databaseKey());
141
+			$options = wp_parse_args(glsr()->defaults, ['settings' => []]);
142
+		}
143
+		$this->options = $options;
144
+	}
145 145
 
146
-    /**
147
-     * @param string|array $pathOrOptions
148
-     * @param mixed $value
149
-     * @return bool
150
-     */
151
-    public function set($pathOrOptions, $value = '')
152
-    {
153
-        if (is_string($pathOrOptions)) {
154
-            $pathOrOptions = glsr(Helper::class)->dataSet($this->all(), $pathOrOptions, $value);
155
-        }
156
-        if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
157
-            $this->reset();
158
-        }
159
-        return $result;
160
-    }
146
+	/**
147
+	 * @param string|array $pathOrOptions
148
+	 * @param mixed $value
149
+	 * @return bool
150
+	 */
151
+	public function set($pathOrOptions, $value = '')
152
+	{
153
+		if (is_string($pathOrOptions)) {
154
+			$pathOrOptions = glsr(Helper::class)->dataSet($this->all(), $pathOrOptions, $value);
155
+		}
156
+		if ($result = update_option(static::databaseKey(), (array) $pathOrOptions)) {
157
+			$this->reset();
158
+		}
159
+		return $result;
160
+	}
161 161
 }
Please login to merge, or discard this patch.