Ping.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.1, at includes/Api/Ping.php
| 1 | <?php |
| 2 | |
| 3 | namespace FlyWP\Api; |
| 4 | |
| 5 | class Ping { |
| 6 | |
| 7 | /** |
| 8 | * Ping constructor. |
| 9 | */ |
| 10 | public function __construct() { |
| 11 | flywp()->router->get( 'ping', [ $this, 'handle_ping' ] ); |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Handle ping request. |
| 16 | * |
| 17 | * @return void |
| 18 | */ |
| 19 | public function handle_ping() { |
| 20 | $response = [ |
| 21 | 'message' => 'pong', |
| 22 | 'wp_version' => get_bloginfo( 'version' ), |
| 23 | 'php_version' => PHP_VERSION, |
| 24 | 'plugin_version' => FLYWP_VERSION, |
| 25 | ]; |
| 26 | |
| 27 | wp_send_json( $response ); |
| 28 | } |
| 29 | } |
| 30 |