| @@ -54,9 +54,11 @@ | ||
| 54 | 54 | */ |
| 55 | 55 | private function register_init_hooks(): void { |
| 56 | 56 | Hook_Registry::add_action( 'init', array( $this, 'initiate_plugin' ) ); |
| 57 | 57 | Hook_Registry::add_action( 'widgets_init', array( $this, 'register_widgets' ) ); |
| 58 | - Hook_Registry::add_action( 'rest_api_init', array( $this, 'register_rest_routes' ) ); | |
| 58 | + if ( Feature_Manager::is_enabled( 'rest_api' ) ) { | |
| 59 | + Hook_Registry::add_action( 'rest_api_init', array( $this, 'register_rest_routes' ) ); | |
| 60 | + } | |
| 59 | 61 | Hook_Registry::add_action( 'parse_query', array( $this, 'parse_query' ) ); |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | /** |
| @@ -83,8 +85,12 @@ | ||
| 83 | 85 | * |
| 84 | 86 | * @since 3.3.0 |
| 85 | 87 | */ |
| 86 | 88 | public function register_widgets(): void { |
| 89 | + if ( ! Feature_Manager::is_enabled( 'legacy_widgets' ) ) { | |
| 90 | + return; | |
| 91 | + } | |
| 92 | + | |
| 87 | 93 | register_widget( '\WebberZone\Top_Ten\Frontend\Widgets\Posts_Widget' ); |
| 88 | 94 | register_widget( '\WebberZone\Top_Ten\Frontend\Widgets\Count_Widget' ); |
| 89 | 95 | } |
| 90 | 96 | |
| @@ -93,8 +99,12 @@ | ||
| 93 | 99 | * |
| 94 | 100 | * @since 3.0.0 |
| 95 | 101 | */ |
| 96 | 102 | public function register_rest_routes(): void { |
| 103 | + if ( ! Feature_Manager::is_enabled( 'rest_api' ) ) { | |
| 104 | + return; | |
| 105 | + } | |
| 106 | + | |
| 97 | 107 | $controller = new Frontend\REST_API(); |
| 98 | 108 | $controller->register_routes(); |
| 99 | 109 | } |
| 100 | 110 | |