| @@ -31,8 +31,9 @@ | ||
| 31 | 31 | use WPDeveloper\BetterDocs\Dependencies\DI\Container; |
| 32 | 32 | use WPDeveloper\BetterDocs\Dependencies\DI\ContainerBuilder; |
| 33 | 33 | use WPDeveloper\BetterDocs\Editors\Editor; |
| 34 | 34 | use WPDeveloper\BetterDocs\FrontEnd\FrontEnd; |
| 35 | +use WPDeveloper\BetterDocs\FrontEnd\PrintTemplate; | |
| 35 | 36 | use WPDeveloper\BetterDocs\FrontEnd\SearchExtender; |
| 36 | 37 | use WPDeveloper\BetterDocs\FrontEnd\TemplateTags; |
| 37 | 38 | use WPDeveloper\BetterDocs\FrontEnd\WooProductFAQ; |
| 38 | 39 | use WPDeveloper\BetterDocs\Abilities\AbilitiesRegistrar; |
| @@ -131,9 +132,9 @@ | ||
| 131 | 132 | /** |
| 132 | 133 | * Plugin Version |
| 133 | 134 | * @var string |
| 134 | 135 | */ |
| 135 | - public $version = '4.9.0'; | |
| 136 | + public $version = '4.9.3'; | |
| 136 | 137 | |
| 137 | 138 | /** |
| 138 | 139 | * WriteWithAI Class |
| 139 | 140 | * @var string |
| @@ -150,9 +151,9 @@ | ||
| 150 | 151 | /** |
| 151 | 152 | * Plugin DB Version |
| 152 | 153 | * @var string |
| 153 | 154 | */ |
| 154 | - public $db_version = '1.0.2'; | |
| 155 | + public $db_version = '1.0.3'; | |
| 155 | 156 | |
| 156 | 157 | public function __construct() { |
| 157 | 158 | $this->define_constants(); |
| 158 | 159 | |
| @@ -318,8 +319,13 @@ | ||
| 318 | 319 | |
| 319 | 320 | $this->container->get( FrontEnd::class ); |
| 320 | 321 | $this->container->get( SearchExtender::class ); |
| 321 | 322 | |
| 323 | + // Running logo header / page footer for the browser's own Print command. | |
| 324 | + // Registered unconditionally: it covers every front-end page, including | |
| 325 | + // the ones that carry no BetterDocs print button. | |
| 326 | + $this->container->get( PrintTemplate::class ); | |
| 327 | + | |
| 322 | 328 | /** |
| 323 | 329 | * Single-product FAQ rendering (WooCommerce). The class itself bails when |
| 324 | 330 | * WooCommerce is inactive or the feature is disabled. |
| 325 | 331 | */ |
| @@ -478,8 +484,95 @@ | ||
| 478 | 484 | public function show_api_docs_teaser() { |
| 479 | 485 | return ! $this->is_pro_active() && ! $this->has_api_docs(); |
| 480 | 486 | } |
| 481 | 487 | |
| 488 | + /** | |
| 489 | + * Whether the real Glossaries screen is available (i.e. Pro is providing it). | |
| 490 | + * | |
| 491 | + * Glossaries now lives in Pro (moved out of Free), so — like Content | |
| 492 | + * Intelligence and API Docs — there is a concrete Pro class to detect. The | |
| 493 | + * class_exists() default keeps the gate correct against a Pro build that | |
| 494 | + * predates the move (that Pro is active but does NOT ship the manager, so | |
| 495 | + * this must be false, not simply `is_pro_active()`); the filter lets Pro/add-ons | |
| 496 | + * flip it explicitly. | |
| 497 | + * | |
| 498 | + * @return bool | |
| 499 | + */ | |
| 500 | + public function has_glossaries() { | |
| 501 | + return (bool) apply_filters( | |
| 502 | + 'betterdocs_pro_has_glossaries', | |
| 503 | + class_exists( '\\WPDeveloper\\BetterDocsPro\\Core\\GlossaryTaxonomy' ) | |
| 504 | + ); | |
| 505 | + } | |
| 506 | + | |
| 507 | + /** | |
| 508 | + * Whether Free should render its locked Glossaries screen instead of the real | |
| 509 | + * manager. | |
| 510 | + * | |
| 511 | + * True whenever the Pro manager is not available — i.e. Pro is off (a genuine | |
| 512 | + * upsell) OR an older Pro that predates the glossaries move is active (it can no | |
| 513 | + * longer provide the manager, so the slot must not be left blank). Only a Pro new | |
| 514 | + * enough to ship GlossaryTaxonomy hides this and takes over the route. | |
| 515 | + * | |
| 516 | + * @return bool | |
| 517 | + */ | |
| 518 | + public function show_glossary_teaser() { | |
| 519 | + return ! $this->has_glossaries(); | |
| 520 | + } | |
| 521 | + | |
| 522 | + /** | |
| 523 | + * Whether the locked Glossaries screen is showing because an *outdated* Pro | |
| 524 | + * is active (as opposed to no Pro at all). | |
| 525 | + * | |
| 526 | + * Glossaries moved into Pro, so a Pro that predates the move is active but no | |
| 527 | + * longer provides the manager. That user already owns Pro, so the locked | |
| 528 | + * screen must ask them to UPDATE Pro rather than upsell "get Pro". Mirrors the | |
| 529 | + * has_glossaries() capability check. | |
| 530 | + * | |
| 531 | + * @return bool | |
| 532 | + */ | |
| 533 | + public function glossaries_needs_pro_update() { | |
| 534 | + return $this->is_pro_active() && ! $this->has_glossaries(); | |
| 535 | + } | |
| 536 | + | |
| 537 | + /** | |
| 538 | + * The BetterDocs Pro version that first ships the Glossaries manager, shown in | |
| 539 | + * the "please update Pro" copy. Filterable so the target can move with Pro. | |
| 540 | + * | |
| 541 | + * @return string | |
| 542 | + */ | |
| 543 | + public function glossaries_min_pro_version() { | |
| 544 | + return (string) apply_filters( 'betterdocs_glossaries_min_pro_version', '4.3.1' ); | |
| 545 | + } | |
| 546 | + | |
| 547 | + /** | |
| 548 | + * Whether Pro provides the real Content Intelligence screen. | |
| 549 | + * | |
| 550 | + * Pro flips this via `betterdocs_pro_has_content_intelligence`; the | |
| 551 | + * class_exists() default keeps the gate correct against a Pro build that | |
| 552 | + * predates that filter. | |
| 553 | + * | |
| 554 | + * @return bool | |
| 555 | + */ | |
| 556 | + public function has_content_intelligence() { | |
| 557 | + return (bool) apply_filters( | |
| 558 | + 'betterdocs_pro_has_content_intelligence', | |
| 559 | + class_exists( '\\WPDeveloper\\BetterDocsPro\\Core\\ContentIntelligenceService' ) | |
| 560 | + ); | |
| 561 | + } | |
| 562 | + | |
| 563 | + /** | |
| 564 | + * Whether Free should show its locked Content Intelligence teaser. | |
| 565 | + * | |
| 566 | + * Only without Pro. An older Pro has already paid, so they get nothing here — | |
| 567 | + * they need a plugin update, not an upsell. | |
| 568 | + * | |
| 569 | + * @return bool | |
| 570 | + */ | |
| 571 | + public function show_content_intelligence_teaser() { | |
| 572 | + return ! $this->is_pro_active() && ! $this->has_content_intelligence(); | |
| 573 | + } | |
| 574 | + | |
| 482 | 575 | public function pro_version() { |
| 483 | 576 | if ( ! $this->is_pro_active() ) { |
| 484 | 577 | return false; |
| 485 | 578 | } |
| @@ -531,8 +624,9 @@ | ||
| 531 | 624 | 'toplevel_page_betterdocs-admin', |
| 532 | 625 | 'admin_page_betterdocs-admin', |
| 533 | 626 | 'betterdocs_page_betterdocs-admin', |
| 534 | 627 | 'betterdocs_page_betterdocs-analytics', |
| 628 | + 'betterdocs_page_betterdocs-content-iq', | |
| 535 | 629 | 'betterdocs_page_betterdocs-settings', |
| 536 | 630 | 'betterdocs_page_betterdocs-mcp', |
| 537 | 631 | 'betterdocs_page_betterdocs-faq', |
| 538 | 632 | 'betterdocs_page_betterdocs-glossaries', |