Passed
Push — master ( 251272...937ebe )
by Paul
06:42 queued 03:14
created
plugin/Reviews.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		$this->args = $args;
30 30
 		$this->max_num_pages = $maxPageCount;
31 31
 		$this->results = $reviews;
32
-		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS );
32
+		parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
 	}
34 34
 
35 35
 	/**
Please login to merge, or discard this patch.
plugin/Review.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function build( array $args = [] )
70 70
 	{
71
-		if( empty( $this->ID )) {
71
+		if( empty($this->ID) ) {
72 72
 			return new ReviewHtml;
73 73
 		}
74 74
 		$partial = glsr( SiteReviewsPartial::class );
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function offsetGet( $key )
94 94
 	{
95
-		if( property_exists( $this, $key )) {
95
+		if( property_exists( $this, $key ) ) {
96 96
 			return $this->$key;
97 97
 		}
98
-		if( array_key_exists( $key, (array)$this->custom )) {
98
+		if( array_key_exists( $key, (array)$this->custom ) ) {
99 99
 			return $this->custom[$key];
100 100
 		}
101 101
 		return null;
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function offsetSet( $key, $value )
110 110
 	{
111
-		if( property_exists( $this, $key )) {
111
+		if( property_exists( $this, $key ) ) {
112 112
 			$this->$key = $value;
113 113
 			return;
114 114
 		}
115
-		if( !is_array( $this->custom )) {
115
+		if( !is_array( $this->custom ) ) {
116 116
 			$this->custom = array_filter( (array)$this->custom );
117 117
 		}
118 118
 		$this->custom[$key] = $value;
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 			'review_type' => 'local',
158 158
 		];
159 159
 		$meta = array_filter(
160
-			array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))),
160
+			array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ),
161 161
 			'strlen'
162 162
 		);
163
-		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ));
163
+		$properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) );
164 164
 		$this->modified = $this->isModified( $properties );
165 165
 		array_walk( $properties, function( $value, $key ) {
166
-			if( !property_exists( $this, $key ) || isset( $this->$key ))return;
166
+			if( !property_exists( $this, $key ) || isset($this->$key) )return;
167 167
 			$this->$key = maybe_unserialize( $value );
168 168
 		});
169 169
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	protected function setTermIds( WP_Post $post )
175 175
 	{
176 176
 		$this->term_ids = [];
177
-		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return;
177
+		if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return;
178 178
 		foreach( $terms as $term ) {
179 179
 			$this->term_ids[] = $term->term_id;
180 180
 		}
Please login to merge, or discard this patch.
helpers.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 		'glsr_get_review', 'glsr_get_reviews',
20 20
 		'glsr_log',
21 21
 	);
22
-	if( !in_array( $hook, $hooks ) || !function_exists( $hook ))return;
23
-	add_filter( $hook, function() use( $hook, $args ) {
22
+	if( !in_array( $hook, $hooks ) || !function_exists( $hook ) )return;
23
+	add_filter( $hook, function() use($hook, $args) {
24 24
 		array_shift( $args ); // remove the fallback value
25 25
 		return call_user_func_array( $hook, $args );
26 26
 	});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function glsr( $alias = null ) {
33 33
 	$app = \GeminiLabs\SiteReviews\Application::load();
34
-	return !empty( $alias )
34
+	return !empty($alias)
35 35
 		? $app->make( $alias )
36 36
 		: $app;
37 37
 }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	$result = array();
46 46
 	foreach( $array as $subarray ) {
47 47
 		$subarray = (array)$subarray;
48
-		if( !isset( $subarray[$column] ))continue;
48
+		if( !isset($subarray[$column]) )continue;
49 49
 		$result[] = $subarray[$column];
50 50
 	}
51 51
 	return $result;
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function glsr_calculate_ratings() {
58 58
 	glsr( 'Controllers\AdminController' )->routerCountReviews( false );
59
-	glsr_log()->info( __( 'Recalculated rating counts.', 'site-reviews' ));
59
+	glsr_log()->info( __( 'Recalculated rating counts.', 'site-reviews' ) );
60 60
 }
61 61
 
62 62
 /**
63 63
  * @return \GeminiLabs\SiteReviews\Review|false
64 64
  */
