Passed
Push — master ( a42385...9b46a7 )
by Paul
04:14
created
plugin/Commands/TogglePinned.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	public function __construct( $input )
11 11
 	{
12 12
 		$this->id = $input['id'];
13
-		$this->pinned = isset( $input['pinned'] )
13
+		$this->pinned = isset($input['pinned'])
14 14
 			? wp_validate_boolean( $input['pinned'] )
15 15
 			: null;
16 16
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/ButtonGenerator.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			'label' => '['.$tag.']',
48 48
 			'required' => $this->required,
49 49
 			'title' => esc_html__( 'Shortcode', 'site-reviews' ),
50
-		]);
50
+		] );
51 51
 		return $this;
52 52
 	}
53 53
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty($field) )return;
61 61
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
62
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ) ) )return;
63 63
 			return $this->$method( $field );
64 64
 		}, $fields );
65
-		return array_values( array_filter( $generatedFields ));
65
+		return array_values( array_filter( $generatedFields ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	protected function getFields()
72 72
 	{
73 73
 		$fields = $this->generateFields( $this->fields() );
74
-		if( !empty( $this->errors )) {
74
+		if( !empty($this->errors) ) {
75 75
 			$errors = [];
76 76
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
77
+				if( false !== array_search( $name, array_column( $fields, 'name' ) ) )continue;
78 78
 				$errors[] = $this->errors[$name];
79 79
 			}
80 80
 			$this->errors = $errors;
81 81
 		}
82
-		return empty( $this->errors )
82
+		return empty($this->errors)
83 83
 			? $fields
84 84
 			: $this->errors;
85 85
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return wp_parse_args( $field, [
93 93
 			'items' => [],
94 94
 			'type' => '',
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'tooltip' => '',
111 111
 			'type' => '',
112 112
 			'value' => '',
113
-		]);
113
+		] );
114 114
 	}
115 115
 
116 116
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function normalizeContainer( array $field )
120 120
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
121
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ) )return;
122 122
 		$field['items'] = $this->generateFields( $field['items'] );
123 123
 		return $field;
124 124
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	protected function normalizeField( array $field, array $defaults )
130 130
 	{
131
-		if( !$this->validate( $field ))return;
131
+		if( !$this->validate( $field ) )return;
132 132
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 133
 			return $value !== '';
134 134
 		});
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			'tooltip' => '',
149 149
 			'type' => '',
150 150
 			'value' => '',
151
-		]);
152
-		if( !is_array( $listbox ))return;
153
-		if( !array_key_exists( '', $listbox['options'] )) {
151
+		] );
152
+		if( !is_array( $listbox ) )return;
153
+		if( !array_key_exists( '', $listbox['options'] ) ) {
154 154
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 155
 		}
156 156
 		foreach( $listbox['options'] as $value => $text ) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	protected function normalizePost( array $field )
