@@ -28,22 +28,22 @@ discard block |
||
28 | 28 | public function __construct( $input ) |
29 | 29 | { |
30 | 30 | $this->request = $input; |
31 | - $this->ajax_request = isset( $input['ajax_request'] ); |
|
31 | + $this->ajax_request = isset($input['ajax_request']); |
|
32 | 32 | $this->assigned_to = $this->getNumeric( 'assign_to' ); |
33 | - $this->author = sanitize_text_field( $this->get( 'name' )); |
|
34 | - $this->avatar = get_avatar_url( $this->get( 'email' )); |
|
35 | - $this->blacklisted = isset( $input['blacklisted'] ); |
|
36 | - $this->category = sanitize_key( $this->get( 'category' )); |
|
37 | - $this->content = sanitize_textarea_field( $this->get( 'content' )); |
|
33 | + $this->author = sanitize_text_field( $this->get( 'name' ) ); |
|
34 | + $this->avatar = get_avatar_url( $this->get( 'email' ) ); |
|
35 | + $this->blacklisted = isset($input['blacklisted']); |
|
36 | + $this->category = sanitize_key( $this->get( 'category' ) ); |
|
37 | + $this->content = sanitize_textarea_field( $this->get( 'content' ) ); |
|
38 | 38 | $this->custom = $this->getCustom(); |
39 | - $this->email = sanitize_email( $this->get( 'email' )); |
|
40 | - $this->form_id = sanitize_key( $this->get( 'form_id' )); |
|
39 | + $this->email = sanitize_email( $this->get( 'email' ) ); |
|
40 | + $this->form_id = sanitize_key( $this->get( 'form_id' ) ); |
|
41 | 41 | $this->ip_address = $this->get( 'ip_address' ); |
42 | - $this->post_id = intval( $this->get( 'post_id' )); |
|
43 | - $this->rating = intval( $this->get( 'rating' )); |
|
42 | + $this->post_id = intval( $this->get( 'post_id' ) ); |
|
43 | + $this->rating = intval( $this->get( 'rating' ) ); |
|
44 | 44 | $this->referer = $this->get( 'referer' ); |
45 | - $this->terms = isset( $input['terms'] ); |
|
46 | - $this->title = sanitize_text_field( $this->get( 'title' )); |
|
45 | + $this->terms = isset($input['terms']); |
|
46 | + $this->title = sanitize_text_field( $this->get( 'title' ) ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function get( $key ) |
54 | 54 | { |
55 | - return isset( $this->request[$key] ) |
|
55 | + return isset($this->request[$key]) |
|
56 | 56 | ? (string)$this->request[$key] |
57 | 57 | : ''; |
58 | 58 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ]; |
70 | 70 | $custom = $this->request; |
71 | 71 | foreach( $unset as $value ) { |
72 | - unset( $custom[$value] ); |
|
72 | + unset($custom[$value]); |
|
73 | 73 | } |
74 | 74 | return $custom; |
75 | 75 | } |
@@ -17,15 +17,15 @@ discard block |
||
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', null, $command ); // @compat |
26 | 26 | do_action( 'site-reviews/review/submitted', $review ); |
27 | 27 | if( $command->ajax_request )return; |
28 | - wp_safe_redirect( $this->getReferer( $command )); |
|
28 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
29 | 29 | exit; |
30 | 30 | } |
31 | 31 | |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function getReferer( Command $command ) |
36 | 36 | { |
37 | - $referer = trim( get_post_meta( $command->post_id, 'redirect_to', true )); |
|
38 | - if( empty( $referer )) { |
|
37 | + $referer = trim( get_post_meta( $command->post_id, 'redirect_to', true ) ); |
|
38 | + if( empty($referer) ) { |
|
39 | 39 | $referer = $command->referer; |
40 | 40 | } |
41 | - if( empty( $referer )) { |
|
41 | + if( empty($referer) ) { |
|
42 | 42 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
43 | 43 | $referer = home_url(); |
44 | 44 | } |
@@ -24,7 +24,9 @@ |
||
24 | 24 | glsr( Notification::class )->send( $review ); |
25 | 25 | do_action( 'site-reviews/local/review/submitted', null, $command ); // @compat |
26 | 26 | do_action( 'site-reviews/review/submitted', $review ); |
27 | - if( $command->ajax_request )return; |
|
27 | + if( $command->ajax_request ) { |
|
28 | + return; |
|
29 | + } |
|
28 | 30 | wp_safe_redirect( $this->getReferer( $command )); |
29 | 31 | exit; |
30 | 32 | } |