| @@ -62,15 +62,8 @@ | ||
| 62 | 62 | return $ok; |
| 63 | 63 | }, |
| 64 | 64 | 'callback' => [ $this, 'rest_update_option' ] |
| 65 | 65 | ] ); |
| 66 | - register_rest_route( $this->namespace, '/installed_plugins/', [ | |
| 67 | - 'methods' => 'POST', | |
| 68 | - 'permission_callback' => function () { | |
| 69 | - return current_user_can( 'manage_options' ); | |
| 70 | - }, | |
| 71 | - 'callback' => [ $this, 'rest_installed_plugins' ] | |
| 72 | - ] ); | |
| 73 | 66 | } |
| 74 | 67 | |
| 75 | 68 | public function file_rand( $filesize ) { |
| 76 | 69 | $tmp_file = tmpfile(); |
| @@ -112,28 +105,8 @@ | ||
| 112 | 105 | } |
| 113 | 106 | |
| 114 | 107 | public function rest_all_settings() { |
| 115 | 108 | return new WP_REST_Response( [ 'success' => true, 'data' => $this->get_all_options() ], 200 ); |
| 116 | - } | |
| 117 | - | |
| 118 | - public function rest_installed_plugins() { | |
| 119 | - if ( !function_exists( 'get_plugins' ) ) { | |
| 120 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 121 | - } | |
| 122 | - $all_plugins = get_plugins(); | |
| 123 | - $result = []; | |
| 124 | - foreach ( $all_plugins as $plugin_file => $plugin_data ) { | |
| 125 | - // Plugin file looks like "ai-engine/ai-engine.php" — the slug is the | |
| 126 | - // first path segment. Some plugins live at the root (single file), | |
| 127 | - // those we just skip; we only care about Meow Apps directories anyway. | |
| 128 | - $parts = explode( '/', $plugin_file ); | |
| 129 | - if ( count( $parts ) < 2 ) { | |
| 130 | - continue; | |
| 131 | - } | |
| 132 | - $slug = $parts[0]; | |
| 133 | - $result[ $slug ] = is_plugin_active( $plugin_file ) ? 'active' : 'inactive'; | |
| 134 | - } | |
| 135 | - return new WP_REST_Response( [ 'success' => true, 'data' => $result ], 200 ); | |
| 136 | 109 | } |
| 137 | 110 | |
| 138 | 111 | public function rest_update_option( $request ) { |
| 139 | 112 | $params = $request->get_json_params(); |