| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FirePlugins Framework |
| 4 | - * @version 1.0.15 | |
| 4 | + * @version 1.2.6 | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FPFramework\API; |
| @@ -29,17 +29,17 @@ | ||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | public function register_routes() |
| 32 | 32 | { |
| 33 | - // find all routes | |
| 34 | - $routes = array_diff( scandir( __DIR__ . '/Routes' ), [ '.', '..', 'index.php' ] ); | |
| 35 | - | |
| 33 | + // explicit route list — avoids a scandir() on every rest_api_init request | |
| 34 | + $routes = [ | |
| 35 | + 'CPT' | |
| 36 | + ]; | |
| 37 | + | |
| 36 | 38 | foreach ($routes as $route) |
| 37 | 39 | { |
| 38 | - $route = str_replace('.php', '', $route); | |
| 39 | - | |
| 40 | 40 | $class = '\FPFramework\API\Routes\\' . $route; |
| 41 | - $api = new $class($this); | |
| 41 | + $api = new $class(); | |
| 42 | 42 | $api->register(); |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |