Passed
Push — master ( f48539...8e7eaf )
by Paul
04:07
created
views/pages/tools/general.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if (glsr()->hasPermission('settings')) : ?>
3
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
4 4
 <div class="glsr-card card">
5 5
     <h3>Export Settings</h3>
6 6
     <p>Export the Site Reviews settings for this site to a <code>*.json</code> file. This allows you to easily import the plugin settings into another site.</p>
7
-    <p>To export your Site Reviews' reviews and categories, please use the WordPress <a href="<?= admin_url('export.php'); ?>">Export</a> tool.</p>
7
+    <p>To export your Site Reviews' reviews and categories, please use the WordPress <a href="<?= admin_url( 'export.php' ); ?>">Export</a> tool.</p>
8 8
     <form method="post">
9 9
         <input type="hidden" name="{{ id }}[_action]" value="export-settings">
10
-        <?php wp_nonce_field('export-settings'); ?>
11
-        <?php submit_button(__('Export Settings', 'site-reviews'), 'secondary'); ?>
10
+        <?php wp_nonce_field( 'export-settings' ); ?>
11
+        <?php submit_button( __( 'Export Settings', 'site-reviews' ), 'secondary' ); ?>
12 12
     </form>
13 13
 </div>
14 14
 <?php endif; ?>
15 15
 
16
-<?php if (glsr()->hasPermission('settings')) : ?>
16
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
17 17
 <div class="glsr-card card">
18 18
     <h3>Import Settings</h3>
19 19
     <p>Import the Site Reviews settings from a <code>*.json</code> file. This file can be obtained by exporting the settings on another site using the export tool below.</p>
20
-    <p>To import your Site Reviews' reviews and categories from another website, please use the WordPress <a href="<?= admin_url('import.php'); ?>">Import</a> tool.</p>
20
+    <p>To import your Site Reviews' reviews and categories from another website, please use the WordPress <a href="<?= admin_url( 'import.php' ); ?>">Import</a> tool.</p>
21 21
     <form method="post" enctype="multipart/form-data">
22 22
         <input type="file" name="import-file">
23 23
         <input type="hidden" name="{{ id }}[_action]" value="import-settings">
24
-        <?php wp_nonce_field('import-settings'); ?>
25
-        <?php submit_button(__('Import Settings', 'site-reviews'), 'secondary'); ?>
24
+        <?php wp_nonce_field( 'import-settings' ); ?>
25
+        <?php submit_button( __( 'Import Settings', 'site-reviews' ), 'secondary' ); ?>
26 26
     </form>
27 27
 </div>
28 28
 <?php endif; ?>
29 29
 
30
-<?php if (glsr()->hasPermission('settings')) : ?>
30
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
31 31
 <div class="glsr-card card">
32 32
     <h3>Migrate Plugin</h3>
33 33
     <p>Run this tool if your reviews stopped working correctly after upgrading the plugin to the latest version (i.e. read-only reviews, zero-star ratings, missing role capabilities, etc.).</p>
34 34
     <form method="post">
35 35
         <input type="hidden" name="{{ id }}[_action]" value="migrate-reviews">
36
-        <?php wp_nonce_field('migrate-reviews'); ?>
36
+        <?php wp_nonce_field( 'migrate-reviews' ); ?>
37 37
         <p class="submit">
38 38
             <button type="submit" class="glsr-button button" name="migrate-reviews" id="migrate-reviews">
39
-                <span data-loading="<?= __('Migrating Reviews, please wait...', 'site-reviews'); ?>"><?= __('Run Migration', 'site-reviews'); ?></span>
39
+                <span data-loading="<?= __( 'Migrating Reviews, please wait...', 'site-reviews' ); ?>"><?= __( 'Run Migration', 'site-reviews' ); ?></span>
40 40
             </button>
41 41
         </p>
42 42
     </form>
@@ -49,26 +49,26 @@  discard block
 block discarded – undo
49 49
     <p>If you suspect that the rating counts are incorrect (perhaps you have cloned a page that had reviews assigned to it, or edited/deleted reviews directly from your database), you can recalculate them here.</p>
50 50
     <form method="post">
51 51
         <input type="hidden" name="{{ id }}[_action]" value="count-reviews">
52
-        <?php wp_nonce_field('count-reviews'); ?>
52
+        <?php wp_nonce_field( 'count-reviews' ); ?>
53 53
         <p class="submit">
54 54
             <button type="submit" class="glsr-button button" name="count-reviews" id="count-reviews">
55
-                <span data-loading="<?= __('Recalculating Counts, please wait...', 'site-reviews'); ?>"><?= __('Recalculate Counts', 'site-reviews'); ?></span>
55
+                <span data-loading="<?= __( 'Recalculating Counts, please wait...', 'site-reviews' ); ?>"><?= __( 'Recalculate Counts', 'site-reviews' ); ?></span>
56 56
             </button>
57 57
         </p>
58 58
     </form>
59 59
 </div>
60 60
 
61
-<?php if (glsr()->hasPermission('settings')) : ?>
61
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
62 62
 <div class="glsr-card card">
63 63
     <h3>Reset Permissions</h3>
64 64
     <p>Site Reviews provides custom post_type capabilities that mirror the capabilities of your posts by default. For example, if a user role has permission to edit others posts, then that role will also have permission to edit other users reviews.</p>
65 65
     <p>If you have changed the capabilities of your user roles and you suspect that Site Reviews is not working correctly due to your changes, you may use this tool to reset the Site Reviews capabilities for your user roles.</p>
66 66
     <form method="post">
67 67
         <input type="hidden" name="{{ id }}[_action]" value="reset-permissions">
68
-        <?php wp_nonce_field('reset-permissions'); ?>
68
+        <?php wp_nonce_field( 'reset-permissions' ); ?>
69 69
         <p class="submit">
70 70
             <button type="submit" class="glsr-button button" name="reset-permissions" id="reset-permissions">
71
-                <span data-loading="<?= __('Resetting Permissions, please wait...', 'site-reviews'); ?>"><?= __('Reset Permissions', 'site-reviews'); ?></span>
71
+                <span data-loading="<?= __( 'Resetting Permissions, please wait...', 'site-reviews' ); ?>"><?= __( 'Reset Permissions', 'site-reviews' ); ?></span>
72 72
             </button>
73 73
         </p>
74 74
     </form>
Please login to merge, or discard this patch.
views/partials/styles/divi/submit-button.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="et_contact_bottom_container">
4 4
     <button type="submit" class="glsr-button et_pb_contact_submit et_pb_button">
Please login to merge, or discard this patch.
config/styles/divi.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'fields' => [
5
-        'input' => 'input',
6
-        'input_checkbox' => 'input',
7
-        'input_radio' => 'input',
8
-        'label' => 'et_pb_contact_form_label',
9
-        'select' => 'et_pb_contact_select input',
10
-        'textarea' => 'et_pb_contact_message input',
11
-    ],
12
-    'validation' => [
13
-        'field_error_class' => 'et_contact_error',
14
-        'input_error_class' => 'et_contact_error',
15
-    ],
4
+	'fields' => [
5
+		'input' => 'input',
6
+		'input_checkbox' => 'input',
7
+		'input_radio' => 'input',
8
+		'label' => 'et_pb_contact_form_label',
9
+		'select' => 'et_pb_contact_select input',
10
+		'textarea' => 'et_pb_contact_message input',
11
+	],
12
+	'validation' => [
13
+		'field_error_class' => 'et_contact_error',
14
+		'input_error_class' => 'et_contact_error',
15
+	],
16 16
 ];
Please login to merge, or discard this patch.
plugin/Modules/System.php 2 patches
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -13,378 +13,378 @@
 block discarded – undo
13 13
 
14 14
 class System
15 15
 {
16
-    const PAD = 40;
16
+	const PAD = 40;
17 17
 
18
-    /**
19
-     * @return string
20
-     */
21
-    public function __toString()
22
-    {
23
-        return $this->get();
24
-    }
18
+	/**
19
+	 * @return string
20
+	 */
21
+	public function __toString()
22
+	{
23
+		return $this->get();
24
+	}
25 25
 
26
-    /**
27
-     * @return string
28
-     */
29
-    public function get()
30
-    {
31
-        $details = [
32
-            'plugin' => 'Plugin Details',
33
-            'addon' => 'Addon Details',
34
-            'browser' => 'Browser Details',
35
-            'server' => 'Server Details',
36
-            'php' => 'PHP Configuration',
37
-            'wordpress' => 'WordPress Configuration',
38
-            'mu-plugin' => 'Must-Use Plugins',
39
-            'multisite-plugin' => 'Network Active Plugins',
40
-            'active-plugin' => 'Active Plugins',
41
-            'inactive-plugin' => 'Inactive Plugins',
42
-            'setting' => 'Plugin Settings',
43
-            'reviews' => 'Review Counts',
44
-        ];
45
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
46
-            $methodName = Helper::buildMethodName('get-'.$key.'-details');
47
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
48
-                return $carry.$this->implode(
49
-                    strtoupper($details[$key]),
50
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
51
-                );
52
-            }
53
-            return $carry;
54
-        });
55
-        return trim($systemInfo);
56
-    }
26
+	/**
27
+	 * @return string
28
+	 */
29
+	public function get()
30
+	{
31
+		$details = [
32
+			'plugin' => 'Plugin Details',
33
+			'addon' => 'Addon Details',
34
+			'browser' => 'Browser Details',
35
+			'server' => 'Server Details',
36
+			'php' => 'PHP Configuration',
37
+			'wordpress' => 'WordPress Configuration',
38
+			'mu-plugin' => 'Must-Use Plugins',
39
+			'multisite-plugin' => 'Network Active Plugins',
40
+			'active-plugin' => 'Active Plugins',
41
+			'inactive-plugin' => 'Inactive Plugins',
42
+			'setting' => 'Plugin Settings',
43
+			'reviews' => 'Review Counts',
44
+		];
45
+		$systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
46
+			$methodName = Helper::buildMethodName('get-'.$key.'-details');
47
+			if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
48
+				return $carry.$this->implode(
49
+					strtoupper($details[$key]),
50
+					apply_filters('site-reviews/system/'.$key, $systemDetails)
51
+				);
52
+			}
53
+			return $carry;
54
+		});
55
+		return trim($systemInfo);
56
+	}
57 57
 
58
-    /**
59
-     * @return array
60
-     */
61
-    public function getActivePluginDetails()
62
-    {
63
-        $plugins = get_plugins();
64
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
65
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
66
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
67
-    }
58
+	/**
59
+	 * @return array
60
+	 */
61
+	public function getActivePluginDetails()
62
+	{
63
+		$plugins = get_plugins();
64
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
65
+		$inactive = array_diff_key($plugins, array_flip($activePlugins));
66
+		return $this->normalizePluginList(array_diff_key($plugins, $inactive));
67
+	}
68 68
 
69
-    /**
70
-     * @return array
71
-     */
72
-    public function getAddonDetails()
73
-    {
74
-        $details = apply_filters('site-reviews/addon/system-info', []);
75
-        ksort($details);
76
-        return $details;
77
-    }
69
+	/**
70
+	 * @return array
71
+	 */
72
+	public function getAddonDetails()
73
+	{
74
+		$details = apply_filters('site-reviews/addon/system-info', []);
75
+		ksort($details);
76
+		return $details;
77
+	}
78 78
 
79
-    /**
80
-     * @return array
81
-     */
82
-    public function getBrowserDetails()
83
-    {
84
-        $browser = new Browser();
85
-        $name = esc_attr($browser->getName());
86
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
87
-        $version = esc_attr($browser->getVersion());
88
-        return [
89
-            'Browser Name' => sprintf('%s %s', $name, $version),
90
-            'Browser UA' => $userAgent,
91
-        ];
92
-    }
79
+	/**
80
+	 * @return array
81
+	 */
82
+	public function getBrowserDetails()
83
+	{
84
+		$browser = new Browser();
85
+		$name = esc_attr($browser->getName());
86
+		$userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
87
+		$version = esc_attr($browser->getVersion());
88
+		return [
89
+			'Browser Name' => sprintf('%s %s', $name, $version),
90
+			'Browser UA' => $userAgent,
91
+		];
92
+	}
93 93
 
