Passed
Push — master ( 7de9ff...9a7a6b )
by Paul
07:10 queued 03:33
created
plugin/Modules/Blacklist.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function isBlacklisted( array $review )
13 13
 	{
14
-		$target = implode( "\n", array_filter([
14
+		$target = implode( "\n", array_filter( [
15 15
 			$review['name'],
16 16
 			$review['content'],
17 17
 			$review['email'],
18 18
 			$review['ip_address'],
19 19
 			$review['title'],
20
-		]));
20
+		] ) );
21 21
 		return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22 22
 			$this->check( $target ),
23 23
 			$review
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function check( $target )
32 32
 	{
33
-		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ));
34
-		if( empty( $blacklist )) {
33
+		$blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
34
+		if( empty($blacklist) ) {
35 35
 			return false;
36 36
 		}
37 37
 		$lines = explode( "\n", $blacklist );
38 38
 		foreach( (array)$lines as $line ) {
39 39
 			$line = trim( $line );
40
-			if( empty( $line ) || 256 < strlen( $line ))continue;
41
-			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ));
42
-			if( preg_match( $pattern, $target )) {
40
+			if( empty($line) || 256 < strlen( $line ) )continue;
41
+			$pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
42
+			if( preg_match( $pattern, $target ) ) {
43 43
 				return true;
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function __get( $key )
21 21
 	{
22
-		if( array_key_exists( $key, $this->values )) {
22
+		if( array_key_exists( $key, $this->values ) ) {
23 23
 			return $this->values[$key];
24 24
 		}
25 25
 		return '';
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 */
14 14
 	public function __call( $name, array $args = [] )
15 15
 	{
16
-		if( !method_exists( $this, $name ))return;
16
+		if( !method_exists( $this, $name ) )return;
17 17
 		$defaults = call_user_func_array( [$this, $name], $args );
18 18
 		$hookName = (new ReflectionClass( $this ))->getShortName();
19 19
 		$hookName = str_replace( 'Defaults', '', $hookName );
Please login to merge, or discard this patch.
plugin/Modules/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function get()
110 110
 	{
111
-		return empty( $this->log )
111
+		return empty($this->log)
112 112
 			? __( 'Console is empty', 'site-reviews' )
113 113
 			: $this->log;
114 114
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	public function humanSize( $valueIfEmpty = null )
121 121
 	{
122 122
 		$bytes = $this->size();
123
-		if( empty( $bytes ) && is_string( $valueIfEmpty )) {
123
+		if( empty($bytes) && is_string( $valueIfEmpty ) ) {
124 124
 			return $valueIfEmpty;
125 125
 		}
126
-		$exponent = floor( log( max( $bytes, 1 ), 1024 ));
127
-		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent];
126
+		$exponent = floor( log( max( $bytes, 1 ), 1024 ) );
127
+		return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent];
128 128
 	}
129 129
 
130 130
 	/**
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	public function log( $level, $message, array $context = [] )
148 148
 	{
149 149
 		$constants = (new ReflectionClass( __CLASS__ ))->getConstants();
150
-		if( in_array( $level, $constants, true )) {
150
+		if( in_array( $level, $constants, true ) ) {
151 151
 			$entry = $this->buildLogEntry( $level, $message, $context );
152
-			file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
152
+			file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
153 153
 			$this->reset();
154 154
 		}
155 155
 		return $this;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	protected function interpolate( $message, $context = [] )
224 224
 	{
225
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
225
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
226 226
 			return print_r( $message, true );
227 227
 		}
228 228
 		$replace = [];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		if( $value instanceof DateTime ) {
251 251
 			$value = $value->format( 'Y-m-d H:i:s' );
252 252
 		}
253
-		else if( $this->isObjectOrArray( $value )) {
253
+		else if( $this->isObjectOrArray( $value ) ) {
254 254
 			$value = json_encode( $value );
255 255
 		}
256 256
 		return (string)$value;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->clear();
266 266
 			file_put_contents(
267 267
 				$this->file,
268
-				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ))
268
+				$this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) )
269 269
 			);
270 270
 		}
271 271
 	}
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) {
23 23
 			$column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
24 24
 				'href' => (string)get_the_permalink( $assignedPost->ID ),
25
-			]);
25
+			] );
26 26
 		}
27 27
 		return $column;
28 28
 	}
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		$pinned = get_post_meta( $postId, 'pinned', true )
37 37
 			? 'pinned '
38 38
 			: '';
39
-		return glsr( Builder::class )->i([
39
+		return glsr( Builder::class )->i( [
40 40
 			'class' => $pinned.'dashicons dashicons-sticky',
41 41
 			'data-id' => $postId,
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function buildColumnReviewer( $postId )
50 50
 	{
51
-		return strval( get_post_meta( $postId, 'author', true ));
51
+		return strval( get_post_meta( $postId, 'author', true ) );
52 52
 	}
53 53
 
54 54
 	/**
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 	public function buildColumnRating( $postId )
60 60
 	{
61 61
 		return glsr( Partial::class )->build( 'star-rating', [
62
-			'rating' => intval( get_post_meta( $postId, 'rating', true )),
63
-		]);
62
+			'rating' => intval( get_post_meta( $postId, 'rating', true ) ),
63
+		] );
64 64
 	}
65 65
 
66 66
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function renderFilters( $postType )
83 83
 	{
84 84
 		if( $postType !== Application::POST_TYPE )return;
85
-		if( !( $status = filter_input( INPUT_GET, 'post_status' ))) {
85
+		if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
86 86
 			$status = 'publish';
87 87
 		}
88 88
 		$ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	protected function renderFilterRatings( $ratings )
113 113
 	{
114
-		if( empty( $ratings ))return;
115
-		$ratings = array_flip( array_reverse( $ratings ));
114
+		if( empty($ratings) )return;
115
+		$ratings = array_flip( array_reverse( $ratings ) );
116 116
 		array_walk( $ratings, function( &$value, $key ) {
117 117
 			$label = _n( '%s star', '%s stars', $key, 'site-reviews' );
118 118
 			$value = sprintf( $label, $key );
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 		echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
121 121
 			'class' => 'screen-reader-text',
122 122
 			'for' => 'rating',
123
-		]);
124
-		echo glsr( Builder::class )->select([
123
+		] );
124
+		echo glsr( Builder::class )->select( [
125 125
 			'name' => 'rating',
126 126
 			'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
127 127
 			'value' => filter_input( INPUT_GET, 'rating' ),
128
-		]);
128
+		] );
129 129
 	}
130 130
 
131 131
 	/**
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 		echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
139 139
 			'class' => 'screen-reader-text',
140 140
 			'for' => 'review_type',
141
-		]);
142
-		echo glsr( Builder::class )->select([
141
+		] );
142
+		echo glsr( Builder::class )->select( [
143 143
 			'name' => 'review_type',
144 144
 			'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
145 145
 			'value' => filter_input( INPUT_GET, 'review_type' ),
146
-		]);
146
+		] );
147 147
 	}
148 148
 }
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	public function callbackRegisterSettings( $input )
19 19
 	{
20
-		if( !is_array( $input )) {
20
+		if( !is_array( $input ) ) {
21 21
 			$input = ['settings' => []];
22 22
 		}
23 23
 		if( key( $input ) == 'settings' ) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			$options = $this->sanitizeGeneral( $input, $options );
26 26
 			$options = $this->sanitizeSubmissions( $input, $options );
27 27
 			$options = $this->sanitizeTranslations( $input, $options );
28
-			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
28
+			glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
 			return $options;
30 30
 		}
31 31
 		return $input;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
41 41
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-		]);
42
+		] );
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 		if( $inputForm['support']['polylang'] == 'yes' ) {
52 52
 			if( !glsr( Polylang::class )->isActive() ) {
53 53
 				$options['settings']['general']['support']['polylang'] = 'no';
54
-				glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ));
54
+				glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
55 55
 			}
56 56
 			else if( !glsr( Polylang::class )->isSupported() ) {
57 57
 				$options['settings']['general']['support']['polylang'] = 'no';
58
-				glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ));
58
+				glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
59 59
 			}
60 60
 		}
61
-		if( !isset( $inputForm['notifications'] )) {
61
+		if( !isset($inputForm['notifications']) ) {
62 62
 			$options['settings']['general']['notifications'] = [];
63 63
 		}
64 64
 		if( trim( $inputForm['notification_message'] ) == '' ) {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	protected function sanitizeSubmissions( array $input, array $options )
74 74
 	{
75 75
 		$inputForm = $input['settings']['submissions'];
76
-		if( !isset( $inputForm['required'] )) {
76
+		if( !isset($inputForm['required']) ) {
77 77
 			$options['settings']['submissions']['required'] = [];
78 78
 		}
79 79
 		return $options;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	protected function sanitizeTranslations( array $input, array $options )
86 86
 	{
87
-		if( isset( $input['settings']['strings'] )) {
88
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
87
+		if( isset($input['settings']['strings']) ) {
88
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
89 89
 			$allowedTags = ['a' => ['class' => [], 'href' => [], 'target' => []]];
90
-			array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) {
91
-				if( isset( $string['s2'] )) {
90
+			array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) {
91
+				if( isset($string['s2']) ) {
92 92
 					$string['s2'] = wp_kses( $string['s2'], $allowedTags );
93 93
 				}
94
-				if( isset( $string['p2'] )) {
94
+				if( isset($string['p2']) ) {
95 95
 					$string['p2'] = wp_kses( $string['p2'], $allowedTags );
96 96
 				}
97 97
 			});
Please login to merge, or discard this patch.
plugin/Modules/Html/Partials/Pagination.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 				'loader' => '<div class="glsr-loader"></div>',
28 28
 				'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
29 29
 			],
30
-		]);
30
+		] );
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	protected function buildLinks()
37 37
 	{
38
-		$args = glsr( Style::class )->paginationArgs([
38
+		$args = glsr( Style::class )->paginationArgs( [
39 39
 			'current' => $this->args['paged'],
40 40
 			'total' => $this->args['total'],
41
-		]);
41
+		] );
42 42
 		if( is_front_page() ) {
43
-			unset( $args['format'] );
43
+			unset($args['format']);
44 44
 		}
45 45
 		if( $args['type'] == 'array' ) {
46 46
 			$args['type'] = 'plain';
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
 		return wp_parse_args( $args, [
57 57
 			'paged' => glsr( QueryBuilder::class )->getPaged(),
58 58
 			'total' => 1,
59
-		]);
59
+		] );
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 		$review = glsr( ReviewManager::class )->create( $command );
18 18
 		if( !$review ) {
19 19
 			glsr( Session::class )->set( $command->form_id.'errors', [] );
20
-			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ));
20
+			glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) );
21 21
 			return;
22 22
 		}
23
-		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ));
23
+		glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) );
24 24
 		glsr( Notification::class )->send( $review );
25 25
 		if( $command->ajax_request )return;
26
-		wp_safe_redirect( $this->getReferer( $command ));
26
+		wp_safe_redirect( $this->getReferer( $command ) );
27 27
 		exit;
28 28
 	}
29 29
 
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	protected function getReferer( Command $command )
34 34
 	{
35
-		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
36
-		if( empty( $referer )) {
35
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
36
+		if( empty($referer) ) {
37 37
 			$referer = $command->referer;
38 38
 		}
39
-		if( empty( $referer )) {
39
+		if( empty($referer) ) {
40 40
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
41 41
 			$referer = home_url();
42 42
 		}
Please login to merge, or discard this patch.
plugin/Modules/Html/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	{
29 29
 		$fields = [];
30 30
 		foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) {
31
-			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ));
31
+			$fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) );
32 32
 		}
33 33
 		return $fields;
34 34
 	}
Please login to merge, or discard this patch.