sprintf( /* translators: %s: error handler class name */ esc_html__( 'Error handler class "%s" does not exist.', 'mcp-adapter' ), esc_html( $error_handler ) ) ); } if ( ! in_array( McpErrorHandlerInterface::class, class_implements( $error_handler ) ?: array(), true ) ) { return new \WP_Error( 'invalid_error_handler', sprintf( /* translators: %s: error handler class name */ esc_html__( 'Error handler class "%s" must implement the McpErrorHandlerInterface.', 'mcp-adapter' ), esc_html( $error_handler ) ) ); } // Use NullMcpObservabilityHandler if no observability handler is provided. if ( ! $observability_handler ) { $observability_handler = NullMcpObservabilityHandler::class; } // Validate observability handler class exists and implements McpObservabilityHandlerInterface. if ( ! class_exists( $observability_handler ) ) { return new \WP_Error( 'invalid_observability_handler', sprintf( /* translators: %s: observability handler class name */ esc_html__( 'Observability handler class "%s" does not exist.', 'mcp-adapter' ), esc_html( $observability_handler ) ) ); } if ( ! in_array( McpObservabilityHandlerInterface::class, class_implements( $observability_handler ) ?: array(), true ) ) { return new \WP_Error( 'invalid_observability_handler', sprintf( /* translators: %s: observability handler class name */ esc_html__( 'Observability handler class "%s" must implement the McpObservabilityHandlerInterface interface.', 'mcp-adapter' ), esc_html( $observability_handler ) ) ); } if ( ! doing_action( 'mcp_adapter_init' ) ) { _doing_it_wrong( __FUNCTION__, esc_html__( 'MCP Servers must be created during the "mcp_adapter_init" action. Hook into "mcp_adapter_init" to register your server.', 'mcp-adapter' ), '0.1.0' ); return new \WP_Error( 'invalid_timing', esc_html__( 'MCP Server creation must be done during mcp_adapter_init action.', 'mcp-adapter' ) ); } if ( isset( $this->servers[ $server_id ] ) ) { _doing_it_wrong( __FUNCTION__, sprintf( // translators: %s: server ID esc_html__( 'Server with ID "%s" already exists. Each server must have a unique ID.', 'mcp-adapter' ), esc_html( $server_id ) ), '0.1.0' ); return new \WP_Error( 'duplicate_server_id', // translators: %s: server ID. sprintf( esc_html__( 'Server with ID "%s" already exists.', 'mcp-adapter' ), esc_html( $server_id ) ) ); } // Create server with tools, resources, and prompts - let server handle all registration logic. $server = new McpServer( $server_id, $server_route_namespace, $server_route, $server_name, $server_description, $server_version, $mcp_transports, $error_handler, $observability_handler, $tools, $resources, $prompts, $transport_permission_callback ); // Track server creation. $server->get_observability_handler()->record_event( 'mcp.server.created', array( 'status' => 'success', 'server_id' => $server_id, 'transport_count' => count( $mcp_transports ), 'tools_count' => count( $tools ), 'resources_count' => count( $resources ), 'prompts_count' => count( $prompts ), ) ); // Add server to registry. $this->servers[ $server_id ] = $server; return $this; } /** * Get a server by ID. * * @param string $server_id Server ID. * * @return \WP\MCP\Core\McpServer|null */ public function get_server( string $server_id ): ?McpServer { return $this->servers[ $server_id ] ?? null; } /** * Get all registered servers * * @return \WP\MCP\Core\McpServer[] */ public function get_servers(): array { return $this->servers; } /** * Conditionally create the default server based on filter. * * @internal For use by adapter initialization only. */ private function maybe_create_default_server(): void { // Allow disabling default server creation if ( ! apply_filters( 'mcp_adapter_create_default_server', true ) ) { return; } // Register category before abilities add_action( 'wp_abilities_api_categories_init', array( $this, 'register_default_category' ) ); add_action( 'wp_abilities_api_init', array( $this, 'register_default_abilities' ) ); add_action( 'mcp_adapter_init', array( DefaultServerFactory::class, 'create' ) ); } /** * Register the default MCP category. * * @return void */ public function register_default_category(): void { wp_register_ability_category( 'mcp-adapter', array( 'label' => 'MCP Adapter', 'description' => 'Abilities for the MCP Adapter', ) ); } /** * Register the default MCP abilities. * * @return void */ public function register_default_abilities(): void { // Register the three core MCP abilities DiscoverAbilitiesAbility::register(); GetAbilityInfoAbility::register(); ExecuteAbilityAbility::register(); } /** * Register WP-CLI commands if WP-CLI is available * * @internal For use by adapter initialization only. */ private function register_wp_cli_commands(): void { // Only register if WP-CLI is available if ( ! defined( 'WP_CLI' ) || ! constant( 'WP_CLI' ) ) { return; } if ( ! class_exists( 'WP_CLI' ) ) { return; } \WP_CLI::add_command( 'mcp-adapter', McpCommand::class, array( 'shortdesc' => 'Manage MCP servers via WP-CLI.', 'longdesc' => 'Commands for managing and serving MCP servers, including STDIO transport.', ) ); } } * * Destinations declared in the form content (webhooks, the legacy postToUrl attribute and * the Salesforce integration) are only honored when the source post's author has the * `manage_options` capability. Returns false when no post author can be determined (for * example, widget or block-template forms whose source id is not a numeric post). * * @param int|string $source_id The form source id: a post id for post/page forms, or a * non-numeric value for widget or block-template sources. * @return boolean */ public static function should_honor_content_destinations( $source_id ) { if ( ! is_numeric( $source_id ) ) { return false; } $source_id = (int) $source_id; if ( $source_id <= 0 ) { return false; } $author_id = (int) get_post_field( 'post_author', $source_id ); return $author_id > 0 && user_can( $author_id, 'manage_options' ); } /** * Returns true if the Integrations UI should be shown in the Forms dashboard. * * @since 6.22.0 * * @return boolean */ public static function show_dashboard_integrations() { /** * Whether to show Integrations UI in the Forms dashboard. * * @since 6.22.0 * * @param bool true Whether to show the Integrations UI in the dashboard. Default true. */ return apply_filters( 'jetpack_forms_show_dashboard_integrations', true ); } /** * Returns true if the Integrations UI should be shown in the Form block editor. * * @since 6.22.0 * * @return boolean */ public static function show_block_integrations() { /** * Whether to show Integrations UI in the Form block editor. * * @since 6.22.0 * * @param bool true Whether to show the Integrations UI in the editor. Default true. */ return apply_filters( 'jetpack_forms_show_block_integrations', true ); } /** * Returns true if integration icons should be shown (editor sidebar and integrations modal). * * @since 6.22.0 * * @return boolean */ public static function show_integration_icons() { /** * Whether to show integration icons in the UI. * * If set to false, the ActiveIntegrations component (editor sidebar) will be hidden * and integration icons in the integrations modal will not be rendered. * * @since 6.22.0 * * @param bool true Whether to show integration icons. Default true. */ return apply_filters( 'jetpack_forms_show_integration_icons', true ); } }
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Forms\Jetpack_Forms" not found in /htdocs/emploitogo.info/wp-content/plugins/jetpack/modules/contact-form.php:30 Stack trace: #0 /htdocs/emploitogo.info/wp-content/plugins/jetpack/class.jetpack.php(1709): include_once() #1 /htdocs/emploitogo.info/wp-includes/class-wp-hook.php(341): Jetpack::load_modules('') #2 /htdocs/emploitogo.info/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters('', Array) #3 /htdocs/emploitogo.info/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #4 /htdocs/emploitogo.info/wp-settings.php(749): do_action('after_setup_the...') #5 /htdocs/emploitogo.info/wp-config.php(112): require_once('/htdocs/emploit...') #6 /htdocs/emploitogo.info/wp-load.php(50): require_once('/htdocs/emploit...') #7 /htdocs/emploitogo.info/wp-blog-header.php(13): require_once('/htdocs/emploit...') #8 /htdocs/emploitogo.info/index.php(17): require('/htdocs/emploit...') #9 {main} thrown in /htdocs/emploitogo.info/wp-content/plugins/jetpack/modules/contact-form.php on line 30