94
-    /**
95
-     * @return array
96
-     */
97
-    public function getInactivePluginDetails()
98
-    {
99
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
100
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
101
-        $multisitePlugins = $this->getMultisitePluginDetails();
102
-        return empty($multisitePlugins)
103
-            ? $inactivePlugins
104
-            : array_diff($inactivePlugins, $multisitePlugins);
105
-    }
94
+	/**
95
+	 * @return array
96
+	 */
97
+	public function getInactivePluginDetails()
98
+	{
99
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
100
+		$inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
101
+		$multisitePlugins = $this->getMultisitePluginDetails();
102
+		return empty($multisitePlugins)
103
+			? $inactivePlugins
104
+			: array_diff($inactivePlugins, $multisitePlugins);
105
+	}
106 106
 
107
-    /**
108
-     * @return array
109
-     */
110
-    public function getMuPluginDetails()
111
-    {
112
-        if (empty($plugins = get_mu_plugins())) {
113
-            return [];
114
-        }
115
-        return $this->normalizePluginList($plugins);
116
-    }
107
+	/**
108
+	 * @return array
109
+	 */
110
+	public function getMuPluginDetails()
111
+	{
112
+		if (empty($plugins = get_mu_plugins())) {
113
+			return [];
114
+		}
115
+		return $this->normalizePluginList($plugins);
116
+	}
117 117
 
118
-    /**
119
-     * @return array
120
-     */
121
-    public function getMultisitePluginDetails()
122
-    {
123
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
124
-        if (!is_multisite() || empty($activePlugins)) {
125
-            return [];
126
-        }
127
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
128
-    }
118
+	/**
119
+	 * @return array
120
+	 */
121
+	public function getMultisitePluginDetails()
122
+	{
123
+		$activePlugins = (array) get_site_option('active_sitewide_plugins', []);
124
+		if (!is_multisite() || empty($activePlugins)) {
125
+			return [];
126
+		}
127
+		return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
128
+	}
129 129
 
130
-    /**
131
-     * @return array
132
-     */
133
-    public function getPhpDetails()
134
-    {
135
-        $displayErrors = $this->getINI('display_errors', null)
136
-            ? 'On ('.$this->getINI('display_errors').')'
137
-            : 'N/A';
138
-        $intlSupport = extension_loaded('intl')
139
-            ? phpversion('intl')
140
-            : 'false';
141
-        return [
142
-            'cURL' => var_export(function_exists('curl_init'), true),
143
-            'Default Charset' => $this->getINI('default_charset'),
144
-            'Display Errors' => $displayErrors,
145
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
146
-            'Intl' => $intlSupport,
147
-            'IPv6' => var_export(defined('AF_INET6'), true),
148
-            'Max Execution Time' => $this->getINI('max_execution_time'),
149
-            'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
150
-            'Max Input Vars' => $this->getINI('max_input_vars'),
151
-            'Memory Limit' => $this->getINI('memory_limit'),
152
-            'Post Max Size' => $this->getINI('post_max_size'),
153
-            'Sendmail Path' => $this->getINI('sendmail_path'),
154
-            'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
155
-            'Session Name' => esc_html($this->getINI('session.name')),
156
-            'Session Save Path' => esc_html($this->getINI('session.save_path')),
157
-            'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
158
-            'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
159
-            'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
160
-        ];
161
-    }
130
+	/**
131
+	 * @return array
132
+	 */
133
+	public function getPhpDetails()
134
+	{
135
+		$displayErrors = $this->getINI('display_errors', null)
136
+			? 'On ('.$this->getINI('display_errors').')'
137
+			: 'N/A';
138
+		$intlSupport = extension_loaded('intl')
139
+			? phpversion('intl')
140
+			: 'false';
141
+		return [
142
+			'cURL' => var_export(function_exists('curl_init'), true),
143
+			'Default Charset' => $this->getINI('default_charset'),
144
+			'Display Errors' => $displayErrors,
145
+			'fsockopen' => var_export(function_exists('fsockopen'), true),
146
+			'Intl' => $intlSupport,
147
+			'IPv6' => var_export(defined('AF_INET6'), true),
148
+			'Max Execution Time' => $this->getINI('max_execution_time'),
149
+			'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
150
+			'Max Input Vars' => $this->getINI('max_input_vars'),
151
+			'Memory Limit' => $this->getINI('memory_limit'),
152
+			'Post Max Size' => $this->getINI('post_max_size'),
153
+			'Sendmail Path' => $this->getINI('sendmail_path'),
154
+			'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
155
+			'Session Name' => esc_html($this->getINI('session.name')),
156
+			'Session Save Path' => esc_html($this->getINI('session.save_path')),
157
+			'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
158
+			'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
159
+			'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
160
+		];
161
+	}
162 162
 
163
-    /**
164
-     * @return array
165
-     */
166
-    public function getReviewsDetails()
167
-    {
168
-        $counts = glsr(CountsManager::class)->getCounts();
169
-        $counts = Arr::flattenArray($counts);
170
-        array_walk($counts, function (&$ratings) use ($counts) {
171
-            if (is_array($ratings)) {
172
-                $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
173
-                return;
174
-            }
175
-            glsr_log()
176
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
177
-                ->debug($ratings)
178
-                ->debug($counts);
179
-        });
180
-        ksort($counts);
181
-        return $counts;
182
-    }
163
+	/**
164
+	 * @return array
165
+	 */
166
+	public function getReviewsDetails()
167
+	{
168
+		$counts = glsr(CountsManager::class)->getCounts();
169
+		$counts = Arr::flattenArray($counts);
170
+		array_walk($counts, function (&$ratings) use ($counts) {
171
+			if (is_array($ratings)) {
172
+				$ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
173
+				return;
174
+			}
175
+			glsr_log()
176
+				->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
177
+				->debug($ratings)
178
+				->debug($counts);
179
+		});
180
+		ksort($counts);
181
+		return $counts;
182
+	}
183 183
 
184
-    /**
185
-     * @return array
186
-     */
187
-    public function getServerDetails()
188
-    {
189
-        global $wpdb;
190
-        return [
191
-            'Host Name' => $this->getHostName(),
192
-            'MySQL Version' => $wpdb->db_version(),
193
-            'PHP Version' => PHP_VERSION,
194
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
195
-        ];
196
-    }
184
+	/**
185
+	 * @return array
186
+	 */
187
+	public function getServerDetails()
188
+	{
189
+		global $wpdb;
190
+		return [
191
+			'Host Name' => $this->getHostName(),
192
+			'MySQL Version' => $wpdb->db_version(),
193
+			'PHP Version' => PHP_VERSION,
194
+			'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
195
+		];
196
+	}
197 197
 
198
-    /**
199
-     * @return array
200
-     */
201
-    public function getSettingDetails()
202
-    {
203
-        $settings = glsr(OptionManager::class)->get('settings', []);
204
-        $settings = Arr::flattenArray($settings, true);
205
-        $settings = $this->purgeSensitiveData($settings);
206
-        ksort($settings);
207
-        $details = [];
208
-        foreach ($settings as $key => $value) {
209
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
210
-                continue;
211
-            }
212
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/u', '\\n', $value)), ENT_QUOTES, 'UTF-8');
213
-            $details[$key] = $value;
214
-        }
215
-        return $details;
216
-    }
198
+	/**
199
+	 * @return array
200
+	 */
201
+	public function getSettingDetails()
202
+	{
203
+		$settings = glsr(OptionManager::class)->get('settings', []);
204
+		$settings = Arr::flattenArray($settings, true);
205
+		$settings = $this->purgeSensitiveData($settings);
206
+		ksort($settings);
207
+		$details = [];
208
+		foreach ($settings as $key => $value) {
209
+			if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
210
+				continue;
211
+			}
212
+			$value = htmlspecialchars(trim(preg_replace('/\s\s+/u', '\\n', $value)), ENT_QUOTES, 'UTF-8');
213
+			$details[$key] = $value;
214
+		}
215
+		return $details;
216
+	}
217 217
 
218
-    /**
219
-     * @return array
220
-     */
221
-    public function getPluginDetails()
222
-    {
223
-        return [
224
-            'Console level' => glsr(Console::class)->humanLevel(),
225
-            'Console size' => glsr(Console::class)->humanSize('0'),
226
-            'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'),
227
-            'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'),
228
-            'Version (current)' => glsr()->version,
229
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
230
-        ];
231
-    }
218
+	/**
219
+	 * @return array
220
+	 */
221
+	public function getPluginDetails()
222
+	{
223
+		return [
224
+			'Console level' => glsr(Console::class)->humanLevel(),
225
+			'Console size' => glsr(Console::class)->humanSize('0'),
226
+			'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'),
227
+			'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'),
228
+			'Version (current)' => glsr()->version,
229
+			'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
230
+		];
231
+	}
232 232
 
233
-    /**
234
-     * @return array
235
-     */
236
-    public function getWordpressDetails()
237
-    {
238
-        global $wpdb;
239
-        $theme = wp_get_theme();
240
-        return [
241
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
242
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
243
-            'Home URL' => home_url(),
244
-            'Language' => get_locale(),
245
-            'Memory Limit' => WP_MEMORY_LIMIT,
246
-            'Multisite' => var_export(is_multisite(), true),
247
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
248
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
249
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
250
-            'Post Stati' => implode(', ', get_post_stati()),
251
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
252
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
253
-            'Site URL' => site_url(),
254
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
255
-            'Version' => get_bloginfo('version'),
256
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
257
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
258
-            'WP Memory Limit' => WP_MEMORY_LIMIT,
259
-        ];
260
-    }
233
+	/**
234
+	 * @return array
235
+	 */
236
+	public function getWordpressDetails()
237
+	{
238
+		global $wpdb;
239
+		$theme = wp_get_theme();
240
+		return [
241
+			'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
242
+			'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
243
+			'Home URL' => home_url(),
244
+			'Language' => get_locale(),
245
+			'Memory Limit' => WP_MEMORY_LIMIT,
246
+			'Multisite' => var_export(is_multisite(), true),
247
+			'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
248
+			'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
249
+			'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
250
+			'Post Stati' => implode(', ', get_post_stati()),
251
+			'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
252
+			'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
253
+			'Site URL' => site_url(),
254
+			'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
255
+			'Version' => get_bloginfo('version'),
256
+			'WP Debug' => var_export(defined('WP_DEBUG'), true),
257
+			'WP Max Upload Size' => size_format(wp_max_upload_size()),
258
+			'WP Memory Limit' => WP_MEMORY_LIMIT,
259
+		];
260
+	}
261 261
 
262
-    /**
263
-     * @return string
264
-     */
265
-    protected function detectWebhostProvider()
266
-    {
267
-        $checks = [
268
-            '.accountservergroup.com' => 'Site5',
269
-            '.gridserver.com' => 'MediaTemple Grid',
270
-            '.inmotionhosting.com' => 'InMotion Hosting',
271
-            '.ovh.net' => 'OVH',
272
-            '.pair.com' => 'pair Networks',
273
-            '.stabletransit.com' => 'Rackspace Cloud',
274
-            '.stratoserver.net' => 'STRATO',
275
-            '.sysfix.eu' => 'SysFix.eu Power Hosting',
276
-            'bluehost.com' => 'Bluehost',
277
-            'DH_USER' => 'DreamHost',
278
-            'Flywheel' => 'Flywheel',
279
-            'ipagemysql.com' => 'iPage',
280
-            'ipowermysql.com' => 'IPower',
281
-            'localhost:/tmp/mysql5.sock' => 'ICDSoft',
282
-            'mysqlv5' => 'NetworkSolutions',
283
-            'PAGELYBIN' => 'Pagely',
284
-            'secureserver.net' => 'GoDaddy',
285
-            'WPE_APIKEY' => 'WP Engine',
286
-        ];
287
-        foreach ($checks as $key => $value) {
288
-            if (!$this->isWebhostCheckValid($key)) {
289
-                continue;
290
-            }
291
-            return $value;
292
-        }
293
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
294
-    }
262
+	/**
263
+	 * @return string
264
+	 */
265
+	protected function detectWebhostProvider()
266
+	{
267
+		$checks = [
268
+			'.accountservergroup.com' => 'Site5',
269
+			'.gridserver.com' => 'MediaTemple Grid',
270
+			'.inmotionhosting.com' => 'InMotion Hosting',
271
+			'.ovh.net' => 'OVH',
272
+			'.pair.com' => 'pair Networks',
273
+			'.stabletransit.com' => 'Rackspace Cloud',
274
+			'.stratoserver.net' => 'STRATO',
275
+			'.sysfix.eu' => 'SysFix.eu Power Hosting',
276
+			'bluehost.com' => 'Bluehost',
277
+			'DH_USER' => 'DreamHost',
278
+			'Flywheel' => 'Flywheel',
279
+			'ipagemysql.com' => 'iPage',
280
+			'ipowermysql.com' => 'IPower',
281
+			'localhost:/tmp/mysql5.sock' => 'ICDSoft',
282
+			'mysqlv5' => 'NetworkSolutions',
283
+			'PAGELYBIN' => 'Pagely',
284
+			'secureserver.net' => 'GoDaddy',
285
+			'WPE_APIKEY' => 'WP Engine',
286
+		];
287
+		foreach ($checks as $key => $value) {
288
+			if (!$this->isWebhostCheckValid($key)) {
289
+				continue;
290
+			}
291
+			return $value;
292
+		}
293
+		return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
294
+	}
295 295
 
296
-    /**
297
-     * @return string
298
-     */
299
-    protected function getHostName()
300
-    {
301
-        return sprintf('%s (%s)',
302
-            $this->detectWebhostProvider(),
303
-            Helper::getIpAddress()
304
-        );
305
-    }
296
+	/**
297
+	 * @return string
298
+	 */
299
+	protected function getHostName()
300
+	{
301
+		return sprintf('%s (%s)',
302
+			$this->detectWebhostProvider(),
303
+			Helper::getIpAddress()
304
+		);
305
+	}
306 306
 
307
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
308
-    {
309
-        return function_exists('ini_get')
310
-            ? ini_get($name)
311
-            : $disabledValue;
312
-    }
307
+	protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
308
+	{
309
+		return function_exists('ini_get')
310
+			? ini_get($name)
311
+			: $disabledValue;
312
+	}
313 313
 
314
-    /**
315
-     * @return array
316
-     */
317
-    protected function getWordpressPlugins()
318
-    {
319
-        $plugins = get_plugins();
320
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
321
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
322
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
323
-        return $active + $inactive;
324
-    }
314
+	/**
315
+	 * @return array
316
+	 */
317
+	protected function getWordpressPlugins()
318
+	{
319
+		$plugins = get_plugins();
320
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
321
+		$inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
322
+		$active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
323
+		return $active + $inactive;
324
+	}
325 325
 
326
-    /**
327
-     * @param string $title
328
-     * @return string
329
-     */
330
-    protected function implode($title, array $details)
331
-    {
332
-        $strings = ['['.$title.']'];
333
-        $padding = max(array_map('strlen', array_keys($details)));
334
-        $padding = max([$padding, static::PAD]);
335
-        foreach ($details as $key => $value) {
336
-            $strings[] = is_string($key)
337
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
338
-                : ' - '.$value;
339
-        }
340
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
341
-    }
326
+	/**
327
+	 * @param string $title
328
+	 * @return string
329
+	 */
330
+	protected function implode($title, array $details)
331
+	{
332
+		$strings = ['['.$title.']'];
333
+		$padding = max(array_map('strlen', array_keys($details)));
334
+		$padding = max([$padding, static::PAD]);
335
+		foreach ($details as $key => $value) {
336
+			$strings[] = is_string($key)
337
+				? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
338
+				: ' - '.$value;
339
+		}
340
+		return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
341
+	}
342 342
 
343
-    /**
344
-     * @param string $key
345
-     * @return bool
346
-     */
347
-    protected function isWebhostCheckValid($key)
348
-    {
349
-        return defined($key)
350
-            || filter_input(INPUT_SERVER, $key)
351
-            || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
352
-            || Str::contains(DB_HOST, $key)
353
-            || Str::contains(php_uname(), $key);
354
-    }
343
+	/**
344
+	 * @param string $key
345
+	 * @return bool
346
+	 */
347
+	protected function isWebhostCheckValid($key)
348
+	{
349
+		return defined($key)
350
+			|| filter_input(INPUT_SERVER, $key)
351
+			|| Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
352
+			|| Str::contains(DB_HOST, $key)
353
+			|| Str::contains(php_uname(), $key);
354
+	}
355 355
 
356
-    /**
357
-     * @return array
358
-     */
359
-    protected function normalizePluginList(array $plugins)
360
-    {
361
-        $plugins = array_map(function ($plugin) {
362
-            return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
363
-        }, $plugins);
364
-        natcasesort($plugins);
365
-        return array_flip($plugins);
366
-    }
356
+	/**
357
+	 * @return array
358
+	 */
359
+	protected function normalizePluginList(array $plugins)
360
+	{
361
+		$plugins = array_map(function ($plugin) {
362
+			return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
363
+		}, $plugins);
364
+		natcasesort($plugins);
365
+		return array_flip($plugins);
366
+	}
367 367
 
368
-    /**
369
-     * @return array
370
-     */
371
-    protected function purgeSensitiveData(array $settings)
372
-    {
373
-        $keys = [
374
-            'general.trustalyze_serial',
375
-            'licenses.',
376
-            'submissions.recaptcha.key',
377
-            'submissions.recaptcha.secret',
378
-        ];
379
-        array_walk($settings, function (&$value, $setting) use ($keys) {
380
-            foreach ($keys as $key) {
381
-                if (!Str::startsWith($key, $setting) || empty($value)) {
382
-                    continue;
383
-                }
384
-                $value = str_repeat('•', 13);
385
-                return;
386
-            }
387
-        });
388
-        return $settings;
389
-    }
368
+	/**
369
+	 * @return array
370
+	 */
371
+	protected function purgeSensitiveData(array $settings)
372
+	{
373
+		$keys = [
374
+			'general.trustalyze_serial',
375
+			'licenses.',
376
+			'submissions.recaptcha.key',
377
+			'submissions.recaptcha.secret',
378
+		];
379
+		array_walk($settings, function (&$value, $setting) use ($keys) {
380
+			foreach ($keys as $key) {
381
+				if (!Str::startsWith($key, $setting) || empty($value)) {
382
+					continue;
383
+				}
384
+				$value = str_repeat('•', 13);
385
+				return;
386
+			}
387
+		});
388
+		return $settings;
389
+	}
390 390
 }
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
             'setting' => 'Plugin Settings',
43 43
             'reviews' => 'Review Counts',
44 44
         ];
45
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
46
-            $methodName = Helper::buildMethodName('get-'.$key.'-details');
47
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
45
+        $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use ($details) {
46
+            $methodName = Helper::buildMethodName( 'get-'.$key.'-details' );
47
+            if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
48 48
                 return $carry.$this->implode(
49
-                    strtoupper($details[$key]),
50
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
49
+                    strtoupper( $details[$key] ),
50
+                    apply_filters( 'site-reviews/system/'.$key, $systemDetails )
51 51
                 );
52 52
             }
53 53
             return $carry;
54 54
         });
55
-        return trim($systemInfo);
55
+        return trim( $systemInfo );
56 56
     }
57 57
 
58 58
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     public function getActivePluginDetails()
62 62
     {
63 63
         $plugins = get_plugins();
64
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
65
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
66
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
64
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
65
+        $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
66
+        return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
67 67
     }
68 68
 
69 69
     /**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getAddonDetails()
73 73
     {
74
-        $details = apply_filters('site-reviews/addon/system-info', []);
75
-        ksort($details);
74
+        $details = apply_filters( 'site-reviews/addon/system-info', [] );
75
+        ksort( $details );
76 76
         return $details;
77 77
     }
78 78
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     public function getBrowserDetails()
83 83
     {
84 84
         $browser = new Browser();
85
-        $name = esc_attr($browser->getName());
86
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
87
-        $version = esc_attr($browser->getVersion());
85
+        $name = esc_attr( $browser->getName() );
86
+        $userAgent = esc_attr( $browser->getUserAgent()->getUserAgentString() );
87
+        $version = esc_attr( $browser->getVersion() );
88 88
         return [
89
-            'Browser Name' => sprintf('%s %s', $name, $version),
89
+            'Browser Name' => sprintf( '%s %s', $name, $version ),
90 90
             'Browser UA' => $userAgent,
91 91
         ];
92 92
     }
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getInactivePluginDetails()
98 98
     {
99
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
100
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
99
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
100
+        $inactivePlugins = $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
101 101
         $multisitePlugins = $this->getMultisitePluginDetails();
102 102
         return empty($multisitePlugins)
103 103
             ? $inactivePlugins
104
-            : array_diff($inactivePlugins, $multisitePlugins);
104
+            : array_diff( $inactivePlugins, $multisitePlugins );
105 105
     }
106 106
 
107 107
     /**
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getMuPluginDetails()
111 111
     {
112
-        if (empty($plugins = get_mu_plugins())) {
112
+        if( empty($plugins = get_mu_plugins()) ) {
113 113
             return [];
114 114
         }
115
-        return $this->normalizePluginList($plugins);
115
+        return $this->normalizePluginList( $plugins );
116 116
     }
117 117
 
118 118
     /**
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function getMultisitePluginDetails()
122 122
     {
123
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
124
-        if (!is_multisite() || empty($activePlugins)) {
123
+        $activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] );
124
+        if( !is_multisite() || empty($activePlugins) ) {
125 125
             return [];
126 126
         }
127
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
127
+        return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins ) );
128 128
     }
129 129
 
130 130
     /**
@@ -132,31 +132,31 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getPhpDetails()
134 134
     {
135
-        $displayErrors = $this->getINI('display_errors', null)
136
-            ? 'On ('.$this->getINI('display_errors').')'
135
+        $displayErrors = $this->getINI( 'display_errors', null )
136
+            ? 'On ('.$this->getINI( 'display_errors' ).')'
137 137
             : 'N/A';
138
-        $intlSupport = extension_loaded('intl')
139
-            ? phpversion('intl')
138
+        $intlSupport = extension_loaded( 'intl' )
139
+            ? phpversion( 'intl' )
140 140
             : 'false';
141 141
         return [
142
-            'cURL' => var_export(function_exists('curl_init'), true),
143
-            'Default Charset' => $this->getINI('default_charset'),
142
+            'cURL' => var_export( function_exists( 'curl_init' ), true ),
143
+            'Default Charset' => $this->getINI( 'default_charset' ),
144 144
             'Display Errors' => $displayErrors,
145
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
145
+            'fsockopen' => var_export( function_exists( 'fsockopen' ), true ),
146 146
             'Intl' => $intlSupport,
147
-            'IPv6' => var_export(defined('AF_INET6'), true),
148
-            'Max Execution Time' => $this->getINI('max_execution_time'),
149
-            'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
150
-            'Max Input Vars' => $this->getINI('max_input_vars'),
151
-            'Memory Limit' => $this->getINI('memory_limit'),
152
-            'Post Max Size' => $this->getINI('post_max_size'),
153
-            'Sendmail Path' => $this->getINI('sendmail_path'),
154
-            'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
155
-            'Session Name' => esc_html($this->getINI('session.name')),
156
-            'Session Save Path' => esc_html($this->getINI('session.save_path')),
157
-            'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
158
-            'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
159
-            'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
147
+            'IPv6' => var_export( defined( 'AF_INET6' ), true ),
148
+            'Max Execution Time' => $this->getINI( 'max_execution_time' ),
149
+            'Max Input Nesting Level' => $this->getINI( 'max_input_nesting_level' ),
150
+            'Max Input Vars' => $this->getINI( 'max_input_vars' ),
151
+            'Memory Limit' => $this->getINI( 'memory_limit' ),
152
+            'Post Max Size' => $this->getINI( 'post_max_size' ),
153
+            'Sendmail Path' => $this->getINI( 'sendmail_path' ),
154
+            'Session Cookie Path' => esc_html( $this->getINI( 'session.cookie_path' ) ),
155
+            'Session Name' => esc_html( $this->getINI( 'session.name' ) ),
156
+            'Session Save Path' => esc_html( $this->getINI( 'session.save_path' ) ),
157
+            'Session Use Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_cookies', false ) ), true ),
158
+            'Session Use Only Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_only_cookies', false ) ), true ),
159
+            'Upload Max Filesize' => $this->getINI( 'upload_max_filesize' ),
160 160
         ];
161 161
     }
162 162
 
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getReviewsDetails()
167 167
     {
168
-        $counts = glsr(CountsManager::class)->getCounts();
169
-        $counts = Arr::flattenArray($counts);
170
-        array_walk($counts, function (&$ratings) use ($counts) {
171
-            if (is_array($ratings)) {
172
-                $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
168
+        $counts = glsr( CountsManager::class )->getCounts();
169
+        $counts = Arr::flattenArray( $counts );
170
+        array_walk( $counts, function( &$ratings ) use ($counts) {
171
+            if( is_array( $ratings ) ) {
172
+                $ratings = array_sum( $ratings ).' ('.implode( ', ', $ratings ).')';
173 173
                 return;
174 174
             }
175 175
             glsr_log()
176
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
177
-                ->debug($ratings)
178
-                ->debug($counts);
176
+                ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
177
+                ->debug( $ratings )
178
+                ->debug( $counts );
179 179
         });
180
-        ksort($counts);
180
+        ksort( $counts );
181 181
         return $counts;
182 182
     }
183 183
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'Host Name' => $this->getHostName(),
192 192
             'MySQL Version' => $wpdb->db_version(),
193 193
             'PHP Version' => PHP_VERSION,
194
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
194
+            'Server Software' => filter_input( INPUT_SERVER, 'SERVER_SOFTWARE' ),
195 195
         ];
196 196
     }
197 197
 
@@ -200,16 +200,16 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getSettingDetails()
202 202
     {
203
-        $settings = glsr(OptionManager::class)->get('settings', []);
204
-        $settings = Arr::flattenArray($settings, true);
205
-        $settings = $this->purgeSensitiveData($settings);
206
-        ksort($settings);
203
+        $settings = glsr( OptionManager::class )->get( 'settings', [] );
204
+        $settings = Arr::flattenArray( $settings, true );
205
+        $settings = $this->purgeSensitiveData( $settings );
206
+        ksort( $settings );
207 207
         $details = [];
208
-        foreach ($settings as $key => $value) {
209
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
208
+        foreach( $settings as $key => $value ) {
209
+            if( Str::startsWith( 'strings', $key ) && Str::endsWith( 'id', $key ) ) {
210 210
                 continue;
211 211
             }
212
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/u', '\\n', $value)), ENT_QUOTES, 'UTF-8');
212
+            $value = htmlspecialchars( trim( preg_replace( '/\s\s+/u', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
213 213
             $details[$key] = $value;
214 214
         }
215 215
         return $details;
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
     public function getPluginDetails()
222 222
     {
223 223
         return [
224
-            'Console level' => glsr(Console::class)->humanLevel(),
225
-            'Console size' => glsr(Console::class)->humanSize('0'),
226
-            'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'),
227
-            'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'),
224
+            'Console level' => glsr( Console::class )->humanLevel(),
225
+            'Console size' => glsr( Console::class )->humanSize( '0' ),
226
+            'Last Migration Run' => glsr( Date::class )->localized( glsr( OptionManager::class )->get( 'last_migration_run' ), 'unknown' ),
227
+            'Last Rating Count' => glsr( Date::class )->localized( glsr( OptionManager::class )->get( 'last_review_count' ), 'unknown' ),
228 228
             'Version (current)' => glsr()->version,
229
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
229
+            'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
230 230
         ];
231 231
     }
232 232
 
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
         global $wpdb;
239 239
         $theme = wp_get_theme();
240 240
         return [
241
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
242
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
241
+            'Active Theme' => sprintf( '%s v%s', (string)$theme->Name, (string)$theme->Version ),
242
+            'Email Domain' => substr( strrchr( glsr( OptionManager::class )->getWP( 'admin_email' ), '@' ), 1 ),
243 243
             'Home URL' => home_url(),
244 244
             'Language' => get_locale(),
245 245
             'Memory Limit' => WP_MEMORY_LIMIT,
246
-            'Multisite' => var_export(is_multisite(), true),
247
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
248
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
249
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
250
-            'Post Stati' => implode(', ', get_post_stati()),
251
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
252
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
246
+            'Multisite' => var_export( is_multisite(), true ),
247
+            'Page For Posts ID' => glsr( OptionManager::class )->getWP( 'page_for_posts' ),
248
+            'Page On Front ID' => glsr( OptionManager::class )->getWP( 'page_on_front' ),
249
+            'Permalink Structure' => glsr( OptionManager::class )->getWP( 'permalink_structure', 'default' ),
250
+            'Post Stati' => implode( ', ', get_post_stati() ),
251
+            'Remote Post' => glsr( Cache::class )->getRemotePostTest(),
252
+            'Show On Front' => glsr( OptionManager::class )->getWP( 'show_on_front' ),
253 253
             'Site URL' => site_url(),
254
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
255
-            'Version' => get_bloginfo('version'),
256
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
257
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
254
+            'Timezone' => glsr( OptionManager::class )->getWP( 'timezone_string', $this->getINI( 'date.timezone' ).' (PHP)' ),
255
+            'Version' => get_bloginfo( 'version' ),
256
+            'WP Debug' => var_export( defined( 'WP_DEBUG' ), true ),
257
+            'WP Max Upload Size' => size_format( wp_max_upload_size() ),
258 258
             'WP Memory Limit' => WP_MEMORY_LIMIT,
259 259
         ];
260 260
     }
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
             'secureserver.net' => 'GoDaddy',
285 285
             'WPE_APIKEY' => 'WP Engine',
286 286
         ];
287
-        foreach ($checks as $key => $value) {
288
-            if (!$this->isWebhostCheckValid($key)) {
287
+        foreach( $checks as $key => $value ) {
288
+            if( !$this->isWebhostCheckValid( $key ) ) {
289 289
                 continue;
290 290
             }
291 291
             return $value;
292 292
         }
293
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
293
+        return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
294 294
     }
295 295
 
296 296
     /**
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
      */
299 299
     protected function getHostName()
300 300
     {
301
-        return sprintf('%s (%s)',
301
+        return sprintf( '%s (%s)',
302 302
             $this->detectWebhostProvider(),
303 303
             Helper::getIpAddress()
304 304
         );
305 305
     }
306 306
 
307
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
307
+    protected function getINI( $name, $disabledValue = 'ini_get() is disabled.' )
308 308
     {
309
-        return function_exists('ini_get')
310
-            ? ini_get($name)
309
+        return function_exists( 'ini_get' )
310
+            ? ini_get( $name )
311 311
             : $disabledValue;
312 312
     }
313 313
 
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
     protected function getWordpressPlugins()
318 318
     {
319 319
         $plugins = get_plugins();
320
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
321
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
322
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
320
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
321
+        $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
322
+        $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
323 323
         return $active + $inactive;
324 324
     }
325 325
 
@@ -327,48 +327,48 @@  discard block
 block discarded – undo
327 327
      * @param string $title
328 328
      * @return string
329 329
      */
330
-    protected function implode($title, array $details)
330
+    protected function implode( $title, array $details )
331 331
     {
332 332
         $strings = ['['.$title.']'];
333
-        $padding = max(array_map('strlen', array_keys($details)));
334
-        $padding = max([$padding, static::PAD]);
335
-        foreach ($details as $key => $value) {
336
-            $strings[] = is_string($key)
337
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
333
+        $padding = max( array_map( 'strlen', array_keys( $details ) ) );
334
+        $padding = max( [$padding, static::PAD] );
335
+        foreach( $details as $key => $value ) {
336
+            $strings[] = is_string( $key )
337
+                ? sprintf( '%s : %s', str_pad( $key, $padding, '.' ), $value )
338 338
                 : ' - '.$value;
339 339
         }
340
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
340
+        return implode( PHP_EOL, $strings ).PHP_EOL.PHP_EOL;
341 341
     }
342 342
 
343 343
     /**
344 344
      * @param string $key
345 345
      * @return bool
346 346
      */
347
-    protected function isWebhostCheckValid($key)
347
+    protected function isWebhostCheckValid( $key )
348 348
     {
349
-        return defined($key)
350
-            || filter_input(INPUT_SERVER, $key)
351
-            || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
352
-            || Str::contains(DB_HOST, $key)
353
-            || Str::contains(php_uname(), $key);
349
+        return defined( $key )
350
+            || filter_input( INPUT_SERVER, $key )
351
+            || Str::contains( filter_input( INPUT_SERVER, 'SERVER_NAME' ), $key )
352
+            || Str::contains( DB_HOST, $key )
353
+            || Str::contains( php_uname(), $key );
354 354
     }
355 355
 
356 356
     /**
357 357
      * @return array
358 358
      */
359
-    protected function normalizePluginList(array $plugins)
359
+    protected function normalizePluginList( array $plugins )
360 360
     {
361
-        $plugins = array_map(function ($plugin) {
362
-            return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
363
-        }, $plugins);
364
-        natcasesort($plugins);
365
-        return array_flip($plugins);
361
+        $plugins = array_map( function( $plugin ) {
362
+            return sprintf( '%s v%s', Arr::get( $plugin, 'Name' ), Arr::get( $plugin, 'Version' ) );
363
+        }, $plugins );
364
+        natcasesort( $plugins );
365
+        return array_flip( $plugins );
366 366
     }
367 367
 
368 368
     /**
369 369
      * @return array
370 370
      */
371
-    protected function purgeSensitiveData(array $settings)
371
+    protected function purgeSensitiveData( array $settings )
372 372
     {
373 373
         $keys = [
374 374
             'general.trustalyze_serial',
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
             'submissions.recaptcha.key',
377 377
             'submissions.recaptcha.secret',
378 378
         ];
379
-        array_walk($settings, function (&$value, $setting) use ($keys) {
380
-            foreach ($keys as $key) {
381
-                if (!Str::startsWith($key, $setting) || empty($value)) {
379
+        array_walk( $settings, function( &$value, $setting ) use ($keys) {
380
+            foreach( $keys as $key ) {
381
+                if( !Str::startsWith( $key, $setting ) || empty($value) ) {
382 382
                     continue;
383 383
                 }
384
-                $value = str_repeat('•', 13);
384
+                $value = str_repeat( '•', 13 );
385 385
                 return;
386 386
             }
387 387
         });
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Labels.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -7,106 +7,106 @@
 block discarded – undo
7 7
 
8 8
 class Labels
9 9
 {
10
-    /**
11
-     * @param string $translation
12
-     * @param string $test
13
-     * @return string
14
-     */
15
-    public function filterPostStatusLabels($translation, $text)
16
-    {
17
-        $replacements = $this->getStatusLabels();
18
-        return array_key_exists($text, $replacements)
19
-            ? $replacements[$text]
20
-            : $translation;
21
-    }
10
+	/**
11
+	 * @param string $translation
12
+	 * @param string $test
13
+	 * @return string
14
+	 */
15
+	public function filterPostStatusLabels($translation, $text)
16
+	{
17
+		$replacements = $this->getStatusLabels();
18
+		return array_key_exists($text, $replacements)
19
+			? $replacements[$text]
20
+			: $translation;
21
+	}
22 22
 
23
-    /**
24
-     * @return array
25
-     */
26
-    public function filterUpdateMessages(array $messages)
27
-    {
28
-        $post = get_post();
29
-        if (!($post instanceof WP_Post)) {
30
-            return;
31
-        }
32
-        $strings = $this->getReviewLabels();
33
-        $restored = filter_input(INPUT_GET, 'revision');
34
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
-            $restored = sprintf($strings['restored'], $revisionTitle);
36
-        }
37
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
38
-        $messages[Application::POST_TYPE] = [
39
-             1 => $strings['updated'],
40
-             4 => $strings['updated'],
41
-             5 => $restored,
42
-             6 => $strings['published'],
43
-             7 => $strings['saved'],
44
-             8 => $strings['submitted'],
45
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
46
-            10 => $strings['draft_updated'],
47
-            50 => $strings['approved'],
48
-            51 => $strings['unapproved'],
49
-            52 => $strings['reverted'],
50
-        ];
51
-        return $messages;
52
-    }
23
+	/**
24
+	 * @return array
25
+	 */
26
+	public function filterUpdateMessages(array $messages)
27
+	{
28
+		$post = get_post();
29
+		if (!($post instanceof WP_Post)) {
30
+			return;
31
+		}
32
+		$strings = $this->getReviewLabels();
33
+		$restored = filter_input(INPUT_GET, 'revision');
34
+		if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
+			$restored = sprintf($strings['restored'], $revisionTitle);
36
+		}
37
+		$scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
38
+		$messages[Application::POST_TYPE] = [
39
+			 1 => $strings['updated'],
40
+			 4 => $strings['updated'],
41
+			 5 => $restored,
42
+			 6 => $strings['published'],
43
+			 7 => $strings['saved'],
44
+			 8 => $strings['submitted'],
45
+			 9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
46
+			10 => $strings['draft_updated'],
47
+			50 => $strings['approved'],
48
+			51 => $strings['unapproved'],
49
+			52 => $strings['reverted'],
50
+		];
51
+		return $messages;
52
+	}
53 53
 
54
-    /**
55
-     * @return void
56
-     */
57
-    public function translatePostStatusLabels()
58
-    {
59
-        global $wp_scripts;
60
-        $strings = [
61
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
62
-            'published' => __('Approved', 'site-reviews'),
63
-        ];
64
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
65
-            $l10n = &$wp_scripts->registered['post']->extra['data'];
66
-            foreach ($strings as $search => $replace) {
67
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/u', '$1'.$replace, $l10n);
68
-            }
69
-        }
70
-    }
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function translatePostStatusLabels()
58
+	{
59
+		global $wp_scripts;
60
+		$strings = [
61
+			'savePending' => __('Save as Unapproved', 'site-reviews'),
62
+			'published' => __('Approved', 'site-reviews'),
63
+		];
64
+		if (isset($wp_scripts->registered['post']->extra['data'])) {
65
+			$l10n = &$wp_scripts->registered['post']->extra['data'];
66
+			foreach ($strings as $search => $replace) {
67
+				$l10n = preg_replace('/("'.$search.'":")([^"]+)/u', '$1'.$replace, $l10n);
68
+			}
69
+		}
70
+	}
71 71
 
72
-    /**
73
-     * @return array
74
-     */
75
-    protected function getReviewLabels()
76
-    {
77
-        return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
90
-        ];
91
-    }
72
+	/**
73
+	 * @return array
74
+	 */
75
+	protected function getReviewLabels()
76
+	{
77
+		return [
78
+			'approved' => __('Review has been approved and published.', 'site-reviews'),
79
+			'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
+			'preview' => __('Preview review', 'site-reviews'),
81
+			'published' => __('Review approved and published.', 'site-reviews'),
82
+			'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
+			'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
+			'saved' => __('Review saved.', 'site-reviews'),
85
+			'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
+			'submitted' => __('Review submitted.', 'site-reviews'),
87
+			'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
+			'updated' => __('Review updated.', 'site-reviews'),
89
+			'view' => __('View review', 'site-reviews'),
90
+		];
91
+	}
92 92
 
93
-    /**
94
-     * Store the labels to avoid unnecessary loops.
95
-     * @return array
96
-     */
97
-    protected function getStatusLabels()
98
-    {
99
-        static $labels;
100
-        if (empty($labels)) {
101
-            $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
-            ];
109
-        }
110
-        return $labels;
111
-    }
93
+	/**
94
+	 * Store the labels to avoid unnecessary loops.
95
+	 * @return array
96
+	 */
97
+	protected function getStatusLabels()
98
+	{
99
+		static $labels;
100
+		if (empty($labels)) {
101
+			$labels = [
102
+				'Pending' => __('Unapproved', 'site-reviews'),
103
+				'Pending Review' => __('Unapproved', 'site-reviews'),
104
+				'Privately Published' => __('Privately Approved', 'site-reviews'),
105
+				'Publish' => __('Approve', 'site-reviews'),
106
+				'Published' => __('Approved', 'site-reviews'),
107
+				'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
+			];
109
+		}
110
+		return $labels;
111
+	}
112 112
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
      * @param string $test
13 13
      * @return string
14 14
      */
15
-    public function filterPostStatusLabels($translation, $text)
15
+    public function filterPostStatusLabels( $translation, $text )
16 16
     {
17 17
         $replacements = $this->getStatusLabels();
18
-        return array_key_exists($text, $replacements)
18
+        return array_key_exists( $text, $replacements )
19 19
             ? $replacements[$text]
20 20
             : $translation;
21 21
     }
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @return array
25 25
      */
26
-    public function filterUpdateMessages(array $messages)
26
+    public function filterUpdateMessages( array $messages )
27 27
     {
28 28
         $post = get_post();
29
-        if (!($post instanceof WP_Post)) {
29
+        if( !($post instanceof WP_Post) ) {
30 30
             return;
31 31
         }
32 32
         $strings = $this->getReviewLabels();
33
-        $restored = filter_input(INPUT_GET, 'revision');
34
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
-            $restored = sprintf($strings['restored'], $revisionTitle);
33
+        $restored = filter_input( INPUT_GET, 'revision' );
34
+        if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) {
35
+            $restored = sprintf( $strings['restored'], $revisionTitle );
36 36
         }
37
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
37
+        $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) );
38 38
         $messages[Application::POST_TYPE] = [
39 39
              1 => $strings['updated'],
40 40
              4 => $strings['updated'],
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
              6 => $strings['published'],
43 43
              7 => $strings['saved'],
44 44
              8 => $strings['submitted'],
45
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
45
+             9 => sprintf( $strings['scheduled'], '<strong>'.$scheduled_date.'</strong>' ),
46 46
             10 => $strings['draft_updated'],
47 47
             50 => $strings['approved'],
48 48
             51 => $strings['unapproved'],
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
     {
59 59
         global $wp_scripts;
60 60
         $strings = [
61
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
62
-            'published' => __('Approved', 'site-reviews'),
61
+            'savePending' => __( 'Save as Unapproved', 'site-reviews' ),
62
+            'published' => __( 'Approved', 'site-reviews' ),
63 63
         ];
64
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
64
+        if( isset($wp_scripts->registered['post']->extra['data']) ) {
65 65
             $l10n = &$wp_scripts->registered['post']->extra['data'];
66
-            foreach ($strings as $search => $replace) {
67
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/u', '$1'.$replace, $l10n);
66
+            foreach( $strings as $search => $replace ) {
67
+                $l10n = preg_replace( '/("'.$search.'":")([^"]+)/u', '$1'.$replace, $l10n );
68 68
             }
69 69
         }
70 70
     }
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
     protected function getReviewLabels()
76 76
     {
77 77
         return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
78
+            'approved' => __( 'Review has been approved and published.', 'site-reviews' ),
79
+            'draft_updated' => __( 'Review draft updated.', 'site-reviews' ),
80
+            'preview' => __( 'Preview review', 'site-reviews' ),
81
+            'published' => __( 'Review approved and published.', 'site-reviews' ),
82
+            'restored' => __( 'Review restored to revision from %s.', 'site-reviews' ),
83
+            'reverted' => __( 'Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews' ),
84
+            'saved' => __( 'Review saved.', 'site-reviews' ),
85
+            'scheduled' => __( 'Review scheduled for: %s.', 'site-reviews' ),
86
+            'submitted' => __( 'Review submitted.', 'site-reviews' ),
87
+            'unapproved' => __( 'Review has been unapproved and is now pending.', 'site-reviews' ),
88
+            'updated' => __( 'Review updated.', 'site-reviews' ),
89
+            'view' => __( 'View review', 'site-reviews' ),
90 90
         ];
91 91
     }
92 92
 
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     protected function getStatusLabels()
98 98
     {
99 99
         static $labels;
100
-        if (empty($labels)) {
100
+        if( empty($labels) ) {
101 101
             $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
102
+                'Pending' => __( 'Unapproved', 'site-reviews' ),
103
+                'Pending Review' => __( 'Unapproved', 'site-reviews' ),
104
+                'Privately Published' => __( 'Privately Approved', 'site-reviews' ),
105
+                'Publish' => __( 'Approve', 'site-reviews' ),
106
+                'Published' => __( 'Approved', 'site-reviews' ),
107
+                'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ),
108 108
             ];
109 109
         }
110 110
         return $labels;
Please login to merge, or discard this patch.
plugin/Blocks/SiteReviewsFormBlock.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -7,115 +7,115 @@
 block discarded – undo
7 7
 
8 8
 class SiteReviewsFormBlock extends BlockGenerator
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function attributes()
14
-    {
15
-        return [
16
-            'assign_to' => [
17
-                'default' => '',
18
-                'type' => 'string',
19
-            ],
20
-            'category' => [
21
-                'default' => '',
22
-                'type' => 'string',
23
-            ],
24
-            'className' => [
25
-                'default' => '',
26
-                'type' => 'string',
27
-            ],
28
-            'hide' => [
29
-                'default' => '',
30
-                'type' => 'string',
31
-            ],
32
-            'id' => [
33
-                'default' => '',
34
-                'type' => 'string',
35
-            ],
36
-        ];
37
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function attributes()
14
+	{
15
+		return [
16
+			'assign_to' => [
17
+				'default' => '',
18
+				'type' => 'string',
19
+			],
20
+			'category' => [
21
+				'default' => '',
22
+				'type' => 'string',
23
+			],
24
+			'className' => [
25
+				'default' => '',
26
+				'type' => 'string',
27
+			],
28
+			'hide' => [
29
+				'default' => '',
30
+				'type' => 'string',
31
+			],
32
+			'id' => [
33
+				'default' => '',
34
+				'type' => 'string',
35
+			],
36
+		];
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    public function render(array $attributes)
43
-    {
44
-        $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
47
-            $this->filterFormFields();
48
-            $this->filterRatingField();
49
-            $this->filterShortcodeClass();
50
-            $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
-                $this->filterInterpolation();
53
-            }
54
-        }
55
-        return $shortcode->buildShortcode($attributes);
56
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function render(array $attributes)
43
+	{
44
+		$attributes['class'] = $attributes['className'];
45
+		$shortcode = glsr(Shortcode::class);
46
+		if ('edit' == filter_input(INPUT_GET, 'context')) {
47
+			$this->filterFormFields();
48
+			$this->filterRatingField();
49
+			$this->filterShortcodeClass();
50
+			$this->filterSubmitButton();
51
+			if (!$this->hasVisibleFields($shortcode, $attributes)) {
52
+				$this->filterInterpolation();
53
+			}
54
+		}
55
+		return $shortcode->buildShortcode($attributes);
56
+	}
57 57
 
58
-    /**
59
-     * @return void
60
-     */
61
-    protected function filterFormFields()
62
-    {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
65
-                $field['disabled'] = true;
66
-                $field['tabindex'] = '-1';
67
-            });
68
-            return $config;
69
-        });
70
-    }
58
+	/**
59
+	 * @return void
60
+	 */
61
+	protected function filterFormFields()
62
+	{
63
+		add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
+			array_walk($config, function (&$field) {
65
+				$field['disabled'] = true;
66
+				$field['tabindex'] = '-1';
67
+			});
68
+			return $config;
69
+		});
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     */
75
-    protected function filterInterpolation()
76
-    {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
-            $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
-            $context['response'] = '';
81
-            $context['submit_button'] = '';
82
-            return $context;
83
-        });
84
-    }
72
+	/**
73
+	 * @return void
74
+	 */
75
+	protected function filterInterpolation()
76
+	{
77
+		add_filter('site-reviews/interpolate/reviews-form', function ($context) {
78
+			$context['class'] = 'glsr-default glsr-block-disabled';
79
+			$context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
80
+			$context['response'] = '';
81
+			$context['submit_button'] = '';
82
+			return $context;
83
+		});
84
+	}
85 85
 
