Passed
Push — master ( af979f...1dfed5 )
by Paul
08:16 queued 04:12
created
views/pages/welcome/whatsnew.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
 <p class="about-description">We hope you love the changes in this new release!</p>
4 4
 <div class="is-fullwidth">
Please login to merge, or discard this patch.
plugin/Modules/Updater.php 3 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -7,266 +7,266 @@
 block discarded – undo
7 7
 
8 8
 class Updater
9 9
 {
10
-    /**
11
-     * @var string
12
-     */
13
-    protected $apiUrl;
14
-    /**
15
-     * @var array
16
-     */
17
-    protected $data;
18
-    /**
19
-     * @var string
20
-     */
21
-    protected $plugin;
22
-    /**
23
-     * @var string
24
-     */
25
-    protected $transientName;
10
+	/**
11
+	 * @var string
12
+	 */
13
+	protected $apiUrl;
14
+	/**
15
+	 * @var array
16
+	 */
17
+	protected $data;
18
+	/**
19
+	 * @var string
20
+	 */
21
+	protected $plugin;
22
+	/**
23
+	 * @var string
24
+	 */
25
+	protected $transientName;
26 26
 
27
-    /**
28
-     * @param string $apiUrl
29
-     * @param string $file
30
-     */
31
-    public function __construct($apiUrl, $file, array $data = [])
32
-    {
33
-        if (!function_exists('get_plugin_data')) {
34
-            require_once ABSPATH.WPINC.'/plugin.php';
35
-        }
36
-        $this->apiUrl = trailingslashit(apply_filters('site-reviews/addon/api-url', $apiUrl));
37
-        $this->data = wp_parse_args($data, get_plugin_data($file));
38
-        $this->plugin = plugin_basename($file);
39
-        $this->transientName = Application::PREFIX.md5(Arr::get($data, 'TextDomain'));
40
-    }
27
+	/**
28
+	 * @param string $apiUrl
29
+	 * @param string $file
30
+	 */
31
+	public function __construct($apiUrl, $file, array $data = [])
32
+	{
33
+		if (!function_exists('get_plugin_data')) {
34
+			require_once ABSPATH.WPINC.'/plugin.php';
35
+		}
36
+		$this->apiUrl = trailingslashit(apply_filters('site-reviews/addon/api-url', $apiUrl));
37
+		$this->data = wp_parse_args($data, get_plugin_data($file));
38
+		$this->plugin = plugin_basename($file);
39
+		$this->transientName = Application::PREFIX.md5(Arr::get($data, 'TextDomain'));
40
+	}
41 41
 
42
-    /**
43
-     * @return object
44
-     */
45
-    public function activateLicense(array $data = [])
46
-    {
47
-        return $this->request('activate_license', $data);
48
-    }
42
+	/**
43
+	 * @return object
44
+	 */
45
+	public function activateLicense(array $data = [])
46
+	{
47
+		return $this->request('activate_license', $data);
48
+	}
49 49
 
50
-    /**
51
-     * @return object
52
-     */
53
-    public function checkLicense(array $data = [])
54
-    {
55
-        $response = $this->request('check_license', $data);
56
-        if ('valid' === Arr::get($response, 'license')) {
57
-            $this->getPluginUpdate(true);
58
-        }
59
-        return $response;
60
-    }
50
+	/**
51
+	 * @return object
52
+	 */
53
+	public function checkLicense(array $data = [])
54
+	{
55
+		$response = $this->request('check_license', $data);
56
+		if ('valid' === Arr::get($response, 'license')) {
57
+			$this->getPluginUpdate(true);
58
+		}
59
+		return $response;
60
+	}
61 61
 
62
-    /**
63
-     * @return object
64
-     */
65
-    public function deactivateLicense(array $data = [])
66
-    {
67
-        return $this->request('deactivate_license', $data);
68
-    }
62
+	/**
63
+	 * @return object
64
+	 */
65
+	public function deactivateLicense(array $data = [])
66
+	{
67
+		return $this->request('deactivate_license', $data);
68
+	}
69 69
 
70
-    /**
71
-     * @param false|object|array $result
72
-     * @param string $action
73
-     * @param object $args
74
-     * @return mixed
75
-     */
76
-    public function filterPluginUpdateDetails($result, $action, $args)
77
-    {
78
-        if ('plugin_information' != $action
79
-            || Arr::get($this->data, 'TextDomain') != Arr::get($args, 'slug')) {
80
-            return $result;
81
-        }
82
-        if ($updateInfo = $this->getPluginUpdate()) {
83
-            return $this->modifyUpdateDetails($updateInfo);
84
-        }
85
-        return $result;
86
-    }
70
+	/**
71
+	 * @param false|object|array $result
72
+	 * @param string $action
73
+	 * @param object $args
74
+	 * @return mixed
75
+	 */
76
+	public function filterPluginUpdateDetails($result, $action, $args)
77
+	{
78
+		if ('plugin_information' != $action
79
+			|| Arr::get($this->data, 'TextDomain') != Arr::get($args, 'slug')) {
80
+			return $result;
81
+		}
82
+		if ($updateInfo = $this->getPluginUpdate()) {
83
+			return $this->modifyUpdateDetails($updateInfo);
84
+		}
85
+		return $result;
86
+	}
87 87
 
88
-    /**
89
-     * @param object $transient
90
-     * @return object
91
-     */
92
-    public function filterPluginUpdates($transient)
93
-    {
94
-        if ($updateInfo = $this->getPluginUpdate()) {
95
-            return $this->modifyPluginUpdates($transient, $updateInfo);
96
-        }
97
-        return $transient;
98
-    }
88
+	/**
89
+	 * @param object $transient
90
+	 * @return object
91
+	 */
92
+	public function filterPluginUpdates($transient)
93
+	{
94
+		if ($updateInfo = $this->getPluginUpdate()) {
95
+			return $this->modifyPluginUpdates($transient, $updateInfo);
96
+		}
97
+		return $transient;
98
+	}
99 99
 
100
-    /**
101
-     * @return object
102
-     */
103
-    public function getVersion(array $data = [])
104
-    {
105
-        return $this->request('get_version', $data);
106
-    }
100
+	/**
101
+	 * @return object
102
+	 */
103
+	public function getVersion(array $data = [])
104
+	{
105
+		return $this->request('get_version', $data);
106
+	}
107 107
 
108
-    /**
109
-     * @return void
110
-     */
111
-    public function init()
112
-    {
113
-        if ($this->apiUrl === trailingslashit(home_url())) {
114
-            return;
115
-        }
116
-        add_filter('plugins_api',                             [$this, 'filterPluginUpdateDetails'], 10, 3);
117
-        add_filter('pre_set_site_transient_update_plugins',   [$this, 'filterPluginUpdates'], 999);
118
-        add_action('load-update-core.php',                    [$this, 'onForceUpdateCheck'], 9);
119
-        add_action('in_plugin_update_message-'.$this->plugin, [$this, 'renderLicenseMissingLink']);
120
-    }
108
+	/**
109
+	 * @return void
110
+	 */
111
+	public function init()
112
+	{
113
+		if ($this->apiUrl === trailingslashit(home_url())) {
114
+			return;
115
+		}
116
+		add_filter('plugins_api',                             [$this, 'filterPluginUpdateDetails'], 10, 3);
117
+		add_filter('pre_set_site_transient_update_plugins',   [$this, 'filterPluginUpdates'], 999);
118
+		add_action('load-update-core.php',                    [$this, 'onForceUpdateCheck'], 9);
119
+		add_action('in_plugin_update_message-'.$this->plugin, [$this, 'renderLicenseMissingLink']);
120
+	}
121 121
 
122
-    /**
123
-     * @return bool
124
-     */
125
-    public function isLicenseValid()
126
-    {
127
-        $result = $this->checkLicense();
128
-        return 'valid' === Arr::get($result, 'license');
129
-    }
122
+	/**
123
+	 * @return bool
124
+	 */
125
+	public function isLicenseValid()
126
+	{
127
+		$result = $this->checkLicense();
128
+		return 'valid' === Arr::get($result, 'license');
129
+	}
130 130
 
131
-    /**
132
-     * @return void
133
-     */
134
-    public function onForceUpdateCheck()
135
-    {
136
-        if (!filter_input(INPUT_GET, 'force-check')) {
137
-            return;
138
-        }
139
-        foreach (glsr()->addons as $addon) {
140
-            try {
141
-                glsr($addon)->updater->getPluginUpdate(true);
142
-            } catch (\Exception $e) {
143
-                glsr_log()->error($e->getMessage());
144
-            }
145
-        }
146
-    }
131
+	/**
132
+	 * @return void
133
+	 */
134
+	public function onForceUpdateCheck()
135
+	{
136
+		if (!filter_input(INPUT_GET, 'force-check')) {
137
+			return;
138
+		}
139
+		foreach (glsr()->addons as $addon) {
140
+			try {
141
+				glsr($addon)->updater->getPluginUpdate(true);
142
+			} catch (\Exception $e) {
143
+				glsr_log()->error($e->getMessage());
144
+			}
145
+		}
146
+	}
147 147
 
148
-    /**
149
-     * @return void
150
-     */
151
-    public function renderLicenseMissingLink()
152
-    {
153
-        if (!$this->isLicenseValid()) {
154
-            glsr()->render('partials/addons/license-missing');
155
-        }
156
-    }
148
+	/**
149
+	 * @return void
150
+	 */
151
+	public function renderLicenseMissingLink()
152
+	{
153
+		if (!$this->isLicenseValid()) {
154
+			glsr()->render('partials/addons/license-missing');
155
+		}
156
+	}
157 157
 
158
-    /**
159
-     * @return false|object
160
-     */
161
-    protected function getCachedVersion()
162
-    {
163
-        return get_transient($this->transientName);
164
-    }
158
+	/**
159
+	 * @return false|object
160
+	 */
161
+	protected function getCachedVersion()
162
+	{
163
+		return get_transient($this->transientName);
164
+	}
165 165
 
166
-    /**
167
-     * @param bool $force
168
-     * @return false|object
169
-     */
170
-    protected function getPluginUpdate($force = false)
171
-    {
172
-        $version = $this->getCachedVersion();
173
-        if (false === $version || $force) {
174
-            $version = $this->getVersion();
175
-            $this->setCachedVersion($version);
176
-        }
177
-        if (isset($version->error)) {
178
-            glsr_log()->error($version->error);
179
-            return false;
180
-        }
181
-        return $version;
182
-    }
166
+	/**
167
+	 * @param bool $force
168
+	 * @return false|object
169
+	 */
170
+	protected function getPluginUpdate($force = false)
171
+	{
172
+		$version = $this->getCachedVersion();
173
+		if (false === $version || $force) {
174
+			$version = $this->getVersion();
175
+			$this->setCachedVersion($version);
176
+		}
177
+		if (isset($version->error)) {
178
+			glsr_log()->error($version->error);
179
+			return false;
180
+		}
181
+		return $version;
182
+	}
183 183
 
184
-    /**
185
-     * @param object $transient
186
-     * @param object $updateInfo
187
-     * @return object
188
-     */
189
-    protected function modifyPluginUpdates($transient, $updateInfo)
190
-    {
191
-        $updateInfo->id = Application::ID.'/'.Arr::get($this->data, 'TextDomain');
192
-        $updateInfo->plugin = $this->plugin;
193
-        $updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
194
-        $updateInfo->tested = Arr::get($this->data, 'testedTo');
195
-        $transient->checked[$this->plugin] = Arr::get($this->data, 'Version');
196
-        $transient->last_checked = time();
197
-        if (version_compare($updateInfo->new_version, Arr::get($this->data, 'Version'), '>')) {
198
-            unset($transient->no_update[$this->plugin]);
199
-            $updateInfo->update = true;
200
-            $transient->response[$this->plugin] = $updateInfo;
201
-        } else {
202
-            unset($transient->response[$this->plugin]);
203
-            $transient->no_update[$this->plugin] = $updateInfo;
204
-        }
205
-        return $transient;
206
-    }
184
+	/**
185
+	 * @param object $transient
186
+	 * @param object $updateInfo
187
+	 * @return object
188
+	 */
189
+	protected function modifyPluginUpdates($transient, $updateInfo)
190
+	{
191
+		$updateInfo->id = Application::ID.'/'.Arr::get($this->data, 'TextDomain');
192
+		$updateInfo->plugin = $this->plugin;
193
+		$updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
194
+		$updateInfo->tested = Arr::get($this->data, 'testedTo');
195
+		$transient->checked[$this->plugin] = Arr::get($this->data, 'Version');
196
+		$transient->last_checked = time();
197
+		if (version_compare($updateInfo->new_version, Arr::get($this->data, 'Version'), '>')) {
198
+			unset($transient->no_update[$this->plugin]);
199
+			$updateInfo->update = true;
200
+			$transient->response[$this->plugin] = $updateInfo;
201
+		} else {
202
+			unset($transient->response[$this->plugin]);
203
+			$transient->no_update[$this->plugin] = $updateInfo;
204
+		}
205
+		return $transient;
206
+	}
207 207
 
208
-    /**
209
-     * @param object $updateInfo
210
-     * @return object
211
-     */
212
-    protected function modifyUpdateDetails($updateInfo)
213
-    {
214
-        $updateInfo->author = Arr::get($this->data, 'Author');
215
-        $updateInfo->author_profile = Arr::get($this->data, 'AuthorURI');
216
-        $updateInfo->requires = Arr::get($this->data, 'RequiresWP');
217
-        $updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
218
-        $updateInfo->tested = Arr::get($this->data, 'testedTo');
219
-        $updateInfo->version = $updateInfo->new_version;
220
-        return $updateInfo;
221
-    }
208
+	/**
209
+	 * @param object $updateInfo
210
+	 * @return object
211
+	 */
212
+	protected function modifyUpdateDetails($updateInfo)
213
+	{
214
+		$updateInfo->author = Arr::get($this->data, 'Author');
215
+		$updateInfo->author_profile = Arr::get($this->data, 'AuthorURI');
216
+		$updateInfo->requires = Arr::get($this->data, 'RequiresWP');
217
+		$updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
218
+		$updateInfo->tested = Arr::get($this->data, 'testedTo');
219
+		$updateInfo->version = $updateInfo->new_version;
220
+		return $updateInfo;
221
+	}
222 222
 
223
-    /**
224
-     * @param \WP_Error|array $response
225
-     * @return object
226
-     */
227
-    protected function normalizeResponse($response)
228
-    {
229
-        $body = wp_remote_retrieve_body($response);
230
-        if ($data = json_decode($body)) {
231
-            $data = array_map('maybe_unserialize', (array) $data);
232
-            return (object) $data;
233
-        }
234
-        $error = is_wp_error($response)
235
-            ? $response->get_error_message()
236
-            : 'Update server not responding ('.Arr::get($this->data, 'TextDomain').')';
237
-        return (object) ['error' => $error];
238
-    }
223
+	/**
224
+	 * @param \WP_Error|array $response
225
+	 * @return object
226
+	 */
227
+	protected function normalizeResponse($response)
228
+	{
229
+		$body = wp_remote_retrieve_body($response);
230
+		if ($data = json_decode($body)) {
231
+			$data = array_map('maybe_unserialize', (array) $data);
232
+			return (object) $data;
233
+		}
234
+		$error = is_wp_error($response)
235
+			? $response->get_error_message()
236
+			: 'Update server not responding ('.Arr::get($this->data, 'TextDomain').')';
237
+		return (object) ['error' => $error];
238
+	}
239 239
 
240
-    /**
241
-     * @param string $action activate_license|check_license|deactivate_license|get_version
242
-     * @return object
243
-     */
244
-    protected function request($action, array $data = [])
245
-    {
246
-        $data = wp_parse_args($data, $this->data);
247
-        $response = wp_remote_post($this->apiUrl, [
248
-            'body' => [
249
-                'edd_action' => $action,
250
-                'item_id' => Arr::get($data, 'item_id'),
251
-                'item_name' => Arr::get($data, 'Name'),
252
-                'license' => Arr::get($data, 'license'),
253
-                'slug' => Arr::get($data, 'TextDomain'),
254
-                'url' => home_url(),
255
-            ],
256
-            'sslverify' => apply_filters('site-reviews/sslverify/post', false),
257
-            'timeout' => 15,
258
-        ]);
259
-        return $this->normalizeResponse($response);
260
-    }
240
+	/**
241
+	 * @param string $action activate_license|check_license|deactivate_license|get_version
242
+	 * @return object
243
+	 */
244
+	protected function request($action, array $data = [])
245
+	{
246
+		$data = wp_parse_args($data, $this->data);
247
+		$response = wp_remote_post($this->apiUrl, [
248
+			'body' => [
249
+				'edd_action' => $action,
250
+				'item_id' => Arr::get($data, 'item_id'),
251
+				'item_name' => Arr::get($data, 'Name'),
252
+				'license' => Arr::get($data, 'license'),
253
+				'slug' => Arr::get($data, 'TextDomain'),
254
+				'url' => home_url(),
255
+			],
256
+			'sslverify' => apply_filters('site-reviews/sslverify/post', false),
257
+			'timeout' => 15,
258
+		]);
259
+		return $this->normalizeResponse($response);
260
+	}
261 261
 
262
-    /**
263
-     * @param object $version
264
-     * @return void
265
-     */
266
-    protected function setCachedVersion($version)
267
-    {
268
-        if (!isset($version->error)) {
269
-            set_transient($this->transientName, $version, 3 * HOUR_IN_SECONDS);
270
-        }
271
-    }
262
+	/**
263
+	 * @param object $version
264
+	 * @return void
265
+	 */
266
+	protected function setCachedVersion($version)
267
+	{
268
+		if (!isset($version->error)) {
269
+			set_transient($this->transientName, $version, 3 * HOUR_IN_SECONDS);
270
+		}
271
+	}
272 272
 }
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -28,33 +28,33 @@  discard block
 block discarded – undo
28 28
      * @param string $apiUrl
29 29
      * @param string $file
30 30
      */