65 65
 function glsr_create_review( $reviewValues = array() ) {
66
-	if( !is_array( $reviewValues )) {
66
+	if( !is_array( $reviewValues ) ) {
67 67
 		$reviewValues = array();
68 68
 	}
69 69
 	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview( $reviewValues );
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
  * @return \WP_Screen|object
75 75
  */
76 76
 function glsr_current_screen() {
77
-	if( function_exists( 'get_current_screen' )) {
77
+	if( function_exists( 'get_current_screen' ) ) {
78 78
 		$screen = get_current_screen();
79 79
 	}
80
-	return empty( $screen )
80
+	return empty($screen)
81 81
 		? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
82 82
 		: $screen;
83 83
 }
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function glsr_get_review( $post_id ) {
126 126
 	$post = null;
127
-	if( is_numeric( $post_id )) {
127
+	if( is_numeric( $post_id ) ) {
128 128
 		$post = get_post( $post_id );
129 129
 	}
130
-	if( !( $post instanceof WP_Post )) {
130
+	if( !($post instanceof WP_Post) ) {
131 131
 		$post = new WP_Post( (object)[] );
132 132
 	}
133 133
 	return glsr( 'Database\ReviewManager' )->single( $post );
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
  * @return array
138 138
  */
139 139
 function glsr_get_reviews( $args = array() ) {
140
-	if( !is_array( $args )) {
140
+	if( !is_array( $args ) ) {
141 141
 		$args = [];
142 142
 	}
143 143
 	return glsr( 'Database\ReviewManager' )->get( $args );
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function glsr_log() {
150 150
 	$args = func_get_args();
151
-	$context = isset( $args[1] )
151
+	$context = isset($args[1])
152 152
 		? $args[1]
153 153
 		: [];
154 154
 	$console = glsr( 'Modules\Console' );
155
-	return !empty( $args )
155
+	return !empty($args)
156 156
 		? $console->log( 'debug', $args[0], $context )
157 157
 		: $console;
158 158
 }
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function enqueueAssets()
26 26
 	{
27
-		$command = new EnqueueAdminAssets([
27
+		$command = new EnqueueAdminAssets( [
28 28
 			'pointers' => [[
29 29
 				'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
30 30
 				'id' => 'glsr-pointer-pinned',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				'target' => '#misc-pub-pinned',
37 37
 				'title' => __( 'Pin Your Reviews', 'site-reviews' ),
38 38
 			]],
39
-		]);
39
+		] );
40 40
 		$this->execute( $command );
41 41
 	}
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	{
49 49
 		$links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
50 50
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
51
-		]);
51
+		] );
52 52
 		return $links;
53 53
 	}
54 54
 
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	public function filterDashboardGlanceItems( $items )
61 61
 	{
62 62
 		$postCount = wp_count_posts( Application::POST_TYPE );
63
-		if( empty( $postCount->publish )) {
63
+		if( empty($postCount->publish) ) {
64 64
 			return $items;
65 65
 		}
66 66
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
67
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
67
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
68 68
 		$items = glsr( Helper::class )->consolidateArray( $items );
69 69
 		$items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
70 70
 			? glsr( Builder::class )->a( $text, [
71 71
 				'class' => 'glsr-review-count',
72 72
 				'href' => 'edit.php?post_type='.Application::POST_TYPE,
73
-			])
73
+			] )
74 74
 			: glsr( Builder::class )->span( $text, [
75 75
 				'class' => 'glsr-review-count',
76
-			]);
76
+			] );
77 77
 		return $items;
78 78
 	}
79 79
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function filterTinymcePlugins( $plugins )
86 86
 	{
87
-		if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) {
87
+		if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) {
88 88
 			$plugins = glsr( Helper::class )->consolidateArray( $plugins );
89 89
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
90 90
 		}
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function registerTinymcePopups()
99 99
 	{
100
-		$command = new RegisterTinymcePopups([
100
+		$command = new RegisterTinymcePopups( [
101 101
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
102 102
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
103 103
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
104
-		]);
104
+		] );
105 105
 		$this->execute( $command );
106 106
 	}
107 107
 
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	public function renderTinymceButton( $editorId )
114 114
 	{
115 115
 		$allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId );
116
-		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return;
116
+		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ) )return;
117 117
 		$shortcodes = [];
118 118
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
119 119
 			$shortcodes[$shortcode] = $values;
120 120
 		}