86
-    /**
87
-     * @return void
88
-     */
89
-    protected function filterRatingField()
90
-    {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
93
-                $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/u', '$1'.$stars.'$4', $html);
97
-            }
98
-            return $html;
99
-        }, 10, 3);
100
-    }
86
+	/**
87
+	 * @return void
88
+	 */
89
+	protected function filterRatingField()
90
+	{
91
+		add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
+			if ('rating' == $args['path']) {
93
+				$stars = '<span class="glsr-stars">';
94
+				$stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
+				$stars.= '</span>';
96
+				$html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/u', '$1'.$stars.'$4', $html);
97
+			}
98
+			return $html;
99
+		}, 10, 3);
100
+	}
101 101
 
102
-    /**
103
-     * @return void
104
-     */
105
-    protected function filterShortcodeClass()
106
-    {
107
-        add_filter('site-reviews/style', function () {
108
-            return 'default';
109
-        });
110
-    }
102
+	/**
103
+	 * @return void
104
+	 */
105
+	protected function filterShortcodeClass()
106
+	{
107
+		add_filter('site-reviews/style', function () {
108
+			return 'default';
109
+		});
110
+	}
111 111
 
112
-    /**
113
-     * @return void
114
-     */
115
-    protected function filterSubmitButton()
116
-    {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
119
-        });
120
-    }
112
+	/**
113
+	 * @return void
114
+	 */
115
+	protected function filterSubmitButton()
116
+	{
117
+		add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
+			return str_replace('type="submit"', 'tabindex="-1"', $template);
119
+		});
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * @return string
41 41
      */
