@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getWP( $path, $fallback = '' ) |
82 | 82 | { |
83 | 83 | $option = get_option( $path, $fallback ); |
84 | - return empty( $option ) |
|
84 | + return empty($option) |
|
85 | 85 | ? $fallback |
86 | 86 | : $option; |
87 | 87 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | glsr( DefaultsManager::class )->defaults() |
105 | 105 | ); |
106 | 106 | array_walk( $options, function( &$value ) { |
107 | - if( !is_string( $value ))return; |
|
108 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
107 | + if( !is_string( $value ) )return; |
|
108 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
109 | 109 | }); |
110 | 110 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
111 | 111 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function isRecaptchaEnabled() |
117 | 117 | { |
118 | 118 | $integration = $this->get( 'settings.submissions.recaptcha.integration' ); |
119 | - return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() ); |
|
119 | + return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in()); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function reset() |
126 | 126 | { |
127 | 127 | $options = get_option( static::databaseKey(), [] ); |
128 | - if( !is_array( $options ) || empty( $options )) { |
|
128 | + if( !is_array( $options ) || empty($options) ) { |
|
129 | 129 | delete_option( static::databaseKey() ); |
130 | 130 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
131 | 131 | } |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function set( $pathOrOptions, $value = '' ) |
141 | 141 | { |
142 | - if( is_string( $pathOrOptions )) { |
|
142 | + if( is_string( $pathOrOptions ) ) { |
|
143 | 143 | $pathOrOptions = glsr( Helper::class )->dataSet( $this->all(), $pathOrOptions, $value ); |
144 | 144 | } |
145 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
145 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
146 | 146 | $this->reset(); |
147 | 147 | } |
148 | 148 | return $result; |
@@ -13,7 +13,7 @@ discard block |
||
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 ); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected function filter( array $values = [] ) |
33 | 33 | { |
34 | - return $this->merge( array_filter( $values )); |
|
34 | + return $this->merge( array_filter( $values ) ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | |
11 | 11 | class Console |
12 | 12 | { |
13 | - const DEBUG_0 = 'debug'; // Detailed debug information |
|
14 | - const INFO_1 = 'info'; // Interesting events |
|
15 | - const NOTICE_2 = 'notice'; // Normal but significant events |
|
16 | - const WARNING_3 = 'warning'; // Exceptional occurrences that are not errors |
|
17 | - const ERROR_4 = 'error'; // Runtime errors that do not require immediate action |
|
18 | - const CRITICAL_5 = 'critical'; // Critical conditions |
|
19 | - const ALERT_6 = 'alert'; // Action must be taken immediately |
|
13 | + const DEBUG_0 = 'debug'; // Detailed debug information |
|
14 | + const INFO_1 = 'info'; // Interesting events |
|
15 | + const NOTICE_2 = 'notice'; // Normal but significant events |
|
16 | + const WARNING_3 = 'warning'; // Exceptional occurrences that are not errors |
|
17 | + const ERROR_4 = 'error'; // Runtime errors that do not require immediate action |
|
18 | + const CRITICAL_5 = 'critical'; // Critical conditions |
|
19 | + const ALERT_6 = 'alert'; // Action must be taken immediately |
|
20 | 20 | const EMERGENCY_7 = 'emergency'; // System is unusable |
21 | 21 | |
22 | 22 | protected $file; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function get() |
113 | 113 | { |
114 | - return empty( $this->log ) |
|
114 | + return empty($this->log) |
|
115 | 115 | ? __( 'Console is empty', 'site-reviews' ) |
116 | 116 | : $this->log; |
117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getLevel() |
123 | 123 | { |
124 | - return intval( apply_filters( 'site-reviews/console/level', 2 )); |
|
124 | + return intval( apply_filters( 'site-reviews/console/level', 2 ) ); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getLevels() |
131 | 131 | { |
132 | - return array_values(( new ReflectionClass( __CLASS__ ))->getConstants() ); |
|
132 | + return array_values( (new ReflectionClass( __CLASS__ ))->getConstants() ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | public function humanSize( $valueIfEmpty = null ) |
149 | 149 | { |
150 | 150 | $bytes = $this->size(); |
151 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
151 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
152 | 152 | return $valueIfEmpty; |
153 | 153 | } |
154 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
155 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
154 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
155 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function log( $level, $message, $context = [], $backtraceLine = '' ) |
178 | 178 | { |
179 | - if( empty( $backtraceLine )) { |
|
179 | + if( empty($backtraceLine) ) { |
|
180 | 180 | $backtraceLine = $this->getBacktraceLine(); |
181 | 181 | } |
182 | - if( $this->canLogEntry( $level, $backtraceLine )) { |
|
182 | + if( $this->canLogEntry( $level, $backtraceLine ) ) { |
|
183 | 183 | $context = glsr( Helper::class )->consolidateArray( $context ); |
184 | 184 | $backtraceLine = $this->normalizeBacktraceLine( $backtraceLine ); |
185 | 185 | $message = $this->interpolate( $message, $context ); |
186 | 186 | $entry = $this->buildLogEntry( $level, $message, $backtraceLine ); |
187 | - file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND|LOCK_EX ); |
|
187 | + file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND | LOCK_EX ); |
|
188 | 188 | apply_filters( 'console', $message, $level, $backtraceLine ); // Show in Blackbar plugin if installed |
189 | 189 | $this->reset(); |
190 | 190 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $once = glsr( Helper::class )->consolidateArray( $once ); |
201 | 201 | $levels = $this->getLevels(); |
202 | 202 | foreach( $once as $entry ) { |
203 | - if( !in_array( glsr_get( $entry, 'level' ), $levels ))continue; |
|
203 | + if( !in_array( glsr_get( $entry, 'level' ), $levels ) )continue; |
|
204 | 204 | $level = glsr_get( $entry, 'level' ); |
205 | 205 | $message = glsr_get( $entry, 'message' ); |
206 | 206 | $backtraceLine = glsr_get( $entry, 'backtrace' ); |
@@ -229,11 +229,11 @@ discard block |
||
229 | 229 | { |
230 | 230 | $once = glsr( Session::class )->get( $this->onceSessionKey, [] ); |
231 | 231 | $once = glsr( Helper::class )->consolidateArray( $once ); |
232 | - $filtered = array_filter( $once, function( $entry ) use( $level, $handle ) { |
|
232 | + $filtered = array_filter( $once, function( $entry ) use($level, $handle) { |
|
233 | 233 | return glsr_get( $entry, 'level' ) == $level |
234 | 234 | && glsr_get( $entry, 'handle' ) == $handle; |
235 | 235 | }); |
236 | - if( !empty( $filtered ))return; |
|
236 | + if( !empty($filtered) )return; |
|
237 | 237 | $once[] = [ |
238 | 238 | 'backtrace' => $this->getBacktraceLineFromData( $data ), |
239 | 239 | 'handle' => $handle, |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | protected function getBacktraceLine() |
315 | 315 | { |
316 | 316 | $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 ); |
317 | - $search = array_search( 'log', glsr_array_column( $backtrace, 'function' )); |
|
317 | + $search = array_search( 'log', glsr_array_column( $backtrace, 'function' ) ); |
|
318 | 318 | if( $search !== false ) { |
319 | - $index = glsr_get( $backtrace, ( $search + 2 ).'.function' ) == '{closure}' |
|
319 | + $index = glsr_get( $backtrace, ($search + 2).'.function' ) == '{closure}' |
|
320 | 320 | ? $search + 4 |
321 | 321 | : $search + 1; |
322 | 322 | return $this->buildBacktraceLine( $backtrace, $index ); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | protected function interpolate( $message, $context = [] ) |
357 | 357 | { |
358 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
358 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
359 | 359 | return print_r( $message, true ); |
360 | 360 | } |
361 | 361 | $replace = []; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | glsr()->path( 'plugin/' ), |
385 | 385 | glsr()->path( 'plugin/', false ), |
386 | 386 | trailingslashit( glsr()->path() ), |
387 | - trailingslashit( glsr()->path( '', false )), |
|
387 | + trailingslashit( glsr()->path( '', false ) ), |
|
388 | 388 | WP_CONTENT_DIR, |
389 | 389 | ABSPATH |
390 | 390 | ]; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | if( $value instanceof DateTime ) { |
413 | 413 | $value = $value->format( 'Y-m-d H:i:s' ); |
414 | 414 | } |
415 | - else if( $this->isObjectOrArray( $value )) { |
|
415 | + else if( $this->isObjectOrArray( $value ) ) { |
|
416 | 416 | $value = json_encode( $value ); |
417 | 417 | } |
418 | 418 | return (string)$value; |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function saveAssignedToMetabox( $postId ) |
14 | 14 | { |
15 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
16 | - $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
|
15 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ) )return; |
|
16 | + $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' ) ); |
|
17 | 17 | update_post_meta( $postId, 'assigned_to', $assignedTo ); |
18 | 18 | } |
19 | 19 | |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function saveResponseMetabox( $postId ) |
25 | 25 | { |
26 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
27 | - $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
|
26 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ) )return; |
|
27 | + $response = strval( glsr( Helper::class )->filterInput( 'response' ) ); |
|
28 | 28 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
29 | 29 | 'a' => ['href' => [], 'title' => []], |
30 | 30 | 'em' => [], |
31 | 31 | 'strong' => [], |
32 | - ]))); |
|
32 | + ] ) ) ); |
|
33 | 33 | } |
34 | 34 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | * @see https://wordpress.org/plugins/wp-super-cache/ |
21 | 21 | */ |
22 | 22 | add_action( 'site-reviews/review/created', function( $review, $request ) { |
23 | - if( !function_exists( 'wp_cache_post_change' ))return; |
|
23 | + if( !function_exists( 'wp_cache_post_change' ) )return; |
|
24 | 24 | wp_cache_post_change( $request->post_id ); |
25 | - if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return; |
|
25 | + if( empty($review->assigned_to) || $review->assigned_to == $request->post_id )return; |
|
26 | 26 | wp_cache_post_change( $review->assigned_to ); |
27 | 27 | }, 10, 2 ); |
28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
35 | 35 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
36 | - return array_keys( array_flip( $scriptHandles )); |
|
36 | + return array_keys( array_flip( $scriptHandles ) ); |
|
37 | 37 | }); |
38 | 38 | |
39 | 39 | /** |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @see https://searchandfilter.com/ |
44 | 44 | */ |
45 | 45 | add_filter( 'sf_edit_query_args', function( $query ) { |
46 | - if( !empty( $query['meta_key'] ) && $query['meta_key'] == '_glsr_ranking' ) { |
|
47 | - unset( $query['meta_key'] ); |
|
46 | + if( !empty($query['meta_key']) && $query['meta_key'] == '_glsr_ranking' ) { |
|
47 | + unset($query['meta_key']); |
|
48 | 48 | $query['meta_query'] = [ |
49 | 49 | 'relation' => 'OR', |
50 | 50 | ['key' => '_glsr_ranking', 'compare' => 'NOT EXISTS'], // this comes first! |
@@ -33,7 +33,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -22,17 +22,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -1,6 +1,6 @@ |
||
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> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function enqueueAssets() |
29 | 29 | { |
30 | - if( apply_filters( 'site-reviews/assets/css', true )) { |
|
30 | + if( apply_filters( 'site-reviews/assets/css', true ) ) { |
|
31 | 31 | wp_enqueue_style( |
32 | 32 | Application::ID, |
33 | 33 | $this->getStylesheet(), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | glsr()->version |
36 | 36 | ); |
37 | 37 | } |
38 | - if( apply_filters( 'site-reviews/assets/js', true )) { |
|
38 | + if( apply_filters( 'site-reviews/assets/js', true ) ) { |
|
39 | 39 | $dependencies = apply_filters( 'site-reviews/assets/polyfill', true ) |
40 | 40 | ? [Application::ID.'/polyfill'] |
41 | 41 | : []; |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function enqueuePolyfillService() |
57 | 57 | { |
58 | - if( !apply_filters( 'site-reviews/assets/polyfill', true ))return; |
|
59 | - wp_enqueue_script( Application::ID.'/polyfill', add_query_arg([ |
|
58 | + if( !apply_filters( 'site-reviews/assets/polyfill', true ) )return; |
|
59 | + wp_enqueue_script( Application::ID.'/polyfill', add_query_arg( [ |
|
60 | 60 | 'features' => 'CustomEvent,Element.prototype.closest,Element.prototype.dataset,Event,XMLHttpRequest,MutationObserver', |
61 | 61 | 'flags' => 'gated', |
62 | - ], 'https://polyfill.io/v3/polyfill.min.js' )); |
|
62 | + ], 'https://polyfill.io/v3/polyfill.min.js' ) ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | // nf-google-recaptcha |
73 | 73 | if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
74 | 74 | $language = apply_filters( 'site-reviews/recaptcha/language', get_locale() ); |
75 | - wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([ |
|
75 | + wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [ |
|
76 | 76 | 'hl' => $language, |
77 | 77 | 'render' => 'explicit', |
78 | - ], 'https://www.google.com/recaptcha/api.js' )); |
|
78 | + ], 'https://www.google.com/recaptcha/api.js' ) ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | public function inlineStyles() |
102 | 102 | { |
103 | 103 | $inlineStylesheetPath = glsr()->path( 'assets/styles/inline-styles.css' ); |
104 | - if( !apply_filters( 'site-reviews/assets/css', true ))return; |
|
105 | - if( !file_exists( $inlineStylesheetPath )) { |
|
104 | + if( !apply_filters( 'site-reviews/assets/css', true ) )return; |
|
105 | + if( !file_exists( $inlineStylesheetPath ) ) { |
|
106 | 106 | glsr_log()->error( 'Inline stylesheet is missing: '.$inlineStylesheetPath ); |
107 | 107 | return; |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $script = 'window.hasOwnProperty("GLSR")||(window.GLSR={});'; |
124 | 124 | foreach( $variables as $key => $value ) { |
125 | - $script.= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE )); |
|
125 | + $script .= sprintf( 'GLSR.%s=%s;', $key, json_encode( $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ); |
|
126 | 126 | } |
127 | 127 | $pattern = '/\"([^ \-\"]+)\"(:[{\[\"])/'; // removes unnecessary quotes surrounding object keys |
128 | 128 | $optimizedScript = preg_replace( $pattern, '$1$2', $script ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getFixedSelectorsForPagination() |
136 | 136 | { |
137 | - $selectors = ['#wpadminbar','.site-navigation-fixed']; |
|
137 | + $selectors = ['#wpadminbar', '.site-navigation-fixed']; |
|
138 | 138 | return apply_filters( 'site-reviews/enqueue/public/localize/ajax-pagination', $selectors ); |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function getStylesheet() |
145 | 145 | { |
146 | 146 | $currentStyle = glsr( Style::class )->style; |
147 | - return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' )) |
|
147 | + return file_exists( glsr()->path( 'assets/styles/custom/'.$currentStyle.'.css' ) ) |
|
148 | 148 | ? glsr()->url( 'assets/styles/custom/'.$currentStyle.'.css' ) |
149 | 149 | : glsr()->url( 'assets/styles/'.Application::ID.'.css' ); |
150 | 150 | } |