Passed
Push — master ( e0a59a...75b6ac )
by Paul
06:30 queued 02:41
created
plugin/Modules/Validator/ValidateReview.php 2 patches
Indentation   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -13,285 +13,285 @@
 block discarded – undo
13 13
 
14 14
 class ValidateReview
15 15
 {
16
-    const RECAPTCHA_ENDPOINT = 'https://www.google.com/recaptcha/api/siteverify';
16
+	const RECAPTCHA_ENDPOINT = 'https://www.google.com/recaptcha/api/siteverify';
17 17
 
18
-    const RECAPTCHA_DISABLED = 0;
19
-    const RECAPTCHA_EMPTY = 1;
20
-    const RECAPTCHA_FAILED = 2;
21
-    const RECAPTCHA_INVALID = 3;
22
-    const RECAPTCHA_VALID = 4;
18
+	const RECAPTCHA_DISABLED = 0;
19
+	const RECAPTCHA_EMPTY = 1;
20
+	const RECAPTCHA_FAILED = 2;
21
+	const RECAPTCHA_INVALID = 3;
22
+	const RECAPTCHA_VALID = 4;
23 23
 
24
-    const VALIDATION_RULES = [
25
-        'content' => 'required',
26
-        'email' => 'required|email',
27
-        'name' => 'required',
28
-        'rating' => 'required|number|between:1,5',
29
-        'terms' => 'accepted',
30
-        'title' => 'required',
31
-    ];
24
+	const VALIDATION_RULES = [
25
+		'content' => 'required',
26
+		'email' => 'required|email',
27
+		'name' => 'required',
28
+		'rating' => 'required|number|between:1,5',
29
+		'terms' => 'accepted',
30
+		'title' => 'required',
31
+	];
32 32
 
33
-    /**
34
-     * @var string|void
35
-     */
36
-    public $error;
33
+	/**
34
+	 * @var string|void
35
+	 */
36
+	public $error;
37 37
 
38
-    /**
39
-     * @var string
40
-     */
41
-    public $form_id;
38
+	/**
39
+	 * @var string
40
+	 */
41
+	public $form_id;
42 42
 
43
-    /**
44
-     * @var bool
45
-     */
46
-    public $recaptchaIsUnset = false;
43
+	/**
44
+	 * @var bool
45
+	 */
46
+	public $recaptchaIsUnset = false;
47 47
 
48
-    /**
49
-     * @var array
50
-     */
51
-    public $request;
48
+	/**
49
+	 * @var array
50
+	 */
51
+	public $request;
52 52
 
53
-    /**
54
-     * @var array
55
-     */
56
-    protected $options;
53
+	/**
54
+	 * @var array
55
+	 */
56
+	protected $options;
57 57
 
58
-    /**
59
-     * @return static
60
-     */
61
-    public function validate(array $request)
62
-    {
63
-        $this->form_id = $request['form_id'];
64
-        $this->options = glsr(OptionManager::class)->all();
65
-        $this->request = $this->validateRequest($request);
66
-        $this->validateCustom();
67
-        $this->validateHoneyPot();
68
-        $this->validateReviewLimits();
69
-        $this->validateBlacklist();
70
-        $this->validateAkismet();
71
-        $this->validateRecaptcha();
72
-        if (!empty($this->error)) {
73
-            $this->setSessionValues('message', $this->error);
74
-        }
75
-        return $this;
76
-    }
58
+	/**
59
+	 * @return static
60
+	 */
61
+	public function validate(array $request)
62
+	{
63
+		$this->form_id = $request['form_id'];
64
+		$this->options = glsr(OptionManager::class)->all();
65
+		$this->request = $this->validateRequest($request);
66
+		$this->validateCustom();
67
+		$this->validateHoneyPot();
68
+		$this->validateReviewLimits();
69
+		$this->validateBlacklist();
70
+		$this->validateAkismet();
71
+		$this->validateRecaptcha();
72
+		if (!empty($this->error)) {
73
+			$this->setSessionValues('message', $this->error);
74
+		}
75
+		return $this;
76
+	}
77 77
 
78
-    /**
79
-     * @param string $path
80
-     * @param mixed $fallback
81
-     * @return mixed
82
-     */
83
-    protected function getOption($path, $fallback = '')
84
-    {
85
-        return Arr::get($this->options, $path, $fallback);
86
-    }
78
+	/**
79
+	 * @param string $path
80
+	 * @param mixed $fallback
81
+	 * @return mixed
82
+	 */
83
+	protected function getOption($path, $fallback = '')
84
+	{
85
+		return Arr::get($this->options, $path, $fallback);
86
+	}
87 87
 
88
-    /**
89
-     * @return int
90
-     */
91
-    protected function getRecaptchaStatus()
92
-    {
93
-        if (!glsr(OptionManager::class)->isRecaptchaEnabled()) {
94
-            return static::RECAPTCHA_DISABLED;
95
-        }
96
-        if (empty($this->request['_recaptcha-token'])) {
97
-            return $this->request['_counter'] < intval(apply_filters('site-reviews/recaptcha/timeout', 5))
98
-                ? static::RECAPTCHA_EMPTY
99
-                : static::RECAPTCHA_FAILED;
100
-        }
101
-        return $this->getRecaptchaTokenStatus();
102
-    }
88
+	/**
89
+	 * @return int
90
+	 */
91
+	protected function getRecaptchaStatus()
92
+	{
93
+		if (!glsr(OptionManager::class)->isRecaptchaEnabled()) {
94
+			return static::RECAPTCHA_DISABLED;
95
+		}
96
+		if (empty($this->request['_recaptcha-token'])) {
97
+			return $this->request['_counter'] < intval(apply_filters('site-reviews/recaptcha/timeout', 5))
98
+				? static::RECAPTCHA_EMPTY
99
+				: static::RECAPTCHA_FAILED;
100
+		}
101
+		return $this->getRecaptchaTokenStatus();
102
+	}
103 103
 
104
-    /**
105
-     * @return int
106
-     */
107
-    protected function getRecaptchaTokenStatus()
108
-    {
109
-        $endpoint = add_query_arg([
110
-            'remoteip' => Helper::getIpAddress(),
111
-            'response' => $this->request['_recaptcha-token'],
112
-            'secret' => $this->getOption('settings.submissions.recaptcha.secret'),
113
-        ], static::RECAPTCHA_ENDPOINT);
114
-        if (is_wp_error($response = wp_remote_get($endpoint))) {
115
-            glsr_log()->error($response->get_error_message());
116
-            return static::RECAPTCHA_FAILED;
117
-        }
118
-        $response = json_decode(wp_remote_retrieve_body($response));
119
-        if (!empty($response->success)) {
120
-            return boolval($response->success)
121
-                ? static::RECAPTCHA_VALID
122
-                : static::RECAPTCHA_INVALID;
123
-        }
124
-        foreach ($response->{'error-codes'} as $error) {
125
-            glsr_log()->error('reCAPTCHA error: '.$error);
126
-        }
127
-        return static::RECAPTCHA_INVALID;
128
-    }
104
+	/**
105
+	 * @return int
106
+	 */
107
+	protected function getRecaptchaTokenStatus()
108
+	{
109
+		$endpoint = add_query_arg([
110
+			'remoteip' => Helper::getIpAddress(),
111
+			'response' => $this->request['_recaptcha-token'],
112
+			'secret' => $this->getOption('settings.submissions.recaptcha.secret'),
113
+		], static::RECAPTCHA_ENDPOINT);
114
+		if (is_wp_error($response = wp_remote_get($endpoint))) {
115
+			glsr_log()->error($response->get_error_message());
116
+			return static::RECAPTCHA_FAILED;
117
+		}
118
+		$response = json_decode(wp_remote_retrieve_body($response));
119
+		if (!empty($response->success)) {
120
+			return boolval($response->success)
121
+				? static::RECAPTCHA_VALID
122
+				: static::RECAPTCHA_INVALID;
123
+		}
124
+		foreach ($response->{'error-codes'} as $error) {
125
+			glsr_log()->error('reCAPTCHA error: '.$error);
126
+		}
127
+		return static::RECAPTCHA_INVALID;
128
+	}
129 129
 
130
-    /**
131
-     * @return array
132
-     */
133
-    protected function getValidationRules(array $request)
134
-    {
135
-        $rules = array_intersect_key(
136
-            apply_filters('site-reviews/validation/rules', static::VALIDATION_RULES, $request),
137
-            array_flip($this->getOption('settings.submissions.required', []))
138
-        );
139
-        $excluded = explode(',', Arr::get($request, 'excluded'));
140
-        return array_diff_key($rules, array_flip($excluded));
141
-    }
130
+	/**
131
+	 * @return array
132
+	 */
133
+	protected function getValidationRules(array $request)
134
+	{
135
+		$rules = array_intersect_key(
136
+			apply_filters('site-reviews/validation/rules', static::VALIDATION_RULES, $request),
137
+			array_flip($this->getOption('settings.submissions.required', []))
138
+		);
139
+		$excluded = explode(',', Arr::get($request, 'excluded'));
140
+		return array_diff_key($rules, array_flip($excluded));
141
+	}
142 142
 
143
-    /**
144
-     * @return bool
145
-     */
146
-    protected function isRequestValid(array $request)
147
-    {
148
-        $rules = $this->getValidationRules($request);
149
-        $errors = glsr(Validator::class)->validate($request, $rules);
150
-        if (empty($errors)) {
151
-            return true;
152
-        }
153
-        $this->error = __('Please fix the submission errors.', 'site-reviews');
154
-        $this->setSessionValues('errors', $errors);
155
-        $this->setSessionValues('values', $request);
156
-        return false;
157
-    }
143
+	/**
144
+	 * @return bool
145
+	 */
146
+	protected function isRequestValid(array $request)
147
+	{
148
+		$rules = $this->getValidationRules($request);
149
+		$errors = glsr(Validator::class)->validate($request, $rules);
150
+		if (empty($errors)) {
151
+			return true;
152
+		}
153
+		$this->error = __('Please fix the submission errors.', 'site-reviews');
154
+		$this->setSessionValues('errors', $errors);
155
+		$this->setSessionValues('values', $request);
156
+		return false;
157
+	}
158 158
 
159
-    protected function setError($message, $loggedMessage = '')
160
-    {
161
-        $this->setSessionValues('errors', [], $loggedMessage);
162
-        $this->error = $message;
163
-    }
159
+	protected function setError($message, $loggedMessage = '')
160
+	{
161
+		$this->setSessionValues('errors', [], $loggedMessage);
162
+		$this->error = $message;
163
+	}
164 164
 
165
-    /**
166
-     * @param string $type
167
-     * @param mixed $value
168
-     * @param string $loggedMessage
169
-     * @return void
170
-     */
171
-    protected function setSessionValues($type, $value, $loggedMessage = '')
172
-    {
173
-        glsr()->sessionSet($this->form_id.$type, $value);
174
-        if (!empty($loggedMessage)) {
175
-            glsr_log()->warning($loggedMessage)->debug($this->request);
176
-        }
177
-    }
165
+	/**
166
+	 * @param string $type
167
+	 * @param mixed $value
168
+	 * @param string $loggedMessage
169
+	 * @return void
170
+	 */
171
+	protected function setSessionValues($type, $value, $loggedMessage = '')
172
+	{
173
+		glsr()->sessionSet($this->form_id.$type, $value);
174
+		if (!empty($loggedMessage)) {
175
+			glsr_log()->warning($loggedMessage)->debug($this->request);
176
+		}
177
+	}
178 178
 
179
-    /**
180
-     * @return void
181
-     */
182
-    protected function validateAkismet()
183
-    {
184
-        if (!empty($this->error)) {
185
-            return;
186
-        }
187
-        if (glsr(Akismet::class)->isSpam($this->request)) {
188
-            $this->setError(__('This review has been flagged as possible spam and cannot be submitted.', 'site-reviews'),
189
-                'Akismet caught a spam submission (consider adding the IP address to the blacklist):'
190
-            );
191
-        }
192
-    }
179
+	/**
180
+	 * @return void
181
+	 */
182
+	protected function validateAkismet()
183
+	{
184
+		if (!empty($this->error)) {
185
+			return;
186
+		}
187
+		if (glsr(Akismet::class)->isSpam($this->request)) {
188
+			$this->setError(__('This review has been flagged as possible spam and cannot be submitted.', 'site-reviews'),
189
+				'Akismet caught a spam submission (consider adding the IP address to the blacklist):'
190
+			);
191
+		}
192
+	}
193 193
 
194
-    /**
195
-     * @return void
196
-     */
197
-    protected function validateBlacklist()
198
-    {
199
-        if (!empty($this->error)) {
200
-            return;
201
-        }
202
-        if (!glsr(Blacklist::class)->isBlacklisted($this->request)) {
203
-            return;
204
-        }
205
-        $blacklistAction = $this->getOption('settings.submissions.blacklist.action');
206
-        if ('reject' != $blacklistAction) {
207
-            $this->request['blacklisted'] = true;
208
-            return;
209
-        }
210
-        $this->setError(__('Your review cannot be submitted at this time.', 'site-reviews'),
211
-            'Blacklisted submission detected:'
212
-        );
213
-    }
194
+	/**
195
+	 * @return void
196
+	 */
197
+	protected function validateBlacklist()
198
+	{
199
+		if (!empty($this->error)) {
200
+			return;
201
+		}
202
+		if (!glsr(Blacklist::class)->isBlacklisted($this->request)) {
203
+			return;
204
+		}
205
+		$blacklistAction = $this->getOption('settings.submissions.blacklist.action');
206
+		if ('reject' != $blacklistAction) {
207
+			$this->request['blacklisted'] = true;
208
+			return;
209
+		}
210
+		$this->setError(__('Your review cannot be submitted at this time.', 'site-reviews'),
211
+			'Blacklisted submission detected:'
212
+		);
213
+	}
214 214
 
215
-    /**
216
-     * @return void
217
-     */
218
-    protected function validateCustom()
219
-    {
220
-        if (!empty($this->error)) {
221
-            return;
222
-        }
223
-        $validated = apply_filters('site-reviews/validate/custom', true, $this->request);
224
-        if (true === $validated) {
225
-            return;
226
-        }
227
-        $errorMessage = is_string($validated)
228
-            ? $validated
229
-            : __('The review submission failed. Please notify the site administrator.', 'site-reviews');
230
-        $this->setError($errorMessage);
231
-        $this->setSessionValues('values', $this->request);
232
-    }
215
+	/**
216
+	 * @return void
217
+	 */
218
+	protected function validateCustom()
219
+	{
220
+		if (!empty($this->error)) {
221
+			return;
222
+		}
223
+		$validated = apply_filters('site-reviews/validate/custom', true, $this->request);
224
+		if (true === $validated) {
225
+			return;
226
+		}
227
+		$errorMessage = is_string($validated)
228
+			? $validated
229
+			: __('The review submission failed. Please notify the site administrator.', 'site-reviews');
230
+		$this->setError($errorMessage);
231
+		$this->setSessionValues('values', $this->request);
232
+	}
233 233
 
234
-    /**
235
-     * @return void
236
-     */
237
-    protected function validateHoneyPot()
238
-    {
239
-        if (!empty($this->error)) {
240
-            return;
241
-        }
242
-        if (!empty($this->request['gotcha'])) {
243
-            $this->setError(__('The review submission failed. Please notify the site administrator.', 'site-reviews'),
244
-                'The Honeypot caught a bad submission:'
245
-            );
246
-        }
247
-    }
234
+	/**
235
+	 * @return void
236
+	 */
237
+	protected function validateHoneyPot()
238
+	{
239
+		if (!empty($this->error)) {
240
+			return;
241
+		}
242
+		if (!empty($this->request['gotcha'])) {
243
+			$this->setError(__('The review submission failed. Please notify the site administrator.', 'site-reviews'),
244
+				'The Honeypot caught a bad submission:'
245
+			);
246
+		}
247
+	}
248 248
 
249
-    /**
250
-     * @return void
251
-     */
252
-    protected function validateReviewLimits()
253
-    {
254
-        if (!empty($this->error)) {
255
-            return;
256
-        }
257
-        if (glsr(ReviewLimits::class)->hasReachedLimit($this->request)) {
258
-            $this->setError(__('You have already submitted a review.', 'site-reviews'));
259
-        }
260
-    }
249
+	/**
250
+	 * @return void
251
+	 */
252
+	protected function validateReviewLimits()
253
+	{
254
+		if (!empty($this->error)) {
255
+			return;
256
+		}
257
+		if (glsr(ReviewLimits::class)->hasReachedLimit($this->request)) {
258
+			$this->setError(__('You have already submitted a review.', 'site-reviews'));
259
+		}
260
+	}
261 261
 
262
-    /**
263
-     * @return void
264
-     */
265
-    protected function validateRecaptcha()
266
-    {
267
-        if (!empty($this->error)) {
268
-            return;
269
-        }
270
-        $status = $this->getRecaptchaStatus();
271
-        if (in_array($status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID])) {
272
-            return;
273
-        }
274
-        if (static::RECAPTCHA_EMPTY === $status) {
275
-            $this->setSessionValues('recaptcha', 'unset');
276
-            $this->recaptchaIsUnset = true;
277
-            return;
278
-        }
279
-        $this->setSessionValues('recaptcha', 'reset');
280
-        $errors = [
281
-            static::RECAPTCHA_FAILED => __('The reCAPTCHA failed to load, please refresh the page and try again.', 'site-reviews'),
282
-            static::RECAPTCHA_INVALID => __('The reCAPTCHA verification failed, please try again.', 'site-reviews'),
283
-        ];
284
-        $this->setError($errors[$status]);
285
-    }
262
+	/**
263
+	 * @return void
264
+	 */
265
+	protected function validateRecaptcha()
266
+	{
267
+		if (!empty($this->error)) {
268
+			return;
269
+		}
270
+		$status = $this->getRecaptchaStatus();
271
+		if (in_array($status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID])) {
272
+			return;
273
+		}
274
+		if (static::RECAPTCHA_EMPTY === $status) {
275
+			$this->setSessionValues('recaptcha', 'unset');
276
+			$this->recaptchaIsUnset = true;
277
+			return;
278
+		}
279
+		$this->setSessionValues('recaptcha', 'reset');
280
+		$errors = [
281
+			static::RECAPTCHA_FAILED => __('The reCAPTCHA failed to load, please refresh the page and try again.', 'site-reviews'),
282
+			static::RECAPTCHA_INVALID => __('The reCAPTCHA verification failed, please try again.', 'site-reviews'),
283
+		];
284
+		$this->setError($errors[$status]);
285
+	}
286 286
 
