| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Connectors API.
| File Size: | 730 lines (24 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 1 file wp-admin/includes/plugin.php |
| wp_is_connector_registered( string $id ) X-Ref |
| Checks if a connector is registered. return: bool True if the connector is registered, false otherwise. param: string $id The connector identifier. |
| wp_get_connector( string $id ) X-Ref |
| Retrieves a registered connector. return: array|null { param: string $id The connector identifier. |
| wp_get_connectors() X-Ref |
| Retrieves all registered connectors. return: array { |
| _wp_connectors_resolve_ai_provider_logo_url( string $path ) X-Ref |
| Resolves an AI provider logo file path to a URL. Converts an absolute file path to a plugin URL. The path must reside within the plugins or must-use plugins directory. return: non-empty-string|null The URL to the logo file, or null if the path is invalid. param: string $path Absolute path to the logo file. |
| _wp_connectors_init() X-Ref |
| Initializes the connector registry with default connectors and fires the registration action. Creates the registry instance, registers built-in connectors (which cannot be unhooked), and then fires the `wp_connectors_init` action for plugins to register their own connectors. |
| _wp_connectors_register_default_ai_providers( WP_Connector_Registry $registry ) X-Ref |
| Registers connectors for the built-in AI providers. param: WP_Connector_Registry $registry The connector registry instance. |
| _wp_connectors_mask_api_key( string $key ) X-Ref |
| Masks an API key, showing only the last 4 characters. return: string The masked key, e.g. "************fj39". param: string $key The API key to mask. |
| _wp_connectors_get_api_key_source( string $setting_name, string $env_var_name = '', string $constant_name = '' ) X-Ref |
| Determines the source of an API key for a given connector. Checks in order: environment variable, PHP constant, database. Environment variable and constant are only checked when their respective names are provided. return: string The key source: 'env', 'constant', 'database', or 'none'. param: string $setting_name The option name for the API key (e.g., 'connectors_spam_filtering_my_plugin_api_key'). param: string $env_var_name Optional. Environment variable name to check (e.g., 'MY_PLUGIN_API_KEY'). param: string $constant_name Optional. PHP constant name to check (e.g., 'MY_PLUGIN_API_KEY'). |
| _wp_connectors_is_ai_api_key_valid( string $key, string $provider_id ) X-Ref |
| Checks whether an API key is valid for a given provider. return: bool|null True if valid, false if invalid, null if unable to determine. param: string $key The API key to check. param: string $provider_id The WP AI client provider ID. |
| _wp_connectors_rest_settings_dispatch( WP_REST_Response $response, WP_REST_Server $server, WP_REST_Request $request ) X-Ref |
| Masks and validates connector API keys in REST responses. On every `/wp/v2/settings` response, masks connector API key values so raw keys are never exposed via the REST API. On POST or PUT requests, validates each updated key against the provider before masking. If validation fails, the key is reverted to an empty string. return: WP_REST_Response The modified response with masked/validated keys. param: WP_REST_Response $response The response object. param: WP_REST_Server $server The server instance. param: WP_REST_Request $request The request object. |
| _wp_register_default_connector_settings() X-Ref |
| Registers default connector settings. |
| _wp_connectors_pass_default_keys_to_ai_client() X-Ref |
| Passes stored connector API keys to the WP AI client. |
| _wp_connectors_get_connector_script_module_data( array $data ) X-Ref |
| Exposes connector settings to the connectors-wp-admin script module. return: array<string, mixed> Script module data with connectors added. param: array<string, mixed> $data Existing script module data. |
| Generated : Fri Jul 3 08:20:12 2026 | Cross-referenced by PHPXref |