42
-    public function render(array $attributes)
42
+    public function render( array $attributes )
43 43
     {
44 44
         $attributes['class'] = $attributes['className'];
45
-        $shortcode = glsr(Shortcode::class);
46
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
45
+        $shortcode = glsr( Shortcode::class );
46
+        if( 'edit' == filter_input( INPUT_GET, 'context' ) ) {
47 47
             $this->filterFormFields();
48 48
             $this->filterRatingField();
49 49
             $this->filterShortcodeClass();
50 50
             $this->filterSubmitButton();
51
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
51
+            if( !$this->hasVisibleFields( $shortcode, $attributes ) ) {
52 52
                 $this->filterInterpolation();
53 53
             }
54 54
         }
55
-        return $shortcode->buildShortcode($attributes);
55
+        return $shortcode->buildShortcode( $attributes );
56 56
     }
57 57
 
58 58
     /**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function filterFormFields()
62 62
     {
63
-        add_filter('site-reviews/config/forms/submission-form', function (array $config) {
64
-            array_walk($config, function (&$field) {
63
+        add_filter( 'site-reviews/config/forms/submission-form', function( array $config ) {
64
+            array_walk( $config, function( &$field ) {
65 65
                 $field['disabled'] = true;
66 66
                 $field['tabindex'] = '-1';
67 67
             });
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function filterInterpolation()
76 76
     {
77
-        add_filter('site-reviews/interpolate/reviews-form', function ($context) {
77
+        add_filter( 'site-reviews/interpolate/reviews-form', function( $context ) {
78 78
             $context['class'] = 'glsr-default glsr-block-disabled';
79
-            $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews');
79
+            $context['fields'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' );
80 80
             $context['response'] = '';
81 81
             $context['submit_button'] = '';
82 82
             return $context;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
      */
89 89
     protected function filterRatingField()
90 90
     {
91
-        add_filter('site-reviews/rendered/field', function ($html, $type, $args) {
92
-            if ('rating' == $args['path']) {
91
+        add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) {
92
+            if( 'rating' == $args['path'] ) {
93 93
                 $stars = '<span class="glsr-stars">';
94
-                $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int) glsr()->constant('MAX_RATING', Rating::class));
95
-                $stars.= '</span>';
96
-                $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/u', '$1'.$stars.'$4', $html);
94
+                $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', (int)glsr()->constant( 'MAX_RATING', Rating::class ) );
95
+                $stars .= '</span>';
96
+                $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/u', '$1'.$stars.'$4', $html );
97 97
             }
98 98
             return $html;
99
-        }, 10, 3);
99
+        }, 10, 3 );
100 100
     }
101 101
 
102 102
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     protected function filterShortcodeClass()
106 106
     {
107
-        add_filter('site-reviews/style', function () {
107
+        add_filter( 'site-reviews/style', function() {
108 108
             return 'default';
109 109
         });
110 110
     }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function filterSubmitButton()
116 116
     {
117
-        add_filter('site-reviews/rendered/template/form/submit-button', function ($template) {
118
-            return str_replace('type="submit"', 'tabindex="-1"', $template);
117
+        add_filter( 'site-reviews/rendered/template/form/submit-button', function( $template ) {
118
+            return str_replace( 'type="submit"', 'tabindex="-1"', $template );
119 119
         });
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
plugin/Blocks/SiteReviewsBlock.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -6,124 +6,124 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsBlock extends BlockGenerator
8 8
 {
9
-    /**
10
-     * @return array
11
-     */
12
-    public function attributes()
13
-    {
14
-        return [
15
-            'assigned_to' => [
16
-                'default' => '',
17
-                'type' => 'string',
18
-            ],
19
-            'category' => [
20
-                'default' => '',
21
-                'type' => 'string',
22
-            ],
23
-            'className' => [
24
-                'default' => '',
25
-                'type' => 'string',
26
-            ],
27
-            'display' => [
28
-                'default' => 5,
29
-                'type' => 'number',
30
-            ],
31
-            'hide' => [
32
-                'default' => '',
33
-                'type' => 'string',
34
-            ],
35
-            'id' => [
36
-                'default' => '',
37
-                'type' => 'string',
38
-            ],
39
-            'pagination' => [
40
-                'default' => '',
41
-                'type' => 'string',
42
-            ],
43
-            'post_id' => [
44
-                'default' => '',
45
-                'type' => 'string',
46
-            ],
47
-            'rating' => [
48
-                'default' => 0,
49
-                'type' => 'number',
50
-            ],
51
-            'schema' => [
52
-                'default' => false,
53
-                'type' => 'boolean',
54
-            ],
55
-            'type' => [
56
-                'default' => 'local',
57
-                'type' => 'string',
58
-            ],
59
-        ];
60
-    }
9
+	/**
10
+	 * @return array
11
+	 */
12
+	public function attributes()
13
+	{
14
+		return [
15
+			'assigned_to' => [
16
+				'default' => '',
17
+				'type' => 'string',
18
+			],
19
+			'category' => [
20
+				'default' => '',
21
+				'type' => 'string',
22
+			],
23
+			'className' => [
24
+				'default' => '',
25
+				'type' => 'string',
26
+			],
27
+			'display' => [
28
+				'default' => 5,
29
+				'type' => 'number',
30
+			],
31
+			'hide' => [
32
+				'default' => '',
33
+				'type' => 'string',
34
+			],
35
+			'id' => [
36
+				'default' => '',
37
+				'type' => 'string',
38
+			],
39
+			'pagination' => [
40
+				'default' => '',
41
+				'type' => 'string',
42
+			],
43
+			'post_id' => [
44
+				'default' => '',
45
+				'type' => 'string',
46
+			],
47
+			'rating' => [
48
+				'default' => 0,
49
+				'type' => 'number',
50
+			],
51
+			'schema' => [
52
+				'default' => false,
53
+				'type' => 'boolean',
54
+			],
55
+			'type' => [
56
+				'default' => 'local',
57
+				'type' => 'string',
58
+			],
59
+		];
60
+	}
61 61
 
62
-    /**
63
-     * @return string
64
-     */
65
-    public function render(array $attributes)
66
-    {
67
-        $attributes['class'] = $attributes['className'];
68
-        $shortcode = glsr(Shortcode::class);
69
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
70
-            $attributes = $this->normalize($attributes);
71
-            $this->filterReviewLinks();
72
-            $this->filterShortcodeClass();
73
-            $this->filterShowMoreLinks('content');
74
-            $this->filterShowMoreLinks('response');
75
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
76
-                $this->filterInterpolation();
77
-            }
78
-        }
79
-        return $shortcode->buildShortcode($attributes);
80
-    }
62
+	/**
63
+	 * @return string
64
+	 */
65
+	public function render(array $attributes)
66
+	{
67
+		$attributes['class'] = $attributes['className'];
68
+		$shortcode = glsr(Shortcode::class);
69
+		if ('edit' == filter_input(INPUT_GET, 'context')) {
70
+			$attributes = $this->normalize($attributes);
71
+			$this->filterReviewLinks();
72
+			$this->filterShortcodeClass();
73
+			$this->filterShowMoreLinks('content');
74
+			$this->filterShowMoreLinks('response');
75
+			if (!$this->hasVisibleFields($shortcode, $attributes)) {
76
+				$this->filterInterpolation();
77
+			}
78
+		}
79
+		return $shortcode->buildShortcode($attributes);
80
+	}
81 81
 
82
-    /**
83
-     * @return void
84
-     */
85
-    protected function filterInterpolation()
86
-    {
87
-        add_filter('site-reviews/interpolate/reviews', function ($context) {
88
-            $context['class'] = 'glsr-default glsr-block-disabled';
89
-            $context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
90
-            return $context;
91
-        });
92
-    }
82
+	/**
83
+	 * @return void
84
+	 */
85
+	protected function filterInterpolation()
86
+	{
87
+		add_filter('site-reviews/interpolate/reviews', function ($context) {
88
+			$context['class'] = 'glsr-default glsr-block-disabled';
89
+			$context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
90
+			return $context;
91
+		});
92
+	}
93 93
 
94
-    /**
95
-     * @return void
96
-     */
97
-    protected function filterReviewLinks()
98
-    {
99
-        add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
-            return str_replace('<a', '<a tabindex="-1"', $template);
101
-        });
102
-    }
94
+	/**
95
+	 * @return void
96
+	 */
97
+	protected function filterReviewLinks()
98
+	{
99
+		add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
+			return str_replace('<a', '<a tabindex="-1"', $template);
101
+		});
102
+	}
103 103
 
104
-    /**
105
-     * @return void
106
-     */
107
-    protected function filterShortcodeClass()
108
-    {
109
-        add_filter('site-reviews/style', function () {
110
-            return 'default';
111
-        });
112
-    }
104
+	/**
105
+	 * @return void
106
+	 */
107
+	protected function filterShortcodeClass()
108
+	{
109
+		add_filter('site-reviews/style', function () {
110
+			return 'default';
111
+		});
112
+	}
113 113
 
114
-    /**
115
-     * @param string $field
116
-     * @return void
117
-     */
118
-    protected function filterShowMoreLinks($field)
119
-    {
120
-        add_filter('site-reviews/review/wrap/'.$field, function ($value) {
121
-            $value = preg_replace(
122
-                '/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/us',
123
-                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
124
-                $value
125
-            );
126
-            return $value;
127
-        });
128
-    }
114
+	/**
115
+	 * @param string $field
116
+	 * @return void
117
+	 */
118
+	protected function filterShowMoreLinks($field)
119
+	{
120
+		add_filter('site-reviews/review/wrap/'.$field, function ($value) {
121
+			$value = preg_replace(
122
+				'/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/us',
123
+				'$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
124
+				$value
125
+			);
126
+			return $value;
127
+		});
128
+	}
129 129
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -62,21 +62,21 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @return string
64 64
      */
