@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function compose( Review $review, array $notification ) |
37 | 37 | { |
38 | - if( empty( $this->endpoint ))return; |
|
38 | + if( empty($this->endpoint) )return; |
|
39 | 39 | $this->review = $review; |
40 | 40 | $args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification ); |
41 | 41 | $notification = [ |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function send() |
59 | 59 | { |
60 | - if( empty( $this->endpoint )) { |
|
60 | + if( empty($this->endpoint) ) { |
|
61 | 61 | return new WP_Error( 'slack', 'Slack notification was not sent: missing endpoint' ); |
62 | 62 | } |
63 | 63 | return wp_remote_post( $endpoint, [ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'redirection' => 5, |
70 | 70 | 'sslverify' => false, |
71 | 71 | 'timeout' => 45, |
72 | - ]); |
|
72 | + ] ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function buildAuthorField() |
79 | 79 | { |
80 | - $email = !empty( $this->review->email ) |
|
80 | + $email = !empty($this->review->email) |
|
81 | 81 | ? '<'.$this->review->email.'>' |
82 | 82 | : ''; |
83 | 83 | $author = trim( rtrim( $this->review->author ).' '.$email ); |
84 | - return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ))]; |
|
84 | + return ['value' => implode( ' - ', array_filter( [$author, $this->review->ip_address] ) )]; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function buildContentField() |
91 | 91 | { |
92 | - return !empty( $this->review->content ) |
|
92 | + return !empty($this->review->content) |
|
93 | 93 | ? ['value' => $this->review->content] |
94 | 94 | : []; |
95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function buildLinkField() |
101 | 101 | { |
102 | - return !empty( $this->link ) |
|
102 | + return !empty($this->link) |
|
103 | 103 | ? ['value' => $this->link] |
104 | 104 | : []; |
105 | 105 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | protected function buildStarsField() |
126 | 126 | { |
127 | 127 | $solidStars = str_repeat( '★', $this->review->rating ); |
128 | - $emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating )); |
|
128 | + $emptyStars = str_repeat( '☆', max( 0, Rating::MAX_RATING - $this->review->rating ) ); |
|
129 | 129 | $stars = $solidStars.$emptyStars; |
130 | 130 | $stars = apply_filters( 'site-reviews/slack/stars', $stars, $this->review->rating, Rating::MAX_RATING ); |
131 | 131 | return ['title' => $stars]; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function buildTitleField() |
138 | 138 | { |
139 | - return !empty( $this->review->title ) |
|
139 | + return !empty($this->review->title) |
|
140 | 140 | ? ['title' => $this->review->title] |
141 | 141 | : []; |
142 | 142 | } |
@@ -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 | $this->review = $review; |
40 | 42 | $args = shortcode_atts( glsr( SlackDefaults::class )->defaults(), $notification ); |
41 | 43 | $notification = [ |
@@ -17,14 +17,14 @@ |
||
17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
18 | 18 | if( !$review ) { |
19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
21 | 21 | return; |
22 | 22 | } |
23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | do_action( 'site-reviews/local/review/submitted', $review ); |
26 | 26 | if( $command->ajax_request )return; |
27 | - if( empty( $command->referer )) { |
|
27 | + if( empty($command->referer) ) { |
|
28 | 28 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
29 | 29 | $command->referer = home_url(); |
30 | 30 | } |
@@ -23,7 +23,9 @@ |
||
23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | do_action( 'site-reviews/local/review/submitted', $review ); |
26 | - if( $command->ajax_request )return; |
|
26 | + if( $command->ajax_request ) { |
|
27 | + return; |
|
28 | + } |
|
27 | 29 | if( empty( $command->referer )) { |
28 | 30 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
29 | 31 | $command->referer = home_url(); |