| @@ 44-49 (lines=6) @@ | ||
| 41 | ) ); |
|
| 42 | } |
|
| 43 | ||
| 44 | if ( ! $this->app->request()->is_secret_valid() ) { |
|
| 45 | return $this->app->response()->error( new WP_Error( |
|
| 46 | 'invalid_headers', |
|
| 47 | __( 'Failed to validate secret.', 'writing-on-github' ) |
|
| 48 | ) ); |
|
| 49 | } |
|
| 50 | ||
| 51 | // ping |
|
| 52 | if ( $this->app->request()->is_ping() ) { |
|
| @@ 57-62 (lines=6) @@ | ||
| 54 | } |
|
| 55 | ||
| 56 | // push |
|
| 57 | if ( ! $this->app->request()->is_push() ) { |
|
| 58 | return $this->app->response()->error( new WP_Error( |
|
| 59 | 'invalid_headers', |
|
| 60 | __( 'Failed to validate webhook event.', 'writing-on-github' ) |
|
| 61 | ) ); |
|
| 62 | } |
|
| 63 | $payload = $this->app->request()->payload(); |
|
| 64 | ||
| 65 | if ( ! $payload->should_import() ) { |
|