65
-    public function render(array $attributes)
65
+    public function render( array $attributes )
66 66
     {
67 67
         $attributes['class'] = $attributes['className'];
68
-        $shortcode = glsr(Shortcode::class);
69
-        if ('edit' == filter_input(INPUT_GET, 'context')) {
70
-            $attributes = $this->normalize($attributes);
68
+        $shortcode = glsr( Shortcode::class );
69
+        if( 'edit' == filter_input( INPUT_GET, 'context' ) ) {
70
+            $attributes = $this->normalize( $attributes );
71 71
             $this->filterReviewLinks();
72 72
             $this->filterShortcodeClass();
73
-            $this->filterShowMoreLinks('content');
74
-            $this->filterShowMoreLinks('response');
75
-            if (!$this->hasVisibleFields($shortcode, $attributes)) {
73
+            $this->filterShowMoreLinks( 'content' );
74
+            $this->filterShowMoreLinks( 'response' );
75
+            if( !$this->hasVisibleFields( $shortcode, $attributes ) ) {
76 76
                 $this->filterInterpolation();
77 77
             }
78 78
         }
79
-        return $shortcode->buildShortcode($attributes);
79
+        return $shortcode->buildShortcode( $attributes );
80 80
     }
81 81
 
82 82
     /**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function filterInterpolation()
86 86
     {
87
-        add_filter('site-reviews/interpolate/reviews', function ($context) {
87
+        add_filter( 'site-reviews/interpolate/reviews', function( $context ) {
88 88
             $context['class'] = 'glsr-default glsr-block-disabled';
89
-            $context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews');
89
+            $context['reviews'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' );
90 90
             return $context;
91 91
         });
92 92
     }
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function filterReviewLinks()
98 98
     {
99
-        add_filter('site-reviews/rendered/template/reviews', function ($template) {
100
-            return str_replace('<a', '<a tabindex="-1"', $template);
99
+        add_filter( 'site-reviews/rendered/template/reviews', function( $template ) {
100
+            return str_replace( '<a', '<a tabindex="-1"', $template );
101 101
         });
102 102
     }
103 103
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function filterShortcodeClass()
108 108
     {
109
-        add_filter('site-reviews/style', function () {
109
+        add_filter( 'site-reviews/style', function() {
110 110
             return 'default';
111 111
         });
112 112
     }
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
      * @param string $field
116 116
      * @return void
117 117
      */
118
-    protected function filterShowMoreLinks($field)
118
+    protected function filterShowMoreLinks( $field )
119 119
     {
120
-        add_filter('site-reviews/review/wrap/'.$field, function ($value) {
120
+        add_filter( 'site-reviews/review/wrap/'.$field, function( $value ) {
121 121
             $value = preg_replace(
122 122
                 '/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/us',
123
-                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5',
123
+                '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__( 'Show more', 'site-reviews' ).'</a>$5',
124 124
                 $value
125 125
             );
126 126
             return $value;
Please login to merge, or discard this patch.
views/partials/notices/trustalyze.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <div class="notice is-dismissible glsr-notice" data-dismiss="trustalyze">
2 2
     <div class="glsr-notice-icon">
3
-        <img width="96" height="96" src="<?= glsr()->url('assets/images/trustalyze-badge.png'); ?>">
3
+        <img width="96" height="96" src="<?= glsr()->url( 'assets/images/trustalyze-badge.png' ); ?>">
4 4
     </div>
5 5
     <div class="glsr-notice-content">
6 6
         <h3>Validate Your Reviews on the Blockchain With the Trustalyze Confidence System</h3>
7 7
         <p>Site Reviews integrates with the <a href="https://trustalyze.com/plans?ref=105">Trustalyze Confidence System</a>, a service which uses blockchain technology to verify to your visitors and customers that your reviews are authentic.</p>
8
-        <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-general'); ?>" class="button">Enable the integration</a>
8
+        <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#tab-general' ); ?>" class="button">Enable the integration</a>
9 9
     </div>
10 10
 </div>
Please login to merge, or discard this patch.
plugin/Controllers/TrustalyzeController.php 3 patches
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -12,210 +12,210 @@
 block discarded – undo
12 12
 
13 13
 class TrustalyzeController extends Controller
14 14
 {
15
-    protected $apiKey = 'settings.general.trustalyze_serial';
16
-    protected $emailKey = 'settings.general.trustalyze_email';
17
-    protected $enabledKey = 'settings.general.trustalyze';
18
-    protected $trustalyzeKey = '_glsr_trustalyze';
19
-
20
-    /**
21
-     * @return array
22
-     * @filter site-reviews/settings/callback
23
-     */
24
-    public function filterSettingsCallback(array $settings)
25
-    {
26
-        if ('yes' !== Arr::get($settings, $this->enabledKey)) {
27
-            return $settings;
28
-        }
29
-        $isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings);
30
-        $isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings);
31
-        $isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false);
32
-        if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) {
33
-            $settings = $this->sanitizeTrustalyzeSettings($settings);
34
-        }
35
-        return $settings;
36
-    }
37
-
38
-    /**
39
-     * @param string $template
40
-     * @return array
41
-     * @filter site-reviews/interpolate/partials/form/table-row-multiple
42
-     */
43
-    public function filterSettingsTableRow(array $context, $template, array $data)
44
-    {
45
-        if ($this->enabledKey !== Arr::get($data, 'field.path')) {
46
-            return $context;
47
-        }
48
-        $isAccountValidated = !empty(glsr(OptionManager::class)->getWP($this->trustalyzeKey));
49
-        $isIntegrationEnabled = glsr(OptionManager::class)->getBool('settings.general.trustalyze');
50
-        if ($isAccountValidated && $isIntegrationEnabled) {
51
-            return $context;
52
-        }
53
-        $context['field'].= $this->buildCreateButton();
54
-        return $context;
55
-    }
56
-
57
-    /**
58
-     * Triggered when a review is created.
59
-     * @return void
60
-     * @action site-reviews/review/created
61
-     */
62
-    public function onCreated(Review $review)
63
-    {
64
-        if (!$this->canPostReview($review)) {
65
-            return;
66
-        }
67
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
68
-        if ($trustalyze->success) {
69
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
70
-        }
71
-    }
72
-
73
-    /**
74
-     * Triggered when a review is reverted to its original title/content/date_timestamp.
75
-     * @return void
76
-     * @action site-reviews/review/reverted
77
-     */
78
-    public function onReverted(Review $review)
79
-    {
80
-        if (!$this->canPostReview($review)) {
81
-            return;
82
-        }
83
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
84
-        if ($trustalyze->success) {
85
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
86
-        }
87
-    }
88
-
89
-    /**
90
-     * Triggered when an existing review is updated.
91
-     * @return void
92
-     * @action site-reviews/review/saved
93
-     */
94
-    public function onSaved(Review $review)
95
-    {
96
-        if (!$this->canPostReview($review)) {
97
-            return;
98
-        }
99
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
100
-        if ($trustalyze->success) {
101
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
102
-        }
103
-    }
104
-
105
-    /**
106
-     * Triggered when a review's response is added or updated.
107
-     * @param int $metaId
108
-     * @param int $postId
109
-     * @param string $metaKey
110
-     * @return void
111
-     * @action updated_postmeta
112
-     */
113
-    public function onUpdatedMeta($metaId, $postId, $metaKey)
114
-    {
115
-        $review = glsr_get_review($postId);
116
-        if (!$this->canPostResponse($review) || '_response' !== $metaKey) {
117
-            return;
118
-        }
119
-        $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review);
120
-        if ($trustalyze->success) {
121
-            glsr(Database::class)->set($review->ID, 'trustalyze_response', true);
122
-        }
123
-    }
124
-
125
-    /**
126
-     * @return string
127
-     */
128
-    protected function buildCreateButton()
129
-    {
130
-        return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [
131
-            'class' => 'button',
132
-            'href' => Trustalyze::WEB_URL,
133
-            'target' => '_blank',
134
-        ]);
135
-    }
136
-
137
-    /**
138
-     * @return bool
139
-     */
140
-    protected function canPostResponse(Review $review)
141
-    {
142
-        $requiredValues = [
143
-            glsr(Database::class)->get($review->ID, 'trustalyze'),
144
-            $review->response,
145
-            $review->review_id,
146
-        ];
147
-        return $this->canProceed($review, 'trustalyze_response')
148
-            && 'publish' === $review->status
149
-            && 3 === count(array_filter($requiredValues));
150
-    }
151
-
152
-    /**
153
-     * @return bool
154
-     */
155
-    protected function canPostReview(Review $review)
156
-    {
157
-        $requiredValues = [
158
-            $review->author,
159
-            $review->content,
160
-            $review->rating,
161
-            $review->review_id,
162
-            $review->title,
163
-        ];
164
-        return $this->canProceed($review)
165
-            && 'publish' === $review->status
166
-            && 5 === count(array_filter($requiredValues));
167
-    }
168
-
169
-    /**
170
-     * @param string $metaKey
171
-     * @return bool
172
-     */
173
-    protected function canProceed(Review $review, $metaKey = 'trustalyze')
174
-    {
175
-        return glsr(OptionManager::class)->getBool($this->enabledKey)
176
-            && $this->isReviewPostId($review->ID)
177
-            && !$this->hasMetaKey($review, $metaKey);
178
-    }
179
-
180
-    /**
181
-     * @param string $metaKey
182
-     * @return bool
183
-     */
184
-    protected function hasMetaKey(Review $review, $metaKey = 'trustalyze')
185
-    {
186
-        return '' !== glsr(Database::class)->get($review->ID, $metaKey);
187
-    }
188
-
189
-    /**
190
-     * @param string $key
191
-     * @return bool
192
-     */
193
-    protected function isEmptyOrModified($key, array $settings)
194
-    {
195
-        $oldValue = glsr_get_option($key);
196
-        $newValue = Arr::get($settings, $key);
197
-        return empty($newValue) || $newValue !== $oldValue;
198
-    }
199
-
200
-    /**
201
-     * @return array
202
-     */
203
-    protected function sanitizeTrustalyzeSettings(array $settings)
204
-    {
205
-        $trustalyze = glsr(Trustalyze::class)->activateKey(
206
-            Arr::get($settings, $this->apiKey),
207
-            Arr::get($settings, $this->emailKey)
208
-        );
209
-        if ($trustalyze->success) {
210
-            update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
211
-        } else {
212
-            delete_option($this->trustalyzeKey);
213
-            $settings = Arr::set($settings, $this->enabledKey, 'no');
214
-            glsr(Notice::class)->addError(sprintf(
215
-                __('Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews'),
216
-                '('.$trustalyze->message.')'
217
-            ));
218
-        }
219
-        return $settings;
220
-    }
15
+	protected $apiKey = 'settings.general.trustalyze_serial';
16
+	protected $emailKey = 'settings.general.trustalyze_email';
17
+	protected $enabledKey = 'settings.general.trustalyze';
18
+	protected $trustalyzeKey = '_glsr_trustalyze';
19
+
20
+	/**
21
+	 * @return array
22
+	 * @filter site-reviews/settings/callback
23
+	 */
24
+	public function filterSettingsCallback(array $settings)
25
+	{
26
+		if ('yes' !== Arr::get($settings, $this->enabledKey)) {
27
+			return $settings;
28
+		}
29
+		$isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings);
30
+		$isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings);
31
+		$isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false);
32
+		if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) {
33
+			$settings = $this->sanitizeTrustalyzeSettings($settings);
34
+		}
35
+		return $settings;
36
+	}
37
+
38
+	/**
39
+	 * @param string $template
40
+	 * @return array
41
+	 * @filter site-reviews/interpolate/partials/form/table-row-multiple
42
+	 */
43
+	public function filterSettingsTableRow(array $context, $template, array $data)
44
+	{
45
+		if ($this->enabledKey !== Arr::get($data, 'field.path')) {
46
+			return $context;
47
+		}
48
+		$isAccountValidated = !empty(glsr(OptionManager::class)->getWP($this->trustalyzeKey));
49
+		$isIntegrationEnabled = glsr(OptionManager::class)->getBool('settings.general.trustalyze');
50
+		if ($isAccountValidated && $isIntegrationEnabled) {
51
+			return $context;
52
+		}
53
+		$context['field'].= $this->buildCreateButton();
54
+		return $context;
55
+	}
56
+
57
+	/**
58
+	 * Triggered when a review is created.
59
+	 * @return void
60
+	 * @action site-reviews/review/created
61
+	 */
62
+	public function onCreated(Review $review)
63
+	{
64
+		if (!$this->canPostReview($review)) {
65
+			return;
66
+		}
67
+		$trustalyze = glsr(Trustalyze::class)->sendReview($review);
68
+		if ($trustalyze->success) {
69
+			glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
70
+		}
71
+	}
72
+
73
+	/**
74
+	 * Triggered when a review is reverted to its original title/content/date_timestamp.
75
+	 * @return void
76
+	 * @action site-reviews/review/reverted
77
+	 */
78
+	public function onReverted(Review $review)
79
+	{
80
+		if (!$this->canPostReview($review)) {
81
+			return;
82
+		}
83
+		$trustalyze = glsr(Trustalyze::class)->sendReview($review);
84
+		if ($trustalyze->success) {
85
+			glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
86
+		}
87
+	}
88
+
89
+	/**
90
+	 * Triggered when an existing review is updated.
91
+	 * @return void
92
+	 * @action site-reviews/review/saved
93
+	 */
94
+	public function onSaved(Review $review)
95
+	{
96
+		if (!$this->canPostReview($review)) {
97
+			return;
98
+		}
99
+		$trustalyze = glsr(Trustalyze::class)->sendReview($review);
100
+		if ($trustalyze->success) {
101
+			glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
102
+		}
103
+	}
104
+
105
+	/**
106
+	 * Triggered when a review's response is added or updated.
107
+	 * @param int $metaId
108
+	 * @param int $postId
109
+	 * @param string $metaKey
110
+	 * @return void
111
+	 * @action updated_postmeta
112
+	 */
113
+	public function onUpdatedMeta($metaId, $postId, $metaKey)
114
+	{
115
+		$review = glsr_get_review($postId);
116
+		if (!$this->canPostResponse($review) || '_response' !== $metaKey) {
117
+			return;
118
+		}
119
+		$trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review);
120
+		if ($trustalyze->success) {
121
+			glsr(Database::class)->set($review->ID, 'trustalyze_response', true);
122
+		}
123
+	}
124
+
125
+	/**
126
+	 * @return string
127
+	 */
128
+	protected function buildCreateButton()
129
+	{
130
+		return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [
131
+			'class' => 'button',
132
+			'href' => Trustalyze::WEB_URL,
133
+			'target' => '_blank',
134
+		]);
135
+	}
136
+
137
+	/**
138
+	 * @return bool
139
+	 */
140
+	protected function canPostResponse(Review $review)
141
+	{
142
+		$requiredValues = [
143
+			glsr(Database::class)->get($review->ID, 'trustalyze'),
144
+			$review->response,
145
+			$review->review_id,
146
+		];
147
+		return $this->canProceed($review, 'trustalyze_response')
148
+			&& 'publish' === $review->status
149
+			&& 3 === count(array_filter($requiredValues));
150
+	}
151
+
152
+	/**
153
+	 * @return bool
154
+	 */
155
+	protected function canPostReview(Review $review)
156
+	{
157
+		$requiredValues = [
158
+			$review->author,
159
+			$review->content,
160
+			$review->rating,
161
+			$review->review_id,
162
+			$review->title,
163
+		];
164
+		return $this->canProceed($review)
165
+			&& 'publish' === $review->status
166
+			&& 5 === count(array_filter($requiredValues));
167
+	}
168
+
169
+	/**
170
+	 * @param string $metaKey
171
+	 * @return bool
172
+	 */
173
+	protected function canProceed(Review $review, $metaKey = 'trustalyze')
174
+	{
175
+		return glsr(OptionManager::class)->getBool($this->enabledKey)
176
+			&& $this->isReviewPostId($review->ID)
177
+			&& !$this->hasMetaKey($review, $metaKey);
178
+	}
179
+
180
+	/**
181
+	 * @param string $metaKey
182
+	 * @return bool
183
+	 */
184
+	protected function hasMetaKey(Review $review, $metaKey = 'trustalyze')
185
+	{
186
+		return '' !== glsr(Database::class)->get($review->ID, $metaKey);
187
+	}
188
+
189
+	/**
190
+	 * @param string $key
191
+	 * @return bool
192
+	 */
193
+	protected function isEmptyOrModified($key, array $settings)
194
+	{
195
+		$oldValue = glsr_get_option($key);
196
+		$newValue = Arr::get($settings, $key);
197
+		return empty($newValue) || $newValue !== $oldValue;
198
+	}
199
+
200
+	/**
201
+	 * @return array
202
+	 */
203
+	protected function sanitizeTrustalyzeSettings(array $settings)
204
+	{
205
+		$trustalyze = glsr(Trustalyze::class)->activateKey(
206
+			Arr::get($settings, $this->apiKey),
207
+			Arr::get($settings, $this->emailKey)
208
+		);
209
+		if ($trustalyze->success) {
210
+			update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
211
+		} else {
212
+			delete_option($this->trustalyzeKey);
213
+			$settings = Arr::set($settings, $this->enabledKey, 'no');
214
+			glsr(Notice::class)->addError(sprintf(
215
+				__('Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews'),
216
+				'('.$trustalyze->message.')'
217
+			));
218
+		}
219
+		return $settings;
220
+	}
221 221
 }
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
      * @return array
