| @@ -2,10 +2,12 @@ | ||
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: BetterDocs |
| 5 | 5 | * Plugin URI: https://betterdocs.co/ |
| 6 | - * Description: Create stunning Knowledge base for your WordPress website and reduce support pressure with the help of BetterDocs. Get access to amazing templates and create fully customizable KB with AI Write. | |
| 7 | - * Version: 3.5.0 | |
| 6 | + * Description: Create stunning Knowledge base & FAQs for your WordPress website and reduce support pressure with the help of BetterDocs. Get access to amazing templates and create fully customizable KB with AI Write. | |
| 7 | + * Version: 4.9.2 | |
| 8 | + * Requires at least: 6.4 | |
| 9 | + * Requires PHP: 7.4 | |
| 8 | 10 | * Author: WPDeveloper |
| 9 | 11 | * Author URI: https://wpdeveloper.com |
| 10 | 12 | * License: GPL-3.0+ |
| 11 | 13 | * License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| @@ -13,8 +15,10 @@ | ||
| 13 | 15 | * Domain Path: /languages |
| 14 | 16 | */ |
| 15 | 17 | |
| 16 | 18 | // If this file is called directly, abort. |
| 19 | +use WPDeveloper\BetterDocs\Plugin; | |
| 20 | + | |
| 17 | 21 | defined( 'ABSPATH' ) || exit; |
| 18 | 22 | |
| 19 | 23 | define( 'BETTERDOCS_PLUGIN_FILE', __FILE__ ); |
| 20 | 24 | |
| @@ -20,24 +24,62 @@ | ||
| 20 | 24 | |
| 21 | 25 | require_once __DIR__ . '/includes/v2x-compatibility.php'; |
| 22 | 26 | require_once __DIR__ . '/vendor/autoload.php'; |
| 23 | 27 | |
| 28 | +/** | |
| 29 | + * Bundled MCP runtime (WordPress Abilities API + Parsedown). | |
| 30 | + * | |
| 31 | + * Loaded through the Jetpack Autoloader so that if the same library is also | |
| 32 | + * shipped by another plugin — or lands in WordPress core — the newest copy | |
| 33 | + * wins and loads once, with no fatal class collisions. This lets BetterDocs | |
| 34 | + * serve its MCP connector out of the box, without the standalone Abilities | |
| 35 | + * API plugin. See docs/mcp-server.md for the update procedure. | |
| 36 | + * | |
| 37 | + * On WordPress 7.1+, where core ships the Abilities API itself, Runtime::init() | |
| 38 | + * stands the bundled copy down so it stops duplicating core's REST routes and | |
| 39 | + * admin assets; on 6.4-7.0 the bundle is the only API and is left untouched. | |
| 40 | + * | |
| 41 | + * @since 4.9.0 | |
| 42 | + */ | |
| 43 | +$betterdocs_mcp_runtime = __DIR__ . '/dependencies/vendor/autoload_packages.php'; | |
| 44 | +if ( is_readable( $betterdocs_mcp_runtime ) ) { | |
| 45 | + require_once $betterdocs_mcp_runtime; | |
| 24 | 46 | |
| 47 | + \WPDeveloper\BetterDocs\Abilities\Runtime::init(); | |
| 48 | +} | |
| 49 | +unset( $betterdocs_mcp_runtime ); | |
| 50 | + | |
| 25 | 51 | /** |
| 26 | - * Intiate the BetterDocs Plugin | |
| 52 | + * Declare WooCommerce HPOS (custom order tables) compatibility. BetterDocs | |
| 53 | + * never touches order storage, so this is a pure compatibility flag. Must run | |
| 54 | + * on before_woocommerce_init — the Plugin bootstraps on `init`, which is too | |
| 55 | + * late for WooCommerce to read the declaration. | |
| 56 | + */ | |
| 57 | +add_action( 'before_woocommerce_init', function () { | |
| 58 | + if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { | |
| 59 | + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( | |
| 60 | + 'custom_order_tables', | |
| 61 | + BETTERDOCS_PLUGIN_FILE, | |
| 62 | + true | |
| 63 | + ); | |
| 64 | + } | |
| 65 | +} ); | |
| 66 | + | |
| 67 | +/** | |
| 68 | + * Initiate the BetterDocs Plugin | |
| 27 | 69 | * |
| 70 | + * @return Plugin | |
| 28 | 71 | * @since 2.5.0 |
| 29 | - * @return \WPDeveloper\BetterDocs\Plugin | |
| 30 | 72 | */ |
| 31 | -function betterdocs() { | |
| 73 | +function betterdocs(): Plugin { | |
| 32 | 74 | /** |
| 33 | 75 | * Remove PRO Functionalities if pro is not updated. |
| 34 | 76 | */ |
| 35 | - if( ! function_exists('betterdocs_pro') ){ | |
| 77 | + if ( ! function_exists( 'betterdocs_pro' ) ) { | |
| 36 | 78 | remove_action( 'betterdocs_init', 'run_betterdocs_pro' ); |
| 37 | 79 | } |
| 38 | 80 | |
| 39 | - return \WPDeveloper\BetterDocs\Plugin::get_instance(); | |
| 81 | + return Plugin::get_instance(); | |
| 40 | 82 | } |
| 41 | 83 | |
| 42 | 84 | /** |
| 43 | 85 | * Initialize BetterDocs (Free) |
| @@ -44,9 +86,9 @@ | ||
| 44 | 86 | * Here, begins the execution of the plugin. |
| 45 | 87 | * |
| 46 | 88 | * Returns the main instance of BetterDocs. |
| 47 | 89 | * |
| 90 | + * @return Plugin | |
| 48 | 91 | * @since 3.0 |
| 49 | - * @return \WPDeveloper\BetterDocs\Plugin | |
| 50 | 92 | */ |
| 51 | 93 | |
| 52 | 94 | betterdocs(); |