Passed
Push — master ( 32d871...06bde6 )
by Paul
06:00
created
plugin/Modules/Schema.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 		foreach( glsr( Database::class )->getReviews( $this->args )->reviews as $review ) {
33 33
 			$reviews[] = $this->buildReview( $review );
34 34
 		}
35
-		if( !empty( $reviews )) {
35
+		if( !empty($reviews) ) {
36 36
 			array_walk( $reviews, function( &$review ) {
37
-				unset( $review['@context'] );
38
-				unset( $review['itemReviewed'] );
37
+				unset($review['@context']);
38
+				unset($review['itemReviewed']);
39 39
 			});
40 40
 			$schema['review'] = $reviews;
41 41
 		}
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	public function buildReview( $review )
50 50
 	{
51 51
 		$schema = SchemaOrg::Review()
52
-			->doIf( !in_array( 'title', $this->args['hide'] ), function( ReviewSchema $schema ) use( $review ) {
52
+			->doIf( !in_array( 'title', $this->args['hide'] ), function( ReviewSchema $schema ) use($review) {
53 53
 				$schema->name( $review->title );
54 54
 			})
55
-			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( ReviewSchema $schema ) use( $review ) {
55
+			->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( ReviewSchema $schema ) use($review) {
56 56
 				$schema->reviewBody( $review->content );
57 57
 			})
58
-			->datePublished(( new DateTime( $review->date ))->format( DateTime::ISO8601 ))
58
+			->datePublished( (new DateTime( $review->date ))->format( DateTime::ISO8601 ) )
59 59
 			->author( SchemaOrg::Person()
60 60
 				->name( $review->author )
61 61
 			)
62 62
 			->itemReviewed( $this->getSchemaType()
63 63
 				->name( $this->getThingName() )
64 64
 			);
65
-		if( !empty( $review->rating )) {
65
+		if( !empty($review->rating) ) {
66 66
 			$schema->reviewRating( SchemaOrg::Rating()
67 67
 				->ratingValue( $review->rating )
68 68
 				->bestRating( Rating::MAX_RATING )
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function buildSummary( $args = null )
80 80
 	{
81
-		if( is_array( $args )) {
81
+		if( is_array( $args ) ) {
82 82
 			$this->args = $args;
83 83
 		}
84 84
 		$schema = $this->getSchemaType()
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			->image( $this->getThingImage() )
91 91
 			->url( $this->getThingUrl() );
92 92
 		$count = $this->getReviewCount();
93
-		if( !empty( $count )) {
93
+		if( !empty($count) ) {
94 94
 			$schema->aggregateRating( SchemaOrg::AggregateRating()
95 95
 				->ratingValue( $this->getRatingValue() )
96 96
 				->reviewCount( $count )
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function render()
110 110
 	{
111
-		if( is_null( glsr()->schemas ))return;
111
+		if( is_null( glsr()->schemas ) )return;
112 112
 		printf( '<script type="application/ld+json">%s</script>', json_encode(
113 113
 			apply_filters( 'site-reviews/schema/all', glsr()->schemas ),
114 114
 			JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
115
-		));
115
+		) );
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function store( array $schema )
122 122
 	{
123
-		$schemas = (array) glsr()->schemas;
123
+		$schemas = (array)glsr()->schemas;
124 124
 		$schemas[] = $schema;
125
-		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas )));
125
+		glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) );
126 126
 	}
127 127
 
128 128
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	protected function getReviews( $force = false )
149 149
 	{
150
-		if( !isset( $this->reviews ) || $force ) {
150
+		if( !isset($this->reviews) || $force ) {
151 151
 			$args = wp_parse_args( ['count' => -1], $this->args );
152 152
 			$this->reviews = glsr( Database::class )->getReviews( $args )->reviews;
153 153
 		}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function getSchemaOption( $option, $fallback )
163 163
 	{
164
-		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) {
164
+		if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) {
165 165
 			return $schemaOption;
166 166
 		}
167 167
 		$default = glsr( OptionManager::class )->get( 'settings.reviews.schema.'.$option.'.default', $fallback );
Please login to merge, or discard this patch.
plugin/Modules/Logger.php 1 patch
Spacing   +12 added lines, -12 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
 			? __( 'Log is empty', 'site-reviews' )
113 113
 			: $this->log;
114 114
 	}
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 	{
135 135
 		$constants = (new ReflectionClass( __CLASS__ ))->getConstants();
136 136
 		$constants = (array)apply_filters( 'site-reviews/log-levels', $constants );
137
-		if( in_array( $level, $constants, true )) {
137
+		if( in_array( $level, $constants, true ) ) {
138 138
 			$entry = $this->buildLogEntry( $level, $message, $context );
139
-			file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX );
139
+			file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX );
140 140
 			$this->reset();
141 141
 		}
142 142
 		return $this;
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 	protected function getDebugInformation()
187 187
 	{
188 188
 		$caller = debug_backtrace( 0, 6 );
189
-		$index = array_search( 'log', array_column( $caller, 'function' ));
189
+		$index = array_search( 'log', array_column( $caller, 'function' ) );
190 190
 		if( $index === false
191
-			|| !isset( $caller[$index+2]['class'] )
192
-			|| !isset( $caller[$index+2]['function'] )
191
+			|| !isset($caller[$index + 2]['class'])
192
+			|| !isset($caller[$index + 2]['function'])
193 193
 		)return;
194 194
 		return sprintf( '[%s()->%s:%s] ',
195
-			$caller[$index+2]['class'],
196
-			$caller[$index+2]['function'],
197
-			$caller[$index+1]['line']
195
+			$caller[$index + 2]['class'],
196
+			$caller[$index + 2]['function'],
197
+			$caller[$index + 1]['line']
198 198
 		);
199 199
 	}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	protected function interpolate( $message, $context = [] )
208 208
 	{
209
-		if( $this->isObjectOrArray( $message ) || !is_array( $context )) {
209
+		if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) {
210 210
 			return print_r( $message, true );
211 211
 		}
212 212
 		$replace = [];
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		if( $value instanceof DateTime ) {
235 235
 			$value = $value->format( 'Y-m-d H:i:s' );
236 236
 		}
237
-		else if( $this->isObjectOrArray( $value )) {
237
+		else if( $this->isObjectOrArray( $value ) ) {
238 238
 			$value = json_encode( $value );
239 239
 		}
240 240
 		return (string)$value;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			$this->clear();
251 251
 			file_put_contents(
252 252
 				$this->file,
253
-				$this->buildLogEntry( 'info', __( 'Log has been automatically reset (512 KB max size)', 'site-reviews' ))
253
+				$this->buildLogEntry( 'info', __( 'Log has been automatically reset (512 KB max size)', 'site-reviews' ) )
254 254
 			);
255 255
 		}
256 256
 	}
Please login to merge, or discard this patch.
plugin/Database/Cache.php 1 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/pages/addons/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 				'name' => 'tripadvisor',
13 13
 				'title' => 'Tripadvisor Reviews',
14 14
 			],
15
-		]);
15
+		] );
16 16
 		$template->render( 'partials/addons/addon', [
17 17
 			'context' => [
18 18
 				'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ),
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 				'name' => 'yelp',
21 21
 				'title' => 'Yelp Reviews',
22 22
 			],
23
-		]);
23
+		] );
24 24
 	?>