169 169
 	{
170
-		if( !is_array( $field['query_args'] )) {
170
+		if( !is_array( $field['query_args'] ) ) {
171 171
 			$field['query_args'] = [];
172 172
 		}
173 173
 		$posts = get_posts( wp_parse_args( $field['query_args'], [
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 			'orderby' => 'title',
176 176
 			'post_type' => 'post',
177 177
 			'posts_per_page' => 30,
178
-		]));
179
-		if( !empty( $posts )) {
178
+		] ) );
179
+		if( !empty($posts) ) {
180 180
 			$options = [];
181 181
 			foreach( $posts as $post ) {
182 182
 				$options[$post->ID] = esc_html( $post->post_title );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			'tooltip' => '',
207 207
 			'type' => '',
208 208
 			'value' => '',
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	protected function validate( array $field )
216 216
 	{
217
-		$args = shortcode_atts([
217
+		$args = shortcode_atts( [
218 218
 			'label' => '',
219 219
 			'name' => false,
220 220
 			'required' => false,
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	protected function validateErrors( array $args )
232 232
 	{
233
-		if( !isset( $args['required']['error'] )) {
233
+		if( !isset($args['required']['error']) ) {
234 234
 			return true;
235 235
 		}
236
-		$this->errors[$args['name']] = $this->normalizeContainer([
236
+		$this->errors[$args['name']] = $this->normalizeContainer( [
237 237
 			'html' => $args['required']['error'],
238 238
 			'type' => 'container',
239
-		]);
239
+		] );
240 240
 		return false;
241 241
 	}
242 242
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			return true;
250 250
 		}
251 251
 		$alert = esc_html__( 'Some of the shortcode options are required.', 'site-reviews' );
252
-		if( isset( $args['required']['alert'] )) {
252
+		if( isset($args['required']['alert']) ) {
253 253
 			$alert = $args['required']['alert'];
254 254
 		}
255
-		else if( !empty( $args['label'] )) {
255
+		else if( !empty($args['label']) ) {
256 256
 			$alert = sprintf(
257 257
 				esc_html_x( 'The "%s" option is required.', 'the option label', 'site-reviews' ),
258 258
 				str_replace( ':', '', $args['label'] )
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,9 +57,13 @@  discard block
 block discarded – undo
57 57
 	protected function generateFields( array $fields )
58 58
 	{
59 59
 		$generatedFields = array_map( function( $field ) {
60
-			if( empty( $field ))return;
60
+			if( empty( $field )) {
61
+				return;
62
+			}
61 63
 			$field = $this->normalize( $field );
62
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
64
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
65
+				return;
66
+			}
63 67
 			return $this->$method( $field );
64 68
 		}, $fields );
65 69
 		return array_values( array_filter( $generatedFields ));
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 		if( !empty( $this->errors )) {
75 79
 			$errors = [];
76 80
 			foreach( $this->required as $name => $alert ) {
77
-				if( false !== array_search( $name, array_column( $fields, 'name' )))continue;
81
+				if( false !== array_search( $name, array_column( $fields, 'name' ))) {
82
+					continue;
83
+				}
78 84
 				$errors[] = $this->errors[$name];
79 85
 			}
80 86
 			$this->errors = $errors;
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 	 */
119 125
 	protected function normalizeContainer( array $field )
120 126
 	{
121
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
127
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
128
+			return;
129
+		}
122 130
 		$field['items'] = $this->generateFields( $field['items'] );
123 131
 		return $field;
124 132
 	}
@@ -128,7 +136,9 @@  discard block
 block discarded – undo
128 136
 	 */
129 137
 	protected function normalizeField( array $field, array $defaults )
130 138
 	{
131
-		if( !$this->validate( $field ))return;
139
+		if( !$this->validate( $field )) {
140
+			return;
141
+		}
132 142
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
133 143
 			return $value !== '';
134 144
 		});
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
 			'type' => '',
150 160
 			'value' => '',
151 161
 		]);
152
-		if( !is_array( $listbox ))return;
162
+		if( !is_array( $listbox )) {
163
+			return;
164
+		}
153 165
 		if( !array_key_exists( '', $listbox['options'] )) {
154 166
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
155 167
 		}
Please login to merge, or discard this patch.
plugin/Modules/Date.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 		$diff = time() - strtotime( $date );
32 32
 		foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
33 33
 			if( $diff > $timePeriod[0] )continue;
34
-			$unit = intval( floor( $diff / $timePeriod[1] ));
34
+			$unit = intval( floor( $diff / $timePeriod[1] ) );
35 35
 			$relativeDates = [
36 36
 				_n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
37 37
 				_n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 	{
31 31
 		$diff = time() - strtotime( $date );
32 32
 		foreach( static::$TIME_PERIODS as $i => $timePeriod ) {
33
-			if( $diff > $timePeriod[0] )continue;
33
+			if( $diff > $timePeriod[0] ) {
34
+				continue;
35
+			}
34 36
 			$unit = intval( floor( $diff / $timePeriod[1] ));
35 37
 			$relativeDates = [
36 38
 				_n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Modules/Session.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -161,7 +161,9 @@  discard block
 block discarded – undo
161 161
 		if( !empty( $sessions )) {
162 162
 			$now = time();
163 163
 			foreach( $sessions as $session ) {
164
-				if( $now <= $session->expiration )continue;
164
+				if( $now <= $session->expiration ) {
165
+					continue;
166
+				}
165 167
 				$expiredSessions[] = $session->name;
166 168
 				$expiredSessions[] = str_replace( '_expires_', '_', $session->name );
167 169
 			}
@@ -204,7 +206,9 @@  discard block
 block discarded – undo
204 206
 	 */
205 207
 	protected function setCookie()
206 208
 	{
207
-		if( headers_sent() )return;
209
+		if( headers_sent() ) {
210
+			return;
211
+		}
208 212
 		$cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset;
209 213
 		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' )));
210 214
 		setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 
35 35
 	public function __construct()
36 36
 	{
37
-		if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE )) {
38
-			$cookie = explode( '||', stripslashes( $cookieId ));
37
+		if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE ) ) {
38
+			$cookie = explode( '||', stripslashes( $cookieId ) );
39 39
 			$this->sessionId = preg_replace( '/[^A-Za-z0-9_]/', '', $cookie[0] );
40 40
 			$this->expiryTimestamp = absint( $cookie[1] );
41 41
 			$this->expiryTimestampReset = absint( $cookie[2] );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function deleteExpiredSessions( $limit = 1000 )
77 77
 	{
78
-		if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ))) {
78
+		if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ) ) ) {
79 79
 			glsr( SqlQueries::class )->deleteExpiredSessions( $expiredSessions );
80 80
 		}
81 81
 	}
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	public function get( $key, $fallback = '', $unset = false )
90 90
 	{
91 91
 		$key = sanitize_key( $key );
92
-		$value = isset( $this->sessionData[$key] )
92
+		$value = isset($this->sessionData[$key])
93 93
 			? maybe_unserialize( $this->sessionData[$key] )
94 94
 			: $fallback;
95
-		if( isset( $this->sessionData[$key] ) && $unset ) {
96
-			unset( $this->sessionData[$key] );
95
+		if( isset($this->sessionData[$key]) && $unset ) {
96
+			unset($this->sessionData[$key]);
97 97
 			$this->updateSession();
98 98
 		}
99 99
 		return $value;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	protected function deleteSession()
128 128
 	{
129 129
 		delete_option( $this->getSessionId() );
130
-		delete_option( $this->getSessionId( 'expires' ));
130
+		delete_option( $this->getSessionId( 'expires' ) );
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function generateSessionId()
137 137
 	{
138
-		return md5(( new PasswordHash( 8, false ))->get_random_bytes( 32 ));
138
+		return md5( (new PasswordHash( 8, false ))->get_random_bytes( 32 ) );
139 139
 	}
140 140
 
141 141
 	/**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	protected function getExpiredSessions( $limit )
146 146
 	{
147 147
 		$expiredSessions = [];
148
-		$sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ));
149
-		if( !empty( $sessions )) {
148
+		$sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ) );
149
+		if( !empty($sessions) ) {
150 150
 			$now = time();
151 151
 			foreach( $sessions as $session ) {
152 152
 				if( $now <= $session->expiration )continue;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	protected function getSessionId( $separator = '' )
165 165
 	{
166
-		return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ));
166
+		return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ) );
167 167
 	}
168 168
 
169 169
 	/**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	{
195 195
 		if( headers_sent() )return;
196 196
 		$cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset;
197
-		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' )));
197
+		$cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ) ) );
198 198
 		setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath );
199 199
 	}
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	protected function updateSession()
214 214
 	{
215
-		if( false === get_option( $this->getSessionId() )) {
215
+		if( false === get_option( $this->getSessionId() ) ) {
216 216
 			return $this->createSession();
217 217
 		}
218 218
 		update_option( $this->getSessionId(), $this->sessionData, false );
Please login to merge, or discard this patch.
plugin/Filters.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@
 block discarded – undo
22 22
 	protected $public;
23 23
 	protected $translator;
24 24
 
25
-	public function __construct( Application $app ) {
25
+	public function __construct( Application $app )
26
+	{
26 27
 		$this->app = $app;
27 28
 		$this->admin = $app->make( AdminController::class );
28 29
 		$this->basename = plugin_basename( $app->file );
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -38,28 +38,28 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function run()
40 40
 	{
41
-		add_filter( 'mce_external_plugins',                                    [$this->admin, 'filterTinymcePlugins'], 15 );
42
-		add_filter( 'plugin_action_links_'.$this->basename,                    [$this->admin, 'filterActionLinks'] );
43
-		add_filter( 'dashboard_glance_items',                                  [$this->admin, 'filterDashboardGlanceItems'] );
44
-		add_filter( 'wp_editor_settings',                                      [$this->editor, 'filterEditorSettings'] );
45
-		add_filter( 'the_editor',                                              [$this->editor, 'filterEditorTextarea'] );
46
-		add_filter( 'gettext',                                                 [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
-		add_filter( 'gettext_with_context',                                    [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
-		add_filter( 'post_updated_messages',                                   [$this->editor, 'filterUpdateMessages'] );
49
-		add_filter( 'bulk_post_updated_messages',                              [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
-		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns',         [$this->listtable, 'filterColumnsForPostType'] );
51
-		add_filter( 'post_date_column_status',                                 [$this->listtable, 'filterDateColumnStatus'], 10, 2 );
52
-		add_filter( 'default_hidden_columns',                                  [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
53
-		add_filter( 'display_post_states',                                     [$this->listtable, 'filterPostStates'], 10, 2 );
54
-		add_filter( 'post_row_actions',                                        [$this->listtable, 'filterRowActions'], 10, 2 );
41
+		add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
42
+		add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
43
+		add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
44
+		add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] );
45
+		add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] );
46
+		add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47
+		add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48
+		add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] );
49
+		add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
+		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
51
+		add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 );
52
+		add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
53
+		add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 );
54
+		add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
55 55
 		add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
56
-		add_filter( 'ngettext',                                                [$this->listtable, 'filterStatusText'], 10, 5 );
57
-		add_filter( 'script_loader_tag',                                       [$this->public, 'filterEnqueuedScripts'], 10, 2 );
58
-		add_filter( 'query_vars',                                              [$this->public, 'filterQueryVars'] );
59
-		add_filter( 'site-reviews/render/view',                                [$this->public, 'filterRenderView'] );
60
-		add_filter( 'gettext',                                                 [$this->translator, 'filterGettext'], 10, 3 );
61
-		add_filter( 'gettext_with_context',                                    [$this->translator, 'filterGettextWithContext'], 10, 4 );
62
-		add_filter( 'ngettext',                                                [$this->translator, 'filterNgettext'], 10, 5 );
63
-		add_filter( 'ngettext_with_context',                                   [$this->translator, 'filterNgettextWithContext'], 10, 6 );
56
+		add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
57
+		add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 );
58
+		add_filter( 'query_vars', [$this->public, 'filterQueryVars'] );
59
+		add_filter( 'site-reviews/render/view', [$this->public, 'filterRenderView'] );
60
+		add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 );
61
+		add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 );
62
+		add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 );
63
+		add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 );
64 64
 	}
65 65
 }
Please login to merge, or discard this patch.
plugin/Database/Cache.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 	const EXPIRY_TIME = WEEK_IN_SECONDS;
11 11
 
12 12
 	/**
13
- 	 * @return array
13
+	 * @return array
14 14
 	 */
15 15
 	public function getCloudflareIps()
16 16
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			$ipAddresses = array_fill_keys( ['v4', 'v6'], [] );
20 20
 			foreach( array_keys( $ipAddresses ) as $version ) {
21 21
 				$response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version );
22
-				if( is_wp_error( $response )) {
22
+				if( is_wp_error( $response ) ) {
23 23
 					glsr_log()->error( $response->get_error_message() );
24 24
 					continue;
25 25
 				}
26
-				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response )));
26
+				$ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) );
27 27
 			}
28 28
 			set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME );
29 29
 		}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		if( $test === false ) {
58 58
 			$response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' );
59 59
 			$test = !is_wp_error( $response )
60
-				&& in_array( $response['response']['code'], range( 200, 299 ))
60
+				&& in_array( $response['response']['code'], range( 200, 299 ) )
61 61
 				? 'Works'
62 62
 				: 'Does not work';
63 63
 			set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME );
Please login to merge, or discard this patch.
views/partials/email/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php defined( 'WPINC' ) || die;
2 2
 
3
-include trailingslashit(__DIR__).'header.php';
4
-include trailingslashit(__DIR__).'body.php';
5
-include trailingslashit(__DIR__).'footer.php';
3
+include trailingslashit( __DIR__ ).'header.php';
4
+include trailingslashit( __DIR__ ).'body.php';
5
+include trailingslashit( __DIR__ ).'footer.php';
Please login to merge, or discard this patch.
plugin/Database/DefaultsManager.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 	protected function normalize( array $settings )
54 54
 	{
55 55
 		array_walk( $settings, function( &$setting ) {
56
-			if( isset( $setting['default'] ))return;
56
+			if( isset( $setting['default'] )) {
57
+				return;
58
+			}
57 59
 			$setting['default'] = '';
58 60
 		});
59 61
 		return $settings;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	public function defaults()
14 14
 	{
15 15
 		$settings = $this->settings();
16
-		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ));
16
+		$defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) );
17 17
 		return wp_parse_args( $defaults, [
18 18
 			'version' => '',
19 19
 			'version_upgraded_from' => '',
20
-		]);
20
+		] );
21 21
 	}
