Passed
Push — hotfix/fix-counts ( 1543e7...1ce239 )
by Paul
03:48
created
plugin/Application.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function __construct()
34 34
 	{
35 35
 		static::$instance = $this;
36
-		$this->file = realpath( trailingslashit( dirname( __DIR__ )).static::ID.'.php' );
36
+		$this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
37 37
 		$plugin = get_file_data( $this->file, [
38 38
 			'languages' => 'Domain Path',
39 39
 			'name' => 'Plugin Name',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$constant = $className.'::'.$property;
87 87
 		return defined( $constant )
88
-			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ))
88
+			? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
89 89
 			: '';
90 90
 	}
91 91
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function file( $view )
105 105
 	{
106
-		$view.= '.php';
106
+		$view .= '.php';
107 107
 		$filePaths = [];
108
-		if( glsr( Helper::class )->startsWith( 'templates/', $view )) {
109
-			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ));
108
+		if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) {
109
+			$filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) );
110 110
 		}
111 111
 		$filePaths[] = $this->path( $view );
112 112
 		$filePaths[] = $this->path( 'views/'.$view );
113 113
 		foreach( $filePaths as $file ) {
114
-			if( !file_exists( $file ))continue;
114
+			if( !file_exists( $file ) )continue;
115 115
 			return $file;
116 116
 		}
117 117
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getDefaults()
123 123
 	{
124
-		if( empty( $this->defaults )) {
124
+		if( empty($this->defaults) ) {
125 125
 			$this->defaults = $this->make( DefaultsManager::class )->get();
126 126
 			$this->upgrade();
127 127
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			'addons' => 'install_plugins',
138 138
 			'settings' => 'manage_options',
139 139
 		];
140
-		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ));
140
+		return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ) );
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	public function hasPermission( $page = '' )
147 147
 	{
148 148
 		$isAdmin = $this->isAdmin();
149
-		return !$isAdmin || ( $isAdmin && current_user_can( $this->getPermission( $page )));
149
+		return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) ));
150 150
 	}
151 151
 
152 152
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		$path = plugin_dir_path( $this->file );
176 176
 		if( !$realpath ) {
177
-			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ));
177
+			$path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
178 178
 		}
179 179
 		$path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
180 180
 		return apply_filters( 'site-reviews/path', $path, $file );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$types = apply_filters( 'site-reviews/addon/types', [] );
207 207
 		$this->reviewTypes = wp_parse_args( $types, [
208 208
 			'local' => __( 'Local', 'site-reviews' ),
209
-		]);
209
+		] );
210 210
 	}
211 211
 
212 212
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	{
218 218
 		$view = apply_filters( 'site-reviews/render/view', $view, $data );
219 219
 		$file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
220
-		if( !file_exists( $file )) {
220
+		if( !file_exists( $file ) ) {
221 221
 			glsr_log()->error( 'File not found: '.$file );
222 222
 			return;
223 223
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function scheduleCronJob()
233 233
 	{
234
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
234
+		if( wp_next_scheduled( static::CRON_EVENT ) )return;
235 235
 		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
236 236
 	}
237 237
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function unscheduleCronJob()
251 251
 	{
252
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
252
+		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
253 253
 	}
254 254
 
255 255
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function url( $path = '' )
283 283
 	{
284
-		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
284
+		$url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
285 285
 		return apply_filters( 'site-reviews/url', $url, $path );
286 286
 	}
287 287
 }
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
26 26
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 27
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 28
 				'class' => 'pending-count',
29
-			]);
29
+			] );
30 30
 			$awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
31 31
 				'class' => 'awaiting-mod count-'.$postCount->pending,
32
-			]);
32
+			] );
33 33
 			$menu[$key][0] .= ' '.$awaitingModeration;
34 34
 			if( $typenow === Application::POST_TYPE ) {
35
-				$menu[$key][4].= ' current';
35
+				$menu[$key][4] .= ' current';
36 36
 			}
37 37
 			break;
38 38
 		}
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 			'tools' => __( 'Tools', 'site-reviews' ),
50 50
 			'addons' => __( 'Add-ons', 'site-reviews' ),
51 51
 			'documentation' => __( 'Documentation', 'site-reviews' ),
52
-		]);
52
+		] );
53 53
 		foreach( $pages as $slug => $title ) {
54 54
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 55
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
56
+			if( !is_callable( $callback ) )continue;
57 57
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
58 58
 		}
