@@ -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 = [ |
@@ -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' ); |
@@ -109,7 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
112 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
113 | + return; |
|
114 | + } |
|
113 | 115 | glsr()->render( 'partials/editor/review', [ |
114 | 116 | 'post' => $post, |
115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
121 | 123 | */ |
122 | 124 | public function renderReviewNotice( WP_Post $post ) |
123 | 125 | { |
124 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
126 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
127 | + return; |
|
128 | + } |
|
125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
126 | 130 | glsr( Template::class )->render( 'partials/editor/notice', [ |
127 | 131 | 'context' => [ |
@@ -136,12 +140,16 @@ discard block |
||
136 | 140 | */ |
137 | 141 | public function renderTinymceButton() |
138 | 142 | { |
139 | - if( glsr_current_screen()->base != 'post' )return; |
|
143 | + if( glsr_current_screen()->base != 'post' ) { |
|
144 | + return; |
|
145 | + } |
|
140 | 146 | $shortcodes = []; |
141 | 147 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
142 | 148 | $shortcodes[$shortcode] = $values; |
143 | 149 | } |
144 | - if( empty( $shortcodes ))return; |
|
150 | + if( empty( $shortcodes )) { |
|
151 | + return; |
|
152 | + } |
|
145 | 153 | glsr()->render( 'partials/editor/tinymce', [ |
146 | 154 | 'shortcodes' => $shortcodes, |
147 | 155 | ]); |
@@ -35,7 +35,9 @@ |
||
35 | 35 | */ |
36 | 36 | public function renderTaxonomyFilter() |
37 | 37 | { |
38 | - if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return; |
|
38 | + if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
40 | 42 | 'class' => 'screen-reader-text', |
41 | 43 | 'for' => Application::TAXONOMY, |