287
-    /**
288
-     * @return array
289
-     */
290
-    protected function validateRequest(array $request)
291
-    {
292
-        if ($this->isRequestValid($request)) {
293
-            return array_merge(glsr(ValidateReviewDefaults::class)->defaults(), $request);
294
-        }
295
-        return $request;
296
-    }
287
+	/**
288
+	 * @return array
289
+	 */
290
+	protected function validateRequest(array $request)
291
+	{
292
+		if ($this->isRequestValid($request)) {
293
+			return array_merge(glsr(ValidateReviewDefaults::class)->defaults(), $request);
294
+		}
295
+		return $request;
296
+	}
297 297
 }
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
     /**
59 59
      * @return static
60 60
      */
61
-    public function validate(array $request)
61
+    public function validate( array $request )
62 62
     {
63 63
         $this->form_id = $request['form_id'];
64
-        $this->options = glsr(OptionManager::class)->all();
65
-        $this->request = $this->validateRequest($request);
64
+        $this->options = glsr( OptionManager::class )->all();
65
+        $this->request = $this->validateRequest( $request );
66 66
         $this->validateCustom();
67 67
         $this->validateHoneyPot();
68 68
         $this->validateReviewLimits();
69 69
         $this->validateBlacklist();
70 70
         $this->validateAkismet();
71 71
         $this->validateRecaptcha();
72
-        if (!empty($this->error)) {
73
-            $this->setSessionValues('message', $this->error);
72
+        if( !empty($this->error) ) {
73
+            $this->setSessionValues( 'message', $this->error );
74 74
         }
75 75
         return $this;
76 76
     }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
      * @param mixed $fallback
81 81
      * @return mixed
82 82
      */
83
-    protected function getOption($path, $fallback = '')
83
+    protected function getOption( $path, $fallback = '' )
84 84
     {
85
-        return Arr::get($this->options, $path, $fallback);
85
+        return Arr::get( $this->options, $path, $fallback );
86 86
     }
87 87
 
88 88
     /**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function getRecaptchaStatus()
92 92
     {
93
-        if (!glsr(OptionManager::class)->isRecaptchaEnabled()) {
93
+        if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) {
94 94
             return static::RECAPTCHA_DISABLED;
95 95
         }
96
-        if (empty($this->request['_recaptcha-token'])) {
97
-            return $this->request['_counter'] < intval(apply_filters('site-reviews/recaptcha/timeout', 5))
96
+        if( empty($this->request['_recaptcha-token']) ) {
97
+            return $this->request['_counter'] < intval( apply_filters( 'site-reviews/recaptcha/timeout', 5 ) )
98 98
                 ? static::RECAPTCHA_EMPTY
99 99
                 : static::RECAPTCHA_FAILED;
100 100
         }
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function getRecaptchaTokenStatus()
108 108
     {
109
-        $endpoint = add_query_arg([
109
+        $endpoint = add_query_arg( [
110 110
             'remoteip' => Helper::getIpAddress(),
111 111
             'response' => $this->request['_recaptcha-token'],
112
-            'secret' => $this->getOption('settings.submissions.recaptcha.secret'),
113
-        ], static::RECAPTCHA_ENDPOINT);
114
-        if (is_wp_error($response = wp_remote_get($endpoint))) {
115
-            glsr_log()->error($response->get_error_message());
112
+            'secret' => $this->getOption( 'settings.submissions.recaptcha.secret' ),
113
+        ], static::RECAPTCHA_ENDPOINT );
114
+        if( is_wp_error( $response = wp_remote_get( $endpoint ) ) ) {
115
+            glsr_log()->error( $response->get_error_message() );
116 116
             return static::RECAPTCHA_FAILED;
117 117
         }
118
-        $response = json_decode(wp_remote_retrieve_body($response));
119
-        if (!empty($response->success)) {
120
-            return boolval($response->success)
118
+        $response = json_decode( wp_remote_retrieve_body( $response ) );
119
+        if( !empty($response->success) ) {
120
+            return boolval( $response->success )
121 121
                 ? static::RECAPTCHA_VALID
122 122
                 : static::RECAPTCHA_INVALID;
123 123
         }
124
-        foreach ($response->{'error-codes'} as $error) {
125
-            glsr_log()->error('reCAPTCHA error: '.$error);
124
+        foreach( $response->{'error-codes'} as $error ) {
125
+            glsr_log()->error( 'reCAPTCHA error: '.$error );
126 126
         }
127 127
         return static::RECAPTCHA_INVALID;
128 128
     }
@@ -130,35 +130,35 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * @return array
132 132
      */
133
-    protected function getValidationRules(array $request)
133
+    protected function getValidationRules( array $request )
134 134
     {
135 135
         $rules = array_intersect_key(
136
-            apply_filters('site-reviews/validation/rules', static::VALIDATION_RULES, $request),
137
-            array_flip($this->getOption('settings.submissions.required', []))
136
+            apply_filters( 'site-reviews/validation/rules', static::VALIDATION_RULES, $request ),
137
+            array_flip( $this->getOption( 'settings.submissions.required', [] ) )
138 138
         );
139
-        $excluded = explode(',', Arr::get($request, 'excluded'));
140
-        return array_diff_key($rules, array_flip($excluded));
139
+        $excluded = explode( ',', Arr::get( $request, 'excluded' ) );
140
+        return array_diff_key( $rules, array_flip( $excluded ) );
141 141
     }
142 142
 
143 143
     /**
144 144
      * @return bool
145 145
      */
146
-    protected function isRequestValid(array $request)
146
+    protected function isRequestValid( array $request )
147 147
     {
148
-        $rules = $this->getValidationRules($request);
149
-        $errors = glsr(Validator::class)->validate($request, $rules);
150
-        if (empty($errors)) {
148
+        $rules = $this->getValidationRules( $request );
149
+        $errors = glsr( Validator::class )->validate( $request, $rules );
150
+        if( empty($errors) ) {
151 151
             return true;
152 152
         }
153
-        $this->error = __('Please fix the submission errors.', 'site-reviews');
154
-        $this->setSessionValues('errors', $errors);
155
-        $this->setSessionValues('values', $request);
153
+        $this->error = __( 'Please fix the submission errors.', 'site-reviews' );
154
+        $this->setSessionValues( 'errors', $errors );
155
+        $this->setSessionValues( 'values', $request );
156 156
         return false;
157 157
     }
158 158
 
159
-    protected function setError($message, $loggedMessage = '')
159
+    protected function setError( $message, $loggedMessage = '' )
160 160
     {
161
-        $this->setSessionValues('errors', [], $loggedMessage);
161
+        $this->setSessionValues( 'errors', [], $loggedMessage );
162 162
         $this->error = $message;
163 163
     }
164 164
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
      * @param string $loggedMessage
169 169
      * @return void
170 170
      */
171
-    protected function setSessionValues($type, $value, $loggedMessage = '')
171
+    protected function setSessionValues( $type, $value, $loggedMessage = '' )
172 172
     {
173
-        glsr()->sessionSet($this->form_id.$type, $value);
174
-        if (!empty($loggedMessage)) {
175
-            glsr_log()->warning($loggedMessage)->debug($this->request);
173
+        glsr()->sessionSet( $this->form_id.$type, $value );
174
+        if( !empty($loggedMessage) ) {
175
+            glsr_log()->warning( $loggedMessage )->debug( $this->request );
176 176
         }
177 177
     }
178 178
 
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
      */
182 182
     protected function validateAkismet()
183 183
     {
184
-        if (!empty($this->error)) {
184
+        if( !empty($this->error) ) {
185 185
             return;
186 186
         }
187
-        if (glsr(Akismet::class)->isSpam($this->request)) {
188
-            $this->setError(__('This review has been flagged as possible spam and cannot be submitted.', 'site-reviews'),
187
+        if( glsr( Akismet::class )->isSpam( $this->request ) ) {
188
+            $this->setError( __( 'This review has been flagged as possible spam and cannot be submitted.', 'site-reviews' ),
189 189
                 'Akismet caught a spam submission (consider adding the IP address to the blacklist):'
190 190
             );
191 191
         }
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
      */
197 197
     protected function validateBlacklist()
198 198
     {
199
-        if (!empty($this->error)) {
199
+        if( !empty($this->error) ) {
200 200
             return;
201 201
         }
202
-        if (!glsr(Blacklist::class)->isBlacklisted($this->request)) {
202
+        if( !glsr( Blacklist::class )->isBlacklisted( $this->request ) ) {
203 203
             return;
204 204
         }
205
-        $blacklistAction = $this->getOption('settings.submissions.blacklist.action');
206
-        if ('reject' != $blacklistAction) {
205
+        $blacklistAction = $this->getOption( 'settings.submissions.blacklist.action' );
206
+        if( 'reject' != $blacklistAction ) {
207 207
             $this->request['blacklisted'] = true;
208 208
             return;
209 209
         }
210
-        $this->setError(__('Your review cannot be submitted at this time.', 'site-reviews'),
210
+        $this->setError( __( 'Your review cannot be submitted at this time.', 'site-reviews' ),
211 211
             'Blacklisted submission detected:'
212 212
         );
213 213
     }
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
      */
218 218
     protected function validateCustom()
219 219
     {
220
-        if (!empty($this->error)) {
220
+        if( !empty($this->error) ) {
221 221
             return;
222 222
         }
223
-        $validated = apply_filters('site-reviews/validate/custom', true, $this->request);
224
-        if (true === $validated) {
223
+        $validated = apply_filters( 'site-reviews/validate/custom', true, $this->request );
224
+        if( true === $validated ) {
225 225
             return;
226 226
         }
227
-        $errorMessage = is_string($validated)
227
+        $errorMessage = is_string( $validated )
228 228
             ? $validated
229
-            : __('The review submission failed. Please notify the site administrator.', 'site-reviews');
230
-        $this->setError($errorMessage);
231
-        $this->setSessionValues('values', $this->request);
229
+            : __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' );
230
+        $this->setError( $errorMessage );
231
+        $this->setSessionValues( 'values', $this->request );
232 232
     }
233 233
 
234 234
     /**
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function validateHoneyPot()
238 238
     {
239
-        if (!empty($this->error)) {
239
+        if( !empty($this->error) ) {
240 240
             return;
241 241
         }
242
-        if (!empty($this->request['gotcha'])) {
243
-            $this->setError(__('The review submission failed. Please notify the site administrator.', 'site-reviews'),
242
+        if( !empty($this->request['gotcha']) ) {
243
+            $this->setError( __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ),
244 244
                 'The Honeypot caught a bad submission:'
245 245
             );
246 246
         }
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
      */
252 252
     protected function validateReviewLimits()
253 253
     {
254
-        if (!empty($this->error)) {
254
+        if( !empty($this->error) ) {
255 255
             return;
256 256
         }
257
-        if (glsr(ReviewLimits::class)->hasReachedLimit($this->request)) {
258
-            $this->setError(__('You have already submitted a review.', 'site-reviews'));
257
+        if( glsr( ReviewLimits::class )->hasReachedLimit( $this->request ) ) {
258
+            $this->setError( __( 'You have already submitted a review.', 'site-reviews' ) );
259 259
         }
260 260
     }
261 261
 
@@ -264,33 +264,33 @@  discard block
 block discarded – undo
264 264
      */
265 265
     protected function validateRecaptcha()
266 266
     {
267
-        if (!empty($this->error)) {
267
+        if( !empty($this->error) ) {
268 268
             return;
269 269
         }
270 270
         $status = $this->getRecaptchaStatus();
271
-        if (in_array($status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID])) {
271
+        if( in_array( $status, [static::RECAPTCHA_DISABLED, static::RECAPTCHA_VALID] ) ) {
272 272
             return;
273 273
         }
274
-        if (static::RECAPTCHA_EMPTY === $status) {
275
-            $this->setSessionValues('recaptcha', 'unset');
274
+        if( static::RECAPTCHA_EMPTY === $status ) {
275
+            $this->setSessionValues( 'recaptcha', 'unset' );
276 276
             $this->recaptchaIsUnset = true;
277 277
             return;
278 278
         }
279
-        $this->setSessionValues('recaptcha', 'reset');
279
+        $this->setSessionValues( 'recaptcha', 'reset' );
280 280
         $errors = [
281
-            static::RECAPTCHA_FAILED => __('The reCAPTCHA failed to load, please refresh the page and try again.', 'site-reviews'),
282
-            static::RECAPTCHA_INVALID => __('The reCAPTCHA verification failed, please try again.', 'site-reviews'),
281
+            static::RECAPTCHA_FAILED => __( 'The reCAPTCHA failed to load, please refresh the page and try again.', 'site-reviews' ),
282
+            static::RECAPTCHA_INVALID => __( 'The reCAPTCHA verification failed, please try again.', 'site-reviews' ),
283 283
         ];
284
-        $this->setError($errors[$status]);
284
+        $this->setError( $errors[$status] );
285 285
     }
286 286
 
287 287
     /**
288 288
      * @return array
289 289
      */
290
-    protected function validateRequest(array $request)
290
+    protected function validateRequest( array $request )
291 291
     {
292
-        if ($this->isRequestValid($request)) {
293
-            return array_merge(glsr(ValidateReviewDefaults::class)->defaults(), $request);
292
+        if( $this->isRequestValid( $request ) ) {
293
+            return array_merge( glsr( ValidateReviewDefaults::class )->defaults(), $request );
294 294
         }
295 295
         return $request;
296 296
     }
Please login to merge, or discard this patch.
views/pages/documentation/shortcodes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <p>This page shows all of the available shortcode options with examples of how to use them. You can use multiple options in the same shortcode.</p>
4 4
 
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     <div class="glsr-card-header">
7 7
         <h3>[site_reviews]</h3>
8 8
         <button type="button" class="handlediv" aria-expanded="true">
9
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
9
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
10 10
             <span class="toggle-indicator" aria-hidden="true"></span>
11 11
         </button>
12 12
     </div>
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     <div class="glsr-card-header">
81 81
         <h3>[site_reviews_form]</h3>
82 82
         <button type="button" class="handlediv" aria-expanded="true">
83
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
83
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
84 84
             <span class="toggle-indicator" aria-hidden="true"></span>
85 85
         </button>
86 86
     </div>
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     <div class="glsr-card-header">
129 129
         <h3>[site_reviews_summary]</h3>
130 130
         <button type="button" class="handlediv" aria-expanded="true">
131
-            <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span>
131
+            <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span>
132 132
             <span class="toggle-indicator" aria-hidden="true"></span>
133 133
         </button>
134 134
     </div>
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         <pre><code>[site_reviews_summary hide="bars,if_empty,rating,stars,summary"]</code></pre>
159 159
 
160 160
         <p class="glsr-heading">labels</p>
161
-        <p>The "labels" attribute allows you to enter custom labels for the percentage bar levels (from high to low), each level should be separated with a comma. However, rather than using this attribute to change the labels it's recommended to instead create a custom translation for them in the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!translations'); ?>">Settings &rarr; Translations</a></code> page.</p>
161
+        <p>The "labels" attribute allows you to enter custom labels for the percentage bar levels (from high to low), each level should be separated with a comma. However, rather than using this attribute to change the labels it's recommended to instead create a custom translation for them in the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ); ?>">Settings &rarr; Translations</a></code> page.</p>
162 162
         <p>The default labels value is: <code>"Excellent,Very good,Average,Poor,Terrible"</code></p>
163 163
         <pre><code>[site_reviews_summary labels="5 star,4 star,3 star,2 star,1 star"]</code></pre>
164 164
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         <pre><code>[site_reviews_summary schema="true"]</code></pre>
176 176
 
177 177
         <p class="glsr-heading">text</p>
178
-        <p>The "text" attribute allows you to change the summary text. Available template tags to use are, "{rating}" which represents the calculated average rating, "{max}" which represents the maximum star rating available, and "{num}" which represents the total number of reviews. However, rather than using this attribute to change the summary text it's recommended to instead create a custom translation for it in the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!translations'); ?>">Settings &rarr; Translations</a></code> page. That way, you will be able to customize both the singular (1 review) and plural (2 reviews) summary texts.</p>
178
+        <p>The "text" attribute allows you to change the summary text. Available template tags to use are, "{rating}" which represents the calculated average rating, "{max}" which represents the maximum star rating available, and "{num}" which represents the total number of reviews. However, rather than using this attribute to change the summary text it's recommended to instead create a custom translation for it in the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ); ?>">Settings &rarr; Translations</a></code> page. That way, you will be able to customize both the singular (1 review) and plural (2 reviews) summary texts.</p>
179 179
         <p>The default text value is: <code>"{rating} out of {max} stars (based on {num} reviews)"</code></p>
180 180
         <pre><code>[site_reviews_summary text="{num} customer reviews"]</code></pre>
181 181
 
Please login to merge, or discard this patch.
views/partials/notices/welcome.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1 1
 <div class="notice notice-info is-dismissible glsr-notice" data-dismiss="welcome">
2
-    <p><?= $text; ?> &mdash; <a class="button button-small" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=welcome#!whatsnew'); ?>">See what's new</a></p> 
2
+    <p><?= $text; ?> &mdash; <a class="button button-small" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=welcome#!whatsnew' ); ?>">See what's new</a></p> 
3 3
 </div>
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -7,92 +7,92 @@
 block discarded – undo
7 7
 
8 8
 class SiteReviewsWidget extends Widget
9 9
 {
10
-    /**
11
-     * @param array $instance
12
-     * @return void
13
-     */
14
-    public function form($instance)
15
-    {
16
-        $this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
-        $terms = glsr(Database::class)->getTerms();
18
-        $this->renderField('text', [
19
-            'class' => 'widefat',
20
-            'label' => __('Title', 'site-reviews'),
21
-            'name' => 'title',
22
-        ]);
23
-        $this->renderField('number', [
24
-            'class' => 'small-text',
25
-            'default' => 10,
26
-            'label' => __('How many reviews would you like to display?', 'site-reviews'),
27
-            'max' => 100,
28
-            'name' => 'display',
29
-        ]);
30
-        $this->renderField('select', [
31
-            'label' => __('What is the minimum rating to display?', 'site-reviews'),
32
-            'name' => 'rating',
33
-            'options' => [
34
-                '5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
-                '4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
-                '3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
-                '2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
-                '1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
39
-            ],
40
-        ]);
41
-        if (count(glsr()->reviewTypes) > 1) {
42
-            $this->renderField('select', [
43
-                'class' => 'widefat',
44
-                'label' => __('Which type of review would you like to display?', 'site-reviews'),
45
-                'name' => 'type',
46
-                'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
-            ]);
48
-        }
49
-        if (!empty($terms)) {
50
-            $this->renderField('select', [
51
-                'class' => 'widefat',
52
-                'label' => __('Limit reviews to this category', 'site-reviews'),
53
-                'name' => 'category',
54
-                'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
-            ]);
56
-        }
57
-        $this->renderField('text', [
58
-            'class' => 'widefat',
59
-            'default' => '',
60
-            'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
-            'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
62
-            'name' => 'assigned_to',
63
-        ]);
64
-        $this->renderField('text', [
65
-            'class' => 'widefat',
66
-            'label' => __('Enter any custom CSS classes here', 'site-reviews'),
67
-            'name' => 'class',
68
-        ]);
69
-        $this->renderField('checkbox', [
70
-            'name' => 'hide',
71
-            'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
-        ]);
73
-    }
10
+	/**
11
+	 * @param array $instance
12
+	 * @return void
13
+	 */
14
+	public function form($instance)
15
+	{
16
+		$this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
+		$terms = glsr(Database::class)->getTerms();
18
+		$this->renderField('text', [
19
+			'class' => 'widefat',
20
+			'label' => __('Title', 'site-reviews'),
21
+			'name' => 'title',
22
+		]);
23
+		$this->renderField('number', [
24
+			'class' => 'small-text',
25
+			'default' => 10,
26
+			'label' => __('How many reviews would you like to display?', 'site-reviews'),
27
+			'max' => 100,
28
+			'name' => 'display',
29
+		]);
30
+		$this->renderField('select', [
31
+			'label' => __('What is the minimum rating to display?', 'site-reviews'),
32
+			'name' => 'rating',
33
+			'options' => [
34
+				'5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
+				'4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
+				'3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
+				'2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
+				'1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
39
+			],
40
+		]);
41
+		if (count(glsr()->reviewTypes) > 1) {
42
+			$this->renderField('select', [
43
+				'class' => 'widefat',
44
+				'label' => __('Which type of review would you like to display?', 'site-reviews'),
45
+				'name' => 'type',
46
+				'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
+			]);
48
+		}
49
+		if (!empty($terms)) {
50
+			$this->renderField('select', [
51
+				'class' => 'widefat',
52
+				'label' => __('Limit reviews to this category', 'site-reviews'),
53
+				'name' => 'category',
54
+				'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
+			]);
56
+		}
57
+		$this->renderField('text', [
58
+			'class' => 'widefat',
59
+			'default' => '',
60
+			'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
+			'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
62
+			'name' => 'assigned_to',
63
+		]);
64
+		$this->renderField('text', [
65
+			'class' => 'widefat',
66
+			'label' => __('Enter any custom CSS classes here', 'site-reviews'),
67
+			'name' => 'class',
68
+		]);
69
+		$this->renderField('checkbox', [
70
+			'name' => 'hide',
71
+			'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
+		]);
73
+	}
74 74
 
75
-    /**
76
-     * @param array $newInstance
77
-     * @param array $oldInstance
78
-     * @return array
79
-     */
80
-    public function update($newInstance, $oldInstance)
81
-    {
82
-        if (!is_numeric($newInstance['display'])) {
83
-            $newInstance['display'] = 10;
84
-        }
85
-        $newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
-        return parent::update($newInstance, $oldInstance);
87
-    }
75
+	/**
76
+	 * @param array $newInstance
77
+	 * @param array $oldInstance
78
+	 * @return array
79
+	 */
80
+	public function update($newInstance, $oldInstance)
81
+	{
82
+		if (!is_numeric($newInstance['display'])) {
83
+			$newInstance['display'] = 10;
84
+		}
85
+		$newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
+		return parent::update($newInstance, $oldInstance);
87
+	}
88 88
 
89
-    /**
90
-     * @param array $args
91
-     * @param array $instance
92
-     * @return void
93
-     */
94
-    public function widget($args, $instance)
95
-    {
96
-        echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
97
-    }
89
+	/**
90
+	 * @param array $args
91
+	 * @param array $instance
92
+	 * @return void
93
+	 */
94
+	public function widget($args, $instance)
95
+	{
96
+		echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@  discard block
 block discarded – undo
11 11
      * @param array $instance
12 12
      * @return void
13 13
      */
14
-    public function form($instance)
14
+    public function form( $instance )
15 15
     {
16
-        $this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
-        $terms = glsr(Database::class)->getTerms();
18
-        $this->renderField('text', [
16
+        $this->widgetArgs = glsr( SiteReviewsShortcode::class )->normalizeAtts( $instance );
17
+        $terms = glsr( Database::class )->getTerms();
18
+        $this->renderField( 'text', [
19 19
             'class' => 'widefat',
20
-            'label' => __('Title', 'site-reviews'),
20
+            'label' => __( 'Title', 'site-reviews' ),
21 21
             'name' => 'title',
22
-        ]);
23
-        $this->renderField('number', [
22
+        ] );
23
+        $this->renderField( 'number', [
24 24
             'class' => 'small-text',
25 25
             'default' => 10,
26
-            'label' => __('How many reviews would you like to display?', 'site-reviews'),
26
+            'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
27 27
             'max' => 100,
28 28
             'name' => 'display',
29
-        ]);
30
-        $this->renderField('select', [
31
-            'label' => __('What is the minimum rating to display?', 'site-reviews'),
29
+        ] );
30
+        $this->renderField( 'select', [
31
+            'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
32 32
             'name' => 'rating',
33 33
             'options' => [
34
-                '5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
-                '4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
-                '3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
-                '2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
-                '1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
34
+                '5' => sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ),
35
+                '4' => sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ),
36
+                '3' => sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ),
37
+                '2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
38
+                '1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
39 39
             ],
40
-        ]);
41
-        if (count(glsr()->reviewTypes) > 1) {
42
-            $this->renderField('select', [
40
+        ] );
41
+        if( count( glsr()->reviewTypes ) > 1 ) {
42
+            $this->renderField( 'select', [
43 43
                 'class' => 'widefat',
44
-                'label' => __('Which type of review would you like to display?', 'site-reviews'),
44
+                'label' => __( 'Which type of review would you like to display?', 'site-reviews' ),
45 45
                 'name' => 'type',
46
-                'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
-            ]);
46
+                'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
47
+            ] );
48 48
         }
49
-        if (!empty($terms)) {
50
-            $this->renderField('select', [
49
+        if( !empty($terms) ) {
50
+            $this->renderField( 'select', [
51 51
                 'class' => 'widefat',
52
-                'label' => __('Limit reviews to this category', 'site-reviews'),
52
+                'label' => __( 'Limit reviews to this category', 'site-reviews' ),
53 53
                 'name' => 'category',
54
-                'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
-            ]);
54
+                'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
55
+            ] );
56 56
         }
57
-        $this->renderField('text', [
57
+        $this->renderField( 'text', [
58 58
             'class' => 'widefat',
59 59
             'default' => '',
60
-            'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
-            'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
60
+            'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
61
+            'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
62 62
             'name' => 'assigned_to',
63
-        ]);
64
-        $this->renderField('text', [
63
+        ] );
64
+        $this->renderField( 'text', [
65 65
             'class' => 'widefat',
66
-            'label' => __('Enter any custom CSS classes here', 'site-reviews'),
66
+            'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
67 67
             'name' => 'class',
68
-        ]);
69
-        $this->renderField('checkbox', [
68
+        ] );
69
+        $this->renderField( 'checkbox', [
70 70
             'name' => 'hide',
71
-            'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
-        ]);
71
+            'options' => glsr( SiteReviewsShortcode::class )->getHideOptions(),
72
+        ] );
73 73
     }
74 74
 
75 75
     /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
      * @param array $oldInstance
78 78
      * @return array
79 79
      */
80
-    public function update($newInstance, $oldInstance)
80
+    public function update( $newInstance, $oldInstance )
81 81
     {
82
-        if (!is_numeric($newInstance['display'])) {
82
+        if( !is_numeric( $newInstance['display'] ) ) {
83 83
             $newInstance['display'] = 10;
84 84
         }
85
-        $newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
-        return parent::update($newInstance, $oldInstance);
85
+        $newInstance['display'] = min( 50, max( 0, intval( $newInstance['display'] ) ) );
86
+        return parent::update( $newInstance, $oldInstance );
87 87
     }
88 88
 
89 89
     /**
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
      * @param array $instance
92 92
      * @return void
93 93
      */
94
-    public function widget($args, $instance)
94
+    public function widget( $args, $instance )
95 95
     {
96
-        echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
96
+        echo glsr( SiteReviewsShortcode::class )->build( $instance, $args, 'widget' );
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsPopup.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -4,84 +4,84 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
23
-            'maxLength' => 5,
24
-            'name' => 'display',
25
-            'size' => 3,
26
-            'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
31
-            'name' => 'rating',
32
-            'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
39
-            ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
-            'type' => 'listbox',
42
-        ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
44
-            'name' => 'pagination',
45
-            'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
49
-            ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
-            'type' => 'listbox',
52
-        ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
-        [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
57
-            'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
-            'type' => 'textbox',
60
-        ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
62
-            'name' => 'schema',
63
-            'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
-            ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
-            'type' => 'listbox',
69
-        ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
71
-            'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
-            'type' => 'textbox',
74
-        ], [
75
-            'columns' => 2,
76
-            'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
78
-            'layout' => 'grid',
79
-            'spacing' => 5,
80
-            'type' => 'container',
81
-        ], [
82
-            'hidden' => true,
83
-            'name' => 'id',
84
-            'type' => 'textbox',
85
-        ], ];
86
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		], [
22
+			'label' => esc_html__('Display', 'site-reviews'),
23
+			'maxLength' => 5,
24
+			'name' => 'display',
25
+			'size' => 3,
26
+			'text' => '10',
27
+			'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Rating', 'site-reviews'),
31
+			'name' => 'rating',
32
+			'options' => [
33
+				'5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
+				'4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
+				'3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
+				'2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
+				'1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
+				'0' => esc_html(__('Unrated', 'site-reviews')),
39
+			],
40
+			'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
+			'type' => 'listbox',
42
+		], [
43
+			'label' => esc_html__('Pagination', 'site-reviews'),
44
+			'name' => 'pagination',
45
+			'options' => [
46
+				'true' => esc_html__('Enable', 'site-reviews'),
47
+				'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
+				'false' => esc_html__('Disable', 'site-reviews'),
49
+			],
50
+			'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
+			'type' => 'listbox',
52
+		],
53
+		$this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
+		[
56
+			'label' => esc_html__('Assigned To', 'site-reviews'),
57
+			'name' => 'assigned_to',
58
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
+			'type' => 'textbox',
60
+		], [
61
+			'label' => esc_html__('Schema', 'site-reviews'),
62
+			'name' => 'schema',
63
+			'options' => [
64
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
+			],
67
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
+			'type' => 'listbox',
69
+		], [
70
+			'label' => esc_html__('Classes', 'site-reviews'),
71
+			'name' => 'class',
72
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
+			'type' => 'textbox',
74
+		], [
75
+			'columns' => 2,
76
+			'items' => $this->getHideOptions(),
77
+			'label' => esc_html__('Hide', 'site-reviews'),
78
+			'layout' => 'grid',
79
+			'spacing' => 5,
80
+			'type' => 'container',
81
+		], [
82
+			'hidden' => true,
83
+			'name' => 'id',
84
+			'type' => 'textbox',
85
+		], ];
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
22
+            'label' => esc_html__( 'Display', 'site-reviews' ),
23 23
             'maxLength' => 5,
24 24
             'name' => 'display',
25 25
             'size' => 3,
26 26
             'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
27
+            'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
30
+            'label' => esc_html__( 'Rating', 'site-reviews' ),
31 31
             'name' => 'rating',
32 32
             'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
33
+                '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
34
+                '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
35
+                '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
36
+                '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
37
+                '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
38
+                '0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
39 39
             ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
40
+            'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
41 41
             'type' => 'listbox',
42 42
         ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
43
+            'label' => esc_html__( 'Pagination', 'site-reviews' ),
44 44
             'name' => 'pagination',
45 45
             'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
46
+                'true' => esc_html__( 'Enable', 'site-reviews' ),
47
+                'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
48
+                'false' => esc_html__( 'Disable', 'site-reviews' ),
49 49
             ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
50
+            'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
51 51
             'type' => 'listbox',
52 52
         ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
53
+        $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ),
54
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
55 55
         [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
56
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
57 57
             'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
58
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
59 59
             'type' => 'textbox',
60 60
         ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
61
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
62 62
             'name' => 'schema',
63 63
             'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
64
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
65
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
66 66
             ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
67
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
68 68
             'type' => 'listbox',
69 69
         ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
70
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
71 71
             'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
72
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
73 73
             'type' => 'textbox',
74 74
         ], [
75 75
             'columns' => 2,
76 76
             'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
77
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
78 78
             'layout' => 'grid',
79 79
             'spacing' => 5,
80 80
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Controllers/WelcomeController.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,97 +8,97 @@
 block discarded – undo
8 8
 
9 9
 class WelcomeController extends Controller
10 10
 {
11
-    /**
12
-     * @return array
13
-     * @filter plugin_action_links_site-reviews/site-reviews.php
14
-     */
15
-    public function filterActionLinks(array $links)
16
-    {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
20
-        return $links;
21
-    }
11
+	/**
12
+	 * @return array
13
+	 * @filter plugin_action_links_site-reviews/site-reviews.php
14
+	 */
15
+	public function filterActionLinks(array $links)
16
+	{
17
+		$links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
+			'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
+		]);
20
+		return $links;
21
+	}
22 22
 
23
-    /**
24
-     * @return string
25
-     * @filter admin_title
26
-     */
27
-    public function filterAdminTitle($title)
28
-    {
29
-        return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
-            : $title;
32
-    }
23
+	/**
24
+	 * @return string
25
+	 * @filter admin_title
26
+	 */
27
+	public function filterAdminTitle($title)
28
+	{
29
+		return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
+			? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
+			: $title;
32
+	}
33 33
 
34
-    /**
35
-     * @param string $text
36
-     * @return string
37
-     * @filter admin_footer_text
38
-     */
39
-    public function filterFooterText($text)
40
-    {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
-            return $text;
43
-        }
44
-        $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
-            '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
-            '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
50
-    }
34
+	/**
35
+	 * @param string $text
36
+	 * @return string
37
+	 * @filter admin_footer_text
38
+	 */
39
+	public function filterFooterText($text)
40
+	{
41
+		if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
+			return $text;
43
+		}
44
+		$url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
+		return wp_kses_post(sprintf(
46
+			__('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
+			'<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
+			'<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
+		));
50
+	}
51 51
 
52
-    /**
53
-     * @param string $plugin
54
-     * @param bool $isNetworkActivation
55
-     * @return void
56
-     * @action activated_plugin
57
-     */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
59
-    {
60
-        if (!$isNetworkActivation
61
-            && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
-            exit;
65
-        }
66
-    }
52
+	/**
53
+	 * @param string $plugin
54
+	 * @param bool $isNetworkActivation
55
+	 * @return void
56
+	 * @action activated_plugin
57
+	 */
58
+	public function redirectOnActivation($plugin, $isNetworkActivation)
59
+	{
60
+		if (!$isNetworkActivation
61
+			&& 'cli' !== php_sapi_name()
62
+			&& $plugin === plugin_basename(glsr()->file)) {
63
+			wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
+			exit;
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     * @action admin_menu
71
-     */
72
-    public function registerPage()
73
-    {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
-            glsr()->name,
77
-            glsr()->getPermission('welcome'),
78
-            'welcome',
79
-            [$this, 'renderPage']
80
-        );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
-    }
68
+	/**
69
+	 * @return void
70
+	 * @action admin_menu
71
+	 */
72
+	public function registerPage()
73
+	{
74
+		add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
+			sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
+			glsr()->name,
77
+			glsr()->getPermission('welcome'),
78
+			'welcome',
79
+			[$this, 'renderPage']
80
+		);
81
+		remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
+	}
83 83
 
84
-    /**
85
-     * @return void
86
-     * @see $this->registerPage()
87
-     * @callback add_submenu_page
88
-     */
89
-    public function renderPage()
90
-    {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
98
-            'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
100
-            'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
103
-    }
84
+	/**
85
+	 * @return void
86
+	 * @see $this->registerPage()
87
+	 * @callback add_submenu_page
88
+	 */
89
+	public function renderPage()
90
+	{
91
+		$tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
+			'getting-started' => __('Getting Started', 'site-reviews'),
93
+			'whatsnew' => __('What\'s New', 'site-reviews'),
94
+			'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
+			'support' => __('Support', 'site-reviews'),
96
+		]);
97
+		glsr()->render('pages/welcome/index', [
98
+			'data' => ['context' => []],
99
+			'http_referer' => (string) wp_get_referer(),
100
+			'tabs' => $tabs,
101
+			'template' => glsr(Template::class),
102
+		]);
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
      * @return array
13 13
      * @filter plugin_action_links_site-reviews/site-reviews.php
14 14
      */
15
-    public function filterActionLinks(array $links)
15
+    public function filterActionLinks( array $links )
16 16
     {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
17
+        $links['welcome'] = glsr( Builder::class )->a( __( 'About', 'site-reviews' ), [
18
+            'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ),
19
+        ] );
20 20
         return $links;
21 21
     }
22 22
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      * @return string
25 25
      * @filter admin_title
26 26
      */
27
-    public function filterAdminTitle($title)
27
+    public function filterAdminTitle( $title )
28 28
     {
29 29
         return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
30
+            ? sprintf( __( 'Welcome to %s &#8212; WordPress', 'site-reviews' ), glsr()->name )
31 31
             : $title;
32 32
     }
33 33
 
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
      * @return string
37 37
      * @filter admin_footer_text
38 38
      */
39
-    public function filterFooterText($text)
39
+    public function filterFooterText( $text )
40 40
     {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
41
+        if( Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id ) {
42 42
             return $text;
43 43
         }
44 44
         $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
45
+        return wp_kses_post( sprintf(
46
+            __( 'Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews' ),
47 47
             '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48 48
             '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
49
+        ) );
50 50
     }
51 51
 
52 52
     /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      * @return void
56 56
      * @action activated_plugin
57 57
      */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
58
+    public function redirectOnActivation( $plugin, $isNetworkActivation )
59 59
     {
60
-        if (!$isNetworkActivation
60
+        if( !$isNetworkActivation
61 61
             && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
62
+            && $plugin === plugin_basename( glsr()->file ) ) {
63
+            wp_safe_redirect( admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ) );
64 64
             exit;
65 65
         }
66 66
     }
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function registerPage()
73 73
     {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
74
+        add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE,
75
+            sprintf( __( 'Welcome to %s', 'site-reviews' ), glsr()->name ),
76 76
             glsr()->name,
77
-            glsr()->getPermission('welcome'),
77
+            glsr()->getPermission( 'welcome' ),
78 78
             'welcome',
79 79
             [$this, 'renderPage']
80 80
         );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
81
+        remove_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, 'welcome' );
82 82
     }
83 83
 
84 84
     /**
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function renderPage()
90 90
     {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
91
+        $tabs = apply_filters( 'site-reviews/addon/welcome/tabs', [
92
+            'getting-started' => __( 'Getting Started', 'site-reviews' ),
93
+            'whatsnew' => __( 'What\'s New', 'site-reviews' ),
94
+            'upgrade-guide' => __( 'Upgrade Guide', 'site-reviews' ),
95
+            'support' => __( 'Support', 'site-reviews' ),
96
+        ] );
97
+        glsr()->render( 'pages/welcome/index', [
98 98
             'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
99
+            'http_referer' => (string)wp_get_referer(),
100 100
             'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
101
+            'template' => glsr( Template::class ),
102
+        ] );
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
plugin/Controllers/NoticeController.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -8,124 +8,124 @@
 block discarded – undo
8 8
 
9 9
 class NoticeController extends Controller
10 10
 {
11
-    const USER_META_KEY = '_glsr_notices';
11
+	const USER_META_KEY = '_glsr_notices';
12 12
 
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $dismissValuesMap;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $dismissValuesMap;
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
23
-        ];
24
-    }
18
+	public function __construct()
19
+	{
20
+		$this->dismissValuesMap = [
21
+			'rebusify' => glsr()->version('major'),
22
+			'welcome' => glsr()->version('minor'),
23
+		];
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     * @action admin_notices
29
-     */
30
-    public function filterAdminNotices()
31
-    {
32
-        $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
36
-    }
26
+	/**
27
+	 * @return void
28
+	 * @action admin_notices
29
+	 */
30
+	public function filterAdminNotices()
31
+	{
32
+		$screen = glsr_current_screen();
33
+		$this->renderWelcomeNotice($screen->post_type);
34
+		$this->renderRebusifyNotice($screen->post_type);
35
+		$this->renderAddonsNotice($screen->id);
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function routerDismissNotice(array $request)
42
-    {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
45
-        }
46
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function routerDismissNotice(array $request)
42
+	{
43
+		if ($key = Arr::get($request, 'notice')) {
44
+			$this->dismissNotice($key);
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param string $key
50
-     * @return void
51
-     */
52
-    protected function dismissNotice($key)
53
-    {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
55
-    }
48
+	/**
49
+	 * @param string $key
50
+	 * @return void
51
+	 */
52
+	protected function dismissNotice($key)
53
+	{
54
+		$this->setUserMeta($key, $this->getVersionFor($key));
55
+	}
56 56
 
57
-    /**
58
-     * @param string $key
59
-     * @param mixed $fallback
60
-     * @return mixed
61
-     */
62
-    protected function getUserMeta($key, $fallback)
63
-    {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
66
-    }
57
+	/**
58
+	 * @param string $key
59
+	 * @param mixed $fallback
60
+	 * @return mixed
61
+	 */
62
+	protected function getUserMeta($key, $fallback)
63
+	{
64
+		$meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
+		return Arr::get($meta, $key, $fallback);
66
+	}
67 67
 
68
-    /**
69
-     * @param string $noticeKey
70
-     * @return string
71
-     */
72
-    protected function getVersionFor($noticeKey)
73
-    {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
-    }
68
+	/**
69
+	 * @param string $noticeKey
70
+	 * @return string
71
+	 */
72
+	protected function getVersionFor($noticeKey)
73
+	{
74
+		return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
+	}
76 76
 
77
-    /**
78
-     * @param string $screenId
79
-     * @return void
80
-     */
81
-    protected function renderAddonsNotice($screenId)
82
-    {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            echo glsr()->render('partials/notices/addons');
85
-        }
86
-    }
77
+	/**
78
+	 * @param string $screenId
79
+	 * @return void
80
+	 */
81
+	protected function renderAddonsNotice($screenId)
82
+	{
83
+		if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
+			echo glsr()->render('partials/notices/addons');
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * @param string $screenPostType
90
-     * @return void
91
-     */
92
-    protected function renderRebusifyNotice($screenPostType)
93
-    {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            echo glsr()->render('partials/notices/rebusify');
98
-        }
99
-    }
88
+	/**
89
+	 * @param string $screenPostType
90
+	 * @return void
91
+	 */
92
+	protected function renderRebusifyNotice($screenPostType)
93
+	{
94
+		if (Application::POST_TYPE == $screenPostType
95
+			&& version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
+			&& !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
+			echo glsr()->render('partials/notices/rebusify');
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * @param string $screenPostType
103
-     * @return void
104
-     */
105
-    protected function renderWelcomeNotice($screenPostType)
106
-    {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            echo glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
115
-        }
116
-    }
101
+	/**
102
+	 * @param string $screenPostType
103
+	 * @return void
104
+	 */
105
+	protected function renderWelcomeNotice($screenPostType)
106
+	{
107
+		if (Application::POST_TYPE == $screenPostType
108
+			&& version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
+			$welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
+				? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
+				: __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
+			echo glsr()->render('partials/notices/welcome', [
113
+				'text' => sprintf($welcomeText, glsr()->version),
114
+			]);
115
+		}
116
+	}
117 117
 
118
-    /**
119
-     * @param string $key
120
-     * @param mixed $fallback
121
-     * @return mixed
122
-     */
123
-    protected function setUserMeta($key, $value)
124
-    {
125
-        $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
128
-        $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
130
-    }
118
+	/**
119
+	 * @param string $key
120
+	 * @param mixed $fallback
121
+	 * @return mixed
122
+	 */
123
+	protected function setUserMeta($key, $value)
124
+	{
125
+		$userId = get_current_user_id();
126
+		$meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
+		$meta = array_filter(wp_parse_args($meta, []));
128
+		$meta[$key] = $value;
129
+		update_user_meta($userId, static::USER_META_KEY, $meta);
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
21
+            'rebusify' => glsr()->version( 'major' ),
22
+            'welcome' => glsr()->version( 'minor' ),
23 23
         ];
24 24
     }
25 25
 
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
     public function filterAdminNotices()
31 31
     {
32 32
         $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
33
+        $this->renderWelcomeNotice( $screen->post_type );
34
+        $this->renderRebusifyNotice( $screen->post_type );
35
+        $this->renderAddonsNotice( $screen->id );
36 36
     }
37 37
 
38 38
     /**
39 39
      * @return void
40 40
      */
41
-    public function routerDismissNotice(array $request)
41
+    public function routerDismissNotice( array $request )
42 42
     {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
43
+        if( $key = Arr::get( $request, 'notice' ) ) {
44
+            $this->dismissNotice( $key );
45 45
         }
46 46
     }
47 47
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @param string $key
50 50
      * @return void
51 51
      */
52
-    protected function dismissNotice($key)
52
+    protected function dismissNotice( $key )
53 53
     {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
54
+        $this->setUserMeta( $key, $this->getVersionFor( $key ) );
55 55
     }
56 56
 
57 57
     /**
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
      * @param mixed $fallback
60 60
      * @return mixed
61 61
      */
62
-    protected function getUserMeta($key, $fallback)
62
+    protected function getUserMeta( $key, $fallback )
63 63
     {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
64
+        $meta = get_user_meta( get_current_user_id(), static::USER_META_KEY, true );
65
+        return Arr::get( $meta, $key, $fallback );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @param string $noticeKey
70 70
      * @return string
71 71
      */
72
-    protected function getVersionFor($noticeKey)
72
+    protected function getVersionFor( $noticeKey )
73 73
     {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
74
+        return Arr::get( $this->dismissValuesMap, $noticeKey, glsr()->version( 'major' ) );
75 75
     }
76 76
 
77 77
     /**
78 78
      * @param string $screenId
79 79
      * @return void
80 80
      */
81
-    protected function renderAddonsNotice($screenId)
81
+    protected function renderAddonsNotice( $screenId )
82 82
     {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            echo glsr()->render('partials/notices/addons');
83
+        if( Application::POST_TYPE.'_page_addons' == $screenId ) {
84
+            echo glsr()->render( 'partials/notices/addons' );
85 85
         }
86 86
     }
87 87
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      * @param string $screenPostType
90 90
      * @return void
91 91
      */
92
-    protected function renderRebusifyNotice($screenPostType)
92
+    protected function renderRebusifyNotice( $screenPostType )
93 93
     {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            echo glsr()->render('partials/notices/rebusify');
94
+        if( Application::POST_TYPE == $screenPostType
95
+            && version_compare( $this->getVersionFor( 'rebusify' ), $this->getUserMeta( 'rebusify', 0 ), '>' )
96
+            && !glsr( OptionManager::class )->getBool( 'settings.general.rebusify' ) ) {
97
+            echo glsr()->render( 'partials/notices/rebusify' );
98 98
         }
99 99
     }
100 100
 
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
      * @param string $screenPostType
103 103
      * @return void
104 104
      */
105
-    protected function renderWelcomeNotice($screenPostType)
105
+    protected function renderWelcomeNotice( $screenPostType )
106 106
     {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            echo glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
107
+        if( Application::POST_TYPE == $screenPostType
108
+            && version_compare( $this->getVersionFor( 'welcome' ), $this->getUserMeta( 'welcome', 0 ), '>' ) ) {
109
+            $welcomeText = '0.0.0' == glsr( OptionManager::class )->get( 'version_upgraded_from' )
110
+                ? __( 'Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews' )
111
+                : __( 'Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews' );
112
+            echo glsr()->render( 'partials/notices/welcome', [
113
+                'text' => sprintf( $welcomeText, glsr()->version ),
114
+            ] );
115 115
         }
116 116
     }
117 117
 
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
      * @param mixed $fallback
121 121
      * @return mixed
122 122
      */
123
-    protected function setUserMeta($key, $value)
123
+    protected function setUserMeta( $key, $value )
124 124
     {
125 125
         $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
126
+        $meta = (array)get_user_meta( $userId, static::USER_META_KEY, true );
127
+        $meta = array_filter( wp_parse_args( $meta, [] ) );
128 128
         $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
129
+        update_user_meta( $userId, static::USER_META_KEY, $meta );
130 130
     }
131 131
 }
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 2 patches
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -14,189 +14,189 @@
 block discarded – undo
14 14
 
15 15
 class MenuController extends Controller
16 16
 {
17
-    /**
18
-     * @return void
19
-     * @action admin_menu
20
-     */
21
-    public function registerMenuCount()
22
-    {
23
-        global $menu, $typenow;
24
-        foreach ($menu as $key => $value) {
25
-            if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
26
-                continue;
27
-            }
28
-            $postCount = wp_count_posts(Application::POST_TYPE);
29
-            $pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
30
-                'class' => 'unapproved-count',
31
-            ]);
32
-            $awaitingModeration = glsr(Builder::class)->span($pendingCount, [
33
-                'class' => 'awaiting-mod count-'.$postCount->pending,
34
-            ]);
35
-            $menu[$key][0].= ' '.$awaitingModeration;
36
-            if (Application::POST_TYPE === $typenow) {
37
-                $menu[$key][4].= ' current';
38
-            }
39
-            break;
40
-        }
41
-    }
17
+	/**
18
+	 * @return void
19
+	 * @action admin_menu
20
+	 */
21
+	public function registerMenuCount()
22
+	{
23
+		global $menu, $typenow;
24
+		foreach ($menu as $key => $value) {
25
+			if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
26
+				continue;
27
+			}
28
+			$postCount = wp_count_posts(Application::POST_TYPE);
29
+			$pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
30
+				'class' => 'unapproved-count',
31
+			]);
32
+			$awaitingModeration = glsr(Builder::class)->span($pendingCount, [
33
+				'class' => 'awaiting-mod count-'.$postCount->pending,
34
+			]);
35
+			$menu[$key][0].= ' '.$awaitingModeration;
36
+			if (Application::POST_TYPE === $typenow) {
37
+				$menu[$key][4].= ' current';
38
+			}
39
+			break;
40
+		}
41
+	}
42 42
 
43
-    /**
44
-     * @return void
45
-     * @action admin_menu
46
-     */
47
-    public function registerSubMenus()
48
-    {
49
-        $pages = $this->parseWithFilter('submenu/pages', [
50
-            'settings' => __('Settings', 'site-reviews'),
51
-            'tools' => __('Tools', 'site-reviews'),
52
-            'addons' => __('Add-ons', 'site-reviews'),
53
-            'documentation' => __('Help', 'site-reviews'),
54
-        ]);
55
-        foreach ($pages as $slug => $title) {
56
-            $method = Helper::buildMethodName('render-'.$slug.'-menu');
57
-            $callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
-            if (!is_callable($callback)) {
59
-                continue;
60
-            }
61
-            add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
62
-        }
63
-    }
43
+	/**
44
+	 * @return void
45
+	 * @action admin_menu
46
+	 */
47
+	public function registerSubMenus()
48
+	{
49
+		$pages = $this->parseWithFilter('submenu/pages', [
50
+			'settings' => __('Settings', 'site-reviews'),
51
+			'tools' => __('Tools', 'site-reviews'),
52
+			'addons' => __('Add-ons', 'site-reviews'),
53
+			'documentation' => __('Help', 'site-reviews'),
54
+		]);
55
+		foreach ($pages as $slug => $title) {
56
+			$method = Helper::buildMethodName('render-'.$slug.'-menu');
57
+			$callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
+			if (!is_callable($callback)) {
59
+				continue;
60
+			}
61
+			add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
62
+		}
63
+	}
64 64
 
65
-    /**
66
-     * @return void
67
-     * @see $this->registerSubMenus()
68
-     * @callback add_submenu_page
69
-     */
70
-    public function renderAddonsMenu()
71
-    {
72
-        $this->renderPage('addons', [
73
-            'template' => glsr(Template::class),
74
-        ]);
75
-    }
65
+	/**
66
+	 * @return void
67
+	 * @see $this->registerSubMenus()
68
+	 * @callback add_submenu_page
69
+	 */
70
+	public function renderAddonsMenu()
71
+	{
72
+		$this->renderPage('addons', [
73
+			'template' => glsr(Template::class),
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @return void
79
-     * @see $this->registerSubMenus()
80
-     * @callback add_submenu_page
81
-     */
82
-    public function renderDocumentationMenu()
83
-    {
84
-        $tabs = $this->parseWithFilter('documentation/tabs', [
85
-            'support' => __('Support', 'site-reviews'),
86
-            'faq' => __('FAQ', 'site-reviews'),
87
-            'shortcodes' => __('Shortcodes', 'site-reviews'),
88
-            'hooks' => __('Hooks', 'site-reviews'),
89
-            'functions' => __('Functions', 'site-reviews'),
90
-            'addons' => __('Addons', 'site-reviews'),
91
-        ]);
92
-        $addons = apply_filters('site-reviews/addon/documentation', []);
93
-        ksort($addons);
94
-        if (empty($addons)) {
95
-            unset($tabs['addons']);
96
-        }
97
-        $this->renderPage('documentation', [
98
-            'addons' => $addons,
99
-            'tabs' => $tabs,
100
-        ]);
101
-    }
77
+	/**
78
+	 * @return void
79
+	 * @see $this->registerSubMenus()
80
+	 * @callback add_submenu_page
81
+	 */
82
+	public function renderDocumentationMenu()
83
+	{
84
+		$tabs = $this->parseWithFilter('documentation/tabs', [
85
+			'support' => __('Support', 'site-reviews'),
86
+			'faq' => __('FAQ', 'site-reviews'),
87
+			'shortcodes' => __('Shortcodes', 'site-reviews'),
88
+			'hooks' => __('Hooks', 'site-reviews'),
89
+			'functions' => __('Functions', 'site-reviews'),
90
+			'addons' => __('Addons', 'site-reviews'),
91
+		]);
92
+		$addons = apply_filters('site-reviews/addon/documentation', []);
93
+		ksort($addons);
94
+		if (empty($addons)) {
95
+			unset($tabs['addons']);
96
+		}
97
+		$this->renderPage('documentation', [
98
+			'addons' => $addons,
99
+			'tabs' => $tabs,
100
+		]);
101
+	}
102 102
 
103
-    /**
104
-     * @return void
105
-     * @see $this->registerSubMenus()
106
-     * @callback add_submenu_page
107
-     */
108
-    public function renderSettingsMenu()
109
-    {
110
-        $tabs = $this->parseWithFilter('settings/tabs', [
111
-            'general' => __('General', 'site-reviews'),
112
-            'reviews' => __('Reviews', 'site-reviews'),
113
-            'submissions' => __('Submissions', 'site-reviews'),
114
-            'schema' => __('Schema', 'site-reviews'),
115
-            'translations' => __('Translations', 'site-reviews'),
116
-            'addons' => __('Addons', 'site-reviews'),
117
-            'licenses' => __('Licenses', 'site-reviews'),
118
-        ]);
119
-        if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
120
-            unset($tabs['addons']);
121
-        }
122
-        if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
123
-            unset($tabs['licenses']);
124
-        }
125
-        $this->renderPage('settings', [
126
-            'settings' => glsr(Settings::class),
127
-            'tabs' => $tabs,
128
-        ]);
129
-    }
103
+	/**
104
+	 * @return void
105
+	 * @see $this->registerSubMenus()
106
+	 * @callback add_submenu_page
107
+	 */
108
+	public function renderSettingsMenu()
109
+	{
110
+		$tabs = $this->parseWithFilter('settings/tabs', [
111
+			'general' => __('General', 'site-reviews'),
112
+			'reviews' => __('Reviews', 'site-reviews'),
113
+			'submissions' => __('Submissions', 'site-reviews'),
114
+			'schema' => __('Schema', 'site-reviews'),
115
+			'translations' => __('Translations', 'site-reviews'),
116
+			'addons' => __('Addons', 'site-reviews'),
117
+			'licenses' => __('Licenses', 'site-reviews'),
118
+		]);
119
+		if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
120
+			unset($tabs['addons']);
121
+		}
122
+		if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
123
+			unset($tabs['licenses']);
124
+		}
125
+		$this->renderPage('settings', [
126
+			'settings' => glsr(Settings::class),
127
+			'tabs' => $tabs,
128
+		]);
129
+	}
130 130
 
131
-    /**
132
-     * @return void
133
-     * @see $this->registerSubMenus()
134
-     * @callback add_submenu_page
135
-     */
136
-    public function renderToolsMenu()
137
-    {
138
-        $tabs = $this->parseWithFilter('tools/tabs', [
139
-            'general' => __('General', 'site-reviews'),
140
-            'sync' => __('Sync Reviews', 'site-reviews'),
141
-            'console' => __('Console', 'site-reviews'),
142
-            'system-info' => __('System Info', 'site-reviews'),
143
-        ]);
144
-        if (!apply_filters('site-reviews/addon/sync/enable', false)) {
145
-            unset($tabs['sync']);
146
-        }
147
-        $this->renderPage('tools', [
148
-            'data' => [
149
-                'context' => [
150
-                    'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
-                    'console' => strval(glsr(Console::class)),
152
-                    'id' => Application::ID,
153
-                    'system' => strval(glsr(System::class)),
154
-                ],
155
-                'services' => apply_filters('site-reviews/addon/sync/services', []),
156
-            ],
157
-            'tabs' => $tabs,
158
-            'template' => glsr(Template::class),
159
-        ]);
160
-    }
131
+	/**
132
+	 * @return void
133
+	 * @see $this->registerSubMenus()
134
+	 * @callback add_submenu_page
135
+	 */
136
+	public function renderToolsMenu()
137
+	{
138
+		$tabs = $this->parseWithFilter('tools/tabs', [
139
+			'general' => __('General', 'site-reviews'),
140
+			'sync' => __('Sync Reviews', 'site-reviews'),
141
+			'console' => __('Console', 'site-reviews'),
142
+			'system-info' => __('System Info', 'site-reviews'),
143
+		]);
144
+		if (!apply_filters('site-reviews/addon/sync/enable', false)) {
145
+			unset($tabs['sync']);
146
+		}
147
+		$this->renderPage('tools', [
148
+			'data' => [
149
+				'context' => [
150
+					'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
+					'console' => strval(glsr(Console::class)),
152
+					'id' => Application::ID,
153
+					'system' => strval(glsr(System::class)),
154
+				],
155
+				'services' => apply_filters('site-reviews/addon/sync/services', []),
156
+			],
157
+			'tabs' => $tabs,
158
+			'template' => glsr(Template::class),
159
+		]);
160
+	}
161 161
 
162
-    /**
163
-     * @return void
164
-     * @action admin_init
165
-     */
166
-    public function setCustomPermissions()
167
-    {
168
-        foreach (wp_roles()->roles as $role => $value) {
169
-            wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
170
-        }
171
-    }
162
+	/**
163
+	 * @return void
164
+	 * @action admin_init
165
+	 */
166
+	public function setCustomPermissions()
167
+	{
168
+		foreach (wp_roles()->roles as $role => $value) {
169
+			wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
170
+		}
171
+	}
172 172
 
173
-    /**
174
-     * @return string
175
-     */
176
-    protected function getNotices()
177
-    {
178
-        return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
179
-            'id' => 'glsr-notices',
180
-        ]);
181
-    }
173
+	/**
174
+	 * @return string
175
+	 */
176
+	protected function getNotices()
177
+	{
178
+		return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
179
+			'id' => 'glsr-notices',
180
+		]);
181
+	}
182 182
 
183
-    /**
184
-     * @param string $hookSuffix
185
-     * @return array
186
-     */
187
-    protected function parseWithFilter($hookSuffix, array $args = [])
188
-    {
189
-        return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
190
-    }
183
+	/**
184
+	 * @param string $hookSuffix
185
+	 * @return array
186
+	 */
187
+	protected function parseWithFilter($hookSuffix, array $args = [])
188
+	{
189
+		return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
190
+	}
191 191
 
192
-    /**
193
-     * @param string $page
194
-     * @return void
195
-     */
196
-    protected function renderPage($page, array $data = [])
197
-    {
198
-        $data['http_referer'] = (string) wp_get_referer();
199
-        $data['notices'] = $this->getNotices();
200
-        glsr()->render('pages/'.$page.'/index', $data);
201
-    }
192
+	/**
193
+	 * @param string $page
194
+	 * @return void
195
+	 */
196
+	protected function renderPage($page, array $data = [])
197
+	{
198
+		$data['http_referer'] = (string) wp_get_referer();
199
+		$data['notices'] = $this->getNotices();
200
+		glsr()->render('pages/'.$page.'/index', $data);
201
+	}
202 202
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
     public function registerMenuCount()
22 22
     {
23 23
         global $menu, $typenow;
24
-        foreach ($menu as $key => $value) {
25
-            if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
24
+        foreach( $menu as $key => $value ) {
25
+            if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) {
26 26
                 continue;
27 27
             }
28
-            $postCount = wp_count_posts(Application::POST_TYPE);
29
-            $pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
28
+            $postCount = wp_count_posts( Application::POST_TYPE );
29
+            $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
30 30
                 'class' => 'unapproved-count',
31
-            ]);
32
-            $awaitingModeration = glsr(Builder::class)->span($pendingCount, [
31
+            ] );
32
+            $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
33 33
                 'class' => 'awaiting-mod count-'.$postCount->pending,
34
-            ]);
35
-            $menu[$key][0].= ' '.$awaitingModeration;
36
-            if (Application::POST_TYPE === $typenow) {
37
-                $menu[$key][4].= ' current';
34
+            ] );
35
+            $menu[$key][0] .= ' '.$awaitingModeration;
36
+            if( Application::POST_TYPE === $typenow ) {
37
+                $menu[$key][4] .= ' current';
38 38
             }