31
-    public function __construct($apiUrl, $file, array $data = [])
31
+    public function __construct( $apiUrl, $file, array $data = [] )
32 32
     {
33
-        if (!function_exists('get_plugin_data')) {
33
+        if( !function_exists( 'get_plugin_data' ) ) {
34 34
             require_once ABSPATH.WPINC.'/plugin.php';
35 35
         }
36
-        $this->apiUrl = trailingslashit(apply_filters('site-reviews/addon/api-url', $apiUrl));
37
-        $this->data = wp_parse_args($data, get_plugin_data($file));
38
-        $this->plugin = plugin_basename($file);
39
-        $this->transientName = Application::PREFIX.md5(Arr::get($data, 'TextDomain'));
36
+        $this->apiUrl = trailingslashit( apply_filters( 'site-reviews/addon/api-url', $apiUrl ) );
37
+        $this->data = wp_parse_args( $data, get_plugin_data( $file ) );
38
+        $this->plugin = plugin_basename( $file );
39
+        $this->transientName = Application::PREFIX.md5( Arr::get( $data, 'TextDomain' ) );
40 40
     }
41 41
 
42 42
     /**
43 43
      * @return object
44 44
      */
45
-    public function activateLicense(array $data = [])
45
+    public function activateLicense( array $data = [] )
46 46
     {
47
-        return $this->request('activate_license', $data);
47
+        return $this->request( 'activate_license', $data );
48 48
     }
49 49
 
50 50
     /**
51 51
      * @return object
52 52
      */
53
-    public function checkLicense(array $data = [])
53
+    public function checkLicense( array $data = [] )
54 54
     {
55
-        $response = $this->request('check_license', $data);
56
-        if ('valid' === Arr::get($response, 'license')) {
57
-            $this->getPluginUpdate(true);
55
+        $response = $this->request( 'check_license', $data );
56
+        if( 'valid' === Arr::get( $response, 'license' ) ) {
57
+            $this->getPluginUpdate( true );
58 58
         }
59 59
         return $response;
60 60
     }
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @return object
64 64
      */
65
-    public function deactivateLicense(array $data = [])
65
+    public function deactivateLicense( array $data = [] )
66 66
     {
67
-        return $this->request('deactivate_license', $data);
67
+        return $this->request( 'deactivate_license', $data );
68 68
     }
69 69
 
70 70
     /**
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
      * @param object $args
74 74
      * @return mixed
75 75
      */
76
-    public function filterPluginUpdateDetails($result, $action, $args)
76
+    public function filterPluginUpdateDetails( $result, $action, $args )
77 77
     {
78
-        if ('plugin_information' != $action
79
-            || Arr::get($this->data, 'TextDomain') != Arr::get($args, 'slug')) {
78
+        if( 'plugin_information' != $action
79
+            || Arr::get( $this->data, 'TextDomain' ) != Arr::get( $args, 'slug' ) ) {
80 80
             return $result;
81 81
         }
82
-        if ($updateInfo = $this->getPluginUpdate()) {
83
-            return $this->modifyUpdateDetails($updateInfo);
82
+        if( $updateInfo = $this->getPluginUpdate() ) {
83
+            return $this->modifyUpdateDetails( $updateInfo );
84 84
         }
85 85
         return $result;
86 86
     }
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
      * @param object $transient
90 90
      * @return object
91 91
      */
92
-    public function filterPluginUpdates($transient)
92
+    public function filterPluginUpdates( $transient )
93 93
     {
94
-        if ($updateInfo = $this->getPluginUpdate()) {
95
-            return $this->modifyPluginUpdates($transient, $updateInfo);
94
+        if( $updateInfo = $this->getPluginUpdate() ) {
95
+            return $this->modifyPluginUpdates( $transient, $updateInfo );
96 96
         }
97 97
         return $transient;
98 98
     }
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     /**
101 101
      * @return object
102 102
      */
103
-    public function getVersion(array $data = [])
103
+    public function getVersion( array $data = [] )
104 104
     {
105
-        return $this->request('get_version', $data);
105
+        return $this->request( 'get_version', $data );
106 106
     }
107 107
 
108 108
     /**
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function init()
112 112
     {
113
-        if ($this->apiUrl === trailingslashit(home_url())) {
113
+        if( $this->apiUrl === trailingslashit( home_url() ) ) {
114 114
             return;
115 115
         }
116
-        add_filter('plugins_api',                             [$this, 'filterPluginUpdateDetails'], 10, 3);
117
-        add_filter('pre_set_site_transient_update_plugins',   [$this, 'filterPluginUpdates'], 999);
118
-        add_action('load-update-core.php',                    [$this, 'onForceUpdateCheck'], 9);
119
-        add_action('in_plugin_update_message-'.$this->plugin, [$this, 'renderLicenseMissingLink']);
116
+        add_filter( 'plugins_api', [$this, 'filterPluginUpdateDetails'], 10, 3 );
117
+        add_filter( 'pre_set_site_transient_update_plugins', [$this, 'filterPluginUpdates'], 999 );
118
+        add_action( 'load-update-core.php', [$this, 'onForceUpdateCheck'], 9 );
119
+        add_action( 'in_plugin_update_message-'.$this->plugin, [$this, 'renderLicenseMissingLink'] );
120 120
     }
121 121
 
122 122
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     public function isLicenseValid()
126 126
     {
127 127
         $result = $this->checkLicense();
128
-        return 'valid' === Arr::get($result, 'license');
128
+        return 'valid' === Arr::get( $result, 'license' );
129 129
     }
130 130
 
131 131
     /**
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function onForceUpdateCheck()
135 135
     {
136
-        if (!filter_input(INPUT_GET, 'force-check')) {
136
+        if( !filter_input( INPUT_GET, 'force-check' ) ) {
137 137
             return;
138 138
         }
139
-        foreach (glsr()->addons as $addon) {
139
+        foreach( glsr()->addons as $addon ) {
140 140
             try {
141
-                glsr($addon)->updater->getPluginUpdate(true);
142
-            } catch (\Exception $e) {
143
-                glsr_log()->error($e->getMessage());
141
+                glsr( $addon )->updater->getPluginUpdate( true );
142
+            } catch( \Exception $e ) {
143
+                glsr_log()->error( $e->getMessage() );
144 144
             }
145 145
         }
146 146
     }
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function renderLicenseMissingLink()
152 152
     {
153
-        if (!$this->isLicenseValid()) {
154
-            glsr()->render('partials/addons/license-missing');
153
+        if( !$this->isLicenseValid() ) {
154
+            glsr()->render( 'partials/addons/license-missing' );
155 155
         }
156 156
     }
157 157
 
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
      */
161 161
     protected function getCachedVersion()
162 162
     {
163
-        return get_transient($this->transientName);
163
+        return get_transient( $this->transientName );
164 164
     }
165 165
 
166 166
     /**
167 167
      * @param bool $force
168 168
      * @return false|object
169 169
      */
170
-    protected function getPluginUpdate($force = false)
170
+    protected function getPluginUpdate( $force = false )
171 171
     {
172 172
         $version = $this->getCachedVersion();
173
-        if (false === $version || $force) {
173
+        if( false === $version || $force ) {
174 174
             $version = $this->getVersion();
175
-            $this->setCachedVersion($version);
175
+            $this->setCachedVersion( $version );
176 176
         }
177
-        if (isset($version->error)) {
178
-            glsr_log()->error($version->error);
177
+        if( isset($version->error) ) {
178
+            glsr_log()->error( $version->error );
179 179
             return false;
180 180
         }
181 181
         return $version;
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
      * @param object $updateInfo
187 187
      * @return object
188 188
      */
189
-    protected function modifyPluginUpdates($transient, $updateInfo)
189
+    protected function modifyPluginUpdates( $transient, $updateInfo )
190 190
     {
191
-        $updateInfo->id = Application::ID.'/'.Arr::get($this->data, 'TextDomain');
191
+        $updateInfo->id = Application::ID.'/'.Arr::get( $this->data, 'TextDomain' );
192 192
         $updateInfo->plugin = $this->plugin;
193
-        $updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
194
-        $updateInfo->tested = Arr::get($this->data, 'testedTo');
195
-        $transient->checked[$this->plugin] = Arr::get($this->data, 'Version');
193
+        $updateInfo->requires_php = Arr::get( $this->data, 'RequiresPHP' );
194
+        $updateInfo->tested = Arr::get( $this->data, 'testedTo' );
195
+        $transient->checked[$this->plugin] = Arr::get( $this->data, 'Version' );
196 196
         $transient->last_checked = time();
197
-        if (version_compare($updateInfo->new_version, Arr::get($this->data, 'Version'), '>')) {
197
+        if( version_compare( $updateInfo->new_version, Arr::get( $this->data, 'Version' ), '>' ) ) {
198 198
             unset($transient->no_update[$this->plugin]);
199 199
             $updateInfo->update = true;
200 200
             $transient->response[$this->plugin] = $updateInfo;
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
      * @param object $updateInfo
210 210
      * @return object
211 211
      */
212
-    protected function modifyUpdateDetails($updateInfo)
212
+    protected function modifyUpdateDetails( $updateInfo )
213 213
     {
214
-        $updateInfo->author = Arr::get($this->data, 'Author');
215
-        $updateInfo->author_profile = Arr::get($this->data, 'AuthorURI');
216
-        $updateInfo->requires = Arr::get($this->data, 'RequiresWP');
217
-        $updateInfo->requires_php = Arr::get($this->data, 'RequiresPHP');
218
-        $updateInfo->tested = Arr::get($this->data, 'testedTo');
214
+        $updateInfo->author = Arr::get( $this->data, 'Author' );
215
+        $updateInfo->author_profile = Arr::get( $this->data, 'AuthorURI' );
216
+        $updateInfo->requires = Arr::get( $this->data, 'RequiresWP' );
217
+        $updateInfo->requires_php = Arr::get( $this->data, 'RequiresPHP' );
218
+        $updateInfo->tested = Arr::get( $this->data, 'testedTo' );
219 219
         $updateInfo->version = $updateInfo->new_version;
220 220
         return $updateInfo;
221 221
     }
@@ -224,49 +224,49 @@  discard block
 block discarded – undo
224 224
      * @param \WP_Error|array $response
225 225
      * @return object
226 226
      */
227
-    protected function normalizeResponse($response)
227
+    protected function normalizeResponse( $response )
228 228
     {
229
-        $body = wp_remote_retrieve_body($response);
230
-        if ($data = json_decode($body)) {
231
-            $data = array_map('maybe_unserialize', (array) $data);
232
-            return (object) $data;
229
+        $body = wp_remote_retrieve_body( $response );
230
+        if( $data = json_decode( $body ) ) {
231
+            $data = array_map( 'maybe_unserialize', (array)$data );
232
+            return (object)$data;
233 233
         }
234
-        $error = is_wp_error($response)
234
+        $error = is_wp_error( $response )
235 235
             ? $response->get_error_message()
236
-            : 'Update server not responding ('.Arr::get($this->data, 'TextDomain').')';
237
-        return (object) ['error' => $error];
236
+            : 'Update server not responding ('.Arr::get( $this->data, 'TextDomain' ).')';
237
+        return (object)['error' => $error];
238 238
     }
239 239
 
240 240
     /**
241 241
      * @param string $action activate_license|check_license|deactivate_license|get_version
242 242
      * @return object
243 243
      */
244
-    protected function request($action, array $data = [])
244
+    protected function request( $action, array $data = [] )
245 245
     {
246
-        $data = wp_parse_args($data, $this->data);
247
-        $response = wp_remote_post($this->apiUrl, [
246
+        $data = wp_parse_args( $data, $this->data );
247
+        $response = wp_remote_post( $this->apiUrl, [
248 248
             'body' => [
249 249
                 'edd_action' => $action,
250
-                'item_id' => Arr::get($data, 'item_id'),
251
-                'item_name' => Arr::get($data, 'Name'),
252
-                'license' => Arr::get($data, 'license'),
253
-                'slug' => Arr::get($data, 'TextDomain'),
250
+                'item_id' => Arr::get( $data, 'item_id' ),
251
+                'item_name' => Arr::get( $data, 'Name' ),
252
+                'license' => Arr::get( $data, 'license' ),
253
+                'slug' => Arr::get( $data, 'TextDomain' ),
254 254
                 'url' => home_url(),
255 255
             ],
256
-            'sslverify' => apply_filters('site-reviews/sslverify/post', false),
256
+            'sslverify' => apply_filters( 'site-reviews/sslverify/post', false ),
257 257
             'timeout' => 15,
258
-        ]);
259
-        return $this->normalizeResponse($response);
258
+        ] );
259
+        return $this->normalizeResponse( $response );
260 260
     }
261 261
 
262 262
     /**
263 263
      * @param object $version
264 264
      * @return void
265 265
      */
266
-    protected function setCachedVersion($version)
266
+    protected function setCachedVersion( $version )
267 267
     {
268
-        if (!isset($version->error)) {
269
-            set_transient($this->transientName, $version, 3 * HOUR_IN_SECONDS);
268
+        if( !isset($version->error) ) {
269
+            set_transient( $this->transientName, $version, 3 * HOUR_IN_SECONDS );
270 270
         }
271 271
     }
272 272
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,8 @@  discard block
 block discarded – undo
139 139
         foreach (glsr()->addons as $addon) {
140 140
             try {
141 141
                 glsr($addon)->updater->getPluginUpdate(true);
142
-            } catch (\Exception $e) {
142
+            }
143
+            catch (\Exception $e) {
143 144
                 glsr_log()->error($e->getMessage());
144 145
             }
145 146
         }
@@ -198,7 +199,8 @@  discard block
 block discarded – undo
198 199
             unset($transient->no_update[$this->plugin]);
199 200
             $updateInfo->update = true;
200 201
             $transient->response[$this->plugin] = $updateInfo;
201
-        } else {
202
+        }
203
+        else {
202 204
             unset($transient->response[$this->plugin]);
203 205
             $transient->no_update[$this->plugin] = $updateInfo;
204 206
         }
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@
 block discarded – undo
64 64
         $review = glsr_get_review($post);
65 65
         if ('publish' == $post->post_status) {
66 66
             glsr(CountsManager::class)->increaseAll($review);
67
-        } else {
67
+        }
68
+        else {
68 69
             glsr(CountsManager::class)->decreaseAll($review);
69 70
         }
70 71
     }
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -16,159 +16,159 @@
 block discarded – undo
16 16
 
17 17
 class ReviewController extends Controller
18 18
 {
19
-    /**
20
-     * Triggered when a category is added to a review.
21
-     *
22
-     * @param int $postId
23
-     * @param array $terms
24
-     * @param array $newTTIds
25
-     * @param string $taxonomy
26
-     * @param bool $append
27
-     * @param array $oldTTIds
28
-     * @return void
29
-     * @action set_object_terms
30
-     */
31
-    public function onAfterChangeCategory($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
32
-    {
33
-        sort($newTTIds);
34
-        sort($oldTTIds);
35
-        if ($newTTIds === $oldTTIds || !$this->isReviewPostId($postId)) {
36
-            return;
37
-        }
38
-        $review = glsr_get_review($postId);
39
-        if ('publish' !== $review->status) {
40
-            return;
41
-        }
42
-        $ignoredIds = array_intersect($oldTTIds, $newTTIds);
43
-        $decreasedIds = array_diff($oldTTIds, $ignoredIds);
44
-        $increasedIds = array_diff($newTTIds, $ignoredIds);
45
-        if ($review->term_ids = glsr(Database::class)->getTermIds($decreasedIds, 'term_taxonomy_id')) {
46
-            glsr(TermCountsManager::class)->decrease($review);
47
-        }
48
-        if ($review->term_ids = glsr(Database::class)->getTermIds($increasedIds, 'term_taxonomy_id')) {
49
-            glsr(TermCountsManager::class)->increase($review);
50
-        }
51
-    }
19
+	/**
20
+	 * Triggered when a category is added to a review.
21
+	 *
22
+	 * @param int $postId
23
+	 * @param array $terms
24
+	 * @param array $newTTIds
25
+	 * @param string $taxonomy
26
+	 * @param bool $append
27
+	 * @param array $oldTTIds
28
+	 * @return void
29
+	 * @action set_object_terms
30
+	 */
31
+	public function onAfterChangeCategory($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
32
+	{
33
+		sort($newTTIds);
34
+		sort($oldTTIds);
35
+		if ($newTTIds === $oldTTIds || !$this->isReviewPostId($postId)) {
36
+			return;
37
+		}
38
+		$review = glsr_get_review($postId);
39
+		if ('publish' !== $review->status) {
40
+			return;
41
+		}
42
+		$ignoredIds = array_intersect($oldTTIds, $newTTIds);
43
+		$decreasedIds = array_diff($oldTTIds, $ignoredIds);
44
+		$increasedIds = array_diff($newTTIds, $ignoredIds);
45
+		if ($review->term_ids = glsr(Database::class)->getTermIds($decreasedIds, 'term_taxonomy_id')) {
46
+			glsr(TermCountsManager::class)->decrease($review);
47
+		}
48
+		if ($review->term_ids = glsr(Database::class)->getTermIds($increasedIds, 'term_taxonomy_id')) {
49
+			glsr(TermCountsManager::class)->increase($review);
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * Triggered when an existing review is approved|unapproved.
55
-     *
56
-     * @param string $oldStatus
57
-     * @param string $newStatus
58
-     * @param \WP_Post $post
59
-     * @return void
60
-     * @action transition_post_status
61
-     */
62
-    public function onAfterChangeStatus($newStatus, $oldStatus, $post)
63
-    {
64
-        if (Application::POST_TYPE != Arr::get($post, 'post_type') 
65
-            || in_array($oldStatus, ['new', $newStatus])) {
66
-            return;
67
-        }
68
-        $review = glsr_get_review($post);
69
-        if ('publish' == $post->post_status) {
70
-            glsr(CountsManager::class)->increaseAll($review);
71
-        } else {
72
-            glsr(CountsManager::class)->decreaseAll($review);
73
-        }
74
-    }
53
+	/**
54
+	 * Triggered when an existing review is approved|unapproved.
55
+	 *
56
+	 * @param string $oldStatus
57
+	 * @param string $newStatus
58
+	 * @param \WP_Post $post
59
+	 * @return void
60
+	 * @action transition_post_status
61
+	 */
62
+	public function onAfterChangeStatus($newStatus, $oldStatus, $post)
63
+	{
64
+		if (Application::POST_TYPE != Arr::get($post, 'post_type') 
65
+			|| in_array($oldStatus, ['new', $newStatus])) {
66
+			return;
67
+		}
68
+		$review = glsr_get_review($post);
69
+		if ('publish' == $post->post_status) {
70
+			glsr(CountsManager::class)->increaseAll($review);
71
+		} else {
72
+			glsr(CountsManager::class)->decreaseAll($review);
73
+		}
74
+	}
75 75
 
76
-    /**
77
-     * Triggered when a review is first created.
78
-     *
79
-     * @return void
80
-     * @action site-reviews/review/created
81
-     */
82
-    public function onAfterCreate(Review $review)
83
-    {
84
-        if ('publish' !== $review->status) {
85
-            return;
86
-        }
87
-        glsr(GlobalCountsManager::class)->increase($review);
88
-        glsr(PostCountsManager::class)->increase($review);
89
-    }
76
+	/**
77
+	 * Triggered when a review is first created.
78
+	 *
79
+	 * @return void
80
+	 * @action site-reviews/review/created
81
+	 */
82
+	public function onAfterCreate(Review $review)
83
+	{
84
+		if ('publish' !== $review->status) {
85
+			return;
86
+		}
87
+		glsr(GlobalCountsManager::class)->increase($review);
88
+		glsr(PostCountsManager::class)->increase($review);
89
+	}
90 90
 
91
-    /**
92
-     * Triggered when a review is deleted.
93
-     *
94
-     * @param int $postId
95
-     * @return void
96
-     * @action before_delete_post
97
-     */
98
-    public function onBeforeDelete($postId)
99
-    {
100
-        if (!$this->isReviewPostId($postId)) {
101
-            return;
102
-        }
103
-        $review = glsr_get_review($postId);
104
-        if ('trash' !== $review->status) { // do not run for trashed posts
105
-            glsr(CountsManager::class)->decreaseAll($review);
106
-        }
107
-    }
91
+	/**
92
+	 * Triggered when a review is deleted.
93
+	 *
94
+	 * @param int $postId
95
+	 * @return void
96
+	 * @action before_delete_post
97
+	 */
98
+	public function onBeforeDelete($postId)
99
+	{
100
+		if (!$this->isReviewPostId($postId)) {
101
+			return;
102
+		}
103
+		$review = glsr_get_review($postId);
104
+		if ('trash' !== $review->status) { // do not run for trashed posts
105
+			glsr(CountsManager::class)->decreaseAll($review);
106
+		}
107
+	}
108 108
 
109
-    /**
110
-     * Triggered when a review's rating, assigned_to, or review_type is changed.
111
-     *
112
-     * @param int $metaId
113
-     * @param int $postId
114
-     * @param string $metaKey
115
-     * @param mixed $metaValue
116
-     * @return void
117
-     * @action update_postmeta
118
-     */
119
-    public function onBeforeUpdate($metaId, $postId, $metaKey, $metaValue)
120
-    {
121
-        if (!$this->isReviewPostId($postId)) {
122
-            return;
123
-        }
124
-        $metaKey = Str::removePrefix('_', $metaKey);
125
-        if (!in_array($metaKey, ['assigned_to', 'rating', 'review_type'])) {
126
-            return;
127
-        }
128
-        $review = glsr_get_review($postId);
129
-        if ($review->$metaKey == $metaValue) {
130
-            return;
131
-        }
132
-        $method = Helper::buildMethodName($metaKey, 'onBeforeChange');
133
-        call_user_func([$this, $method], $review, $metaValue);
134
-    }
109
+	/**
110
+	 * Triggered when a review's rating, assigned_to, or review_type is changed.
111
+	 *
112
+	 * @param int $metaId
113
+	 * @param int $postId
114
+	 * @param string $metaKey
115
+	 * @param mixed $metaValue
116
+	 * @return void
117
+	 * @action update_postmeta
118
+	 */
119
+	public function onBeforeUpdate($metaId, $postId, $metaKey, $metaValue)
120
+	{
121
+		if (!$this->isReviewPostId($postId)) {
122
+			return;
123
+		}
124
+		$metaKey = Str::removePrefix('_', $metaKey);
125
+		if (!in_array($metaKey, ['assigned_to', 'rating', 'review_type'])) {
126
+			return;
127
+		}
128
+		$review = glsr_get_review($postId);
129
+		if ($review->$metaKey == $metaValue) {
130
+			return;
131
+		}
132
+		$method = Helper::buildMethodName($metaKey, 'onBeforeChange');
133
+		call_user_func([$this, $method], $review, $metaValue);
134
+	}
135 135
 
136
-    /**
137
-     * Triggered by the onBeforeUpdate method.
138
-     *
139
-     * @param string|int $assignedTo
140
-     * @return void
141
-     */
142
-    protected function onBeforeChangeAssignedTo(Review $review, $assignedTo)
143
-    {
144
-        glsr(PostCountsManager::class)->decrease($review);
145
-        $review->assigned_to = $assignedTo;
146
-        glsr(PostCountsManager::class)->increase($review);
147
-    }
136
+	/**
137
+	 * Triggered by the onBeforeUpdate method.
138
+	 *
139
+	 * @param string|int $assignedTo
140
+	 * @return void
141
+	 */
142
+	protected function onBeforeChangeAssignedTo(Review $review, $assignedTo)
143
+	{
144
+		glsr(PostCountsManager::class)->decrease($review);
145
+		$review->assigned_to = $assignedTo;
146
+		glsr(PostCountsManager::class)->increase($review);
147
+	}
148 148
 
149
-    /**
150
-     * Triggered by the onBeforeUpdate method.
151
-     *
152
-     * @param string|int $rating
153
-     * @return void
154
-     */
155
-    protected function onBeforeChangeRating(Review $review, $rating)
156
-    {
157
-        glsr(CountsManager::class)->decreaseAll($review);
158
-        $review->rating = $rating;
159
-        glsr(CountsManager::class)->increaseAll($review);
160
-    }
149
+	/**
150
+	 * Triggered by the onBeforeUpdate method.
151
+	 *
152
+	 * @param string|int $rating
153
+	 * @return void
154
+	 */
155
+	protected function onBeforeChangeRating(Review $review, $rating)
156
+	{
157
+		glsr(CountsManager::class)->decreaseAll($review);
158
+		$review->rating = $rating;
159
+		glsr(CountsManager::class)->increaseAll($review);
160
+	}
161 161
 
162
-    /**
163
-     * Triggered by the onBeforeUpdate method.
164
-     *
165
-     * @param string $reviewType
166
-     * @return void
167
-     */
168
-    protected function onBeforeChangeReviewType(Review $review, $reviewType)
169
-    {
170
-        glsr(CountsManager::class)->decreaseAll($review);
171
-        $review->review_type = $reviewType;
172
-        glsr(CountsManager::class)->increaseAll($review);
173
-    }
162
+	/**
163
+	 * Triggered by the onBeforeUpdate method.
164
+	 *
165
+	 * @param string $reviewType
166
+	 * @return void
167
+	 */
168
+	protected function onBeforeChangeReviewType(Review $review, $reviewType)
169
+	{
170
+		glsr(CountsManager::class)->decreaseAll($review);
171
+		$review->review_type = $reviewType;
172
+		glsr(CountsManager::class)->increaseAll($review);
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
      * @return void
29 29
      * @action set_object_terms
30 30
      */
31
-    public function onAfterChangeCategory($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
31
+    public function onAfterChangeCategory( $postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds )
32 32
     {
33
-        sort($newTTIds);
34
-        sort($oldTTIds);
35
-        if ($newTTIds === $oldTTIds || !$this->isReviewPostId($postId)) {
33
+        sort( $newTTIds );
34
+        sort( $oldTTIds );
35
+        if( $newTTIds === $oldTTIds || !$this->isReviewPostId( $postId ) ) {
36 36
             return;
37 37
         }
38
-        $review = glsr_get_review($postId);
39
-        if ('publish' !== $review->status) {
38
+        $review = glsr_get_review( $postId );
39
+        if( 'publish' !== $review->status ) {
40 40
             return;
41 41
         }
42
-        $ignoredIds = array_intersect($oldTTIds, $newTTIds);
43
-        $decreasedIds = array_diff($oldTTIds, $ignoredIds);
44
-        $increasedIds = array_diff($newTTIds, $ignoredIds);
45
-        if ($review->term_ids = glsr(Database::class)->getTermIds($decreasedIds, 'term_taxonomy_id')) {
46
-            glsr(TermCountsManager::class)->decrease($review);
42
+        $ignoredIds = array_intersect( $oldTTIds, $newTTIds );
43
+        $decreasedIds = array_diff( $oldTTIds, $ignoredIds );
44
+        $increasedIds = array_diff( $newTTIds, $ignoredIds );
45
+        if( $review->term_ids = glsr( Database::class )->getTermIds( $decreasedIds, 'term_taxonomy_id' ) ) {
46
+            glsr( TermCountsManager::class )->decrease( $review );
47 47
         }
48
-        if ($review->term_ids = glsr(Database::class)->getTermIds($increasedIds, 'term_taxonomy_id')) {
49
-            glsr(TermCountsManager::class)->increase($review);
48
+        if( $review->term_ids = glsr( Database::class )->getTermIds( $increasedIds, 'term_taxonomy_id' ) ) {
49
+            glsr( TermCountsManager::class )->increase( $review );
50 50
         }
51 51
     }
52 52
 
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
      * @return void
60 60
      * @action transition_post_status
61 61
      */
62
-    public function onAfterChangeStatus($newStatus, $oldStatus, $post)
62
+    public function onAfterChangeStatus( $newStatus, $oldStatus, $post )
63 63
     {
64
-        if (Application::POST_TYPE != Arr::get($post, 'post_type') 
65
-            || in_array($oldStatus, ['new', $newStatus])) {
64
+        if( Application::POST_TYPE != Arr::get( $post, 'post_type' ) 
65
+            || in_array( $oldStatus, ['new', $newStatus] ) ) {
66 66
             return;
67 67
         }
68
-        $review = glsr_get_review($post);
69
-        if ('publish' == $post->post_status) {
70
-            glsr(CountsManager::class)->increaseAll($review);
68
+        $review = glsr_get_review( $post );
69
+        if( 'publish' == $post->post_status ) {
70
+            glsr( CountsManager::class )->increaseAll( $review );
71 71
         } else {
72
-            glsr(CountsManager::class)->decreaseAll($review);
72
+            glsr( CountsManager::class )->decreaseAll( $review );
73 73
         }
74 74
     }
75 75
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
      * @return void
80 80
      * @action site-reviews/review/created
81 81
      */
82
-    public function onAfterCreate(Review $review)
82
+    public function onAfterCreate( Review $review )
83 83
     {
84
-        if ('publish' !== $review->status) {
84
+        if( 'publish' !== $review->status ) {
85 85
             return;
86 86
         }
87
-        glsr(GlobalCountsManager::class)->increase($review);
88
-        glsr(PostCountsManager::class)->increase($review);
87
+        glsr( GlobalCountsManager::class )->increase( $review );
88
+        glsr( PostCountsManager::class )->increase( $review );
89 89
     }
90 90
 
91 91
     /**
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
      * @return void
96 96
      * @action before_delete_post
97 97
      */
98
-    public function onBeforeDelete($postId)
98
+    public function onBeforeDelete( $postId )
99 99
     {
100
-        if (!$this->isReviewPostId($postId)) {
100
+        if( !$this->isReviewPostId( $postId ) ) {
101 101
             return;
102 102
         }
103
-        $review = glsr_get_review($postId);
104
-        if ('trash' !== $review->status) { // do not run for trashed posts
105
-            glsr(CountsManager::class)->decreaseAll($review);
103
+        $review = glsr_get_review( $postId );
104
+        if( 'trash' !== $review->status ) { // do not run for trashed posts
105
+            glsr( CountsManager::class )->decreaseAll( $review );
106 106
         }
107 107
     }
108 108
 
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
      * @return void
117 117
      * @action update_postmeta
118 118
      */
119
-    public function onBeforeUpdate($metaId, $postId, $metaKey, $metaValue)
119
+    public function onBeforeUpdate( $metaId, $postId, $metaKey, $metaValue )
120 120
     {
121
-        if (!$this->isReviewPostId($postId)) {
121
+        if( !$this->isReviewPostId( $postId ) ) {
122 122
             return;
123 123
         }
124
-        $metaKey = Str::removePrefix('_', $metaKey);
125
-        if (!in_array($metaKey, ['assigned_to', 'rating', 'review_type'])) {
124
+        $metaKey = Str::removePrefix( '_', $metaKey );
125
+        if( !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] ) ) {
126 126
             return;
127 127
         }
128
-        $review = glsr_get_review($postId);
129
-        if ($review->$metaKey == $metaValue) {
128
+        $review = glsr_get_review( $postId );
129
+        if( $review->$metaKey == $metaValue ) {
130 130
             return;
131 131
         }
132
-        $method = Helper::buildMethodName($metaKey, 'onBeforeChange');
133
-        call_user_func([$this, $method], $review, $metaValue);
132
+        $method = Helper::buildMethodName( $metaKey, 'onBeforeChange' );
133
+        call_user_func( [$this, $method], $review, $metaValue );
134 134
     }
135 135
 
136 136
     /**
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
      * @param string|int $assignedTo
140 140
      * @return void
141 141
      */
142
-    protected function onBeforeChangeAssignedTo(Review $review, $assignedTo)
142
+    protected function onBeforeChangeAssignedTo( Review $review, $assignedTo )
143 143
     {
144
-        glsr(PostCountsManager::class)->decrease($review);
144
+        glsr( PostCountsManager::class )->decrease( $review );
145 145
         $review->assigned_to = $assignedTo;
146
-        glsr(PostCountsManager::class)->increase($review);
146
+        glsr( PostCountsManager::class )->increase( $review );
147 147
     }
148 148
 
149 149
     /**
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
      * @param string|int $rating
153 153
      * @return void
154 154
      */
155
-    protected function onBeforeChangeRating(Review $review, $rating)
155
+    protected function onBeforeChangeRating( Review $review, $rating )
156 156
     {
157
-        glsr(CountsManager::class)->decreaseAll($review);
157
+        glsr( CountsManager::class )->decreaseAll( $review );
158 158
         $review->rating = $rating;
159
-        glsr(CountsManager::class)->increaseAll($review);
159
+        glsr( CountsManager::class )->increaseAll( $review );
160 160
     }
161 161
 
162 162
     /**
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
      * @param string $reviewType
166 166
      * @return void
167 167
      */
168
-    protected function onBeforeChangeReviewType(Review $review, $reviewType)
168
+    protected function onBeforeChangeReviewType( Review $review, $reviewType )
169 169
     {
170
-        glsr(CountsManager::class)->decreaseAll($review);
170
+        glsr( CountsManager::class )->decreaseAll( $review );
171 171
         $review->review_type = $reviewType;
172
-        glsr(CountsManager::class)->increaseAll($review);
172
+        glsr( CountsManager::class )->increaseAll( $review );
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
plugin/Database/TermCountsManager.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -9,92 +9,92 @@
 block discarded – undo
9 9
 
10 10
 class TermCountsManager
11 11
 {
12
-    /**
13
-     * @var CountsManager
14
-     */
15
-    protected $manager;
12
+	/**
13
+	 * @var CountsManager
14
+	 */
15
+	protected $manager;
16 16
 
17
-    public function __construct()
18
-    {
19
-        $this->manager = glsr(CountsManager::class);
20
-    }
17
+	public function __construct()
18
+	{
19
+		$this->manager = glsr(CountsManager::class);
20
+	}
21 21
 
22
-    /**
23
-     * @param int $termTaxonomyId
24
-     * @return array
25
-     */
26
-    public function build($termTaxonomyId)
27
-    {
28
-        return $this->manager->buildCounts([
29
-            'term_ids' => [$termTaxonomyId],
30
-        ]);
31
-    }
22
+	/**
23
+	 * @param int $termTaxonomyId
24
+	 * @return array
25
+	 */
26
+	public function build($termTaxonomyId)
27
+	{
28
+		return $this->manager->buildCounts([
29
+			'term_ids' => [$termTaxonomyId],
30
+		]);
31
+	}
32 32
 
33
-    /**
34
-     * @return void
35
-     */
36
-    public function decrease(Review $review)
37
-    {
38
-        foreach ($review->term_ids as $termId) {
39
-            if (empty($counts = $this->get($termId))) {
40
-                continue;
41
-            }
42
-            $this->update($termId,
43
-                $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
44
-            );
45
-        }
46
-    }
33
+	/**
34
+	 * @return void
35
+	 */
36
+	public function decrease(Review $review)
37
+	{
38
+		foreach ($review->term_ids as $termId) {
39
+			if (empty($counts = $this->get($termId))) {
40
+				continue;
41
+			}
42
+			$this->update($termId,
43
+				$this->manager->decreaseRating($counts, $review->review_type, $review->rating)
44
+			);
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param int $termId
50
-     * @return array
51
-     */
52
-    public function get($termId)
53
-    {
54
-        return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
55
-    }
48
+	/**
49
+	 * @param int $termId
50
+	 * @return array
51
+	 */
52
+	public function get($termId)
53
+	{
54
+		return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
55
+	}
56 56
 
57
-    /**
58
-     * @return void
59
-     */
60
-    public function increase(Review $review)
61
-    {
62
-        $terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
-        foreach ($terms as $term) {
64
-            $counts = $this->get($term['term_id']);
65
-            $counts = empty($counts)
66
-                ? $this->build($term['term_taxonomy_id'])
67
-                : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
-            $this->update($term['term_id'], $counts);
69
-        }
70
-    }
57
+	/**
58
+	 * @return void
59
+	 */
60
+	public function increase(Review $review)
61
+	{
62
+		$terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
+		foreach ($terms as $term) {
64
+			$counts = $this->get($term['term_id']);
65
+			$counts = empty($counts)
66
+				? $this->build($term['term_taxonomy_id'])
67
+				: $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
+			$this->update($term['term_id'], $counts);
69
+		}
70
+	}
71 71
 
72
-    /**
73
-     * @param int $termId
74
-     * @return void
75
-     */
76
-    public function update($termId, array $reviewCounts)
77
-    {
78
-        $term = get_term($termId, Application::TAXONOMY);
79
-        if (!isset($term->term_id)) {
80
-            return;
81
-        }
82
-        $ratingCounts = $this->manager->flatten($reviewCounts);
83
-        update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
84
-        update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
85
-        update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
86
-    }
72
+	/**
73
+	 * @param int $termId
74
+	 * @return void
75
+	 */
76
+	public function update($termId, array $reviewCounts)
77
+	{
78
+		$term = get_term($termId, Application::TAXONOMY);
79
+		if (!isset($term->term_id)) {
80
+			return;
81
+		}
82
+		$ratingCounts = $this->manager->flatten($reviewCounts);
83
+		update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
84
+		update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
85
+		update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
86
+	}
87 87
 
88
-    /**
89
-     * @return void
90
-     */
91
-    public function updateAll()
92
-    {
93
-        $terms = glsr(Database::class)->getTerms([
94
-            'fields' => 'all',
95
-        ]);
96
-        foreach ($terms as $term) {
97
-            $this->update($term->term_id, $this->build($term->term_taxonomy_id));
98
-        }
99
-    }
88
+	/**
89
+	 * @return void
90
+	 */
91
+	public function updateAll()
92
+	{
93
+		$terms = glsr(Database::class)->getTerms([
94
+			'fields' => 'all',
95
+		]);
96
+		foreach ($terms as $term) {
97
+			$this->update($term->term_id, $this->build($term->term_taxonomy_id));
98
+		}
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function __construct()
18 18
     {
19
-        $this->manager = glsr(CountsManager::class);
19
+        $this->manager = glsr( CountsManager::class );
20 20
     }
21 21
 
22 22
     /**
23 23
      * @param int $termTaxonomyId
24 24
      * @return array
25 25
      */
26
-    public function build($termTaxonomyId)
26
+    public function build( $termTaxonomyId )
27 27
     {
28
-        return $this->manager->buildCounts([
28
+        return $this->manager->buildCounts( [
29 29
             'term_ids' => [$termTaxonomyId],
30
-        ]);
30
+        ] );
31 31
     }
32 32
 
33 33
     /**
34 34
      * @return void
35 35
      */
36
-    public function decrease(Review $review)
36
+    public function decrease( Review $review )
37 37
     {
38
-        foreach ($review->term_ids as $termId) {
39
-            if (empty($counts = $this->get($termId))) {
38
+        foreach( $review->term_ids as $termId ) {
39
+            if( empty($counts = $this->get( $termId )) ) {
40 40
                 continue;
41 41
             }
42
-            $this->update($termId,
43
-                $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
42
+            $this->update( $termId,
43
+                $this->manager->decreaseRating( $counts, $review->review_type, $review->rating )
44 44
             );
45 45
         }
46 46
     }
@@ -49,23 +49,23 @@  discard block
 block discarded – undo
49 49
      * @param int $termId
50 50
      * @return array
51 51
      */
52
-    public function get($termId)
52
+    public function get( $termId )
53 53
     {
54
-        return array_filter((array) get_term_meta($termId, CountsManager::META_COUNT, true));
54
+        return array_filter( (array)get_term_meta( $termId, CountsManager::META_COUNT, true ) );
55 55
     }
56 56
 
57 57
     /**
58 58
      * @return void
59 59
      */
60
-    public function increase(Review $review)
60
+    public function increase( Review $review )
61 61
     {
62
-        $terms = glsr(ReviewManager::class)->normalizeTerms(implode(',', $review->term_ids));
63
-        foreach ($terms as $term) {
64
-            $counts = $this->get($term['term_id']);
62
+        $terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ) );
63
+        foreach( $terms as $term ) {
64
+            $counts = $this->get( $term['term_id'] );
65 65
             $counts = empty($counts)
66
-                ? $this->build($term['term_taxonomy_id'])
67
-                : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
68
-            $this->update($term['term_id'], $counts);
66
+                ? $this->build( $term['term_taxonomy_id'] )
67
+                : $this->manager->increaseRating( $counts, $review->review_type, $review->rating );
68
+            $this->update( $term['term_id'], $counts );
69 69
         }
70 70
     }
71 71
 
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
      * @param int $termId
74 74
      * @return void
75 75
      */
76
-    public function update($termId, array $reviewCounts)
76
+    public function update( $termId, array $reviewCounts )
77 77
     {
78
-        $term = get_term($termId, Application::TAXONOMY);
79
-        if (!isset($term->term_id)) {
78
+        $term = get_term( $termId, Application::TAXONOMY );
79
+        if( !isset($term->term_id) ) {
80 80
             return;
81 81
         }
82
-        $ratingCounts = $this->manager->flatten($reviewCounts);
83
-        update_term_meta($termId, CountsManager::META_COUNT, $reviewCounts);
84
-        update_term_meta($termId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
85
-        update_term_meta($termId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
82
+        $ratingCounts = $this->manager->flatten( $reviewCounts );
83
+        update_term_meta( $termId, CountsManager::META_COUNT, $reviewCounts );
84
+        update_term_meta( $termId, CountsManager::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
85
+        update_term_meta( $termId, CountsManager::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
86 86
     }
87 87
 
88 88
     /**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function updateAll()
92 92
     {
93
-        $terms = glsr(Database::class)->getTerms([
93
+        $terms = glsr( Database::class )->getTerms( [
94 94
             'fields' => 'all',
95
-        ]);
96
-        foreach ($terms as $term) {
97
-            $this->update($term->term_id, $this->build($term->term_taxonomy_id));
95
+        ] );
96
+        foreach( $terms as $term ) {
97
+            $this->update( $term->term_id, $this->build( $term->term_taxonomy_id ) );
98 98
         }
99 99
     }
100 100
 }
Please login to merge, or discard this patch.
plugin/Database/PostCountsManager.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@
 block discarded – undo
7 7
 
8 8
 class PostCountsManager
9 9
 {
10
-    /**
11
-     * @var CountsManager
12
-     */
13
-    protected $manager;
10
+	/**
11
+	 * @var CountsManager
12
+	 */
13
+	protected $manager;
14 14
 
15
-    public function __construct()
16
-    {
17
-        $this->manager = glsr(CountsManager::class);
18
-    }
15
+	public function __construct()
16
+	{
17
+		$this->manager = glsr(CountsManager::class);
18
+	}
19 19
 
20
-    /**
21
-     * @param int $postId
22
-     * @return array
23
-     */
24
-    public function build($postId)
25
-    {
26
-        return $this->manager->buildCounts([
27
-            'post_ids' => [$postId],
28
-        ]);
29
-    }
20
+	/**
21
+	 * @param int $postId
22
+	 * @return array
23
+	 */
24
+	public function build($postId)
25
+	{
26
+		return $this->manager->buildCounts([
27
+			'post_ids' => [$postId],
28
+		]);
29
+	}
30 30
 
31
-    /**
32
-     * @return void
33
-     */
34
-    public function decrease(Review $review)
35
-    {
36
-        if (empty($counts = $this->get($review->assigned_to))) {
37
-            return;
38
-        }
39
-        $this->update($review->assigned_to,
40
-            $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
41
-        );
42
-    }
31
+	/**
32
+	 * @return void
33
+	 */
34
+	public function decrease(Review $review)
35
+	{
36
+		if (empty($counts = $this->get($review->assigned_to))) {
37
+			return;
38
+		}
39
+		$this->update($review->assigned_to,
40
+			$this->manager->decreaseRating($counts, $review->review_type, $review->rating)
41
+		);
42
+	}
43 43
 
44
-    /**
45
-     * @param int $postId
46
-     * @return array
47
-     */
48
-    public function get($postId)
49
-    {
50
-        return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
51
-    }
44
+	/**
45
+	 * @param int $postId
46
+	 * @return array
47
+	 */
48
+	public function get($postId)
49
+	{
50
+		return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function increase(Review $review)
57
-    {
58
-        if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
59
-            return;
60
-        }
61
-        $counts = $this->get($review->assigned_to);
62
-        $counts = empty($counts)
63
-            ? $this->build($review->assigned_to)
64
-            : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
-        $this->update($review->assigned_to, $counts);
66
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function increase(Review $review)
57
+	{
58
+		if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
59
+			return;
60
+		}
61
+		$counts = $this->get($review->assigned_to);
62
+		$counts = empty($counts)
63
+			? $this->build($review->assigned_to)
64
+			: $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
+		$this->update($review->assigned_to, $counts);
66
+	}
67 67
 
68
-    /**
69
-     * @param int $postId
70
-     * @return void
71
-     */
72
-    public function update($postId, array $reviewCounts)
73
-    {
74
-        $ratingCounts = $this->manager->flatten($reviewCounts);
75
-        update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
-        update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
-        update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
78
-    }
68
+	/**
69
+	 * @param int $postId
70
+	 * @return void
71
+	 */
72
+	public function update($postId, array $reviewCounts)
73
+	{
74
+		$ratingCounts = $this->manager->flatten($reviewCounts);
75
+		update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
+		update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
+		update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
78
+	}
79 79
 
80
-    /**
81
-     * @return void
82
-     */
83
-    public function updateAll()
84
-    {
85
-        $postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
86
-        foreach ($postIds as $postId) {
87
-            $this->update($postId, $this->build($postId));
88
-        }
89
-    }
80
+	/**
81
+	 * @return void
82
+	 */
83
+	public function updateAll()
84
+	{
85
+		$postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
86
+		foreach ($postIds as $postId) {
87
+			$this->update($postId, $this->build($postId));
88
+		}
89
+	}
90 90
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct()
16 16
     {
17
-        $this->manager = glsr(CountsManager::class);
17
+        $this->manager = glsr( CountsManager::class );
18 18
     }
19 19
 
20 20
     /**
21 21
      * @param int $postId
22 22
      * @return array
23 23
      */
24
-    public function build($postId)
24
+    public function build( $postId )
25 25
     {
26
-        return $this->manager->buildCounts([
26
+        return $this->manager->buildCounts( [
27 27
             'post_ids' => [$postId],
28
-        ]);
28
+        ] );
29 29
     }
30 30
 
31 31
     /**
32 32
      * @return void
33 33
      */
34
-    public function decrease(Review $review)
34
+    public function decrease( Review $review )
35 35
     {
36
-        if (empty($counts = $this->get($review->assigned_to))) {
36
+        if( empty($counts = $this->get( $review->assigned_to )) ) {
37 37
             return;
38 38
         }
39
-        $this->update($review->assigned_to,
40
-            $this->manager->decreaseRating($counts, $review->review_type, $review->rating)
39
+        $this->update( $review->assigned_to,
40
+            $this->manager->decreaseRating( $counts, $review->review_type, $review->rating )
41 41
         );
42 42
     }
43 43
 
@@ -45,36 +45,36 @@  discard block
 block discarded – undo
45 45
      * @param int $postId
46 46
      * @return array
47 47
      */
48
-    public function get($postId)
48
+    public function get( $postId )
49 49
     {
50
-        return array_filter((array) get_post_meta($postId, CountsManager::META_COUNT, true));
50
+        return array_filter( (array)get_post_meta( $postId, CountsManager::META_COUNT, true ) );
51 51
     }
52 52
 
53 53
     /**
54 54
      * @return void
55 55
      */
56
-    public function increase(Review $review)
56
+    public function increase( Review $review )
57 57
     {
58
-        if (!(get_post($review->assigned_to) instanceof \WP_Post)) {
58
+        if( !(get_post( $review->assigned_to ) instanceof \WP_Post) ) {
59 59
             return;
60 60
         }
61
-        $counts = $this->get($review->assigned_to);
61
+        $counts = $this->get( $review->assigned_to );
62 62
         $counts = empty($counts)
63
-            ? $this->build($review->assigned_to)
64
-            : $this->manager->increaseRating($counts, $review->review_type, $review->rating);
65
-        $this->update($review->assigned_to, $counts);
63
+            ? $this->build( $review->assigned_to )
64
+            : $this->manager->increaseRating( $counts, $review->review_type, $review->rating );
65
+        $this->update( $review->assigned_to, $counts );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @param int $postId
70 70
      * @return void
71 71
      */
72
-    public function update($postId, array $reviewCounts)
72
+    public function update( $postId, array $reviewCounts )
73 73
     {
74
-        $ratingCounts = $this->manager->flatten($reviewCounts);
75
-        update_post_meta($postId, CountsManager::META_COUNT, $reviewCounts);
76
-        update_post_meta($postId, CountsManager::META_AVERAGE, glsr(Rating::class)->getAverage($ratingCounts));
77
-        update_post_meta($postId, CountsManager::META_RANKING, glsr(Rating::class)->getRanking($ratingCounts));
74
+        $ratingCounts = $this->manager->flatten( $reviewCounts );
75
+        update_post_meta( $postId, CountsManager::META_COUNT, $reviewCounts );
76
+        update_post_meta( $postId, CountsManager::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) );
77
+        update_post_meta( $postId, CountsManager::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) );
78 78
     }
79 79
 
80 80
     /**
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function updateAll()
84 84
     {
85
-        $postIds = glsr(SqlQueries::class)->getReviewsMeta('assigned_to');
86
-        foreach ($postIds as $postId) {
87
-            $this->update($postId, $this->build($postId));
85
+        $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
86
+        foreach( $postIds as $postId ) {
87
+            $this->update( $postId, $this->build( $postId ) );
88 88
         }
89 89
     }
90 90
 }
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -16,204 +16,204 @@
 block discarded – undo
16 16
 
17 17
 class ReviewManager
18 18
 {
19
-    /**
20
-     * @return false|Review
21
-     */
22
-    public function create(CreateReview $command)
23
-    {
24
-        $reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
-        $reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
-        $reviewValues = Arr::prefixArrayKeys($reviewValues);
27
-        unset($reviewValues['json']); // @todo remove the need for this
28
-        $postValues = [
29
-            'comment_status' => 'closed',
30
-            'meta_input' => $reviewValues,
31
-            'ping_status' => 'closed',
32
-            'post_content' => $reviewValues['_content'],
33
-            'post_date' => $reviewValues['_date'],
34
-            'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
35
-            'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
-            'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
37
-            'post_title' => $reviewValues['_title'],
38
-            'post_type' => Application::POST_TYPE,
39
-        ];
40
-        $postId = wp_insert_post($postValues, true);
41
-        if (is_wp_error($postId)) {
42
-            glsr_log()->error($postId->get_error_message())->debug($postValues);
43
-            return false;
44
-        }
45
-        $this->setTerms($postId, $command->category);
46
-        $review = $this->single(get_post($postId));
47
-        do_action('site-reviews/review/created', $review, $command);
48
-        return $review;
49
-    }
19
+	/**
20
+	 * @return false|Review
21
+	 */
22
+	public function create(CreateReview $command)
23
+	{
24
+		$reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
+		$reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
+		$reviewValues = Arr::prefixArrayKeys($reviewValues);
27
+		unset($reviewValues['json']); // @todo remove the need for this
28
+		$postValues = [
29
+			'comment_status' => 'closed',
30
+			'meta_input' => $reviewValues,
31
+			'ping_status' => 'closed',
32
+			'post_content' => $reviewValues['_content'],
33
+			'post_date' => $reviewValues['_date'],
34
+			'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
35
+			'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
+			'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
37
+			'post_title' => $reviewValues['_title'],
38
+			'post_type' => Application::POST_TYPE,
39
+		];
40
+		$postId = wp_insert_post($postValues, true);
41
+		if (is_wp_error($postId)) {
42
+			glsr_log()->error($postId->get_error_message())->debug($postValues);
43
+			return false;
44
+		}
45
+		$this->setTerms($postId, $command->category);
46
+		$review = $this->single(get_post($postId));
47
+		do_action('site-reviews/review/created', $review, $command);
48
+		return $review;
49
+	}
50 50
 
51
-    /**
52
-     * @param string $metaReviewId
53
-     * @return void
54
-     */
55
-    public function delete($metaReviewId)
56
-    {
57
-        if ($postId = $this->getPostId($metaReviewId)) {
58
-            wp_delete_post($postId, true);
59
-        }
60
-    }
51
+	/**
52
+	 * @param string $metaReviewId
53
+	 * @return void
54
+	 */
55
+	public function delete($metaReviewId)
56
+	{
57
+		if ($postId = $this->getPostId($metaReviewId)) {
58
+			wp_delete_post($postId, true);
59
+		}
60
+	}
61 61
 
62
-    /**
63
-     * @return object
64
-     */
65
-    public function get(array $args = [])
66
-    {
67
-        $args = glsr(ReviewsDefaults::class)->merge($args);
68
-        $metaQuery = glsr(QueryBuilder::class)->buildQuery(
69
-            ['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70
-            $args
71
-        );
72
-        $taxQuery = glsr(QueryBuilder::class)->buildQuery(
73
-            ['category'],
74
-            ['category' => $this->normalizeTermIds($args['category'])]
75
-        );
76
-        $paged = glsr(QueryBuilder::class)->getPaged(
77
-            wp_validate_boolean($args['pagination'])
78
-        );
79
-        $parameters = [
80
-            'meta_key' => '_pinned',
81
-            'meta_query' => $metaQuery,
82
-            'offset' => $args['offset'],
83
-            'order' => $args['order'],
84
-            'orderby' => 'meta_value '.$args['orderby'],
85
-            'paged' => Arr::get($args, 'paged', $paged),
86
-            'post__in' => $args['post__in'],
87
-            'post__not_in' => $args['post__not_in'],
88
-            'post_status' => 'publish',
89
-            'post_type' => Application::POST_TYPE,
90
-            'posts_per_page' => $args['per_page'],
91
-            'tax_query' => $taxQuery,
92
-        ];
93
-        $parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
-        $query = new WP_Query($parameters);
95
-        $results = array_map([$this, 'single'], $query->posts);
96
-        $reviews = new Reviews($results, $query->max_num_pages, $args);
97
-        return apply_filters('site-reviews/get/reviews', $reviews, $query);
98
-    }
62
+	/**
63
+	 * @return object
64
+	 */
65
+	public function get(array $args = [])
66
+	{
67
+		$args = glsr(ReviewsDefaults::class)->merge($args);
68
+		$metaQuery = glsr(QueryBuilder::class)->buildQuery(
69
+			['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70
+			$args
71
+		);
72
+		$taxQuery = glsr(QueryBuilder::class)->buildQuery(
73
+			['category'],
74
+			['category' => $this->normalizeTermIds($args['category'])]
75
+		);
76
+		$paged = glsr(QueryBuilder::class)->getPaged(
77
+			wp_validate_boolean($args['pagination'])
78
+		);
79
+		$parameters = [
80
+			'meta_key' => '_pinned',
81
+			'meta_query' => $metaQuery,
82
+			'offset' => $args['offset'],
83
+			'order' => $args['order'],
84
+			'orderby' => 'meta_value '.$args['orderby'],
85
+			'paged' => Arr::get($args, 'paged', $paged),
86
+			'post__in' => $args['post__in'],
87
+			'post__not_in' => $args['post__not_in'],
88
+			'post_status' => 'publish',
89
+			'post_type' => Application::POST_TYPE,
90
+			'posts_per_page' => $args['per_page'],
91
+			'tax_query' => $taxQuery,
92
+		];
93
+		$parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
+		$query = new WP_Query($parameters);
95
+		$results = array_map([$this, 'single'], $query->posts);
96
+		$reviews = new Reviews($results, $query->max_num_pages, $args);
97
+		return apply_filters('site-reviews/get/reviews', $reviews, $query);
98
+	}
99 99
 
100
-    /**
101
-     * @param string $metaReviewId
102
-     * @return int
103
-     */
104
-    public function getPostId($metaReviewId)
105
-    {
106
-        return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
107
-    }
100
+	/**
101
+	 * @param string $metaReviewId
102
+	 * @return int
103
+	 */
104
+	public function getPostId($metaReviewId)
105
+	{
106
+		return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
107
+	}
108 108
 
109
-    /**
110
-     * @return array
111
-     */
112
-    public function getRatingCounts(array $args = [])
113
-    {
114
-        $args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
-        $counts = glsr(CountsManager::class)->getCounts([
116
-            'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
-            'term_ids' => $this->normalizeTermIds($args['category']),
118
-            'type' => $args['type'],
119
-        ]);
120
-        return glsr(CountsManager::class)->flatten($counts, [
121
-            'min' => $args['rating'],
122
-        ]);
123
-    }
109
+	/**
110
+	 * @return array
111
+	 */
112
+	public function getRatingCounts(array $args = [])
113
+	{
114
+		$args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
+		$counts = glsr(CountsManager::class)->getCounts([
116
+			'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
+			'term_ids' => $this->normalizeTermIds($args['category']),
118
+			'type' => $args['type'],
119
+		]);
120
+		return glsr(CountsManager::class)->flatten($counts, [
121
+			'min' => $args['rating'],
122
+		]);
123
+	}
124 124
 
125
-    /**
126
-     * @param string $commaSeparatedTermIds
127
-     * @return array
128
-     */
129
-    public function normalizeTermIds($commaSeparatedTermIds)
130
-    {
131
-        $termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
-        return array_unique(array_map('intval', $termIds));
133
-    }
125
+	/**
126
+	 * @param string $commaSeparatedTermIds
127
+	 * @return array
128
+	 */
129
+	public function normalizeTermIds($commaSeparatedTermIds)
130
+	{
131
+		$termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
+		return array_unique(array_map('intval', $termIds));
133
+	}
134 134
 
135
-    /**
136
-     * @param string $commaSeparatedTermIds
137
-     * @return array
138
-     */
139
-    public function normalizeTerms($commaSeparatedTermIds)
140
-    {
141
-        $terms = [];
142
-        $termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
-        foreach ($termIds as $termId) {
144
-            if (is_numeric($termId)) {
145
-                $termId = intval($termId);
146
-            }
147
-            $term = term_exists($termId, Application::TAXONOMY);
148
-            if (!isset($term['term_id'])) {
149
-                continue;
150
-            }
151
-            $terms[] = $term;
152
-        }
153
-        return $terms;
154
-    }
135
+	/**
136
+	 * @param string $commaSeparatedTermIds
137
+	 * @return array
138
+	 */
139
+	public function normalizeTerms($commaSeparatedTermIds)
140
+	{
141
+		$terms = [];
142
+		$termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
+		foreach ($termIds as $termId) {
144
+			if (is_numeric($termId)) {
145
+				$termId = intval($termId);
146
+			}
147
+			$term = term_exists($termId, Application::TAXONOMY);
148
+			if (!isset($term['term_id'])) {
149
+				continue;
150
+			}
151
+			$terms[] = $term;
152
+		}
153
+		return $terms;
154
+	}
155 155
 
156
-    /**
157
-     * @param int $postId
158
-     * @return void
159
-     */
160
-    public function revert($postId)
161
-    {
162
-        if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
163
-            return;
164
-        }
165
-        delete_post_meta($postId, '_edit_last');
166
-        $result = wp_update_post([
167
-            'ID' => $postId,
168
-            'post_content' => glsr(Database::class)->get($postId, 'content'),
169
-            'post_date' => glsr(Database::class)->get($postId, 'date'),
170
-            'post_title' => glsr(Database::class)->get($postId, 'title'),
171
-        ]);
172
-        if (is_wp_error($result)) {
173
-            glsr_log()->error($result->get_error_message());
174
-            return;
175
-        }
176
-        do_action('site-reviews/review/reverted', glsr_get_review($postId));
177
-    }
156
+	/**
157
+	 * @param int $postId
158
+	 * @return void
159
+	 */
160
+	public function revert($postId)
161
+	{
162
+		if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
163
+			return;
164
+		}
165
+		delete_post_meta($postId, '_edit_last');
166
+		$result = wp_update_post([
167
+			'ID' => $postId,
168
+			'post_content' => glsr(Database::class)->get($postId, 'content'),
169
+			'post_date' => glsr(Database::class)->get($postId, 'date'),
170
+			'post_title' => glsr(Database::class)->get($postId, 'title'),
171
+		]);
172
+		if (is_wp_error($result)) {
173
+			glsr_log()->error($result->get_error_message());
174
+			return;
175
+		}
176
+		do_action('site-reviews/review/reverted', glsr_get_review($postId));
177
+	}
178 178
 
179
-    /**
180
-     * @return Review
181
-     */
182
-    public function single(WP_Post $post)
183
-    {
184
-        if (Application::POST_TYPE != $post->post_type) {
185
-            $post = new WP_Post((object) []);
186
-        }
187
-        $review = new Review($post);
188
-        return apply_filters('site-reviews/get/review', $review, $post);
189
-    }
179
+	/**
180
+	 * @return Review
181
+	 */
182
+	public function single(WP_Post $post)
183
+	{
184
+		if (Application::POST_TYPE != $post->post_type) {
185
+			$post = new WP_Post((object) []);
186
+		}
187
+		$review = new Review($post);
188
+		return apply_filters('site-reviews/get/review', $review, $post);
189
+	}
190 190
 
191
-    /**
192
-     * @param bool $isBlacklisted
193
-     * @return string
194
-     */
195
-    protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
196
-    {
197
-        $requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
198
-        return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199
-            ? 'pending'
200
-            : 'publish';
201
-    }
191
+	/**
192
+	 * @param bool $isBlacklisted
193
+	 * @return string
194
+	 */
195
+	protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
196
+	{
197
+		$requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
198
+		return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199
+			? 'pending'
200
+			: 'publish';
201
+	}
202 202
 
203
-    /**
204
-     * @param int $postId
205
-     * @param string $termIds
206
-     * @return void
207
-     */
208
-    protected function setTerms($postId, $termIds)
209
-    {
210
-        $termIds = $this->normalizeTermIds($termIds);
211
-        if (empty($termIds)) {
212
-            return;
213
-        }
214
-        $termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
-        if (is_wp_error($termTaxonomyIds)) {
216
-            glsr_log()->error($termTaxonomyIds->get_error_message());
217
-        }
218
-    }
203
+	/**
204
+	 * @param int $postId
205
+	 * @param string $termIds
206
+	 * @return void
207
+	 */
208
+	protected function setTerms($postId, $termIds)
209
+	{
210
+		$termIds = $this->normalizeTermIds($termIds);
211
+		if (empty($termIds)) {
212
+			return;
213
+		}
214
+		$termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
+		if (is_wp_error($termTaxonomyIds)) {
216
+			glsr_log()->error($termTaxonomyIds->get_error_message());
217
+		}
218
+	}
219 219
 }
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @return false|Review
21 21
      */
22
-    public function create(CreateReview $command)
22
+    public function create( CreateReview $command )
23 23
     {
24
-        $reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
-        $reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
-        $reviewValues = Arr::prefixArrayKeys($reviewValues);
24
+        $reviewValues = glsr( CreateReviewDefaults::class )->restrict( (array)$command );
25
+        $reviewValues = apply_filters( 'site-reviews/create/review-values', $reviewValues, $command );
26
+        $reviewValues = Arr::prefixArrayKeys( $reviewValues );
27 27
         unset($reviewValues['json']); // @todo remove the need for this
28 28
         $postValues = [
29 29
             'comment_status' => 'closed',
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
             'ping_status' => 'closed',
32 32
             'post_content' => $reviewValues['_content'],
33 33
             'post_date' => $reviewValues['_date'],
34
-            'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
34
+            'post_date_gmt' => get_gmt_from_date( $reviewValues['_date'] ),
35 35
             'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
-            'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
36
+            'post_status' => $this->getNewPostStatus( $reviewValues, $command->blacklisted ),
37 37
             'post_title' => $reviewValues['_title'],
38 38
             'post_type' => Application::POST_TYPE,
39 39
         ];
40
-        $postId = wp_insert_post($postValues, true);
41
-        if (is_wp_error($postId)) {
42
-            glsr_log()->error($postId->get_error_message())->debug($postValues);
40
+        $postId = wp_insert_post( $postValues, true );
41
+        if( is_wp_error( $postId ) ) {
42
+            glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
43 43
             return false;
44 44
         }
45
-        $this->setTerms($postId, $command->category);
46
-        $review = $this->single(get_post($postId));
47
-        do_action('site-reviews/review/created', $review, $command);
45
+        $this->setTerms( $postId, $command->category );
46
+        $review = $this->single( get_post( $postId ) );
47
+        do_action( 'site-reviews/review/created', $review, $command );
48 48
         return $review;
49 49
     }
50 50
 
@@ -52,29 +52,29 @@  discard block
 block discarded – undo
52 52
      * @param string $metaReviewId
53 53
      * @return void
54 54
      */
55
-    public function delete($metaReviewId)
55
+    public function delete( $metaReviewId )
56 56
     {
57
-        if ($postId = $this->getPostId($metaReviewId)) {
58
-            wp_delete_post($postId, true);
57
+        if( $postId = $this->getPostId( $metaReviewId ) ) {
58
+            wp_delete_post( $postId, true );
59 59
         }
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return object
64 64
      */
65
-    public function get(array $args = [])
65
+    public function get( array $args = [] )
66 66
     {
67
-        $args = glsr(ReviewsDefaults::class)->merge($args);
68
-        $metaQuery = glsr(QueryBuilder::class)->buildQuery(
67
+        $args = glsr( ReviewsDefaults::class )->merge( $args );
68
+        $metaQuery = glsr( QueryBuilder::class )->buildQuery(
69 69
             ['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70 70
             $args
71 71
         );
72
-        $taxQuery = glsr(QueryBuilder::class)->buildQuery(
72
+        $taxQuery = glsr( QueryBuilder::class )->buildQuery(
73 73
             ['category'],
74
-            ['category' => $this->normalizeTermIds($args['category'])]
74
+            ['category' => $this->normalizeTermIds( $args['category'] )]
75 75
         );
76
-        $paged = glsr(QueryBuilder::class)->getPaged(
77
-            wp_validate_boolean($args['pagination'])
76
+        $paged = glsr( QueryBuilder::class )->getPaged(
77
+            wp_validate_boolean( $args['pagination'] )
78 78
         );
79 79
         $parameters = [
80 80
             'meta_key' => '_pinned',
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'offset' => $args['offset'],
83 83
             'order' => $args['order'],
84 84
             'orderby' => 'meta_value '.$args['orderby'],
85
-            'paged' => Arr::get($args, 'paged', $paged),
85
+            'paged' => Arr::get( $args, 'paged', $paged ),
86 86
             'post__in' => $args['post__in'],
87 87
             'post__not_in' => $args['post__not_in'],
88 88
             'post_status' => 'publish',
@@ -90,62 +90,62 @@  discard block
 block discarded – undo
90 90
             'posts_per_page' => $args['per_page'],
91 91
             'tax_query' => $taxQuery,
92 92
         ];
93
-        $parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
-        $query = new WP_Query($parameters);
95
-        $results = array_map([$this, 'single'], $query->posts);
96
-        $reviews = new Reviews($results, $query->max_num_pages, $args);
97
-        return apply_filters('site-reviews/get/reviews', $reviews, $query);
93
+        $parameters = apply_filters( 'site-reviews/get/reviews/query', $parameters, $args );
94
+        $query = new WP_Query( $parameters );
95
+        $results = array_map( [$this, 'single'], $query->posts );
96
+        $reviews = new Reviews( $results, $query->max_num_pages, $args );
97
+        return apply_filters( 'site-reviews/get/reviews', $reviews, $query );
98 98
     }
99 99
 
100 100
     /**
101 101
      * @param string $metaReviewId
102 102
      * @return int
103 103
      */
104
-    public function getPostId($metaReviewId)
104
+    public function getPostId( $metaReviewId )
105 105
     {
106
-        return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
106
+        return glsr( SqlQueries::class )->getPostIdFromReviewId( $metaReviewId );
107 107
     }
108 108
 
109 109
     /**
110 110
      * @return array
111 111
      */
112
-    public function getRatingCounts(array $args = [])
112
+    public function getRatingCounts( array $args = [] )
113 113
     {
114
-        $args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
-        $counts = glsr(CountsManager::class)->getCounts([
116
-            'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
-            'term_ids' => $this->normalizeTermIds($args['category']),
114
+        $args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args );
115
+        $counts = glsr( CountsManager::class )->getCounts( [
116
+            'post_ids' => Arr::convertStringToArray( $args['assigned_to'] ),
117
+            'term_ids' => $this->normalizeTermIds( $args['category'] ),
118 118
             'type' => $args['type'],
119
-        ]);
120
-        return glsr(CountsManager::class)->flatten($counts, [
119
+        ] );
120
+        return glsr( CountsManager::class )->flatten( $counts, [
121 121
             'min' => $args['rating'],
122
-        ]);
122
+        ] );
123 123
     }
124 124
 
125 125
     /**
126 126
      * @param string $commaSeparatedTermIds
127 127
      * @return array
128 128
      */
129
-    public function normalizeTermIds($commaSeparatedTermIds)
129
+    public function normalizeTermIds( $commaSeparatedTermIds )
130 130
     {
131
-        $termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
-        return array_unique(array_map('intval', $termIds));
131
+        $termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' );
132
+        return array_unique( array_map( 'intval', $termIds ) );
133 133
     }
134 134
 
135 135
     /**
136 136
      * @param string $commaSeparatedTermIds
137 137
      * @return array
138 138
      */
139
-    public function normalizeTerms($commaSeparatedTermIds)
139
+    public function normalizeTerms( $commaSeparatedTermIds )
140 140
     {
141 141
         $terms = [];
142
-        $termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
-        foreach ($termIds as $termId) {
144
-            if (is_numeric($termId)) {
145
-                $termId = intval($termId);
142
+        $termIds = Arr::convertStringToArray( $commaSeparatedTermIds );
143
+        foreach( $termIds as $termId ) {
144
+            if( is_numeric( $termId ) ) {
145
+                $termId = intval( $termId );
146 146
             }
147
-            $term = term_exists($termId, Application::TAXONOMY);
148
-            if (!isset($term['term_id'])) {
147
+            $term = term_exists( $termId, Application::TAXONOMY );
148
+            if( !isset($term['term_id']) ) {
149 149
                 continue;
150 150
             }
151 151
             $terms[] = $term;
@@ -157,44 +157,44 @@  discard block
 block discarded – undo
157 157
      * @param int $postId
158 158
      * @return void
159 159
      */
160
-    public function revert($postId)
160
+    public function revert( $postId )
161 161
     {
162
-        if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
162
+        if( Application::POST_TYPE != get_post_field( 'post_type', $postId ) ) {
163 163
             return;
164 164
         }
165
-        delete_post_meta($postId, '_edit_last');
166
-        $result = wp_update_post([
165
+        delete_post_meta( $postId, '_edit_last' );
166
+        $result = wp_update_post( [
167 167
             'ID' => $postId,
168
-            'post_content' => glsr(Database::class)->get($postId, 'content'),
169
-            'post_date' => glsr(Database::class)->get($postId, 'date'),
170
-            'post_title' => glsr(Database::class)->get($postId, 'title'),
171
-        ]);
172
-        if (is_wp_error($result)) {
173
-            glsr_log()->error($result->get_error_message());
168
+            'post_content' => glsr( Database::class )->get( $postId, 'content' ),
169
+            'post_date' => glsr( Database::class )->get( $postId, 'date' ),
170
+            'post_title' => glsr( Database::class )->get( $postId, 'title' ),
171
+        ] );
172
+        if( is_wp_error( $result ) ) {
173
+            glsr_log()->error( $result->get_error_message() );
174 174
             return;
175 175
         }
176
-        do_action('site-reviews/review/reverted', glsr_get_review($postId));
176
+        do_action( 'site-reviews/review/reverted', glsr_get_review( $postId ) );
177 177
     }
178 178
 
179 179
     /**
180 180
      * @return Review
181 181
      */
182
-    public function single(WP_Post $post)
182
+    public function single( WP_Post $post )
183 183
     {
184
-        if (Application::POST_TYPE != $post->post_type) {
185
-            $post = new WP_Post((object) []);
184
+        if( Application::POST_TYPE != $post->post_type ) {
185
+            $post = new WP_Post( (object)[] );
186 186
         }
187
-        $review = new Review($post);
188
-        return apply_filters('site-reviews/get/review', $review, $post);
187
+        $review = new Review( $post );
188
+        return apply_filters( 'site-reviews/get/review', $review, $post );
189 189
     }
190 190
 
191 191
     /**
192 192
      * @param bool $isBlacklisted
193 193
      * @return string
194 194
      */
195
-    protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
195
+    protected function getNewPostStatus( array $reviewValues, $isBlacklisted )
196 196
     {
197
-        $requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
197
+        $requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' );
198 198
         return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199 199
             ? 'pending'
200 200
             : 'publish';
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
      * @param string $termIds
206 206
      * @return void
207 207
      */
208
-    protected function setTerms($postId, $termIds)
208
+    protected function setTerms( $postId, $termIds )
209 209
     {
210
-        $termIds = $this->normalizeTermIds($termIds);
211
-        if (empty($termIds)) {
210
+        $termIds = $this->normalizeTermIds( $termIds );
211
+        if( empty($termIds) ) {
212 212
             return;
213 213
         }
214
-        $termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
-        if (is_wp_error($termTaxonomyIds)) {
216
-            glsr_log()->error($termTaxonomyIds->get_error_message());
214
+        $termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
215
+        if( is_wp_error( $termTaxonomyIds ) ) {
216
+            glsr_log()->error( $termTaxonomyIds->get_error_message() );
217 217
         }
218 218
     }
219 219
 }
Please login to merge, or discard this patch.
plugin/Database/GlobalCountsManager.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@
 block discarded – undo
7 7
 
8 8
 class GlobalCountsManager
9 9
 {
10
-    /**
11
-     * @var CountsManager
12
-     */
13
-    protected $manager;
10
+	/**
11
+	 * @var CountsManager
12
+	 */
13
+	protected $manager;
14 14
 
15
-    public function __construct()
16
-    {
17
-        $this->manager = glsr(CountsManager::class);
18
-    }
15
+	public function __construct()
16
+	{
17
+		$this->manager = glsr(CountsManager::class);
18
+	}
19 19
 
20
-    /**
21
-     * @return array
22
-     */
23
-    public function build()
24
-    {
25
-        return $this->manager->buildCounts();
26
-    }
20
+	/**
21
+	 * @return array
22
+	 */
23
+	public function build()
24
+	{
25
+		return $this->manager->buildCounts();
26
+	}
27 27
 
28
-    /**
29
-     * @return void
30
-     */
31
-    public function decrease(Review $review)
32
-    {
33
-        $this->update($this->manager->decreaseRating(
34
-            $this->get(),
35
-            $review->review_type,
36
-            $review->rating
37
-        ));
38
-    }
28
+	/**
29
+	 * @return void
30
+	 */
31
+	public function decrease(Review $review)
32
+	{
33
+		$this->update($this->manager->decreaseRating(
34
+			$this->get(),
35
+			$review->review_type,
36
+			$review->rating
37
+		));
38
+	}
39 39
 
40
-    /**
41
-     * @return array
42
-     */
43
-    public function get()
44
-    {
45
-        $counts = glsr(OptionManager::class)->get('counts', []);
46
-        if (!is_array($counts)) {
47
-            glsr_log()->error('Review counts is not an array; possibly due to incorrectly imported reviews.')->debug($counts);
48
-            return [];
49
-        }
50
-        return $counts;
51
-    }
40
+	/**
41
+	 * @return array
42
+	 */
43
+	public function get()
44
+	{
45
+		$counts = glsr(OptionManager::class)->get('counts', []);
46
+		if (!is_array($counts)) {
47
+			glsr_log()->error('Review counts is not an array; possibly due to incorrectly imported reviews.')->debug($counts);
48
+			return [];
49
+		}
50
+		return $counts;
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function increase(Review $review)
57
-    {
58
-        if (empty($counts = $this->get())) {
59
-            $counts = $this->build();
60
-        }
61
-        $this->update($this->manager->increaseRating($counts, $review->review_type, $review->rating));
62
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function increase(Review $review)
57
+	{
58
+		if (empty($counts = $this->get())) {
59
+			$counts = $this->build();
60
+		}
61
+		$this->update($this->manager->increaseRating($counts, $review->review_type, $review->rating));
62
+	}
63 63
 
64
-    /**
65
-     * @return void
66
-     */
67
-    public function update(array $reviewCounts)
68
-    {
69
-        glsr(OptionManager::class)->set('counts', $reviewCounts);
70
-    }
64
+	/**
65
+	 * @return void
66
+	 */
67
+	public function update(array $reviewCounts)
68
+	{
69
+		glsr(OptionManager::class)->set('counts', $reviewCounts);
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     */
75
-    public function updateAll()
76
-    {
77
-        $this->update($this->build());
78
-    }
72
+	/**
73
+	 * @return void
74
+	 */
75
+	public function updateAll()
76
+	{
77
+		$this->update($this->build());
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct()
16 16
     {
17
-        $this->manager = glsr(CountsManager::class);
17
+        $this->manager = glsr( CountsManager::class );
18 18
     }
19 19
 
20 20
     /**
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
     /**
29 29
      * @return void
30 30
      */
31
-    public function decrease(Review $review)
31
+    public function decrease( Review $review )
32 32
     {
33
-        $this->update($this->manager->decreaseRating(
33
+        $this->update( $this->manager->decreaseRating(
34 34
             $this->get(),
35 35
             $review->review_type,
36 36
             $review->rating
37
-        ));
37
+        ) );
38 38
     }
39 39
 
40 40
     /**
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function get()
44 44
     {
45
-        $counts = glsr(OptionManager::class)->get('counts', []);
46
-        if (!is_array($counts)) {
47
-            glsr_log()->error('Review counts is not an array; possibly due to incorrectly imported reviews.')->debug($counts);
45
+        $counts = glsr( OptionManager::class )->get( 'counts', [] );
46
+        if( !is_array( $counts ) ) {
47
+            glsr_log()->error( 'Review counts is not an array; possibly due to incorrectly imported reviews.' )->debug( $counts );
48 48
             return [];
49 49
         }
50 50
         return $counts;
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
     /**
54 54
      * @return void
55 55
      */
56
-    public function increase(Review $review)
56
+    public function increase( Review $review )
57 57
     {
58
-        if (empty($counts = $this->get())) {
58
+        if( empty($counts = $this->get()) ) {
59 59
             $counts = $this->build();
60 60
         }
61
-        $this->update($this->manager->increaseRating($counts, $review->review_type, $review->rating));
61
+        $this->update( $this->manager->increaseRating( $counts, $review->review_type, $review->rating ) );
62 62
     }
63 63
 
64 64
     /**
65 65
      * @return void
66 66
      */
67
-    public function update(array $reviewCounts)
67
+    public function update( array $reviewCounts )
68 68
     {
69
-        glsr(OptionManager::class)->set('counts', $reviewCounts);
69
+        glsr( OptionManager::class )->set( 'counts', $reviewCounts );
70 70
     }
71 71
 
72 72
     /**
@@ -74,6 +74,6 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function updateAll()
76 76
     {
77
-        $this->update($this->build());
77
+        $this->update( $this->build() );
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
plugin/Modules/System.php 2 patches
Indentation   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -12,377 +12,377 @@
 block discarded – undo
12 12
 
13 13
 class System
14 14
 {
15
-    const PAD = 40;
15
+	const PAD = 40;
16 16
 
17
-    /**
18
-     * @return string
19
-     */
20
-    public function __toString()
21
-    {
22
-        return $this->get();
23
-    }
17
+	/**
18
+	 * @return string
19
+	 */
20
+	public function __toString()
21
+	{
22
+		return $this->get();
23
+	}
24 24
 
25
-    /**
26
-     * @return string
27
-     */
28
-    public function get()
29
-    {
30
-        $details = [
31
-            'plugin' => 'Plugin Details',
32
-            'addon' => 'Addon Details',
33
-            'browser' => 'Browser Details',
34
-            'server' => 'Server Details',
35
-            'php' => 'PHP Configuration',
36
-            'wordpress' => 'WordPress Configuration',
37
-            'mu-plugin' => 'Must-Use Plugins',
38
-            'multisite-plugin' => 'Network Active Plugins',
39
-            'active-plugin' => 'Active Plugins',
40
-            'inactive-plugin' => 'Inactive Plugins',
41
-            'setting' => 'Plugin Settings',
42
-            'reviews' => 'Review Counts',
43
-        ];
44
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
45
-            $methodName = Helper::buildMethodName('get-'.$key.'-details');
46
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
47
-                return $carry.$this->implode(
48
-                    strtoupper($details[$key]),
49
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
50
-                );
51
-            }
52
-            return $carry;
53
-        });
54
-        return trim($systemInfo);
55
-    }
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function get()
29
+	{
30
+		$details = [
31
+			'plugin' => 'Plugin Details',
32
+			'addon' => 'Addon Details',
33
+			'browser' => 'Browser Details',
34
+			'server' => 'Server Details',
35
+			'php' => 'PHP Configuration',
36
+			'wordpress' => 'WordPress Configuration',
37
+			'mu-plugin' => 'Must-Use Plugins',
38
+			'multisite-plugin' => 'Network Active Plugins',
39
+			'active-plugin' => 'Active Plugins',
40
+			'inactive-plugin' => 'Inactive Plugins',
41
+			'setting' => 'Plugin Settings',
42
+			'reviews' => 'Review Counts',
43
+		];
44
+		$systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
45
+			$methodName = Helper::buildMethodName('get-'.$key.'-details');
46
+			if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
47
+				return $carry.$this->implode(
48
+					strtoupper($details[$key]),
49
+					apply_filters('site-reviews/system/'.$key, $systemDetails)
50
+				);
51
+			}
52
+			return $carry;
53
+		});
54
+		return trim($systemInfo);
55
+	}
56 56
 
57
-    /**
58
-     * @return array
59
-     */
60
-    public function getActivePluginDetails()
61
-    {
62
-        $plugins = get_plugins();
63
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
64
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
65
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
66
-    }
57
+	/**
58
+	 * @return array
59
+	 */
60
+	public function getActivePluginDetails()
61
+	{
62
+		$plugins = get_plugins();
63
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
64
+		$inactive = array_diff_key($plugins, array_flip($activePlugins));
65
+		return $this->normalizePluginList(array_diff_key($plugins, $inactive));
66
+	}
67 67
 
68
-    /**
69
-     * @return array
70
-     */
71
-    public function getAddonDetails()
72
-    {
73
-        $details = apply_filters('site-reviews/addon/system-info', []);
74
-        ksort($details);
75
-        return $details;
76
-    }
68
+	/**
69
+	 * @return array
70
+	 */
71
+	public function getAddonDetails()
72
+	{
73
+		$details = apply_filters('site-reviews/addon/system-info', []);
74
+		ksort($details);
75
+		return $details;
76
+	}
77 77
 
78
-    /**
79
-     * @return array
80
-     */
81
-    public function getBrowserDetails()
82
-    {
83
-        $browser = new Browser();
84
-        $name = esc_attr($browser->getName());
85
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
86
-        $version = esc_attr($browser->getVersion());
87
-        return [
88
-            'Browser Name' => sprintf('%s %s', $name, $version),
89
-            'Browser UA' => $userAgent,
90
-        ];
91
-    }
78
+	/**
79
+	 * @return array
80
+	 */
81
+	public function getBrowserDetails()
82
+	{
83
+		$browser = new Browser();
84
+		$name = esc_attr($browser->getName());
85
+		$userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
86
+		$version = esc_attr($browser->getVersion());
87
+		return [
88
+			'Browser Name' => sprintf('%s %s', $name, $version),
89
+			'Browser UA' => $userAgent,
90
+		];
91
+	}
92 92
 
93
-    /**
94
-     * @return array
95
-     */
96
-    public function getInactivePluginDetails()
97
-    {
98
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
99
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
100
-        $multisitePlugins = $this->getMultisitePluginDetails();
101
-        return empty($multisitePlugins)
102
-            ? $inactivePlugins
103
-            : array_diff($inactivePlugins, $multisitePlugins);
104
-    }
93
+	/**
94
+	 * @return array
95
+	 */
96
+	public function getInactivePluginDetails()
97
+	{
98
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
99
+		$inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
100
+		$multisitePlugins = $this->getMultisitePluginDetails();
101
+		return empty($multisitePlugins)
102
+			? $inactivePlugins
103
+			: array_diff($inactivePlugins, $multisitePlugins);
104
+	}
105 105
 
106
-    /**
107
-     * @return array
108
-     */
109
-    public function getMuPluginDetails()
110
-    {
111
-        if (empty($plugins = get_mu_plugins())) {
112
-            return [];
113
-        }
114
-        return $this->normalizePluginList($plugins);
115
-    }
106
+	/**
107
+	 * @return array
108
+	 */
109
+	public function getMuPluginDetails()
110
+	{
111
+		if (empty($plugins = get_mu_plugins())) {
112
+			return [];
113
+		}
114
+		return $this->normalizePluginList($plugins);
115
+	}
116 116
 
117
-    /**
118
-     * @return array
119
-     */
120
-    public function getMultisitePluginDetails()
121
-    {
122
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
123
-        if (!is_multisite() || empty($activePlugins)) {
124
-            return [];
125
-        }
126
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
127
-    }
117
+	/**
118
+	 * @return array
119
+	 */
120
+	public function getMultisitePluginDetails()
121
+	{
122
+		$activePlugins = (array) get_site_option('active_sitewide_plugins', []);
123
+		if (!is_multisite() || empty($activePlugins)) {
124
+			return [];
125
+		}
126
+		return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
127
+	}
128 128
 
129
-    /**
130
-     * @return array
131
-     */
132
-    public function getPhpDetails()
133
-    {
134
-        $displayErrors = $this->getINI('display_errors', null)
135
-            ? 'On ('.$this->getINI('display_errors').')'
136
-            : 'N/A';
137
-        $intlSupport = extension_loaded('intl')
138
-            ? phpversion('intl')
139
-            : 'false';
140
-        return [
141
-            'cURL' => var_export(function_exists('curl_init'), true),
142
-            'Default Charset' => $this->getINI('default_charset'),
143
-            'Display Errors' => $displayErrors,
144
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
145
-            'Intl' => $intlSupport,
146
-            'IPv6' => var_export(defined('AF_INET6'), true),
147
-            'Max Execution Time' => $this->getINI('max_execution_time'),
148
-            'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
149
-            'Max Input Vars' => $this->getINI('max_input_vars'),
150
-            'Memory Limit' => $this->getINI('memory_limit'),
151
-            'Post Max Size' => $this->getINI('post_max_size'),
152
-            'Sendmail Path' => $this->getINI('sendmail_path'),
153
-            'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
154
-            'Session Name' => esc_html($this->getINI('session.name')),
155
-            'Session Save Path' => esc_html($this->getINI('session.save_path')),
156
-            'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
157
-            'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
158
-            'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
159
-        ];
160
-    }
129
+	/**
130
+	 * @return array
131
+	 */
132
+	public function getPhpDetails()
133
+	{
134
+		$displayErrors = $this->getINI('display_errors', null)
135
+			? 'On ('.$this->getINI('display_errors').')'
136
+			: 'N/A';
137
+		$intlSupport = extension_loaded('intl')
138
+			? phpversion('intl')
139
+			: 'false';
140
+		return [
141
+			'cURL' => var_export(function_exists('curl_init'), true),
142
+			'Default Charset' => $this->getINI('default_charset'),
143
+			'Display Errors' => $displayErrors,
144
+			'fsockopen' => var_export(function_exists('fsockopen'), true),
145
+			'Intl' => $intlSupport,
146
+			'IPv6' => var_export(defined('AF_INET6'), true),
147
+			'Max Execution Time' => $this->getINI('max_execution_time'),
148
+			'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
149
+			'Max Input Vars' => $this->getINI('max_input_vars'),
150
+			'Memory Limit' => $this->getINI('memory_limit'),
151
+			'Post Max Size' => $this->getINI('post_max_size'),
152
+			'Sendmail Path' => $this->getINI('sendmail_path'),
153
+			'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
154
+			'Session Name' => esc_html($this->getINI('session.name')),
155
+			'Session Save Path' => esc_html($this->getINI('session.save_path')),
156
+			'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
157
+			'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
158
+			'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
159
+		];
160
+	}
161 161
 
162
-    /**
163
-     * @return array
164
-     */
165
-    public function getReviewsDetails()
166
-    {
167
-        $counts = glsr(CountsManager::class)->getCounts();
168
-        $counts = Arr::flattenArray($counts);
169
-        array_walk($counts, function (&$ratings) use ($counts) {
170
-            if (is_array($ratings)) {
171
-                $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
172
-                return;
173
-            }
174
-            glsr_log()
175
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
176
-                ->debug($ratings)
177
-                ->debug($counts);
178
-        });
179
-        ksort($counts);
180
-        return $counts;
181
-    }
162
+	/**
163
+	 * @return array
164
+	 */
165
+	public function getReviewsDetails()
166
+	{
167
+		$counts = glsr(CountsManager::class)->getCounts();
168
+		$counts = Arr::flattenArray($counts);
169
+		array_walk($counts, function (&$ratings) use ($counts) {
170
+			if (is_array($ratings)) {
171
+				$ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
172
+				return;
173
+			}
174
+			glsr_log()
175
+				->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
176
+				->debug($ratings)
177
+				->debug($counts);
178
+		});
179
+		ksort($counts);
180
+		return $counts;
181
+	}
182 182
 
183
-    /**
184
-     * @return array
185
-     */
186
-    public function getServerDetails()
187
-    {
188
-        global $wpdb;
189
-        return [
190
-            'Host Name' => $this->getHostName(),
191
-            'MySQL Version' => $wpdb->db_version(),
192
-            'PHP Version' => PHP_VERSION,
193
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
194
-        ];
195
-    }
183
+	/**
184
+	 * @return array
185
+	 */
186
+	public function getServerDetails()
187
+	{
188
+		global $wpdb;
189
+		return [
190
+			'Host Name' => $this->getHostName(),
191
+			'MySQL Version' => $wpdb->db_version(),
192
+			'PHP Version' => PHP_VERSION,
193
+			'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
194
+		];
195
+	}
196 196
 
197
-    /**
198
-     * @return array
199
-     */
200
-    public function getSettingDetails()
201
-    {
202
-        $settings = glsr(OptionManager::class)->get('settings', []);
203
-        $settings = Arr::flattenArray($settings, true);
204
-        $settings = $this->purgeSensitiveData($settings);
205
-        ksort($settings);
206
-        $details = [];
207
-        foreach ($settings as $key => $value) {
208
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
209
-                continue;
210
-            }
211
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
212
-            $details[$key] = $value;
213
-        }
214
-        return $details;
215
-    }
197
+	/**
198
+	 * @return array
199
+	 */
200
+	public function getSettingDetails()
201
+	{
202
+		$settings = glsr(OptionManager::class)->get('settings', []);
203
+		$settings = Arr::flattenArray($settings, true);
204
+		$settings = $this->purgeSensitiveData($settings);
205
+		ksort($settings);
206
+		$details = [];
207
+		foreach ($settings as $key => $value) {
208
+			if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
209
+				continue;
210
+			}
211
+			$value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
212
+			$details[$key] = $value;
213
+		}
214
+		return $details;
215
+	}
216 216
 
217
-    /**
218
-     * @return array
219
-     */
220
-    public function getPluginDetails()
221
-    {
222
-        return [
223
-            'Console level' => glsr(Console::class)->humanLevel(),
224
-            'Console size' => glsr(Console::class)->humanSize('0'),
225
-            'Last Rating Count' => date_i18n('Y-m-d H:i', glsr(OptionManager::class)->get('last_review_count')),
226
-            'Version (current)' => glsr()->version,
227
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
228
-        ];
229
-    }
217
+	/**
218
+	 * @return array
219
+	 */
220
+	public function getPluginDetails()
221
+	{
222
+		return [
223
+			'Console level' => glsr(Console::class)->humanLevel(),
224
+			'Console size' => glsr(Console::class)->humanSize('0'),
225
+			'Last Rating Count' => date_i18n('Y-m-d H:i', glsr(OptionManager::class)->get('last_review_count')),
226
+			'Version (current)' => glsr()->version,
227
+			'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
228
+		];
229
+	}
230 230
 
231
-    /**
232
-     * @return array
233
-     */
234
-    public function getWordpressDetails()
235
-    {
236
-        global $wpdb;
237
-        $theme = wp_get_theme();
238
-        return [
239
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
240
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
241
-            'Home URL' => home_url(),
242
-            'Language' => get_locale(),
243
-            'Memory Limit' => WP_MEMORY_LIMIT,
244
-            'Multisite' => var_export(is_multisite(), true),
245
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
246
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
247
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
248
-            'Post Stati' => implode(', ', get_post_stati()),
249
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
250
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
251
-            'Site URL' => site_url(),
252
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
253
-            'Version' => get_bloginfo('version'),
254
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
255
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
256
-            'WP Memory Limit' => WP_MEMORY_LIMIT,
257
-        ];
258
-    }
231
+	/**
232
+	 * @return array
233
+	 */
234
+	public function getWordpressDetails()
235
+	{
236
+		global $wpdb;
237
+		$theme = wp_get_theme();
238
+		return [
239
+			'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
240
+			'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
241
+			'Home URL' => home_url(),
242
+			'Language' => get_locale(),
243
+			'Memory Limit' => WP_MEMORY_LIMIT,
244
+			'Multisite' => var_export(is_multisite(), true),
245
+			'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
246
+			'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
247
+			'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
248
+			'Post Stati' => implode(', ', get_post_stati()),
249
+			'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
250
+			'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
251
+			'Site URL' => site_url(),
252
+			'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
253
+			'Version' => get_bloginfo('version'),
254
+			'WP Debug' => var_export(defined('WP_DEBUG'), true),
255
+			'WP Max Upload Size' => size_format(wp_max_upload_size()),
256
+			'WP Memory Limit' => WP_MEMORY_LIMIT,
257
+		];
258
+	}
259 259
 
260
-    /**
261
-     * @return string
262
-     */
263
-    protected function detectWebhostProvider()
264
-    {
265
-        $checks = [
266
-            '.accountservergroup.com' => 'Site5',
267
-            '.gridserver.com' => 'MediaTemple Grid',
268
-            '.inmotionhosting.com' => 'InMotion Hosting',
269
-            '.ovh.net' => 'OVH',
270
-            '.pair.com' => 'pair Networks',
271
-            '.stabletransit.com' => 'Rackspace Cloud',
272
-            '.stratoserver.net' => 'STRATO',
273
-            '.sysfix.eu' => 'SysFix.eu Power Hosting',
274
-            'bluehost.com' => 'Bluehost',
275
-            'DH_USER' => 'DreamHost',
276
-            'Flywheel' => 'Flywheel',
277
-            'ipagemysql.com' => 'iPage',
278
-            'ipowermysql.com' => 'IPower',
279
-            'localhost:/tmp/mysql5.sock' => 'ICDSoft',
280
-            'mysqlv5' => 'NetworkSolutions',
281
-            'PAGELYBIN' => 'Pagely',
282
-            'secureserver.net' => 'GoDaddy',
283
-            'WPE_APIKEY' => 'WP Engine',
284
-        ];
285
-        foreach ($checks as $key => $value) {
286
-            if (!$this->isWebhostCheckValid($key)) {
287
-                continue;
288
-            }
289
-            return $value;
290
-        }
291
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
292
-    }
260
+	/**
261
+	 * @return string
262
+	 */
263
+	protected function detectWebhostProvider()
264
+	{
265
+		$checks = [
266
+			'.accountservergroup.com' => 'Site5',
267
+			'.gridserver.com' => 'MediaTemple Grid',
268
+			'.inmotionhosting.com' => 'InMotion Hosting',
269
+			'.ovh.net' => 'OVH',
270
+			'.pair.com' => 'pair Networks',
271
+			'.stabletransit.com' => 'Rackspace Cloud',
272
+			'.stratoserver.net' => 'STRATO',
273
+			'.sysfix.eu' => 'SysFix.eu Power Hosting',
274
+			'bluehost.com' => 'Bluehost',
275
+			'DH_USER' => 'DreamHost',
276
+			'Flywheel' => 'Flywheel',
277
+			'ipagemysql.com' => 'iPage',
278
+			'ipowermysql.com' => 'IPower',
279
+			'localhost:/tmp/mysql5.sock' => 'ICDSoft',
280
+			'mysqlv5' => 'NetworkSolutions',
281
+			'PAGELYBIN' => 'Pagely',
282
+			'secureserver.net' => 'GoDaddy',
283
+			'WPE_APIKEY' => 'WP Engine',
284
+		];
285
+		foreach ($checks as $key => $value) {
286
+			if (!$this->isWebhostCheckValid($key)) {
287
+				continue;
288
+			}
289
+			return $value;
290
+		}
291
+		return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
292
+	}
293 293
 
294
-    /**
295
-     * @return string
296
-     */
297
-    protected function getHostName()
298
-    {
299
-        return sprintf('%s (%s)',
300
-            $this->detectWebhostProvider(),
301
-            Helper::getIpAddress()
302
-        );
303
-    }
294
+	/**
295
+	 * @return string
296
+	 */
297
+	protected function getHostName()
298
+	{
299
+		return sprintf('%s (%s)',
300
+			$this->detectWebhostProvider(),
301
+			Helper::getIpAddress()
302
+		);
303
+	}
304 304
 
305
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
306
-    {
307
-        return function_exists('ini_get')
308
-            ? ini_get($name)
309
-            : $disabledValue;
310
-    }
305
+	protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
306
+	{
307
+		return function_exists('ini_get')
308
+			? ini_get($name)
309
+			: $disabledValue;
310
+	}
311 311
 
312
-    /**
313
-     * @return array
314
-     */
315
-    protected function getWordpressPlugins()
316
-    {
317
-        $plugins = get_plugins();
318
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
319
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
320
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
321
-        return $active + $inactive;
322
-    }
312
+	/**
313
+	 * @return array
314
+	 */
315
+	protected function getWordpressPlugins()
316
+	{
317
+		$plugins = get_plugins();
318
+		$activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
319
+		$inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
320
+		$active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
321
+		return $active + $inactive;
322
+	}
323 323
 
324
-    /**
325
-     * @param string $title
326
-     * @return string
327
-     */
328
-    protected function implode($title, array $details)
329
-    {
330
-        $strings = ['['.$title.']'];
331
-        $padding = max(array_map('strlen', array_keys($details)));
332
-        $padding = max([$padding, static::PAD]);
333
-        foreach ($details as $key => $value) {
334
-            $strings[] = is_string($key)
335
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
336
-                : ' - '.$value;
337
-        }
338
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
339
-    }
324
+	/**
325
+	 * @param string $title
326
+	 * @return string
327
+	 */
328
+	protected function implode($title, array $details)
329
+	{
330
+		$strings = ['['.$title.']'];
331
+		$padding = max(array_map('strlen', array_keys($details)));
332
+		$padding = max([$padding, static::PAD]);
333
+		foreach ($details as $key => $value) {
334
+			$strings[] = is_string($key)
335
+				? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
336
+				: ' - '.$value;
337
+		}
338
+		return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
339
+	}
340 340
 
341
-    /**
342
-     * @param string $key
343
-     * @return bool
344
-     */
345
-    protected function isWebhostCheckValid($key)
346
-    {
347
-        return defined($key)
348
-            || filter_input(INPUT_SERVER, $key)
349
-            || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
350
-            || Str::contains(DB_HOST, $key)
351
-            || Str::contains(php_uname(), $key);
352
-    }
341
+	/**
342
+	 * @param string $key
343
+	 * @return bool
344
+	 */
345
+	protected function isWebhostCheckValid($key)
346
+	{
347
+		return defined($key)
348
+			|| filter_input(INPUT_SERVER, $key)
349
+			|| Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
350
+			|| Str::contains(DB_HOST, $key)
351
+			|| Str::contains(php_uname(), $key);
352
+	}
353 353
 
354
-    /**
355
-     * @return array
356
-     */
357
-    protected function normalizePluginList(array $plugins)
358
-    {
359
-        $plugins = array_map(function ($plugin) {
360
-            return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
361
-        }, $plugins);
362
-        natcasesort($plugins);
363
-        return array_flip($plugins);
364
-    }
354
+	/**
355
+	 * @return array
356
+	 */
357
+	protected function normalizePluginList(array $plugins)
358
+	{
359
+		$plugins = array_map(function ($plugin) {
360
+			return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
361
+		}, $plugins);
362
+		natcasesort($plugins);
363
+		return array_flip($plugins);
364
+	}
365 365
 
366
-    /**
367
-     * @return array
368
-     */
369
-    protected function purgeSensitiveData(array $settings)
370
-    {
371
-        $keys = [
372
-            'general.rebusify_serial',
373
-            'licenses.',
374
-            'submissions.recaptcha.key',
375
-            'submissions.recaptcha.secret',
376
-        ];
377
-        array_walk($settings, function (&$value, $setting) use ($keys) {
378
-            foreach ($keys as $key) {
379
-                if (!Str::startsWith($key, $setting) || empty($value)) {
380
-                    continue;
381
-                }
382
-                $value = str_repeat('•', 13);
383
-                return;
384
-            }
385
-        });
386
-        return $settings;
387
-    }
366
+	/**
367
+	 * @return array
368
+	 */
369
+	protected function purgeSensitiveData(array $settings)
370
+	{
371
+		$keys = [
372
+			'general.rebusify_serial',
373
+			'licenses.',
374
+			'submissions.recaptcha.key',
375
+			'submissions.recaptcha.secret',
376
+		];
377
+		array_walk($settings, function (&$value, $setting) use ($keys) {
378
+			foreach ($keys as $key) {
379
+				if (!Str::startsWith($key, $setting) || empty($value)) {
380
+					continue;
381
+				}
382
+				$value = str_repeat('•', 13);
383
+				return;
384
+			}
385
+		});
386
+		return $settings;
387
+	}
388 388
 }
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
             'setting' => 'Plugin Settings',
42 42
             'reviews' => 'Review Counts',
43 43
         ];
44
-        $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) {
45
-            $methodName = Helper::buildMethodName('get-'.$key.'-details');
46
-            if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) {
44
+        $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use ($details) {
45
+            $methodName = Helper::buildMethodName( 'get-'.$key.'-details' );
46
+            if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
47 47
                 return $carry.$this->implode(
48
-                    strtoupper($details[$key]),
49
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
48
+                    strtoupper( $details[$key] ),
49
+                    apply_filters( 'site-reviews/system/'.$key, $systemDetails )
50 50
                 );
51 51
             }
52 52
             return $carry;
53 53
         });
54
-        return trim($systemInfo);
54
+        return trim( $systemInfo );
55 55
     }
56 56
 
57 57
     /**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
     public function getActivePluginDetails()
61 61
     {
62 62
         $plugins = get_plugins();
63
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
64
-        $inactive = array_diff_key($plugins, array_flip($activePlugins));
65
-        return $this->normalizePluginList(array_diff_key($plugins, $inactive));
63
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
64
+        $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
65
+        return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
66 66
     }
67 67
 
68 68
     /**
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getAddonDetails()
72 72
     {
73
-        $details = apply_filters('site-reviews/addon/system-info', []);
74
-        ksort($details);
73
+        $details = apply_filters( 'site-reviews/addon/system-info', [] );
74
+        ksort( $details );
75 75
         return $details;
76 76
     }
77 77
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
     public function getBrowserDetails()
82 82
     {
83 83
         $browser = new Browser();
84
-        $name = esc_attr($browser->getName());
85
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
86
-        $version = esc_attr($browser->getVersion());
84
+        $name = esc_attr( $browser->getName() );
85
+        $userAgent = esc_attr( $browser->getUserAgent()->getUserAgentString() );
86
+        $version = esc_attr( $browser->getVersion() );
87 87
         return [
88
-            'Browser Name' => sprintf('%s %s', $name, $version),
88
+            'Browser Name' => sprintf( '%s %s', $name, $version ),
89 89
             'Browser UA' => $userAgent,
90 90
         ];
91 91
     }
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function getInactivePluginDetails()
97 97
     {
98
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
99
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
98
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
99
+        $inactivePlugins = $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
100 100
         $multisitePlugins = $this->getMultisitePluginDetails();
101 101
         return empty($multisitePlugins)
102 102
             ? $inactivePlugins
103
-            : array_diff($inactivePlugins, $multisitePlugins);
103
+            : array_diff( $inactivePlugins, $multisitePlugins );
104 104
     }
105 105
 
106 106
     /**
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getMuPluginDetails()
110 110
     {
111
-        if (empty($plugins = get_mu_plugins())) {
111
+        if( empty($plugins = get_mu_plugins()) ) {
112 112
             return [];
113 113
         }
114
-        return $this->normalizePluginList($plugins);
114
+        return $this->normalizePluginList( $plugins );
115 115
     }
116 116
 
117 117
     /**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getMultisitePluginDetails()
121 121
     {
122
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
123
-        if (!is_multisite() || empty($activePlugins)) {
122
+        $activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] );
123
+        if( !is_multisite() || empty($activePlugins) ) {
124 124
             return [];
125 125
         }
126
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
126
+        return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins ) );
127 127
     }
128 128
 
129 129
     /**
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function getPhpDetails()
133 133
     {
134
-        $displayErrors = $this->getINI('display_errors', null)
135
-            ? 'On ('.$this->getINI('display_errors').')'
134
+        $displayErrors = $this->getINI( 'display_errors', null )
135
+            ? 'On ('.$this->getINI( 'display_errors' ).')'
136 136
             : 'N/A';
137
-        $intlSupport = extension_loaded('intl')
138
-            ? phpversion('intl')
137
+        $intlSupport = extension_loaded( 'intl' )
138
+            ? phpversion( 'intl' )
139 139
             : 'false';
140 140
         return [
141
-            'cURL' => var_export(function_exists('curl_init'), true),
142
-            'Default Charset' => $this->getINI('default_charset'),
141
+            'cURL' => var_export( function_exists( 'curl_init' ), true ),
142
+            'Default Charset' => $this->getINI( 'default_charset' ),
143 143
             'Display Errors' => $displayErrors,
144
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
144
+            'fsockopen' => var_export( function_exists( 'fsockopen' ), true ),
145 145
             'Intl' => $intlSupport,
146
-            'IPv6' => var_export(defined('AF_INET6'), true),
147
-            'Max Execution Time' => $this->getINI('max_execution_time'),
148
-            'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'),
149
-            'Max Input Vars' => $this->getINI('max_input_vars'),
150
-            'Memory Limit' => $this->getINI('memory_limit'),
151
-            'Post Max Size' => $this->getINI('post_max_size'),
152
-            'Sendmail Path' => $this->getINI('sendmail_path'),
153
-            'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')),
154
-            'Session Name' => esc_html($this->getINI('session.name')),
155
-            'Session Save Path' => esc_html($this->getINI('session.save_path')),
156
-            'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true),
157
-            'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true),
158
-            'Upload Max Filesize' => $this->getINI('upload_max_filesize'),
146
+            'IPv6' => var_export( defined( 'AF_INET6' ), true ),
147
+            'Max Execution Time' => $this->getINI( 'max_execution_time' ),
148
+            'Max Input Nesting Level' => $this->getINI( 'max_input_nesting_level' ),
149
+            'Max Input Vars' => $this->getINI( 'max_input_vars' ),
150
+            'Memory Limit' => $this->getINI( 'memory_limit' ),
151
+            'Post Max Size' => $this->getINI( 'post_max_size' ),
152
+            'Sendmail Path' => $this->getINI( 'sendmail_path' ),
153
+            'Session Cookie Path' => esc_html( $this->getINI( 'session.cookie_path' ) ),
154
+            'Session Name' => esc_html( $this->getINI( 'session.name' ) ),
155
+            'Session Save Path' => esc_html( $this->getINI( 'session.save_path' ) ),
156
+            'Session Use Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_cookies', false ) ), true ),
157
+            'Session Use Only Cookies' => var_export( wp_validate_boolean( $this->getINI( 'session.use_only_cookies', false ) ), true ),
158
+            'Upload Max Filesize' => $this->getINI( 'upload_max_filesize' ),
159 159
         ];
160 160
     }
161 161
 
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function getReviewsDetails()
166 166
     {
167
-        $counts = glsr(CountsManager::class)->getCounts();
168
-        $counts = Arr::flattenArray($counts);
169
-        array_walk($counts, function (&$ratings) use ($counts) {
170
-            if (is_array($ratings)) {
171
-                $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')';
167
+        $counts = glsr( CountsManager::class )->getCounts();
168
+        $counts = Arr::flattenArray( $counts );
169
+        array_walk( $counts, function( &$ratings ) use ($counts) {
170
+            if( is_array( $ratings ) ) {
171
+                $ratings = array_sum( $ratings ).' ('.implode( ', ', $ratings ).')';
172 172
                 return;
173 173
             }
174 174
             glsr_log()
175
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
176
-                ->debug($ratings)
177
-                ->debug($counts);
175
+                ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
176
+                ->debug( $ratings )
177
+                ->debug( $counts );
178 178
         });
179
-        ksort($counts);
179
+        ksort( $counts );
180 180
         return $counts;
181 181
     }
182 182
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             'Host Name' => $this->getHostName(),
191 191
             'MySQL Version' => $wpdb->db_version(),
192 192
             'PHP Version' => PHP_VERSION,
193
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
193
+            'Server Software' => filter_input( INPUT_SERVER, 'SERVER_SOFTWARE' ),
194 194
         ];
195 195
     }
196 196
 
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function getSettingDetails()
201 201
     {
202
-        $settings = glsr(OptionManager::class)->get('settings', []);
203
-        $settings = Arr::flattenArray($settings, true);
204
-        $settings = $this->purgeSensitiveData($settings);
205
-        ksort($settings);
202
+        $settings = glsr( OptionManager::class )->get( 'settings', [] );
203
+        $settings = Arr::flattenArray( $settings, true );
204
+        $settings = $this->purgeSensitiveData( $settings );
205
+        ksort( $settings );
206 206
         $details = [];
207
-        foreach ($settings as $key => $value) {
208
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
207
+        foreach( $settings as $key => $value ) {
208
+            if( Str::startsWith( 'strings', $key ) && Str::endsWith( 'id', $key ) ) {
209 209
                 continue;
210 210
             }
211
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
211
+            $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
212 212
             $details[$key] = $value;
213 213
         }
214 214
         return $details;
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
     public function getPluginDetails()
221 221
     {
222 222
         return [
223
-            'Console level' => glsr(Console::class)->humanLevel(),
224
-            'Console size' => glsr(Console::class)->humanSize('0'),
225
-            'Last Rating Count' => date_i18n('Y-m-d H:i', glsr(OptionManager::class)->get('last_review_count')),
223
+            'Console level' => glsr( Console::class )->humanLevel(),
224
+            'Console size' => glsr( Console::class )->humanSize( '0' ),
225
+            'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' ) ),
226 226
             'Version (current)' => glsr()->version,
227
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
227
+            'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
228 228
         ];
229 229
     }
230 230
 
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
         global $wpdb;
237 237
         $theme = wp_get_theme();
238 238
         return [
239
-            'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version),
240
-            'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1),
239
+            'Active Theme' => sprintf( '%s v%s', (string)$theme->Name, (string)$theme->Version ),
240
+            'Email Domain' => substr( strrchr( glsr( OptionManager::class )->getWP( 'admin_email' ), '@' ), 1 ),
241 241
             'Home URL' => home_url(),
242 242
             'Language' => get_locale(),
243 243
             'Memory Limit' => WP_MEMORY_LIMIT,
244
-            'Multisite' => var_export(is_multisite(), true),
245
-            'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'),
246
-            'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'),
247
-            'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'),
248
-            'Post Stati' => implode(', ', get_post_stati()),
249
-            'Remote Post' => glsr(Cache::class)->getRemotePostTest(),
250
-            'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'),
244
+            'Multisite' => var_export( is_multisite(), true ),
245
+            'Page For Posts ID' => glsr( OptionManager::class )->getWP( 'page_for_posts' ),
246
+            'Page On Front ID' => glsr( OptionManager::class )->getWP( 'page_on_front' ),
247
+            'Permalink Structure' => glsr( OptionManager::class )->getWP( 'permalink_structure', 'default' ),
248
+            'Post Stati' => implode( ', ', get_post_stati() ),
249
+            'Remote Post' => glsr( Cache::class )->getRemotePostTest(),
250
+            'Show On Front' => glsr( OptionManager::class )->getWP( 'show_on_front' ),
251 251
             'Site URL' => site_url(),
252
-            'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'),
253
-            'Version' => get_bloginfo('version'),
254
-            'WP Debug' => var_export(defined('WP_DEBUG'), true),
255
-            'WP Max Upload Size' => size_format(wp_max_upload_size()),
252
+            'Timezone' => glsr( OptionManager::class )->getWP( 'timezone_string', $this->getINI( 'date.timezone' ).' (PHP)' ),
253
+            'Version' => get_bloginfo( 'version' ),
254
+            'WP Debug' => var_export( defined( 'WP_DEBUG' ), true ),
255
+            'WP Max Upload Size' => size_format( wp_max_upload_size() ),
256 256
             'WP Memory Limit' => WP_MEMORY_LIMIT,
257 257
         ];
258 258
     }
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
             'secureserver.net' => 'GoDaddy',
283 283
             'WPE_APIKEY' => 'WP Engine',
284 284
         ];
285
-        foreach ($checks as $key => $value) {
286
-            if (!$this->isWebhostCheckValid($key)) {
285
+        foreach( $checks as $key => $value ) {
286
+            if( !$this->isWebhostCheckValid( $key ) ) {
287 287
                 continue;
288 288
             }
289 289
             return $value;
290 290
         }
291
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
291
+        return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
292 292
     }
293 293
 
294 294
     /**
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
      */
297 297
     protected function getHostName()
298 298
     {
299
-        return sprintf('%s (%s)',
299
+        return sprintf( '%s (%s)',
300 300
             $this->detectWebhostProvider(),
301 301
             Helper::getIpAddress()
302 302
         );
303 303
     }
304 304
 
305
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
305
+    protected function getINI( $name, $disabledValue = 'ini_get() is disabled.' )
306 306
     {
307
-        return function_exists('ini_get')
308
-            ? ini_get($name)
307
+        return function_exists( 'ini_get' )
308
+            ? ini_get( $name )
309 309
             : $disabledValue;
310 310
     }
311 311
 
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
     protected function getWordpressPlugins()
316 316
     {
317 317
         $plugins = get_plugins();
318
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
319
-        $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins)));
320
-        $active = $this->normalizePluginList(array_diff_key($plugins, $inactive));
318
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
319
+        $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
320
+        $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
321 321
         return $active + $inactive;
322 322
     }
323 323
 
@@ -325,48 +325,48 @@  discard block
 block discarded – undo
325 325
      * @param string $title
326 326
      * @return string
327 327
      */
328
-    protected function implode($title, array $details)
328
+    protected function implode( $title, array $details )
329 329
     {
330 330
         $strings = ['['.$title.']'];
331
-        $padding = max(array_map('strlen', array_keys($details)));
332
-        $padding = max([$padding, static::PAD]);
333
-        foreach ($details as $key => $value) {
334
-            $strings[] = is_string($key)
335
-                ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value)
331
+        $padding = max( array_map( 'strlen', array_keys( $details ) ) );
332
+        $padding = max( [$padding, static::PAD] );
333
+        foreach( $details as $key => $value ) {
334
+            $strings[] = is_string( $key )
335
+                ? sprintf( '%s : %s', str_pad( $key, $padding, '.' ), $value )
336 336
                 : ' - '.$value;
337 337
         }
338
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
338
+        return implode( PHP_EOL, $strings ).PHP_EOL.PHP_EOL;
339 339
     }
340 340
 
341 341
     /**
342 342
      * @param string $key
343 343
      * @return bool
344 344
      */
345
-    protected function isWebhostCheckValid($key)
345
+    protected function isWebhostCheckValid( $key )
346 346
     {
347
-        return defined($key)
348
-            || filter_input(INPUT_SERVER, $key)
349
-            || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key)
350
-            || Str::contains(DB_HOST, $key)
351
-            || Str::contains(php_uname(), $key);
347
+        return defined( $key )
348
+            || filter_input( INPUT_SERVER, $key )
349
+            || Str::contains( filter_input( INPUT_SERVER, 'SERVER_NAME' ), $key )
350
+            || Str::contains( DB_HOST, $key )
351
+            || Str::contains( php_uname(), $key );
352 352
     }
353 353
 
354 354
     /**
355 355
      * @return array
356 356
      */
357
-    protected function normalizePluginList(array $plugins)
357
+    protected function normalizePluginList( array $plugins )
358 358
     {
359
-        $plugins = array_map(function ($plugin) {
360
-            return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version'));
361
-        }, $plugins);
362
-        natcasesort($plugins);
363
-        return array_flip($plugins);
359
+        $plugins = array_map( function( $plugin ) {
360
+            return sprintf( '%s v%s', Arr::get( $plugin, 'Name' ), Arr::get( $plugin, 'Version' ) );
361
+        }, $plugins );
362
+        natcasesort( $plugins );
363
+        return array_flip( $plugins );
364 364
     }
365 365
 
366 366
     /**
367 367
      * @return array
368 368
      */
369
-    protected function purgeSensitiveData(array $settings)
369
+    protected function purgeSensitiveData( array $settings )
370 370
     {
371 371
         $keys = [
372 372
             'general.rebusify_serial',
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
             'submissions.recaptcha.key',
375 375
             'submissions.recaptcha.secret',
376 376
         ];
377
-        array_walk($settings, function (&$value, $setting) use ($keys) {
378
-            foreach ($keys as $key) {
379
-                if (!Str::startsWith($key, $setting) || empty($value)) {
377
+        array_walk( $settings, function( &$value, $setting ) use ($keys) {
378
+            foreach( $keys as $key ) {
379
+                if( !Str::startsWith( $key, $setting ) || empty($value) ) {
380 380
                     continue;
381 381
                 }
382
-                $value = str_repeat('•', 13);
382
+                $value = str_repeat( '•', 13 );
383 383
                 return;
384 384
             }
385 385
         });
Please login to merge, or discard this patch.
views/pages/welcome/getting-started.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="is-fullwidth">
4 4
     <div class="glsr-flex-row glsr-has-2-columns">
5 5
         <div class="glsr-column">
6 6
             <h3>Editor Blocks</h3>
7 7
             <p>The fastest way to getting started with Site Reviews is to use the three provided blocks in the WordPress Block Editor. Each block comes with multiple settings which let you configure the block exactly as needed. To add a block to your page, click the "Add Block" button and search for "Site Reviews".</p>
8
-            <img class="screenshot" src="<?= glsr()->url('assets/images/blocks.png'); ?>" alt="Editor Blocks" />
8
+            <img class="screenshot" src="<?= glsr()->url( 'assets/images/blocks.png' ); ?>" alt="Editor Blocks" />
9 9
         </div>
10 10
         <div class="glsr-column">
11 11
             <h3>Shortcodes and Widgets</h3>
12 12
             <p>You can also use the shortcodes or widgets on your page. Keep in mind, however, that widgets are limited in options compared to the shortcodes (for example, the "Latest Reviews" widget does not allow pagination). If you are using the Classic Editor in WordPress, you can click on the Site Reviews shortcode button above the editor (next to the media button) to add a shortcode via a friendly popup.</p>
13 13
             <p>To learn more about the shortcodes and the available shortcode options, please see the Shortcode Documentation page of the plugin.</p>
14
-            <a class="button" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes'); ?>">View Shortcode Documentation</a>
14
+            <a class="button" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes' ); ?>">View Shortcode Documentation</a>
15 15
         </div>
16 16
     </div>
17 17
 </div>
@@ -20,31 +20,31 @@  discard block
 block discarded – undo
20 20
     <h2>Features</h2>
21 21
     <ul class="glsr-flex-row glsr-has-3-columns">
22 22
         <li class="glsr-column">
23
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=addons'); ?>">Add-ons</a></h3>
23
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=addons' ); ?>">Add-ons</a></h3>
24 24
             <p>Extend Site Reviews with add-ons that provide additional features.</p>
25 25
         </li>
26 26
         <li class="glsr-column">
27
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!reviews'); ?>">Avatars</a></h3>
27
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!reviews' ); ?>">Avatars</a></h3>
28 28
             <p>Enable avatars to generate images using the WordPress Gravatar service.</p>
29 29
         </li>
30 30
         <li class="glsr-column">
31
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=tools#!general'); ?>">Backup/Restore</a></h3>
31
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=tools#!general' ); ?>">Backup/Restore</a></h3>
32 32
             <p>Backup and restore your plugin settings as needed.</p>
33 33
         </li>
34 34
         <li class="glsr-column">
35
-            <h3><a data-expand="#faq-14" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq'); ?>">Bayesian Ranking</a></h3>
35
+            <h3><a data-expand="#faq-14" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq' ); ?>">Bayesian Ranking</a></h3>
36 36
             <p>Easily rank pages with assigned reviews using the bayesian algorithm.</p>
37 37
         </li>
38 38
         <li class="glsr-column">
39
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions'); ?>">Blacklist</a></h3>
39
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions' ); ?>">Blacklist</a></h3>
40 40
             <p>Blacklist words, phrases, IP addresses, names, and emails.</p>
41 41
         </li>
42 42
         <li class="glsr-column">
43
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Blockchain Validation</a></h3>
43
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Blockchain Validation</a></h3>
44 44
             <p>Verify your reviews on the Blockchain with <a href="https://rebusify.com?ref=105">Rebusify</a>.</p>
45 45
         </li>
46 46
         <li class="glsr-column">
47
-            <h3><a href="<?= admin_url('edit-tags.php?taxonomy=site-review-category&post_type=site-review'); ?>">Categories</a></h3>
47
+            <h3><a href="<?= admin_url( 'edit-tags.php?taxonomy=site-review-category&post_type=site-review' ); ?>">Categories</a></h3>
48 48
             <p>Add your own categories and assign reviews to them.</p>
49 49
         </li>
50 50
         <li class="glsr-column">
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             <p>Designed for WordPress developers with over 100 filter hooks and convenient functions.</p>
53 53
         </li>
54 54
         <li class="glsr-column">
55
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq'); ?>">Documentation</a></h3>
55
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq' ); ?>">Documentation</a></h3>
56 56
             <p>Provides FAQ and documenation for hooks and all shortcodes and functions.</p>
57 57
         </li>
58 58
         <li class="glsr-column">
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
             <p>Use configurable editor blocks in the new WordPress 5.0 editor.</p>
61 61
         </li>
62 62
         <li class="glsr-column">
63
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!schema'); ?>">JSON-LD Schema</a></h3>
63
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!schema' ); ?>">JSON-LD Schema</a></h3>
64 64
             <p>Enable JSON-LD schema to display your reviews and ratings in search results.</p>
65 65
         </li>
66 66
         <li class="glsr-column">
67
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Multilingual</a></h3>
67
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Multilingual</a></h3>
68 68
             <p>Integrates with Polylang and WPML and provides easy search/replace translation.</p>
69 69
         </li>
70 70
         <li class="glsr-column">
@@ -72,47 +72,47 @@  discard block
 block discarded – undo
72 72
             <p>Provides full support for the WordPress multisite feature.</p>
73 73
         </li>
74 74
         <li class="glsr-column">
75
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Notifications</a></h3>
75
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Notifications</a></h3>
76 76
             <p>Send notifications to one or more emails when a review is submitted.</p>
77 77
         </li>
78 78
         <li class="glsr-column">
79
-            <h3><a data-expand="#faq-03" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq'); ?>">Page Assignment</a></h3>
79
+            <h3><a data-expand="#faq-03" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq' ); ?>">Page Assignment</a></h3>
80 80
             <p>Assign reviews to Posts, Pages, and Custom Post Types.</p>
81 81
         </li>
82 82
         <li class="glsr-column">
83
-            <h3><a data-expand="#faq-02" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq'); ?>">Pagination</a></h3>
83
+            <h3><a data-expand="#faq-02" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq' ); ?>">Pagination</a></h3>
84 84
             <p>Enable AJAX pagination to display a custom number of reviews per-page.</p>
85 85
         </li>
86 86
         <li class="glsr-column">
87
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.''); ?>">Responses</a></h3>
87
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'' ); ?>">Responses</a></h3>
88 88
             <p>Write a response to reviews that require a response.</p>
89 89
         </li>
90 90
         <li class="glsr-column">
91
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Restrictions</a></h3>
91
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Restrictions</a></h3>
92 92
             <p>Require approval before publishing reviews and limit to registered users.</p>
93 93
         </li>
94 94
         <li class="glsr-column">
95
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions'); ?>">Review Limits</a></h3>
95
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions' ); ?>">Review Limits</a></h3>
96 96
             <p>Limit review submissions by email address, IP address, or username.</p>
97 97
         </li>
98 98
         <li class="glsr-column">
99
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes'); ?>">Review Summaries</a></h3>
99
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes' ); ?>">Review Summaries</a></h3>
100 100
             <p>Display a summary of your review ratings from high to low.</p>
101 101
         </li>
102 102
         <li class="glsr-column">
103
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes'); ?>">Shortcodes</a></h3>
103
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes' ); ?>">Shortcodes</a></h3>
104 104
             <p>Use the configurable shortcodes complete with documentation.</p>
105 105
         </li>
106 106
         <li class="glsr-column">
107
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Slack</a></h3>
107
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Slack</a></h3>
108 108
             <p>Receive notifications in Slack when a review is submitted.</p>
109 109
         </li>
110 110
         <li class="glsr-column">
111
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions'); ?>">SPAM Protection</a></h3>
111
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!submissions' ); ?>">SPAM Protection</a></h3>
112 112
             <p>Uses a Honeypot and integrates with Invisible reCAPTCHA and Akismet.</p>
113 113
         </li>
114 114
         <li class="glsr-column">
115
-            <h3><a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">Styles</a></h3>
115
+            <h3><a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">Styles</a></h3>
116 116
             <p>Change the submission form style to match popular themes and form plugins.</p>
117 117
         </li>
118 118
         <li class="glsr-column">
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
             <p>Free premium-level support included on the WordPress support forum.</p>
121 121
         </li>
122 122
         <li class="glsr-column">
123
-            <h3><a data-expand="#faq-17" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq'); ?>">Templates</a></h3>
123
+            <h3><a data-expand="#faq-17" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!faq' ); ?>">Templates</a></h3>
124 124
             <p>Use the Site Reviews templates in your theme for full control over the HTML.</p>
125 125
         </li>
126 126
         <li class="glsr-column">
127
-            <h3><a href="<?= admin_url('widgets.php'); ?>">Widgets</a></h3>
127
+            <h3><a href="<?= admin_url( 'widgets.php' ); ?>">Widgets</a></h3>
128 128
             <p>Use the configurable widgets in your sidebars.</p>
129 129
         </li>
130 130
     </ul>
Please login to merge, or discard this patch.