@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | public function routeAdminPostRequest() |
18 | 18 | { |
19 | 19 | $request = $this->getRequest(); |
20 | - if( !$this->isValidPostRequest( $request ))return; |
|
20 | + if( !$this->isValidPostRequest( $request )) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | check_admin_referer( $request['action'] ); |
22 | 24 | $this->routeRequest( 'admin', $request['action'], $request ); |
23 | 25 | } |
@@ -39,10 +41,16 @@ discard block |
||
39 | 41 | */ |
40 | 42 | public function routePublicPostRequest() |
41 | 43 | { |
42 | - if( is_admin() )return; |
|
44 | + if( is_admin() ) { |
|
45 | + return; |
|
46 | + } |
|
43 | 47 | $request = $this->getRequest(); |
44 | - if( !$this->isValidPostRequest( $request ))return; |
|
45 | - if( !$this->isValidPublicNonce( $request ))return; |
|
48 | + if( !$this->isValidPostRequest( $request )) { |
|
49 | + return; |
|
50 | + } |
|
51 | + if( !$this->isValidPublicNonce( $request )) { |
|
52 | + return; |
|
53 | + } |
|
46 | 54 | $this->routeRequest( 'public', $request['action'], $request ); |
47 | 55 | } |
48 | 56 | |
@@ -51,7 +59,9 @@ discard block |
||
51 | 59 | */ |
52 | 60 | protected function checkAjaxNonce( array $request ) |
53 | 61 | { |
54 | - if( !is_user_logged_in() )return; |
|
62 | + if( !is_user_logged_in() ) { |
|
63 | + return; |
|
64 | + } |
|
55 | 65 | if( !isset( $request['nonce'] )) { |
56 | 66 | $this->sendAjaxError( 'request is missing a nonce', $request ); |
57 | 67 | } |
@@ -35,7 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | public function compose( Review $review, array $notification ) |
37 | 37 | { |
38 | - if( empty( $this->endpoint ))return; |
|
38 | + if( empty( $this->endpoint )) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | $args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification ); |
40 | 42 | $this->review = $review; |
41 | 43 | $notification = [ |
@@ -85,7 +85,9 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function buildRecaptcha() |
87 | 87 | { |
88 | - if( !glsr( OptionManager::class )->isRecaptchaEnabled() )return; |
|
88 | + if( !glsr( OptionManager::class )->isRecaptchaEnabled() ) { |
|
89 | + return; |
|
90 | + } |
|
89 | 91 | return glsr( Builder::class )->div([ |
90 | 92 | 'class' => 'glsr-recaptcha-holder', |
91 | 93 | 'data-badge' => glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ), |
@@ -161,7 +163,9 @@ discard block |
||
161 | 163 | */ |
162 | 164 | protected function getRegisterText() |
163 | 165 | { |
164 | - if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' )return; |
|
166 | + if( !get_option( 'users_can_register' ) || glsr( OptionManager::class )->get( 'settings.general.require.login' ) != 'yes' ) { |
|
167 | + return; |
|
168 | + } |
|
165 | 169 | $registerLink = glsr( Builder::class )->a([ |
166 | 170 | 'href' => wp_registration_url(), |
167 | 171 | 'text' => __( 'register', 'site-reviews' ), |
@@ -217,7 +221,9 @@ discard block |
||
217 | 221 | */ |
218 | 222 | protected function normalizeFieldErrors( Field &$field ) |
219 | 223 | { |
220 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
224 | + if( !array_key_exists( $field->field['path'], $this->errors )) { |
|
225 | + return; |
|
226 | + } |
|
221 | 227 | $field->field['errors'] = $this->errors[$field->field['path']]; |
222 | 228 | } |
223 | 229 | |
@@ -226,7 +232,9 @@ discard block |
||
226 | 232 | */ |
227 | 233 | protected function normalizeFieldRequired( Field &$field ) |
228 | 234 | { |
229 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
235 | + if( !in_array( $field->field['path'], $this->required )) { |
|
236 | + return; |
|
237 | + } |
|
230 | 238 | $field->field['required'] = true; |
231 | 239 | } |
232 | 240 | |
@@ -249,7 +257,9 @@ discard block |
||
249 | 257 | */ |
250 | 258 | protected function normalizeFieldValue( Field &$field ) |
251 | 259 | { |
252 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
260 | + if( !array_key_exists( $field->field['path'], $this->values )) { |
|
261 | + return; |
|
262 | + } |
|
253 | 263 | if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
254 | 264 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
255 | 265 | } |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if( !class_exists( 'GL_Plugin_Check_v3' )) { |
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
|
24 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | require_once __DIR__.'/autoload.php'; |
26 | 28 | require_once __DIR__.'/compatibility.php'; |
27 | 29 | require_once __DIR__.'/deprecated.php'; |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function send( Review $review ) |
45 | 45 | { |
46 | - if( empty( $this->types ))return; |
|
46 | + if( empty( $this->types )) { |
|
47 | + return; |
|
48 | + } |
|
47 | 49 | $this->review = $review; |
48 | 50 | $args = [ |
49 | 51 | 'link' => $this->getLink(), |
@@ -146,7 +148,9 @@ discard block |
||
146 | 148 | protected function sendToEmail( array $args ) |
147 | 149 | { |
148 | 150 | $email = $this->buildEmail( $args ); |
149 | - if( !$this->email )return; |
|
151 | + if( !$this->email ) { |
|
152 | + return; |
|
153 | + } |
|
150 | 154 | if( empty( $email->to )) { |
151 | 155 | glsr_log()->error( 'Email notification was not sent: missing email address' ); |
152 | 156 | return; |
@@ -161,7 +165,9 @@ discard block |
||
161 | 165 | */ |
162 | 166 | protected function sendToSlack( array $args ) |
163 | 167 | { |
164 | - if( !$this->slack )return; |
|
168 | + if( !$this->slack ) { |
|
169 | + return; |
|
170 | + } |
|
165 | 171 | $notification = $this->buildSlackNotification( $args ); |
166 | 172 | $result = $notification->send(); |
167 | 173 | if( is_wp_error( $result )) { |
@@ -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; |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
70 | 70 | $this->modified = $this->isModified( $properties ); |
71 | 71 | array_walk( $properties, function( $value, $key ) { |
72 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
72 | + if( !property_exists( $this, $key ) || isset( $this->$key )) { |
|
73 | + return; |
|
74 | + } |
|
73 | 75 | $this->$key = maybe_unserialize( $value ); |
74 | 76 | }); |
75 | 77 | } |
@@ -80,7 +82,9 @@ discard block |
||
80 | 82 | protected function setTermIds( WP_Post $post ) |
81 | 83 | { |
82 | 84 | $this->term_ids = []; |
83 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
85 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) { |
|
86 | + return; |
|
87 | + } |
|
84 | 88 | foreach( $terms as $term ) { |
85 | 89 | $this->term_ids[] = $term->term_id; |
86 | 90 | } |
@@ -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 ); |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function registerMetaBoxes( $postType ) |
91 | 91 | { |
92 | - if( $postType != Application::POST_TYPE )return; |
|
92 | + if( $postType != Application::POST_TYPE ) { |
|
93 | + return; |
|
94 | + } |
|
93 | 95 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
94 | 96 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
95 | 97 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -119,7 +121,9 @@ discard block |
||
119 | 121 | */ |
120 | 122 | public function renderAssignedToMetabox( WP_Post $post ) |
121 | 123 | { |
122 | - if( !$this->isReviewPostType( $post ))return; |
|
124 | + if( !$this->isReviewPostType( $post )) { |
|
125 | + return; |
|
126 | + } |
|
123 | 127 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
124 | 128 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
125 | 129 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -134,7 +138,9 @@ discard block |
||
134 | 138 | */ |
135 | 139 | public function renderDetailsMetaBox( WP_Post $post ) |
136 | 140 | { |
137 | - if( !$this->isReviewPostType( $post ))return; |
|
141 | + if( !$this->isReviewPostType( $post )) { |
|
142 | + return; |
|
143 | + } |
|
138 | 144 | $review = glsr( ReviewManager::class )->single( $post ); |
139 | 145 | glsr()->render( 'partials/editor/metabox-details', [ |
140 | 146 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -148,7 +154,9 @@ discard block |
||
148 | 154 | */ |
149 | 155 | public function renderPinnedInPublishMetaBox() |
150 | 156 | { |
151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
157 | + if( !$this->isReviewPostType( get_post() )) { |
|
158 | + return; |
|
159 | + } |
|
152 | 160 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
153 | 161 | 'context' => [ |
154 | 162 | 'no' => __( 'No', 'site-reviews' ), |
@@ -164,7 +172,9 @@ discard block |
||
164 | 172 | */ |
165 | 173 | public function renderResponseMetaBox( WP_Post $post ) |
166 | 174 | { |
167 | - if( !$this->isReviewPostType( $post ))return; |
|
175 | + if( !$this->isReviewPostType( $post )) { |
|
176 | + return; |
|
177 | + } |
|
168 | 178 | wp_nonce_field( 'response', '_nonce-response', false ); |
169 | 179 | glsr()->render( 'partials/editor/metabox-response', [ |
170 | 180 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -178,7 +188,9 @@ discard block |
||
178 | 188 | */ |
179 | 189 | public function renderTaxonomyMetabox( WP_Post $post ) |
180 | 190 | { |
181 | - if( !$this->isReviewPostType( $post ))return; |
|
191 | + if( !$this->isReviewPostType( $post )) { |
|
192 | + return; |
|
193 | + } |
|
182 | 194 | glsr()->render( 'partials/editor/metabox-categories', [ |
183 | 195 | 'post' => $post, |
184 | 196 | 'tax_name' => Application::TAXONOMY, |
@@ -216,7 +228,9 @@ discard block |
||
216 | 228 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
217 | 229 | { |
218 | 230 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
231 | + if( !( $assignedPost instanceof WP_Post )) { |
|
232 | + return; |
|
233 | + } |
|
220 | 234 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
221 | 235 | 'context' => [ |
222 | 236 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -257,7 +271,9 @@ discard block |
||
257 | 271 | */ |
258 | 272 | protected function getReviewType( $review ) |
259 | 273 | { |
260 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
274 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
275 | + return; |
|
276 | + } |
|
261 | 277 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
262 | 278 | ? glsr()->reviewTypes[$review->review_type] |
263 | 279 | : __( 'Unknown', 'site-reviews' ); |