@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | public function routeAdminPostRequest() |
17 | 17 | { |
18 | 18 | $request = $this->getRequest(); |
19 | - if( !$this->isValidPostRequest( $request ))return; |
|
19 | + if( !$this->isValidPostRequest( $request )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | $this->checkAdminNonce( $request['action'] ); |
21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
22 | 24 | } |
@@ -44,10 +46,16 @@ discard block |
||
44 | 46 | */ |
45 | 47 | public function routePublicPostRequest() |
46 | 48 | { |
47 | - if( is_admin() )return; |
|
49 | + if( is_admin() ) { |
|
50 | + return; |
|
51 | + } |
|
48 | 52 | $request = $this->getRequest(); |
49 | - if( !$this->isValidPostRequest( $request ))return; |
|
50 | - if( !$this->isValidPublicNonce( $request ))return; |
|
53 | + if( !$this->isValidPostRequest( $request )) { |
|
54 | + return; |
|
55 | + } |
|
56 | + if( !$this->isValidPublicNonce( $request )) { |
|
57 | + return; |
|
58 | + } |
|
51 | 59 | $this->routeRequest( 'public', $request['action'], $request ); |
52 | 60 | } |
53 | 61 | |
@@ -57,7 +65,9 @@ discard block |
||
57 | 65 | public function routeWebhookRequest() |
58 | 66 | { |
59 | 67 | $request = filter_input( INPUT_GET, Application::PREFIX.'hook' ); |
60 | - if( !$request )return; |
|
68 | + if( !$request ) { |
|
69 | + return; |
|
70 | + } |
|
61 | 71 | // @todo manage webhook here |
62 | 72 | } |
63 | 73 | |
@@ -80,7 +90,9 @@ discard block |
||
80 | 90 | */ |
81 | 91 | protected function checkAjaxNonce( array $request ) |
82 | 92 | { |
83 | - if( !is_user_logged_in() )return; |
|
93 | + if( !is_user_logged_in() ) { |
|
94 | + return; |
|
95 | + } |
|
84 | 96 | if( !isset( $request['nonce'] )) { |
85 | 97 | glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request ); |
86 | 98 | wp_die(); |
@@ -98,7 +110,9 @@ discard block |
||
98 | 110 | { |
99 | 111 | foreach( ['request', Application::ID] as $key ) { |
100 | 112 | $request = glsr( Helper::class )->filterInputArray( $key ); |
101 | - if( !empty( $request ))break; |
|
113 | + if( !empty( $request )) { |
|
114 | + break; |
|
115 | + } |
|
102 | 116 | } |
103 | 117 | return $this->normalizeRequest( $request ); |
104 | 118 | } |