diff --git a/includes/API/ComingSoon.php b/includes/API/ComingSoon.php index c4d2b5b..44fc15d 100644 --- a/includes/API/ComingSoon.php +++ b/includes/API/ComingSoon.php @@ -1,9 +1,19 @@ get( 'comingSoon' ); return array( 'comingSoon' => $coming_soon_service->is_enabled() ); } + /** + * Enable the coming soon page. + * + * @return array + */ public function enable() { $coming_soon_service = container()->get( 'comingSoon' ); $coming_soon_service->enable(); return array( 'comingSoon' => true ); } + /** + * Disable the coming soon page. + * + * @return array + */ public function disable() { $coming_soon_service = container()->get( 'comingSoon' ); $coming_soon_service->disable(); return array( 'comingSoon' => false ); } + /** + * Check if the current user has permissions to access the API. + * Or if the service provider is not available, return an error. + * + * @return bool|\WP_Error + */ public function check_permissions() { if ( ! current_user_can( 'manage_options' ) ) { return new \WP_Error( 'rest_forbidden', esc_html__( 'You cannot access the resource.' ), array( 'status' => 401 ) );