25 25
 	</div>
26 26
 </div>
Please login to merge, or discard this patch.
views/partials/translations/plural.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 		<p>{{ data.s1 }}</p>
4 4
 		<p>{{ data.p1 }}</p>
5 5
 		<p class="row-actions">
6
-			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
6
+			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
7 7
 		</p>
8 8
 		<button type="button" class="toggle-row">
9 9
 			<span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span>
Please login to merge, or discard this patch.
views/partials/translations/single.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 	<td class="glsr-string-td1 column-primary">
3 3
 		<p>{{ data.s1 }}</p>
4 4
 		<p class="row-actions">
5
-			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
5
+			<span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span>
6 6
 		</p>
7 7
 		<button type="button" class="toggle-row">
8 8
 			<span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span>
Please login to merge, or discard this patch.
views/partials/editor/metabox-categories.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		</ul>
21 21
 	</div>
22 22
 
23
-	<?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?>
23
+	<?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
24 24
 	<div id="<?= $tax_name; ?>-adder" class="wp-hidden-children">
25 25
 		<a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
26 26
 			<?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?>
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			<label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label>
30 30
 			<input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/>
31 31
 			<input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" />
32
-			<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
32
+			<?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?>
33 33
 			<span id="<?= $tax_name; ?>-ajax-response"></span>
34 34
 		</div>
35 35
 	</div>
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/Modules/Email.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$this->message = $this->buildHtmlMessage( $email );
44 44
 		$this->subject = $email['subject'];
45 45
 		$this->to = $email['to'];
46
-		add_action( 'phpmailer_init', [ $this, 'buildPlainTextMessage'] );
46
+		add_action( 'phpmailer_init', [$this, 'buildPlainTextMessage'] );
47 47
 		return $this;
48 48
 	}
49 49
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function buildPlainTextMessage( $phpmailer )
85 85
 	{
86
-		if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return;
86
+		if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return;
87 87
 		$message = $this->stripHtmlTags( $phpmailer->Body );
88 88
 		$phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
89 89
 	}
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			'from',
100 100
 			'reply-to',
101 101
 		];
102
-		$headers = array_intersect_key( $email, array_flip( $allowed ));
102
+		$headers = array_intersect_key( $email, array_flip( $allowed ) );
103 103
 		$headers = array_filter( $headers );
104 104
 		foreach( $headers as $key => $value ) {
105
-			unset( $headers[ $key ] );
105
+			unset($headers[$key]);
106 106
 			$headers[] = "{$key}: {$value}";
107 107
 		}
108 108
 		$headers[] = 'Content-Type: text/html';
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	protected function buildHtmlMessage( $email )
116 116
 	{
117
-		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ));
118
-		if( !empty( $template )) {
117
+		$template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) );
118
+		if( !empty($template) ) {
119 119
 			$message = glsr( Template::class )->interpolate( $template, $email['template-tags'] );
120 120
 		}
121 121
 		else if( $email['template'] ) {
122 122
 			$message = glsr( Template::class )->build( 'templates/'.$email['template'], [
123 123
 				'context' => $email['template-tags'],
124
-			]);
124
+			] );
125 125
 		}
126
-		if( !isset( $message )) {
126
+		if( !isset($message) ) {
127 127
 			$message = $email['message'];
128 128
 		}
129 129
 		$message = $email['before'].$message.$email['after'];
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$message = str_replace( ']]>', ']]&gt;', $message );
135 135
 		$message = glsr( Template::class )->build( 'partials/email/index', [
136 136
 			'context' => ['message' => $message],
137
-		]);
137
+		] );
138 138
 		return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this );
139 139
 	}
140 140
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			'to' => '',
161 161
 		];
162 162
 		$email = shortcode_atts( $defaults, $email );
163
-		if( empty( $email['reply-to'] )) {
163
+		if( empty($email['reply-to']) ) {
164 164
 			$email['reply-to'] = $email['from'];
165 165
 		}
166 166
 		return apply_filters( 'site-reviews/email/compose', $email, $this );
Please login to merge, or discard this patch.