@@ -60,7 +60,9 @@ |
||
60 | 60 | */ |
61 | 61 | public function deactivate( $plugin ) |
62 | 62 | { |
63 | - if( $this->isValid() )return; |
|
63 | + if( $this->isValid() ) { |
|
64 | + return; |
|
65 | + } |
|
64 | 66 | $pluginSlug = plugin_basename( $this->file ); |
65 | 67 | if( $plugin == $pluginSlug ) { |
66 | 68 | $this->redirect(); //exit |
@@ -3,7 +3,9 @@ |
||
3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
4 | 4 | |
5 | 5 | require_once __DIR__.'/site-reviews.php'; |
6 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() )return; |
|
6 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) { |
|
7 | + return; |
|
8 | +} |
|
7 | 9 | |
8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -90,7 +90,9 @@ |
||
90 | 90 | { |
91 | 91 | $total = array_sum( $ratingCounts ); |
92 | 92 | foreach( $ratingCounts as $index => $count ) { |
93 | - if( empty( $count ))continue; |
|
93 | + if( empty( $count )) { |
|
94 | + continue; |
|
95 | + } |
|
94 | 96 | $ratingCounts[$index] = $count / $total * 100; |
95 | 97 | } |
96 | 98 | return $this->getRoundedPercentages( $ratingCounts ); |
@@ -81,7 +81,9 @@ discard block |
||
81 | 81 | ]; |
82 | 82 | if( !isset( $properties[$property] ) |
83 | 83 | || empty( array_filter( [$value], $properties[$property] )) |
84 | - )return; |
|
84 | + ) { |
|
85 | + return; |
|
86 | + } |
|
85 | 87 | $this->$property = $value; |
86 | 88 | } |
87 | 89 | |
@@ -90,7 +92,9 @@ discard block |
||
90 | 92 | */ |
91 | 93 | public function getClosingTag() |
92 | 94 | { |
93 | - if( empty( $this->tag ))return; |
|
95 | + if( empty( $this->tag )) { |
|
96 | + return; |
|
97 | + } |
|
94 | 98 | return '</'.$this->tag.'>'; |
95 | 99 | } |
96 | 100 | |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | */ |
100 | 104 | public function getOpeningTag() |
101 | 105 | { |
102 | - if( empty( $this->tag ))return; |
|
106 | + if( empty( $this->tag )) { |
|
107 | + return; |
|
108 | + } |
|
103 | 109 | $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
104 | 110 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
105 | 111 | } |
@@ -141,7 +147,9 @@ discard block |
||
141 | 147 | */ |
142 | 148 | protected function buildFieldDescription() |
143 | 149 | { |
144 | - if( empty( $this->args['description'] ))return; |
|
150 | + if( empty( $this->args['description'] )) { |
|
151 | + return; |
|
152 | + } |
|
145 | 153 | if( $this->args['is_widget'] ) { |
146 | 154 | return $this->small( $this->args['description'] ); |
147 | 155 | } |
@@ -207,7 +215,9 @@ discard block |
||
207 | 215 | */ |
208 | 216 | protected function buildFormLabel( array $customArgs = [] ) |
209 | 217 | { |
210 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
218 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
219 | + return; |
|
220 | + } |
|
211 | 221 | return $this->label( wp_parse_args( $customArgs, [ |
212 | 222 | 'for' => $this->args['id'], |
213 | 223 | 'is_public' => $this->args['is_public'], |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function saveAssignedToMetabox( $postId ) |
15 | 15 | { |
16 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' ))return; |
|
16 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-assigned-to' ), 'assigned_to' )) { |
|
17 | + return; |
|
18 | + } |
|
17 | 19 | $assignedTo = strval( glsr( Helper::class )->filterInput( 'assigned_to' )); |
18 | 20 | if( get_post_meta( $postId, 'assigned_to', true ) != $assignedTo ) { |
19 | 21 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
@@ -28,7 +30,9 @@ discard block |
||
28 | 30 | */ |
29 | 31 | public function saveResponseMetabox( $postId ) |
30 | 32 | { |
31 | - if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' ))return; |
|
33 | + if( !wp_verify_nonce( glsr( Helper::class )->filterInput( '_nonce-response' ), 'response' )) { |
|
34 | + return; |
|
35 | + } |
|
32 | 36 | $response = strval( glsr( Helper::class )->filterInput( 'response' )); |
33 | 37 | update_post_meta( $postId, 'response', trim( wp_kses( $response, [ |
34 | 38 | 'a' => ['href' => [], 'title' => []], |
@@ -93,7 +93,9 @@ discard block |
||
93 | 93 | foreach( $this->rules as $attribute => $rules ) { |
94 | 94 | foreach( $rules as $rule ) { |
95 | 95 | $this->validateAttribute( $attribute, $rule ); |
96 | - if( $this->shouldStopValidating( $attribute ))break; |
|
96 | + if( $this->shouldStopValidating( $attribute )) { |
|
97 | + break; |
|
98 | + } |
|
97 | 99 | } |
98 | 100 | } |
99 | 101 | return $this->errors; |
@@ -109,7 +111,9 @@ discard block |
||
109 | 111 | public function validateAttribute( $attribute, $rule ) |
110 | 112 | { |
111 | 113 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
112 | - if( $rule == '' )return; |
|
114 | + if( $rule == '' ) { |
|
115 | + return; |
|
116 | + } |
|
113 | 117 | $value = $this->getValue( $attribute ); |
114 | 118 | if( !method_exists( $this, $method = 'validate'.$rule )) { |
115 | 119 | throw new BadMethodCallException( "Method [$method] does not exist." ); |
@@ -178,7 +182,9 @@ discard block |
||
178 | 182 | */ |
179 | 183 | protected function getRule( $attribute, $rules ) |
180 | 184 | { |
181 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
185 | + if( !array_key_exists( $attribute, $this->rules )) { |
|
186 | + return; |
|
187 | + } |
|
182 | 188 | $rules = (array)$rules; |
183 | 189 | foreach( $this->rules[$attribute] as $rule ) { |
184 | 190 | list( $rule, $parameters ) = $this->parseRule( $rule ); |
@@ -37,7 +37,9 @@ |
||
37 | 37 | $lines = explode( "\n", $blacklist ); |
38 | 38 | foreach( (array)$lines as $line ) { |
39 | 39 | $line = trim( $line ); |
40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
40 | + if( empty( $line ) || 256 < strlen( $line )) { |
|
41 | + continue; |
|
42 | + } |
|
41 | 43 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
42 | 44 | if( preg_match( $pattern, $target )) { |
43 | 45 | return true; |
@@ -13,7 +13,9 @@ |
||
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 )) { |
|
17 | + return; |
|
18 | + } |
|
17 | 19 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 20 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 21 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -17,9 +17,13 @@ discard block |
||
17 | 17 | { |
18 | 18 | $queries = []; |
19 | 19 | foreach( $keys as $key ) { |
20 | - if( !array_key_exists( $key, $values ))continue; |
|
20 | + if( !array_key_exists( $key, $values )) { |
|
21 | + continue; |
|
22 | + } |
|
21 | 23 | $methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ ); |
22 | - if( !method_exists( $this, $methodName ))continue; |
|
24 | + if( !method_exists( $this, $methodName )) { |
|
25 | + continue; |
|
26 | + } |
|
23 | 27 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
24 | 28 | if( is_array( $query )) { |
25 | 29 | $queries[] = $query; |
@@ -36,7 +40,9 @@ discard block |
||
36 | 40 | $string = ''; |
37 | 41 | $values = array_filter( $values ); |
38 | 42 | foreach( $conditions as $key => $value ) { |
39 | - if( !isset( $values[$key] ))continue; |
|
43 | + if( !isset( $values[$key] )) { |
|
44 | + continue; |
|
45 | + } |
|
40 | 46 | $values[$key] = implode( ',', (array)$values[$key] ); |
41 | 47 | $string .= strpos( $value, '%s' ) !== false |
42 | 48 | ? sprintf( $value, strval( $values[$key] )) |
@@ -110,7 +116,9 @@ discard block |
||
110 | 116 | */ |
111 | 117 | protected function buildQueryAssignedTo( $value ) |
112 | 118 | { |
113 | - if( empty( $value ))return; |
|
119 | + if( empty( $value )) { |
|
120 | + return; |
|
121 | + } |
|
114 | 122 | $postIds = glsr( Helper::class )->convertStringToArray( $value, 'is_numeric' ); |
115 | 123 | return [ |
116 | 124 | 'compare' => 'IN', |
@@ -125,7 +133,9 @@ discard block |
||
125 | 133 | */ |
126 | 134 | protected function buildQueryCategory( $value ) |
127 | 135 | { |
128 | - if( empty( $value ))return; |
|
136 | + if( empty( $value )) { |
|
137 | + return; |
|
138 | + } |
|
129 | 139 | return [ |
130 | 140 | 'field' => 'term_id', |
131 | 141 | 'taxonomy' => Application::TAXONOMY, |
@@ -139,7 +149,9 @@ discard block |
||
139 | 149 | */ |
140 | 150 | protected function buildQueryRating( $value ) |
141 | 151 | { |
142 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
152 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
153 | + return; |
|
154 | + } |
|
143 | 155 | return [ |
144 | 156 | 'compare' => '>=', |
145 | 157 | 'key' => 'rating', |
@@ -153,7 +165,9 @@ discard block |
||
153 | 165 | */ |
154 | 166 | protected function buildQueryType( $value ) |
155 | 167 | { |
156 | - if( in_array( $value, ['','all'] ))return; |
|
168 | + if( in_array( $value, ['','all'] )) { |
|
169 | + return; |
|
170 | + } |
|
157 | 171 | return [ |
158 | 172 | 'key' => 'review_type', |
159 | 173 | 'value' => $value, |