22 22
      * @filter site-reviews/settings/callback
23 23
      */
24
-    public function filterSettingsCallback(array $settings)
24
+    public function filterSettingsCallback( array $settings )
25 25
     {
26
-        if ('yes' !== Arr::get($settings, $this->enabledKey)) {
26
+        if( 'yes' !== Arr::get( $settings, $this->enabledKey ) ) {
27 27
             return $settings;
28 28
         }
29
-        $isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings);
30
-        $isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings);
31
-        $isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false);
32
-        if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) {
33
-            $settings = $this->sanitizeTrustalyzeSettings($settings);
29
+        $isApiKeyModified = $this->isEmptyOrModified( $this->apiKey, $settings );
30
+        $isEmailModified = $this->isEmptyOrModified( $this->emailKey, $settings );
31
+        $isAccountVerified = glsr( OptionManager::class )->getWP( $this->trustalyzeKey, false );
32
+        if( !$isAccountVerified || $isApiKeyModified || $isEmailModified ) {
33
+            $settings = $this->sanitizeTrustalyzeSettings( $settings );
34 34
         }
35 35
         return $settings;
36 36
     }
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
      * @return array
41 41
      * @filter site-reviews/interpolate/partials/form/table-row-multiple
42 42
      */
43
-    public function filterSettingsTableRow(array $context, $template, array $data)
43
+    public function filterSettingsTableRow( array $context, $template, array $data )
44 44
     {
45
-        if ($this->enabledKey !== Arr::get($data, 'field.path')) {
45
+        if( $this->enabledKey !== Arr::get( $data, 'field.path' ) ) {
46 46
             return $context;
47 47
         }
48
-        $isAccountValidated = !empty(glsr(OptionManager::class)->getWP($this->trustalyzeKey));
49
-        $isIntegrationEnabled = glsr(OptionManager::class)->getBool('settings.general.trustalyze');
50
-        if ($isAccountValidated && $isIntegrationEnabled) {
48
+        $isAccountValidated = !empty(glsr( OptionManager::class )->getWP( $this->trustalyzeKey ));
49
+        $isIntegrationEnabled = glsr( OptionManager::class )->getBool( 'settings.general.trustalyze' );
50
+        if( $isAccountValidated && $isIntegrationEnabled ) {
51 51
             return $context;
52 52
         }
53
-        $context['field'].= $this->buildCreateButton();
53
+        $context['field'] .= $this->buildCreateButton();
54 54
         return $context;
55 55
     }
56 56
 
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
      * @return void
60 60
      * @action site-reviews/review/created
61 61
      */
62
-    public function onCreated(Review $review)
62
+    public function onCreated( Review $review )
63 63
     {
64
-        if (!$this->canPostReview($review)) {
64
+        if( !$this->canPostReview( $review ) ) {
65 65
             return;
66 66
         }
67
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
68
-        if ($trustalyze->success) {
69
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
67
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
68
+        if( $trustalyze->success ) {
69
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
70 70
         }
71 71
     }
72 72
 
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
      * @return void
76 76
      * @action site-reviews/review/reverted
77 77
      */
78
-    public function onReverted(Review $review)
78
+    public function onReverted( Review $review )
79 79
     {
80
-        if (!$this->canPostReview($review)) {
80
+        if( !$this->canPostReview( $review ) ) {
81 81
             return;
82 82
         }
83
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
84
-        if ($trustalyze->success) {
85
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
83
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
84
+        if( $trustalyze->success ) {
85
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
86 86
         }
87 87
     }
88 88
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
      * @return void
92 92
      * @action site-reviews/review/saved
93 93
      */
94
-    public function onSaved(Review $review)
94
+    public function onSaved( Review $review )
95 95
     {
96
-        if (!$this->canPostReview($review)) {
96
+        if( !$this->canPostReview( $review ) ) {
97 97
             return;
98 98
         }
99
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
100
-        if ($trustalyze->success) {
101
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
99
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
100
+        if( $trustalyze->success ) {
101
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
102 102
         }
103 103
     }
104 104
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      * @return void
111 111
      * @action updated_postmeta
112 112
      */
113
-    public function onUpdatedMeta($metaId, $postId, $metaKey)
113
+    public function onUpdatedMeta( $metaId, $postId, $metaKey )
114 114
     {
115
-        $review = glsr_get_review($postId);
116
-        if (!$this->canPostResponse($review) || '_response' !== $metaKey) {
115
+        $review = glsr_get_review( $postId );
116
+        if( !$this->canPostResponse( $review ) || '_response' !== $metaKey ) {
117 117
             return;
118 118
         }
119
-        $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review);
120
-        if ($trustalyze->success) {
121
-            glsr(Database::class)->set($review->ID, 'trustalyze_response', true);
119
+        $trustalyze = glsr( Trustalyze::class )->sendReviewResponse( $review );
120
+        if( $trustalyze->success ) {
121
+            glsr( Database::class )->set( $review->ID, 'trustalyze_response', true );
122 122
         }
123 123
     }
124 124
 
@@ -127,32 +127,32 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function buildCreateButton()
129 129
     {
130
-        return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [
130
+        return glsr( Builder::class )->a( __( 'Create Your Trustalyze Account', 'site-reviews' ), [
131 131
             'class' => 'button',
132 132
             'href' => Trustalyze::WEB_URL,
133 133
             'target' => '_blank',
134
-        ]);
134
+        ] );
135 135
     }
136 136
 
137 137
     /**
138 138
      * @return bool
139 139
      */
140
-    protected function canPostResponse(Review $review)
140
+    protected function canPostResponse( Review $review )
141 141
     {
142 142
         $requiredValues = [
143
-            glsr(Database::class)->get($review->ID, 'trustalyze'),
143
+            glsr( Database::class )->get( $review->ID, 'trustalyze' ),
144 144
             $review->response,
145 145
             $review->review_id,
146 146
         ];
147
-        return $this->canProceed($review, 'trustalyze_response')
147
+        return $this->canProceed( $review, 'trustalyze_response' )
148 148
             && 'publish' === $review->status
149
-            && 3 === count(array_filter($requiredValues));
149
+            && 3 === count( array_filter( $requiredValues ) );
150 150
     }
151 151
 
152 152
     /**
153 153
      * @return bool
154 154
      */
155
-    protected function canPostReview(Review $review)
155
+    protected function canPostReview( Review $review )
156 156
     {
157 157
         $requiredValues = [
158 158
             $review->author,
@@ -161,60 +161,60 @@  discard block
 block discarded – undo
161 161
             $review->review_id,
162 162
             $review->title,
163 163
         ];
164
-        return $this->canProceed($review)
164
+        return $this->canProceed( $review )
165 165
             && 'publish' === $review->status
166
-            && 5 === count(array_filter($requiredValues));
166
+            && 5 === count( array_filter( $requiredValues ) );
167 167
     }
168 168
 
169 169
     /**
170 170
      * @param string $metaKey
171 171
      * @return bool
172 172
      */
173
-    protected function canProceed(Review $review, $metaKey = 'trustalyze')
173
+    protected function canProceed( Review $review, $metaKey = 'trustalyze' )
174 174
     {
175
-        return glsr(OptionManager::class)->getBool($this->enabledKey)
176
-            && $this->isReviewPostId($review->ID)
177
-            && !$this->hasMetaKey($review, $metaKey);
175
+        return glsr( OptionManager::class )->getBool( $this->enabledKey )
176
+            && $this->isReviewPostId( $review->ID )
177
+            && !$this->hasMetaKey( $review, $metaKey );
178 178
     }
179 179
 
180 180
     /**
181 181
      * @param string $metaKey
182 182
      * @return bool
183 183
      */
184
-    protected function hasMetaKey(Review $review, $metaKey = 'trustalyze')
184
+    protected function hasMetaKey( Review $review, $metaKey = 'trustalyze' )
185 185
     {
186
-        return '' !== glsr(Database::class)->get($review->ID, $metaKey);
186
+        return '' !== glsr( Database::class )->get( $review->ID, $metaKey );
187 187
     }
188 188
 
189 189
     /**
190 190
      * @param string $key
191 191
      * @return bool
192 192
      */
193
-    protected function isEmptyOrModified($key, array $settings)
193
+    protected function isEmptyOrModified( $key, array $settings )
194 194
     {
195
-        $oldValue = glsr_get_option($key);
196
-        $newValue = Arr::get($settings, $key);
195
+        $oldValue = glsr_get_option( $key );
196
+        $newValue = Arr::get( $settings, $key );
197 197
         return empty($newValue) || $newValue !== $oldValue;
198 198
     }
199 199
 
200 200
     /**
201 201
      * @return array
202 202
      */
203
-    protected function sanitizeTrustalyzeSettings(array $settings)
203
+    protected function sanitizeTrustalyzeSettings( array $settings )
204 204
     {
205
-        $trustalyze = glsr(Trustalyze::class)->activateKey(
206
-            Arr::get($settings, $this->apiKey),
207
-            Arr::get($settings, $this->emailKey)
205
+        $trustalyze = glsr( Trustalyze::class )->activateKey(
206
+            Arr::get( $settings, $this->apiKey ),
207
+            Arr::get( $settings, $this->emailKey )
208 208
         );
209
-        if ($trustalyze->success) {
210
-            update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
209
+        if( $trustalyze->success ) {
210
+            update_option( $this->trustalyzeKey, Arr::get( $trustalyze->response, 'producttype' ) );
211 211
         } else {
212
-            delete_option($this->trustalyzeKey);
213
-            $settings = Arr::set($settings, $this->enabledKey, 'no');
214
-            glsr(Notice::class)->addError(sprintf(
215
-                __('Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews'),
212
+            delete_option( $this->trustalyzeKey );
213
+            $settings = Arr::set( $settings, $this->enabledKey, 'no' );
214
+            glsr( Notice::class )->addError( sprintf(
215
+                __( 'Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews' ),
216 216
                 '('.$trustalyze->message.')'
217
-            ));
217
+            ) );
218 218
         }
219 219
         return $settings;
220 220
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -208,7 +208,8 @@
 block discarded – undo
208 208
         );
209 209
         if ($trustalyze->success) {
210 210
             update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
211
-        } else {
211
+        }
212
+        else {
212 213
             delete_option($this->trustalyzeKey);
213 214
             $settings = Arr::set($settings, $this->enabledKey, 'no');
214 215
             glsr(Notice::class)->addError(sprintf(
Please login to merge, or discard this patch.