22 22
 
23 23
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function settings()
48 48
 	{
49
-		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ));
49
+		$settings = apply_filters( 'site-reviews/addon/settings', glsr()->config( 'settings' ) );
50 50
 		return $this->normalize( $settings );
51 51
 	}
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	protected function normalize( array $settings )
57 57
 	{
58 58
 		array_walk( $settings, function( &$setting ) {
59
-			if( isset( $setting['default'] ))return;
59
+			if( isset($setting['default']) )return;
60 60
 			$setting['default'] = '';
61 61
 		});
62 62
 		return $settings;
Please login to merge, or discard this patch.
plugin/Database/OptionManager.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		$options = $this->all();
43 43
 		$pointer = &$options;
44 44
 		foreach( $keys as $key ) {
45
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
45
+			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) {
46
+				continue;
47
+			}
46 48
 			$pointer = &$pointer[$key];
47 49
 		}
48 50
 		unset( $pointer[$last] );
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
 			glsr( DefaultsManager::class )->defaults()
78 80
 		);
79 81
 		array_walk( $options, function( &$value ) {
80
-			if( !is_string( $value ))return;
82
+			if( !is_string( $value )) {
83
+				return;
84
+			}
81 85
 			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
82 86
 		});
83 87
 		return glsr( Helper::class )->convertDotNotationArray( $options );
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function all()
30 30
 	{
31
-		if( empty( $this->options )) {
31
+		if( empty($this->options) ) {
32 32
 			$this->reset();
33 33
 		}
34 34
 		return $this->options;
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 		$options = $this->all();
46 46
 		$pointer = &$options;
47 47
 		foreach( $keys as $key ) {
48
-			if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue;
48
+			if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue;
49 49
 			$pointer = &$pointer[$key];
50 50
 		}
51
-		unset( $pointer[$last] );
51
+		unset($pointer[$last]);
52 52
 		return $this->set( $options );
53 53
 	}
54 54
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 			glsr( DefaultsManager::class )->defaults()
81 81
 		);