39 39
             break;
40 40
         }
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function registerSubMenus()
48 48
     {
49
-        $pages = $this->parseWithFilter('submenu/pages', [
50
-            'settings' => __('Settings', 'site-reviews'),
51
-            'tools' => __('Tools', 'site-reviews'),
52
-            'addons' => __('Add-ons', 'site-reviews'),
53
-            'documentation' => __('Help', 'site-reviews'),
54
-        ]);
55
-        foreach ($pages as $slug => $title) {
56
-            $method = Helper::buildMethodName('render-'.$slug.'-menu');
57
-            $callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
-            if (!is_callable($callback)) {
49
+        $pages = $this->parseWithFilter( 'submenu/pages', [
50
+            'settings' => __( 'Settings', 'site-reviews' ),
51
+            'tools' => __( 'Tools', 'site-reviews' ),
52
+            'addons' => __( 'Add-ons', 'site-reviews' ),
53
+            'documentation' => __( 'Help', 'site-reviews' ),
54
+        ] );
55
+        foreach( $pages as $slug => $title ) {
56
+            $method = Helper::buildMethodName( 'render-'.$slug.'-menu' );
57
+            $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
58
+            if( !is_callable( $callback ) ) {
59 59
                 continue;
60 60
             }
61
-            add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
61
+            add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
62 62
         }
63 63
     }
64 64
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function renderAddonsMenu()
71 71
     {
72
-        $this->renderPage('addons', [
73
-            'template' => glsr(Template::class),
74
-        ]);
72
+        $this->renderPage( 'addons', [
73
+            'template' => glsr( Template::class ),
74
+        ] );
75 75
     }
76 76
 
77 77
     /**
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function renderDocumentationMenu()
83 83
     {
84
-        $tabs = $this->parseWithFilter('documentation/tabs', [
85
-            'support' => __('Support', 'site-reviews'),
86
-            'faq' => __('FAQ', 'site-reviews'),
87
-            'shortcodes' => __('Shortcodes', 'site-reviews'),
88
-            'hooks' => __('Hooks', 'site-reviews'),
89
-            'functions' => __('Functions', 'site-reviews'),
90
-            'addons' => __('Addons', 'site-reviews'),
91
-        ]);
92
-        $addons = apply_filters('site-reviews/addon/documentation', []);
93
-        ksort($addons);
94
-        if (empty($addons)) {
84
+        $tabs = $this->parseWithFilter( 'documentation/tabs', [
85
+            'support' => __( 'Support', 'site-reviews' ),
86
+            'faq' => __( 'FAQ', 'site-reviews' ),
87
+            'shortcodes' => __( 'Shortcodes', 'site-reviews' ),
88
+            'hooks' => __( 'Hooks', 'site-reviews' ),
89
+            'functions' => __( 'Functions', 'site-reviews' ),
90
+            'addons' => __( 'Addons', 'site-reviews' ),
91
+        ] );
92
+        $addons = apply_filters( 'site-reviews/addon/documentation', [] );
93
+        ksort( $addons );
94
+        if( empty($addons) ) {
95 95
             unset($tabs['addons']);
96 96
         }
97
-        $this->renderPage('documentation', [
97
+        $this->renderPage( 'documentation', [
98 98
             'addons' => $addons,
99 99
             'tabs' => $tabs,
100
-        ]);
100
+        ] );
101 101
     }
102 102
 
103 103
     /**
@@ -107,25 +107,25 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function renderSettingsMenu()
109 109
     {
110
-        $tabs = $this->parseWithFilter('settings/tabs', [
111
-            'general' => __('General', 'site-reviews'),
112
-            'reviews' => __('Reviews', 'site-reviews'),
113
-            'submissions' => __('Submissions', 'site-reviews'),
114
-            'schema' => __('Schema', 'site-reviews'),
115
-            'translations' => __('Translations', 'site-reviews'),
116
-            'addons' => __('Addons', 'site-reviews'),
117
-            'licenses' => __('Licenses', 'site-reviews'),
118
-        ]);
119
-        if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
110
+        $tabs = $this->parseWithFilter( 'settings/tabs', [
111
+            'general' => __( 'General', 'site-reviews' ),
112
+            'reviews' => __( 'Reviews', 'site-reviews' ),
113
+            'submissions' => __( 'Submissions', 'site-reviews' ),
114
+            'schema' => __( 'Schema', 'site-reviews' ),
115
+            'translations' => __( 'Translations', 'site-reviews' ),
116
+            'addons' => __( 'Addons', 'site-reviews' ),
117
+            'licenses' => __( 'Licenses', 'site-reviews' ),
118
+        ] );
119
+        if( empty(Arr::get( glsr()->defaults, 'settings.addons' )) ) {
120 120
             unset($tabs['addons']);
121 121
         }
122
-        if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
122
+        if( empty(Arr::get( glsr()->defaults, 'settings.licenses' )) ) {
123 123
             unset($tabs['licenses']);
124 124
         }
125
-        $this->renderPage('settings', [
126
-            'settings' => glsr(Settings::class),
125
+        $this->renderPage( 'settings', [
126
+            'settings' => glsr( Settings::class ),
127 127
             'tabs' => $tabs,
128
-        ]);
128
+        ] );
129 129
     }
130 130
 
131 131
     /**
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function renderToolsMenu()
137 137
     {
138
-        $tabs = $this->parseWithFilter('tools/tabs', [
139
-            'general' => __('General', 'site-reviews'),
140
-            'sync' => __('Sync Reviews', 'site-reviews'),
141
-            'console' => __('Console', 'site-reviews'),
142
-            'system-info' => __('System Info', 'site-reviews'),
143
-        ]);
144
-        if (!apply_filters('site-reviews/addon/sync/enable', false)) {
138
+        $tabs = $this->parseWithFilter( 'tools/tabs', [
139
+            'general' => __( 'General', 'site-reviews' ),
140
+            'sync' => __( 'Sync Reviews', 'site-reviews' ),
141
+            'console' => __( 'Console', 'site-reviews' ),
142
+            'system-info' => __( 'System Info', 'site-reviews' ),
143
+        ] );
144
+        if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
145 145
             unset($tabs['sync']);
146 146
         }
147
-        $this->renderPage('tools', [
147
+        $this->renderPage( 'tools', [
148 148
             'data' => [
149 149
                 'context' => [
150
-                    'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
-                    'console' => strval(glsr(Console::class)),
150
+                    'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ),
151
+                    'console' => strval( glsr( Console::class ) ),
152 152
                     'id' => Application::ID,
153
-                    'system' => strval(glsr(System::class)),
153
+                    'system' => strval( glsr( System::class ) ),
154 154
                 ],
155
-                'services' => apply_filters('site-reviews/addon/sync/services', []),
155
+                'services' => apply_filters( 'site-reviews/addon/sync/services', [] ),
156 156
             ],
157 157
             'tabs' => $tabs,
158
-            'template' => glsr(Template::class),
159
-        ]);
158
+            'template' => glsr( Template::class ),
159
+        ] );
160 160
     }
161 161
 
162 162
     /**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function setCustomPermissions()
167 167
     {
168
-        foreach (wp_roles()->roles as $role => $value) {
169
-            wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
168
+        foreach( wp_roles()->roles as $role => $value ) {
169
+            wp_roles()->remove_cap( $role, 'create_'.Application::POST_TYPE );
170 170
         }
171 171
     }
172 172
 
@@ -175,28 +175,28 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function getNotices()
177 177
     {
178
-        return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
178
+        return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
179 179
             'id' => 'glsr-notices',
180
-        ]);
180
+        ] );
181 181
     }
182 182
 
183 183
     /**
184 184
      * @param string $hookSuffix
185 185
      * @return array
186 186
      */
187
-    protected function parseWithFilter($hookSuffix, array $args = [])
187
+    protected function parseWithFilter( $hookSuffix, array $args = [] )
188 188
     {
189
-        return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
189
+        return apply_filters( 'site-reviews/addon/'.$hookSuffix, $args );
190 190
     }
191 191
 
192 192
     /**
193 193
      * @param string $page
194 194
      * @return void
195 195
      */
196
-    protected function renderPage($page, array $data = [])
196
+    protected function renderPage( $page, array $data = [] )
197 197
     {
198
-        $data['http_referer'] = (string) wp_get_referer();
198
+        $data['http_referer'] = (string)wp_get_referer();
199 199
         $data['notices'] = $this->getNotices();
200
-        glsr()->render('pages/'.$page.'/index', $data);
200
+        glsr()->render( 'pages/'.$page.'/index', $data );
201 201
     }
202 202
 }
Please login to merge, or discard this patch.
plugin/Defaults/SiteReviewsDefaults.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $guarded = [
13
-        'fallback',
14
-        'title',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $guarded = [
13
+		'fallback',
14
+		'title',
15
+	];
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $mapped = [
21
-        'count' => 'display', // @deprecated since v4.1.0
22
-        'per_page' => 'display',
23
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $mapped = [
21
+		'count' => 'display', // @deprecated since v4.1.0
22
+		'per_page' => 'display',
23
+	];
24 24
 
25
-    /**
26
-     * @return array
27
-     */
28
-    protected function defaults()
29
-    {
30
-        return [
31
-            'assigned_to' => '',
32
-            'category' => '',
33
-            'class' => '',
34
-            'display' => 5,
35
-            'fallback' => '',
36
-            'hide' => [],
37
-            'id' => '',
38
-            'offset' => '',
39
-            'pagination' => false,
40
-            'rating' => 0,
41
-            'schema' => false,
42
-            'title' => '',
43
-            'type' => 'local',
44
-        ];
45
-    }
25
+	/**
26
+	 * @return array
27
+	 */
28
+	protected function defaults()
29
+	{
30
+		return [
31
+			'assigned_to' => '',
32
+			'category' => '',
33
+			'class' => '',
34
+			'display' => 5,
35
+			'fallback' => '',
36
+			'hide' => [],
37
+			'id' => '',
38
+			'offset' => '',
39
+			'pagination' => false,
40
+			'rating' => 0,
41
+			'schema' => false,
42
+			'title' => '',
43
+			'type' => 'local',
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.