121
-		if( empty( $shortcodes ))return;
121
+		if( empty($shortcodes) )return;
122 122
 		glsr()->render( 'partials/editor/tinymce', [
123 123
 			'shortcodes' => $shortcodes,
124
-		]);
124
+		] );
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	public function routerClearConsole()
131 131
 	{
132 132
 		glsr( Console::class )->clear();
133
-		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ));
133
+		glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function routerFetchConsole()
140 140
 	{
141
-		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ));
141
+		glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
142 142
 	}
143 143
 
144 144
 	/**
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 		}
158 158
 		$postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' );
159 159
 		foreach( $postIds as $postId ) {
160
-			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ));
160
+			$countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) );
161 161
 		}
162 162
 		$countManager->setCounts( $countManager->buildCounts() );
163 163
 		if( $showNotice ) {
164
-			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ));
164
+			glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
165 165
 		}
166
-		glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ));
166
+		glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) );
167 167
 	}
168 168
 
169 169
 	/**
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 	{
198 198
 		$file = $_FILES['import-file'];
199 199
 		if( $file['error'] !== UPLOAD_ERR_OK ) {
200
-			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ));
200
+			return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
201 201
 		}
202
-		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) {
203
-			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ));
202
+		if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
203
+			return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
204 204
 		}
205 205
 		$settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
206
-		if( empty( $settings )) {
207
-			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ));
206
+		if( empty($settings) ) {
207
+			return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
208 208
 		}
209
-		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ));
210
-		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ));
209
+		glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
210
+		glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
211 211
 	}
212 212
 
213 213
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
226 226
 			UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
227 227
 		];
228
-		return !isset( $errors[$errorCode] )
228
+		return !isset($errors[$errorCode])
229 229
 			? __( 'Unknown upload error.', 'site-reviews' )
230 230
 			: $errors[$errorCode];
231 231
 	}
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function routerChangeStatus( array $request )
24 24
 	{
25
-		wp_send_json_success( $this->execute( new ChangeStatus( $request )));
25
+		wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	public function routerClearConsole()
32 32
 	{
33 33
 		glsr( AdminController::class )->routerClearConsole();
34
-		wp_send_json_success([
34
+		wp_send_json_success( [
35 35
 			'console' => glsr( Console::class )->get(),
36 36
 			'notices' => glsr( Notice::class )->get(),
37
-		]);
37
+		] );
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	public function routerCountReviews()
44 44
 	{
45 45
 		glsr( AdminController::class )->routerCountReviews();
46
-		wp_send_json_success([
46
+		wp_send_json_success( [
47 47
 			'notices' => glsr( Notice::class )->get(),
48
-		]);
48
+		] );
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$shortcode = $request['shortcode'];
57 57
 		$response = false;
58
-		if( array_key_exists( $shortcode, glsr()->mceShortcodes )) {
58
+		if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
59 59
 			$data = glsr()->mceShortcodes[$shortcode];
60
-			if( !empty( $data['errors'] )) {
60
+			if( !empty($data['errors']) ) {
61 61
 				$data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
62 62
 			}
63 63
 			$response = [
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 	public function routerFetchConsole()
78 78
 	{
79 79
 		glsr( AdminController::class )->routerFetchConsole();
80
-		wp_send_json_success([
80
+		wp_send_json_success( [
81 81
 			'console' => glsr( Console::class )->get(),
82 82
 			'notices' => glsr( Notice::class )->get(),
83
-		]);
83
+		] );
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public function routerSearchPosts( array $request )
90 90
 	{
91 91
 		$results = glsr( Database::class )->searchPosts( $request['search'] );
92
-		wp_send_json_success([
92
+		wp_send_json_success( [
93 93
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
94 94
 			'items' => $results,
95
-		]);
95
+		] );
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function routerSearchTranslations( array $request )
102 102
 	{
103
-		if( empty( $request['exclude'] )) {
103
+		if( empty($request['exclude']) ) {
104 104
 			$request['exclude'] = [];
105 105
 		}
106 106
 		$results = glsr( Translation::class )
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 			->exclude()
109 109
 			->exclude( $request['exclude'] )
110 110
 			->renderResults();
111
-		wp_send_json_success([
111
+		wp_send_json_success( [
112 112
 			'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
113 113
 			'items' => $results,
114
-		]);
114
+		] );
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	public function routerSubmitReview( array $request )
121 121
 	{
122 122
 		$command = glsr( PublicController::class )->routerSubmitReview( $request );
123
-		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true )));
123
+		$redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
124 124
 		$redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
125 125
 		$data = [
126 126
 			'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function routerTogglePinned( array $request )
142 142
 	{
143
-		$isPinned = $this->execute( new TogglePinned( $request ));
144
-		wp_send_json_success([
143
+		$isPinned = $this->execute( new TogglePinned( $request ) );
144
+		wp_send_json_success( [
145 145
 			'notices' => glsr( Notice::class )->get(),
146 146
 			'pinned' => $isPinned,
147
-		]);
147
+		] );
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	public function filterEnqueuedScripts( $tag, $handle )
34 34
 	{
35 35
 		$scripts = [Application::ID.'/google-recaptcha'];
36
-		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) {
36
+		if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) {
37 37
 			$tag = str_replace( ' src=', ' async src=', $tag );
38 38
 		}
39
-		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) {
39
+		if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) {
40 40
 			$tag = str_replace( ' src=', ' defer src=', $tag );
41 41
 		}
42 42
 		return $tag;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function filterFieldOrder( array $config )
51 51
 	{
52
-		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ));
52
+		$order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) );
53 53
 		return array_intersect_key( array_merge( array_flip( $order ), $config ), $config );
54 54
 	}
55 55
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$validated = glsr( ValidateReview::class )->validate( $request );
102 102
 		$command = new CreateReview( $validated->request );
103
-		if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) {
103
+		if( empty($validated->error) && !$validated->recaptchaIsUnset ) {
104 104
 			$this->execute( $command );
105 105
 		}
106 106
 		return $command;
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,12 +32,12 @@  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 )));
35
+		$referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
36 36
 		$referer = apply_filters( 'site-reviews/review/redirect', $referer, $command );
37
-		if( empty( $referer )) {
37
+		if( empty($referer) ) {
38 38
 			$referer = $command->referer;
39 39
 		}
40
-		if( empty( $referer )) {
40
+		if( empty($referer) ) {
41 41
 			glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command );
42 42
 			$referer = home_url();
43 43
 		}
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function renderAssignedToMetabox( WP_Post $post )
135 135
 	{
136
-		if( !$this->isReviewPostType( $post ))return;
136
+		if( !$this->isReviewPostType( $post ) )return;
137 137
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
138 138
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
139 139
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
140 140
 			'id' => $assignedTo,
141 141
 			'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
142
-		]);
142
+		] );
143 143
 	}
144 144
 
145 145
 	/**
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function renderDetailsMetaBox( WP_Post $post )
150 150
 	{
151
-		if( !$this->isReviewPostType( $post ))return;
151
+		if( !$this->isReviewPostType( $post ) )return;
152 152
 		$review = glsr( ReviewManager::class )->single( $post );
153 153
 		glsr()->render( 'partials/editor/metabox-details', [
154 154
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
155 155
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
156
-		]);
156
+		] );
157 157
 	}
158 158
 
159 159
 	/**
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function renderPinnedInPublishMetaBox()
164 164
 	{
165
-		if( !$this->isReviewPostType( get_post() ))return;
165
+		if( !$this->isReviewPostType( get_post() ) )return;
166 166
 		glsr( Template::class )->render( 'partials/editor/pinned', [
167 167
 			'context' => [
168 168
 				'no' => __( 'No', 'site-reviews' ),
169 169
 				'yes' => __( 'Yes', 'site-reviews' ),
170 170
 			],
171
-			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
172
-		]);
171
+			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
172
+		] );
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function renderResponseMetaBox( WP_Post $post )
180 180
 	{
181
-		if( !$this->isReviewPostType( $post ))return;
181
+		if( !$this->isReviewPostType( $post ) )return;
182 182
 		wp_nonce_field( 'response', '_nonce-response', false );
183 183
 		glsr()->render( 'partials/editor/metabox-response', [
184 184
 			'response' => get_post_meta( $post->ID, 'response', true ),
185
-		]);
185
+		] );
186 186
 	}
187 187
 
188 188
 	/**
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function renderReviewEditor( WP_Post $post )
193 193
 	{
194
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
194
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
195 195
 		glsr()->render( 'partials/editor/review', [
196 196
 			'post' => $post,
197 197
 			'response' => get_post_meta( $post->ID, 'response', true ),
198
-		]);
198
+		] );
199 199
 	}
200 200
 
201 201
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$screen = glsr_current_screen();
208 208
 		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return;
209 209
 		add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
210
-		add_action( 'edit_form_top',         [$this, 'renderReviewNotice'] );
210
+		add_action( 'edit_form_top', [$this, 'renderReviewNotice'] );
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function renderReviewNotice( WP_Post $post )
218 218
 	{
219
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
219
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
220 220
 		glsr( Notice::class )->addWarning( sprintf(
221 221
 			__( '%s reviews are read-only.', 'site-reviews' ),
222 222
 			glsr( Columns::class )->buildColumnReviewType( $post->ID )
223
-		));
223
+		) );
224 224
 		glsr( Template::class )->render( 'partials/editor/notice', [
225 225
 			'context' => [
226 226
 				'notices' => glsr( Notice::class )->get(),
227 227
 			],
228
-		]);
228
+		] );
229 229
 	}
230 230
 
231 231
 	/**
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function renderTaxonomyMetabox( WP_Post $post )
237 237
 	{
238
-		if( !$this->isReviewPostType( $post ))return;
238
+		if( !$this->isReviewPostType( $post ) )return;
239 239
 		glsr()->render( 'partials/editor/metabox-categories', [
240 240
 			'post' => $post,
241 241
 			'tax_name' => Application::TAXONOMY,
242 242
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
243
-		]);
243
+		] );
244 244
 	}
245 245
 
246 246
 	/**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	public function revertReview()
252 252
 	{
253 253
 		if( filter_input( INPUT_GET, 'plugin' ) != Application::ID )return;
254
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
254
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
255 255
 		glsr( ReviewManager::class )->revert( $postId );
256 256
 		$this->redirect( $postId, 52 );
257 257
 	}
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
275 275
 	{
276 276
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
277
-		if( !( $assignedPost instanceof WP_Post ))return;
277
+		if( !($assignedPost instanceof WP_Post) )return;
278 278
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
279 279
 			'context' => [
280 280
 				'data.url' => (string)get_permalink( $assignedPost ),
281 281
 				'data.title' => get_the_title( $assignedPost ),
282 282
 			],
283
-		]);
283
+		] );
284 284
 	}
285 285
 
286 286
 	/**
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 				'class' => 'button button-large',
306 306
 				'href' => $revertUrl,
307 307
 				'id' => 'revert',
308
-			]);
308
+			] );
309 309
 		}
310 310
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
311 311
 			'class' => 'button button-large',
312 312
 			'disabled' => true,
313 313
 			'id' => 'revert',
314
-		]);
314
+		] );
315 315
 	}
316 316
 
317 317
 	/**
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
325 325
 			? glsr()->reviewTypes[$review->review_type]
326 326
 			: __( 'Unknown', 'site-reviews' );
327
-		if( !empty( $review->url )) {
327
+		if( !empty($review->url) ) {
328 328
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
329 329
 				'href' => $review->url,
330 330
 				'target' => '_blank',
331
-			]);
331
+			] );
332 332
 		}
333 333
 		return $reviewType;
334 334
 	}
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	protected function normalizeDetailsMetaBox( Review $review )
359 359
 	{
360
-		$user = empty( $review->user_id )
360
+		$user = empty($review->user_id)
361 361
 			? __( 'Unregistered user', 'site-reviews' )
362 362
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
363 363
 				'href' => get_author_posts_url( $review->user_id ),
364
-			]);
365
-		$email = empty( $review->email )
364
+			] );
365
+		$email = empty($review->email)
366 366
 			? '&mdash;'
367 367
 			: glsr( Builder::class )->a( $review->email, [
368 368
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
369
-			]);
369
+			] );
370 370
 		$metabox = [
371 371
 			__( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ),
372 372
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 			__( 'IP Address', 'site-reviews' ) => $review->ip_address,
378 378
 			__( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
379 379
 		];
380
-		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ));
380
+		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
381 381
 	}
382 382
 
383 383
 	/**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		$redirectUri = $hasReferer
395 395
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
396 396
 			: get_edit_post_link( $postId );
397
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
397
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
398 398
 		exit;
399 399
 	}
400 400
 }
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			'setting' => 'Plugin Settings',
41 41
 			'reviews' => 'Review Counts',
42 42
 		];
43
-		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) {
43
+		$systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) {
44 44
 			$methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' );
45 45
 			if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) {
46 46
 				return $carry.$this->implode(
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	{
61 61
 		$plugins = get_plugins();
62 62
 		$activePlugins = (array)get_option( 'active_plugins', [] );
63
-		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ));
64
-		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
63
+		$inactive = array_diff_key( $plugins, array_flip( $activePlugins ) );
64
+		return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
65 65
 	}
66 66
 
67 67
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	public function getInactivePluginDetails()
96 96
 	{
97 97
 		$activePlugins = (array)get_option( 'active_plugins', [] );
98
-		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins )));
98
+		return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
99 99
 	}
100 100
 
101 101
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	{
106 106
 		$plugins = array_merge(
107 107
 			get_mu_plugins(),
108
-			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ))
108
+			get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) )
109 109
 		);
110
-		if( empty( $plugins ))return;
110
+		if( empty($plugins) )return;
111 111
 		return $this->normalizePluginList( $plugins );
112 112
 	}
113 113
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getMultisitePluginDetails()
118 118
 	{
119
-		if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return;
119
+		if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return;
120 120
 		return $this->normalizePluginList( wp_get_active_network_plugins() );
121 121
 	}
122 122
 
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 			'Memory Limit' => ini_get( 'memory_limit' ),
145 145
 			'Post Max Size' => ini_get( 'post_max_size' ),
146 146
 			'Sendmail Path' => ini_get( 'sendmail_path' ),
147
-			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )),
148
-			'Session Name' => esc_html( ini_get( 'session.name' )),
149
-			'Session Save Path' => esc_html( ini_get( 'session.save_path' )),
150
-			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ),
151
-			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ),
147
+			'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ),
148
+			'Session Name' => esc_html( ini_get( 'session.name' ) ),
149
+			'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ),
150
+			'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ),
151
+			'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ),
152 152
 			'Upload Max Filesize' => ini_get( 'upload_max_filesize' ),
153 153
 		];
154 154
 	}
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	{
161 161
 		$counts = glsr( CountsManager::class )->getCounts();
162 162
 		$counts = glsr( Helper::class )->flattenArray( $counts );
163
- 		array_walk( $counts, function( &$ratings ) use( $counts ) {
164
-			if( !is_array( $ratings )) {
163
+ 		array_walk( $counts, function( &$ratings ) use($counts) {
164
+			if( !is_array( $ratings ) ) {
165 165
 				glsr_log()
166 166
 					->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
167 167
 					->debug( $ratings )
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 		ksort( $settings );
201 201
 		$details = [];
202 202
 		foreach( $settings as $key => $value ) {
203
-			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue;
204
-			$value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' );
203
+			if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue;
204
+			$value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
205 205
 			$details[$key] = $value;
206 206
 		}
207 207
 		return $details;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	{
215 215
 		return [
216 216
 			'Console size' => glsr( Console::class )->humanSize( '0' ),
217
-			'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' )),
217
+			'Last Rating Count' => date_i18n( 'Y-m-d H:i', glsr( OptionManager::class )->get( 'last_review_count' ) ),
218 218
 			'Version (current)' => glsr()->version,
219 219
 			'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
220 220
 		];
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 			'WPE_APIKEY' => 'WP Engine',
275 275
 		];
276 276
 		foreach( $checks as $key => $value ) {
277
-			if( !$this->isWebhostCheckValid( $key ))continue;
277
+			if( !$this->isWebhostCheckValid( $key ) )continue;
278 278
 			return $value;
279 279
 		}
280
-		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ));
280
+		return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
281 281
 	}
282 282
 
283 283
 	/**
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	{
299 299
 		$plugins = get_plugins();
300 300
 		$activePlugins = (array)get_option( 'active_plugins', [] );
301
-		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins )));
302
-		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ));
301
+		$inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) );
302
+		$active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) );
303 303
 		return $active + $inactive;
304 304
 	}
305 305
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	protected function implode( $title, array $details )
311 311
 	{
312 312
 		$strings = ['['.$title.']'];
313
-		$padding = max( array_map( 'strlen', array_keys( $details )) );
313
+		$padding = max( array_map( 'strlen', array_keys( $details ) ) );
314 314
 		$padding = max( [$padding, static::PAD] );
315 315
 		foreach( $details as $key => $value ) {
316 316
 			$strings[] = is_string( $key )
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 		$keys = [
354 354
 			'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret',
355 355
 		];
356
-		array_walk( $settings, function( &$value, $setting ) use( $keys ) {
356
+		array_walk( $settings, function( &$value, $setting ) use($keys) {
357 357
 			foreach( $keys as $key ) {
358
-				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue;
358
+				if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue;
359 359
 				$value = str_repeat( '•', 13 );
360 360
 				return;
361 361
 			}
Please login to merge, or discard this patch.