82 82
 		array_walk( $options, function( &$value ) {
83
-			if( !is_string( $value ))return;
84
-			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ));
83
+			if( !is_string( $value ) )return;
84
+			$value = wp_kses( $value, wp_kses_allowed_html( 'post' ) );
85 85
 		});
86 86
 		return glsr( Helper::class )->convertDotNotationArray( $options );
87 87
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	public function isRecaptchaEnabled()
93 93
 	{
94 94
 		$integration = $this->get( 'settings.submissions.recaptcha.integration' );
95
-		return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() );
95
+		return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in());
96 96
 	}
97 97
 
98 98
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	public function reset()
102 102
 	{
103 103
 		$options = get_option( static::databaseKey(), [] );
104
-		if( !is_array( $options ) || empty( $options )) {
104
+		if( !is_array( $options ) || empty($options) ) {
105 105
 			delete_option( static::databaseKey() );
106 106
 			$options = wp_parse_args( glsr()->defaults, ['settings' => []] );
107 107
 		}
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function set( $pathOrOptions, $value = '' )
117 117
 	{
118
-		if( is_string( $pathOrOptions )) {
118
+		if( is_string( $pathOrOptions ) ) {
119 119
 			$pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() );
120 120
 		}
121
-		if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) {
121
+		if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) {
122 122
 			$this->reset();
123 123
 		}
124 124
 		return $result;
Please login to merge, or discard this patch.