59 59
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	{
68 68
 		$this->renderPage( 'addons', [
69 69
 			'template' => glsr( Template::class ),
70
-		]);
70
+		] );
71 71
 	}
72 72
 
73 73
 	/**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 			'hooks' => __( 'Hooks', 'site-reviews' ),
85 85
 			'functions' => __( 'Functions', 'site-reviews' ),
86 86
 			'addons' => __( 'Addons', 'site-reviews' ),
87
-		]);
87
+		] );
88 88
 		$addons = apply_filters( 'site-reviews/addon/documentation', [] );
89 89
 		ksort( $addons );
90
-		if( empty( $addons )) {
91
-			unset( $tabs['addons'] );
90
+		if( empty($addons) ) {
91
+			unset($tabs['addons']);
92 92
 		}
93 93
 		$this->renderPage( 'documentation', [
94 94
 			'addons' => $addons,
95 95
 			'tabs' => $tabs,
96
-		]);
96
+		] );
97 97
 	}
98 98
 
99 99
 	/**
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 			'translations' => __( 'Translations', 'site-reviews' ),
112 112
 			'addons' => __( 'Addons', 'site-reviews' ),
113 113
 			'licenses' => __( 'Licenses', 'site-reviews' ),
114
-		]);
115
-		if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' ))) {
116
-			unset( $tabs['addons'] );
114
+		] );
115
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.addons' )) ) {
116
+			unset($tabs['addons']);
117 117
 		}
118
-		if( empty( glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' ))) {
119
-			unset( $tabs['licenses'] );
118
+		if( empty(glsr( Helper::class )->dataGet( glsr()->defaults, 'settings.licenses' )) ) {
119
+			unset($tabs['licenses']);
120 120
 		}
121 121
 		$this->renderPage( 'settings', [
122 122
 			'notices' => $this->getNotices(),
123 123
 			'settings' => glsr( Settings::class ),
124 124
 			'tabs' => $tabs,
125
-		]);
125
+		] );
126 126
 	}
127 127
 
128 128
 	/**
@@ -137,24 +137,24 @@  discard block
 block discarded – undo
137 137
 			'sync' => __( 'Sync Reviews', 'site-reviews' ),
138 138
 			'console' => __( 'Console', 'site-reviews' ),
139 139
 			'system-info' => __( 'System Info', 'site-reviews' ),
140
-		]);
141
-		if( !apply_filters( 'site-reviews/addon/sync/enable', false )) {
142
-			unset( $tabs['sync'] );
140
+		] );
141
+		if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
142
+			unset($tabs['sync']);
143 143
 		}
144 144
 		$this->renderPage( 'tools', [
145 145
 			'data' => [
146 146
 				'context' => [
147 147
 					'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ),
148
-					'console' => strval( glsr( Console::class )),
148
+					'console' => strval( glsr( Console::class ) ),
149 149
 					'id' => Application::ID,
150
-					'system' => strval( glsr( System::class )),
150
+					'system' => strval( glsr( System::class ) ),
151 151
 				],
152 152
 				'services' => apply_filters( 'site-reviews/addon/sync/services', [] ),
153 153
 			],
154 154
 			'notices' => $this->getNotices(),
155 155
 			'tabs' => $tabs,
156 156
 			'template' => glsr( Template::class ),
157
-		]);
157
+		] );
158 158
 	}
159 159
 
160 160
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	{
176 176
 		return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
177 177
 			'id' => 'glsr-notices',
178
-		]);
178
+		] );
179 179
 	}
180 180
 
181 181
 	/**
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) {
26
+				continue;
27
+			}
26 28
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 29
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 30
 				'class' => 'pending-count',
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 		foreach( $pages as $slug => $title ) {
54 56
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 57
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
58
+			if( !is_callable( $callback )) {
59
+				continue;
60
+			}
57 61
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
58 62
 		}
59 63
 	}
Please login to merge, or discard this patch.
views/pages/tools/general.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if( glsr()->hasPermission( 'settings' )) : ?>
3
+<?php if( glsr()->hasPermission( 'settings' ) ) : ?>
4 4
 <div class="glsr-card card">
5 5
 	<h3>Export Settings</h3>
6 6
 	<p>Export the Site Reviews settings for this site to a <code>*.json</code> file. This allows you to easily import the plugin settings into another site.</p>
Please login to merge, or discard this patch.