PluginProbe
Hostinger Tools / 3.0.79
Hostinger Tools v3.0.79
3.0.79 3.0.78 3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 All 110 releases
← All changes | includes/Rest/Routes.php +18 -1 3.0.69 → 3.0.79 View file →
@@ -14,13 +14,17 @@
14 14 * @var Settings
15 15 */
16 16 private SettingsRoutes $settings_routes;
17 17
18 + private CacheRoutes $cache_routes;
19 +
18 20 /**
19 21 * @param SettingsRoutes $settings_routes Settings route class.
22 + * @param CacheRoutes $cache_routes Cache route class.
20 23 */
21 - public function __construct( SettingsRoutes $settings_routes ) {
24 + public function __construct( SettingsRoutes $settings_routes, CacheRoutes $cache_routes ) {
22 25 $this->settings_routes = $settings_routes;
26 + $this->cache_routes = $cache_routes;
23 27 }
24 28
25 29 /**
26 30 * Init rest routes
@@ -36,8 +40,21 @@
36 40 */
37 41 public function register_routes() {
38 42 // Register Settings Rest API Routes.
39 43 $this->register_settings_routes();
44 + $this->register_cache_routes();
45 + }
46 +
47 + private function register_cache_routes(): void {
48 + register_rest_route(
49 + HOSTINGER_PLUGIN_REST_API_BASE,
50 + 'clear-cache',
51 + array(
52 + 'methods' => \WP_REST_Server::DELETABLE,
53 + 'callback' => array( $this->cache_routes, 'clear_cache' ),
54 + 'permission_callback' => array( $this, 'permission_check' ),
55 + )
56 + );
40 57 }
41 58
42 59 /**
43 60 *