'; echo esc_html__( 'Agentmatica MCP Connector requires WordPress 6.9 or later for the Abilities API used by its MCP server.', 'agentmatica-mcp-connector' ); echo '

'; } /** * Load admin includes for .htaccess marker writes from the frontend. * * get_home_path() has lived in wp-admin/includes/file.php since WordPress 1.5. * insert_with_markers() lives in wp-admin/includes/misc.php. Neither is loaded on * public requests by default — load both explicitly for cross-version compatibility. */ public static function load_htaccess_admin_includes(): bool { if ( ! function_exists( 'get_home_path' ) ) { $file = ABSPATH . 'wp-admin/includes/file.php'; if ( is_readable( $file ) ) { require_once $file; } } if ( ! function_exists( 'insert_with_markers' ) ) { $misc = ABSPATH . 'wp-admin/includes/misc.php'; if ( is_readable( $misc ) ) { require_once $misc; } } return function_exists( 'insert_with_markers' ); } /** * Filesystem path to the WordPress install root (for .htaccess / web.config). */ public static function get_wordpress_home_path(): string { if ( ! function_exists( 'get_home_path' ) ) { self::load_htaccess_admin_includes(); } if ( function_exists( 'get_home_path' ) ) { $home_path = get_home_path(); if ( is_string( $home_path ) && $home_path !== '' ) { return $home_path; } } return trailingslashit( ABSPATH ); } public static function delete_path_if_exists( string $path ): void { if ( ! file_exists( $path ) ) { return; } if ( function_exists( 'wp_delete_file' ) ) { wp_delete_file( $path ); return; } // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink -- pre-4.2 fallback. unlink( $path ); } }