@@ -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 | check_admin_referer( $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 | |
@@ -66,7 +76,9 @@ discard block |
||
| 66 | 76 | */ |
| 67 | 77 | protected function checkAjaxNonce( array $request ) |
| 68 | 78 | { |
| 69 | - if( !is_user_logged_in() )return; |
|
| 79 | + if( !is_user_logged_in() ) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 70 | 82 | if( !isset( $request['nonce'] )) { |
| 71 | 83 | glsr_log()->error( 'The AJAX request must include a nonce' )->info( $request ); |
| 72 | 84 | wp_die(); |
@@ -84,7 +96,9 @@ discard block |
||
| 84 | 96 | { |
| 85 | 97 | foreach( ['request', Application::ID] as $key ) { |
| 86 | 98 | $request = glsr( Helper::class )->filterInputArray( $key ); |
| 87 | - if( !empty( $request ))break; |
|
| 99 | + if( !empty( $request )) { |
|
| 100 | + break; |
|
| 101 | + } |
|
| 88 | 102 | } |
| 89 | 103 | return $this->normalizeRequest( $request ); |
| 90 | 104 | } |