@@ -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 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->args = $args; |
36 | 36 | $this->ratingCounts = glsr( ReviewManager::class )->getRatingCounts( $args ); |
37 | - if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ))return; |
|
37 | + if( !array_sum( $this->ratingCounts ) && $this->isHidden( 'if_empty' ) )return; |
|
38 | 38 | $this->averageRating = glsr( Rating::class )->getAverage( $this->ratingCounts ); |
39 | 39 | $this->generateSchema(); |
40 | 40 | return glsr( Template::class )->build( 'templates/reviews-summary', [ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | 'stars' => $this->buildStars(), |
48 | 48 | 'text' => $this->buildText(), |
49 | 49 | ], |
50 | - ]); |
|
50 | + ] ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function buildPercentage() |
57 | 57 | { |
58 | - if( $this->isHidden( 'bars' ))return; |
|
59 | - $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts )); |
|
60 | - $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use( $percentages ) { |
|
58 | + if( $this->isHidden( 'bars' ) )return; |
|
59 | + $percentages = preg_filter( '/$/', '%', glsr( Rating::class )->getPercentages( $this->ratingCounts ) ); |
|
60 | + $bars = array_reduce( range( Rating::MAX_RATING, 1 ), function( $carry, $level ) use($percentages) { |
|
61 | 61 | $label = $this->buildPercentageLabel( $this->args['labels'][$level] ); |
62 | 62 | $background = $this->buildPercentageBackground( $percentages[$level] ); |
63 | 63 | $count = apply_filters( 'site-reviews/summary/counts', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $percent = $this->buildPercentageCount( $count ); |
68 | 68 | return $carry.glsr( Builder::class )->div( $label.$background.$percent, [ |
69 | 69 | 'class' => 'glsr-bar', |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | }); |
72 | 72 | return $this->wrap( 'percentage', $bars ); |
73 | 73 | } |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function buildPercentageBackground( $percent ) |
80 | 80 | { |
81 | - $backgroundPercent = glsr( Builder::class )->span([ |
|
81 | + $backgroundPercent = glsr( Builder::class )->span( [ |
|
82 | 82 | 'class' => 'glsr-bar-background-percent', |
83 | 83 | 'style' => 'width:'.$percent, |
84 | - ]); |
|
84 | + ] ); |
|
85 | 85 | return '<span class="glsr-bar-background">'.$backgroundPercent.'</span>'; |
86 | 86 | } |
87 | 87 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function buildRating() |
110 | 110 | { |
111 | - if( $this->isHidden( 'rating' ))return; |
|
111 | + if( $this->isHidden( 'rating' ) )return; |
|
112 | 112 | return $this->wrap( 'rating', '<span>'.$this->averageRating.'</span>' ); |
113 | 113 | } |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function buildStars() |
119 | 119 | { |
120 | - if( $this->isHidden( 'stars' ))return; |
|
120 | + if( $this->isHidden( 'stars' ) )return; |
|
121 | 121 | $stars = glsr_star_rating( $this->averageRating ); |
122 | 122 | return $this->wrap( 'stars', $stars ); |
123 | 123 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function buildText() |
129 | 129 | { |
130 | - if( $this->isHidden( 'summary' ))return; |
|
131 | - $count = intval( array_sum( $this->ratingCounts )); |
|
132 | - if( empty( $this->args['text'] )) { |
|
130 | + if( $this->isHidden( 'summary' ) )return; |
|
131 | + $count = intval( array_sum( $this->ratingCounts ) ); |
|
132 | + if( empty($this->args['text']) ) { |
|
133 | 133 | // @todo document this change |
134 | 134 | $this->args['text'] = _nx( |
135 | 135 | '{rating} out of {max} stars (based on {num} review)', |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ); |
141 | 141 | } |
142 | 142 | $summary = str_replace( |
143 | - ['{rating}','{max}', '{num}'], |
|
143 | + ['{rating}', '{max}', '{num}'], |
|
144 | 144 | [$this->averageRating, Rating::MAX_RATING, $count], |
145 | 145 | $this->args['text'] |
146 | 146 | ); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function generateSchema() |
154 | 154 | { |
155 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
155 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
156 | 156 | glsr( Schema::class )->store( |
157 | 157 | glsr( Schema::class )->buildSummary( $this->args ) |
158 | 158 | ); |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | { |
185 | 185 | return glsr( Builder::class )->div( $value, [ |
186 | 186 | 'class' => 'glsr-summary-'.$key, |
187 | - ]); |
|
187 | + ] ); |
|
188 | 188 | } |
189 | 189 | } |
@@ -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 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->getCounts(), |
65 | 65 | $review->review_type, |
66 | 66 | $review->rating |
67 | - )); |
|
67 | + ) ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function decreasePostCounts( Review $review ) |
74 | 74 | { |
75 | - if( empty( $counts = $this->getPostCounts( $review->assigned_to )))return; |
|
75 | + if( empty($counts = $this->getPostCounts( $review->assigned_to )) )return; |
|
76 | 76 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
77 | 77 | $this->setPostCounts( $review->assigned_to, $counts ); |
78 | 78 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function decreaseTermCounts( Review $review ) |
84 | 84 | { |
85 | 85 | foreach( $review->term_ids as $termId ) { |
86 | - if( empty( $counts = $this->getTermCounts( $termId )))continue; |
|
86 | + if( empty($counts = $this->getTermCounts( $termId )) )continue; |
|
87 | 87 | $counts = $this->decreaseRating( $counts, $review->review_type, $review->rating ); |
88 | 88 | $this->setTermCounts( $termId, $counts ); |
89 | 89 | } |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | public function flatten( array $reviewCounts, array $args = [] ) |
96 | 96 | { |
97 | 97 | $counts = []; |
98 | - array_walk_recursive( $reviewCounts, function( $num, $index ) use( &$counts ) { |
|
99 | - $counts[$index] = $num + intval( glsr_get( $counts, $index, 0 )); |
|
98 | + array_walk_recursive( $reviewCounts, function( $num, $index ) use(&$counts) { |
|
99 | + $counts[$index] = $num + intval( glsr_get( $counts, $index, 0 ) ); |
|
100 | 100 | }); |
101 | 101 | $args = wp_parse_args( $args, [ |
102 | 102 | 'max' => Rating::MAX_RATING, |
103 | 103 | 'min' => Rating::MIN_RATING, |
104 | - ]); |
|
104 | + ] ); |
|
105 | 105 | foreach( $counts as $index => &$num ) { |
106 | - if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ))continue; |
|
106 | + if( $index >= intval( $args['min'] ) && $index <= intval( $args['max'] ) )continue; |
|
107 | 107 | $num = 0; |
108 | 108 | } |
109 | 109 | return $counts; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | $args = $this->normalizeArgs( $args ); |
118 | 118 | |
119 | - if( !empty( $args['post_ids'] ) && !empty( $args['term_ids'] )) { |
|
119 | + if( !empty($args['post_ids']) && !empty($args['term_ids']) ) { |
|
120 | 120 | $counts = [$this->build( $args )]; |
121 | 121 | } |
122 | 122 | else { |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | // @todo if multiple ids are provided, a query must be used! |
131 | 131 | $counts[] = $this->getTermCounts( $termId ); |
132 | 132 | } |
133 | - if( empty( $counts )) { |
|
133 | + if( empty($counts) ) { |
|
134 | 134 | $counts[] = $this->getCounts(); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | return in_array( $args['type'], ['', 'all'] ) |
138 | 138 | ? $this->normalize( [$this->flatten( $counts )] ) |
139 | - : $this->normalize( glsr_array_column( $counts, $args['type'] )); |
|
139 | + : $this->normalize( glsr_array_column( $counts, $args['type'] ) ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function getCounts() |
146 | 146 | { |
147 | 147 | $counts = glsr( OptionManager::class )->get( 'counts', [] ); |
148 | - if( !is_array( $counts )) { |
|
148 | + if( !is_array( $counts ) ) { |
|
149 | 149 | glsr_log()->error( '$counts is not an array' )->debug( $counts ); |
150 | 150 | return []; |
151 | 151 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function getPostCounts( $postId ) |
160 | 160 | { |
161 | - return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true )); |
|
161 | + return array_filter( (array)get_post_meta( $postId, static::META_COUNT, true ) ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getTermCounts( $termId ) |
169 | 169 | { |
170 | - return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true )); |
|
170 | + return array_filter( (array)get_term_meta( $termId, static::META_COUNT, true ) ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function increaseCounts( Review $review ) |
187 | 187 | { |
188 | - if( empty( $counts = $this->getCounts() )) { |
|
188 | + if( empty($counts = $this->getCounts()) ) { |
|
189 | 189 | $counts = $this->buildCounts(); |
190 | 190 | } |
191 | - $this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating )); |
|
191 | + $this->setCounts( $this->increaseRating( $counts, $review->review_type, $review->rating ) ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function increasePostCounts( Review $review ) |
198 | 198 | { |
199 | - if( !( get_post( $review->assigned_to ) instanceof WP_Post ))return; |
|
199 | + if( !(get_post( $review->assigned_to ) instanceof WP_Post) )return; |
|
200 | 200 | $counts = $this->getPostCounts( $review->assigned_to ); |
201 | - $counts = empty( $counts ) |
|
201 | + $counts = empty($counts) |
|
202 | 202 | ? $this->buildPostCounts( $review->assigned_to ) |
203 | 203 | : $this->increaseRating( $counts, $review->review_type, $review->rating ); |
204 | 204 | $this->setPostCounts( $review->assigned_to, $counts ); |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function increaseTermCounts( Review $review ) |
211 | 211 | { |
212 | - $terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids )); |
|
212 | + $terms = glsr( ReviewManager::class )->normalizeTerms( implode( ',', $review->term_ids ) ); |
|
213 | 213 | foreach( $terms as $term ) { |
214 | 214 | $counts = $this->getTermCounts( $term['term_id'] ); |
215 | - $counts = empty( $counts ) |
|
215 | + $counts = empty($counts) |
|
216 | 216 | ? $this->buildTermCounts( $term['term_taxonomy_id'] ) |
217 | 217 | : $this->increaseRating( $counts, $review->review_type, $review->rating ); |
218 | 218 | $this->setTermCounts( $term['term_id'], $counts ); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | { |
236 | 236 | $ratingCounts = $this->flatten( $reviewCounts ); |
237 | 237 | update_post_meta( $postId, static::META_COUNT, $reviewCounts ); |
238 | - update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts )); |
|
239 | - update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts )); |
|
238 | + update_post_meta( $postId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) ); |
|
239 | + update_post_meta( $postId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) ); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | public function setTermCounts( $termId, array $reviewCounts ) |
247 | 247 | { |
248 | 248 | $term = get_term( $termId, Application::TAXONOMY ); |
249 | - if( !isset( $term->term_id ))return; |
|
249 | + if( !isset($term->term_id) )return; |
|
250 | 250 | $ratingCounts = $this->flatten( $reviewCounts ); |
251 | 251 | update_term_meta( $termId, static::META_COUNT, $reviewCounts ); |
252 | - update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts )); |
|
253 | - update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts )); |
|
252 | + update_term_meta( $termId, static::META_AVERAGE, glsr( Rating::class )->getAverage( $ratingCounts ) ); |
|
253 | + update_term_meta( $termId, static::META_RANKING, glsr( Rating::class )->getRanking( $ratingCounts ) ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | { |
263 | 263 | $counts = []; |
264 | 264 | $lastPostId = 0; |
265 | - while( $reviews = $this->queryReviews( $args, $lastPostId )) { |
|
266 | - $types = array_keys( array_flip( glsr_array_column( $reviews, 'type' ))); |
|
267 | - $types = array_unique( array_merge( ['local'], $types )); |
|
265 | + while( $reviews = $this->queryReviews( $args, $lastPostId ) ) { |
|
266 | + $types = array_keys( array_flip( glsr_array_column( $reviews, 'type' ) ) ); |
|
267 | + $types = array_unique( array_merge( ['local'], $types ) ); |
|
268 | 268 | foreach( $types as $type ) { |
269 | 269 | $type = $this->normalizeType( $type ); |
270 | - if( isset( $counts[$type] ))continue; |
|
270 | + if( isset($counts[$type]) )continue; |
|
271 | 271 | $counts[$type] = array_fill_keys( range( 0, Rating::MAX_RATING ), 0 ); |
272 | 272 | } |
273 | 273 | foreach( $reviews as $review ) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | protected function decreaseRating( array $reviewCounts, $type, $rating ) |
288 | 288 | { |
289 | - if( isset( $reviewCounts[$type][$rating] )) { |
|
289 | + if( isset($reviewCounts[$type][$rating]) ) { |
|
290 | 290 | $reviewCounts[$type][$rating] = max( 0, $reviewCounts[$type][$rating] - 1 ); |
291 | 291 | } |
292 | 292 | return $reviewCounts; |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | */ |
300 | 300 | protected function increaseRating( array $reviewCounts, $type, $rating ) |
301 | 301 | { |
302 | - if( !array_key_exists( $type, glsr()->reviewTypes )) { |
|
302 | + if( !array_key_exists( $type, glsr()->reviewTypes ) ) { |
|
303 | 303 | return $reviewCounts; |
304 | 304 | } |
305 | - if( !array_key_exists( $type, $reviewCounts )) { |
|
305 | + if( !array_key_exists( $type, $reviewCounts ) ) { |
|
306 | 306 | $reviewCounts[$type] = []; |
307 | 307 | } |
308 | 308 | $reviewCounts = $this->normalize( $reviewCounts ); |
@@ -315,12 +315,12 @@ discard block |
||
315 | 315 | */ |
316 | 316 | protected function normalize( array $reviewCounts ) |
317 | 317 | { |
318 | - if( empty( $reviewCounts )) { |
|
318 | + if( empty($reviewCounts) ) { |
|
319 | 319 | $reviewCounts = [[]]; |
320 | 320 | } |
321 | 321 | foreach( $reviewCounts as &$counts ) { |
322 | 322 | foreach( range( 0, Rating::MAX_RATING ) as $index ) { |
323 | - if( isset( $counts[$index] ))continue; |
|
323 | + if( isset($counts[$index]) )continue; |
|
324 | 324 | $counts[$index] = 0; |
325 | 325 | } |
326 | 326 | ksort( $counts ); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | 'post_ids' => [], |
338 | 338 | 'term_ids' => [], |
339 | 339 | 'type' => 'local', |
340 | - ]); |
|
340 | + ] ); |
|
341 | 341 | $args['post_ids'] = glsr( Polylang::class )->getPostIds( $args['post_ids'] ); |
342 | 342 | $args['type'] = $this->normalizeType( $args['type'] ); |
343 | 343 | return $args; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | protected function normalizeType( $type ) |
351 | 351 | { |
352 | - return empty( $type ) || !is_string( $type ) |
|
352 | + return empty($type) || !is_string( $type ) |
|
353 | 353 | ? 'local' |
354 | 354 | : $type; |
355 | 355 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function deleteAllSessions( $sessionCookiePrefix ) |
23 | 23 | { |
24 | - return $this->db->query(" |
|
24 | + return $this->db->query( " |
|
25 | 25 | DELETE |
26 | 26 | FROM {$this->db->options} |
27 | 27 | WHERE option_name LIKE '{$sessionCookiePrefix}_%' |
28 | - "); |
|
28 | + " ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function deleteExpiredSessions( $expiredSessions ) |
36 | 36 | { |
37 | - return $this->db->query(" |
|
37 | + return $this->db->query( " |
|
38 | 38 | DELETE |
39 | 39 | FROM {$this->db->options} |
40 | 40 | WHERE option_name IN ('{$expiredSessions}') |
41 | - "); |
|
41 | + " ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getExpiredSessions( $sessionCookiePrefix, $limit ) |
50 | 50 | { |
51 | - return $this->db->get_results(" |
|
51 | + return $this->db->get_results( " |
|
52 | 52 | SELECT option_name AS name, option_value AS expiration |
53 | 53 | FROM {$this->db->options} |
54 | 54 | WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%' |
55 | 55 | ORDER BY option_value ASC |
56 | 56 | LIMIT 0, {$limit} |
57 | - "); |
|
57 | + " ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getPostIdFromReviewId( $metaReviewId ) |
65 | 65 | { |
66 | - $postId = $this->db->get_var(" |
|
66 | + $postId = $this->db->get_var( " |
|
67 | 67 | SELECT p.ID |
68 | 68 | FROM {$this->db->posts} AS p |
69 | 69 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
70 | 70 | WHERE p.post_type = '{Application::POST_TYPE}' |
71 | 71 | AND m.meta_key = 'review_id' |
72 | 72 | AND m.meta_value = '{$metaReviewId}' |
73 | - "); |
|
73 | + " ); |
|
74 | 74 | return intval( $postId ); |
75 | 75 | } |
76 | 76 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getReviewCounts( array $args, $lastPostId = 0, $limit = 500 ) |
83 | 83 | { |
84 | - return $this->db->get_results(" |
|
84 | + return $this->db->get_results( " |
|
85 | 85 | SELECT p.ID, m1.meta_value AS rating, m2.meta_value AS type |
86 | 86 | FROM {$this->db->posts} AS p |
87 | 87 | INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getReviewCountsFor( $metaKey ) |
106 | 106 | { |
107 | - return (array) $this->db->get_results(" |
|
107 | + return (array)$this->db->get_results( " |
|
108 | 108 | SELECT m.meta_value AS name, COUNT(*) num_posts |
109 | 109 | FROM {$this->db->posts} AS p |
110 | 110 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
111 | 111 | WHERE p.post_type = '{Application::POST_TYPE}' |
112 | 112 | AND m.meta_key = '{$metaKey}' |
113 | 113 | GROUP BY name |
114 | - "); |
|
114 | + " ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getReviewIdsByType( $reviewType ) |
122 | 122 | { |
123 | - $query = $this->db->get_col(" |
|
123 | + $query = $this->db->get_col( " |
|
124 | 124 | SELECT m1.meta_value AS review_id |
125 | 125 | FROM {$this->db->posts} AS p |
126 | 126 | INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | AND m1.meta_key = 'review_id' |
130 | 130 | AND m2.meta_key = 'review_type' |
131 | 131 | AND m2.meta_value = '{$reviewType}' |
132 | - "); |
|
133 | - return array_keys( array_flip( $query )); |
|
132 | + " ); |
|
133 | + return array_keys( array_flip( $query ) ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | public function getReviewRatingsFromIds( array $postIds, $greaterThanId = 0, $limit = 100 ) |
142 | 142 | { |
143 | 143 | sort( $postIds ); |
144 | - $postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds )), $limit ); |
|
144 | + $postIds = array_slice( $postIds, intval( array_search( $greaterThanId, $postIds ) ), $limit ); |
|
145 | 145 | $postIds = implode( ',', $postIds ); |
146 | - return $this->db->get_results(" |
|
146 | + return $this->db->get_results( " |
|
147 | 147 | SELECT p.ID, m.meta_value AS rating |
148 | 148 | FROM {$this->db->posts} AS p |
149 | 149 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $queryBuilder = glsr( QueryBuilder::class ); |
168 | 168 | $key = $queryBuilder->buildSqlOr( $key, "m.meta_key = '%s'" ); |
169 | 169 | $status = $queryBuilder->buildSqlOr( $status, "p.post_status = '%s'" ); |
170 | - return $this->db->get_col(" |
|
170 | + return $this->db->get_col( " |
|
171 | 171 | SELECT DISTINCT m.meta_value |
172 | 172 | FROM {$this->db->postmeta} m |
173 | 173 | LEFT JOIN {$this->db->posts} p ON p.ID = m.post_id |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | AND ({$key}) |
176 | 176 | AND ({$status}) |
177 | 177 | ORDER BY m.meta_value |
178 | - "); |
|
178 | + " ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getAndForCounts( array $args, $and = '' ) |
186 | 186 | { |
187 | - if( !empty( $args['post_id'] )) { |
|
188 | - $and.= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}"; |
|
187 | + if( !empty($args['post_id']) ) { |
|
188 | + $and .= "AND m3.meta_key = 'assigned_to' AND m3.meta_value = {$args['post_id']}"; |
|
189 | 189 | } |
190 | - if( !empty( $args['term_taxonomy_id'] )) { |
|
191 | - $and.= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}"; |
|
190 | + if( !empty($args['term_taxonomy_id']) ) { |
|
191 | + $and .= "AND tr.term_taxonomy_id = {$args['term_taxonomy_id']}"; |
|
192 | 192 | } |
193 | 193 | return $and; |
194 | 194 | } |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function getInnerJoinForCounts( array $args, $innerJoin = '' ) |
201 | 201 | { |
202 | - if( !empty( $args['post_id'] )) { |
|
203 | - $innerJoin.= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id"; |
|
202 | + if( !empty($args['post_id']) ) { |
|
203 | + $innerJoin .= "INNER JOIN {$this->db->postmeta} AS m3 ON p.ID = m3.post_id"; |
|
204 | 204 | } |
205 | - if( !empty( $args['term_taxonomy_id'] )) { |
|
206 | - $innerJoin.= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id"; |
|
205 | + if( !empty($args['term_taxonomy_id']) ) { |
|
206 | + $innerJoin .= "INNER JOIN {$this->db->term_relationships} AS tr ON p.ID = tr.object_id"; |
|
207 | 207 | } |
208 | 208 | return $innerJoin; |
209 | 209 | } |
@@ -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 | } |