| @@ -126,10 +126,9 @@ | ||
| 126 | 126 | add_action( 'admin_footer-plugins.php', array( $this, 'disable_deactivation' ) ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if ( $this->settings->get( 'enable_estimated_reading_time' ) ) { |
| 130 | - // Hook into unified metabox instead of creating separate metabox | |
| 131 | - add_action( 'betterdocs_reading_time_tab_content', [ $this, 'render_estimated_time_markup' ] ); | |
| 130 | + add_action( 'add_meta_boxes', [ $this, 'reading_meta_box_' ], 10 ); | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | self::$cache_bank = CacheBank::get_instance(); |
| 135 | 134 | |
| @@ -212,8 +211,20 @@ | ||
| 212 | 211 | } |
| 213 | 212 | return $output; |
| 214 | 213 | } |
| 215 | 214 | |
| 215 | + public function reading_meta_box_() { | |
| 216 | + add_meta_box( | |
| 217 | + 'betterdocs_estimated_time_metabox', | |
| 218 | + __( 'Estimated Reading Time', 'betterdocs' ), | |
| 219 | + [ | |
| 220 | + $this, | |
| 221 | + 'render_estimated_time_markup' | |
| 222 | + ], | |
| 223 | + 'docs' | |
| 224 | + ); | |
| 225 | + } | |
| 226 | + | |
| 216 | 227 | public function render_estimated_time_markup() { |
| 217 | 228 | betterdocs()->views->get( 'admin/metabox/estimated-reading-box' ); |
| 218 | 229 | } |
| 219 | 230 | |
| @@ -400,42 +411,49 @@ | ||
| 400 | 411 | ] |
| 401 | 412 | ); |
| 402 | 413 | } |
| 403 | 414 | |
| 404 | - $spring_campaign_message = '<div class="betterdocs-spring-notice-body"><p style="margin-top: 0; margin-bottom: 0;">🌸 <strong>Spring Savings:</strong> Build AI-powered Knowledge Bases & FAQs to empower support and improve user experience – now <strong>Flat 25% OFF!</strong> ⚡️</p></div>'; | |
| 405 | - $_spring_campaign_notice = [ | |
| 415 | + // $blackfriday_message = '<div class="betterdocs-notice-body"><p style="margin-top: 0; margin-bottom: 0;"><strong>🛍️ Black Friday Specials:</strong> Save up to 35% OFF on BetterDocs PRO plans & manage docs/FAQs seamlessly.</p><a class="button button-primary" href="https://betterdocs.co/bfcm24-pricing" target="_blank"><svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 416 | + // <path d="M15.7431 10.9381L15.904 9.35966C15.9898 8.5175 16.0464 7.9614 16.002 7.61102L16.0175 7.61112C16.7442 7.61112 17.3333 6.98929 17.3333 6.22223C17.3333 5.45517 16.7442 4.83334 16.0175 4.83334C15.2908 4.83334 14.7017 5.45517 14.7017 6.22223C14.7017 6.56914 14.8222 6.88634 15.0214 7.12975C14.7354 7.31608 14.3615 7.70926 13.7987 8.30106L13.7986 8.30107L13.7986 8.30108C13.365 8.75699 13.1482 8.98495 12.9064 9.02025C12.7724 9.03981 12.6358 9.01971 12.5121 8.96219C12.2887 8.85838 12.1398 8.57656 11.842 8.01293L10.2723 5.04204C10.0886 4.69433 9.9348 4.40331 9.79616 4.16913C10.3649 3.86285 10.7543 3.23869 10.7543 2.51852C10.7543 1.49577 9.96888 0.666672 8.99996 0.666672C8.03104 0.666672 7.24557 1.49577 7.24557 2.51852C7.24557 3.23869 7.63503 3.86285 8.20376 4.16913C8.06511 4.40333 7.91137 4.6943 7.72763 5.04204L6.1579 8.01293C5.8601 8.57656 5.71119 8.85838 5.48786 8.96219C5.36411 9.01971 5.22757 9.03981 5.09355 9.02025C4.85169 8.98495 4.63488 8.75699 4.20127 8.30107C3.63844 7.70928 3.26449 7.31608 2.97849 7.12975C3.17771 6.88634 3.29821 6.56914 3.29821 6.22223C3.29821 5.45517 2.70911 4.83334 1.98242 4.83334C1.25572 4.83334 0.666626 5.45517 0.666626 6.22223C0.666626 6.98929 1.25572 7.61112 1.98242 7.61112L1.99795 7.61102C1.95348 7.96139 2.01015 8.51749 2.09596 9.35965L2.2568 10.938C2.34608 11.8142 2.42032 12.6478 2.51125 13.3982H15.4887C15.5796 12.6478 15.6538 11.8142 15.7431 10.9381Z" fill="white"/> | |
| 417 | + // <path d="M8.04563 17.3333H9.95429C12.4419 17.3333 13.6858 17.3333 14.5157 16.5492C14.8779 16.207 15.1073 15.59 15.2728 14.787H2.72711C2.89263 15.59 3.12201 16.207 3.48424 16.5492C4.31414 17.3333 5.55797 17.3333 8.04563 17.3333Z" fill="white"/> | |
| 418 | + // </svg> Upgrade To PRO</a></div>'; | |
| 419 | + // $_blackfriday_notice = [ | |
| 420 | + // 'thumbnail' => $this->assets->icon( 'betterdocs-logo.svg', true ), | |
| 421 | + // 'html' => $blackfriday_message | |
| 422 | + // ]; | |
| 423 | + | |
| 424 | + // $notices->add( | |
| 425 | + // 'blackfriday24', | |
| 426 | + // $_blackfriday_notice, | |
| 427 | + // [ | |
| 428 | + // 'start' => $notices->time(), | |
| 429 | + // 'recurrence' => false, | |
| 430 | + // 'dismissible' => true, | |
| 431 | + // 'refresh' => BETTERDOCS_VERSION, | |
| 432 | + // 'expire' => strtotime( '11:59:59pm December 5, 2024' ), | |
| 433 | + // 'display_if' => ! is_plugin_active( 'betterdocs-pro/betterdocs-pro.php' ) | |
| 434 | + // ] | |
| 435 | + // ); | |
| 436 | + | |
| 437 | + $offer_message = '<div class="betterdocs-notice-body betterdocs-holiday-notice-body"><p style="margin-top: 0; margin-bottom: 0;"><strong>🎉 BetterDocs Just Hit 40,000+ Users!</strong> Join the celebration with 20% OFF & unlock even more power with premium features today!</p><div class="betterdocs-notice-actions"><a class="button button-primary" href="https://betterdocs.co/40K-admin-notice" target="_blank"><svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 438 | + <path d="M15.7431 10.9381L15.904 9.35966C15.9898 8.5175 16.0464 7.9614 16.002 7.61102L16.0175 7.61112C16.7442 7.61112 17.3333 6.98929 17.3333 6.22223C17.3333 5.45517 16.7442 4.83334 16.0175 4.83334C15.2908 4.83334 14.7017 5.45517 14.7017 6.22223C14.7017 6.56914 14.8222 6.88634 15.0214 7.12975C14.7354 7.31608 14.3615 7.70926 13.7987 8.30106L13.7986 8.30107L13.7986 8.30108C13.365 8.75699 13.1482 8.98495 12.9064 9.02025C12.7724 9.03981 12.6358 9.01971 12.5121 8.96219C12.2887 8.85838 12.1398 8.57656 11.842 8.01293L10.2723 5.04204C10.0886 4.69433 9.9348 4.40331 9.79616 4.16913C10.3649 3.86285 10.7543 3.23869 10.7543 2.51852C10.7543 1.49577 9.96888 0.666672 8.99996 0.666672C8.03104 0.666672 7.24557 1.49577 7.24557 2.51852C7.24557 3.23869 7.63503 3.86285 8.20376 4.16913C8.06511 4.40333 7.91137 4.6943 7.72763 5.04204L6.1579 8.01293C5.8601 8.57656 5.71119 8.85838 5.48786 8.96219C5.36411 9.01971 5.22757 9.03981 5.09355 9.02025C4.85169 8.98495 4.63488 8.75699 4.20127 8.30107C3.63844 7.70928 3.26449 7.31608 2.97849 7.12975C3.17771 6.88634 3.29821 6.56914 3.29821 6.22223C3.29821 5.45517 2.70911 4.83334 1.98242 4.83334C1.25572 4.83334 0.666626 5.45517 0.666626 6.22223C0.666626 6.98929 1.25572 7.61112 1.98242 7.61112L1.99795 7.61102C1.95348 7.96139 2.01015 8.51749 2.09596 9.35965L2.2568 10.938C2.34608 11.8142 2.42032 12.6478 2.51125 13.3982H15.4887C15.5796 12.6478 15.6538 11.8142 15.7431 10.9381Z" fill="white"/> | |
| 439 | + <path d="M8.04563 17.3333H9.95429C12.4419 17.3333 13.6858 17.3333 14.5157 16.5492C14.8779 16.207 15.1073 15.59 15.2728 14.787H2.72711C2.89263 15.59 3.12201 16.207 3.48424 16.5492C4.31414 17.3333 5.55797 17.3333 8.04563 17.3333Z" fill="white"/> | |
| 440 | + </svg>Upgrade To PRO</a></div></div>'; | |
| 441 | + $_offer_notice = [ | |
| 406 | 442 | 'thumbnail' => $this->assets->icon( 'betterdocs-logo.svg', true ), |
| 407 | - 'html' => $spring_campaign_message, | |
| 408 | - 'links' => [ | |
| 409 | - 'support' => [ | |
| 410 | - 'link' => 'https://betterdocs.co/spring2026-admin-notice', | |
| 411 | - 'attributes' => [ | |
| 412 | - 'target' => '_blank', | |
| 413 | - 'class' => 'offer-button', | |
| 414 | - ], | |
| 415 | - 'label' => __( 'Upgrade To PRO Now', 'betterdocs' ), | |
| 416 | - ], | |
| 417 | - 'maybe_later' => [ | |
| 418 | - 'label' => __( 'I\'ll Grab It Later', 'betterdocs' ), | |
| 419 | - 'attributes' => [ | |
| 420 | - 'target' => '_blank', | |
| 421 | - 'data-later' => true, | |
| 422 | - 'class' => 'dismiss-btn', | |
| 423 | - ], | |
| 424 | - ], | |
| 425 | - ], | |
| 443 | + 'html' => $offer_message | |
| 426 | 444 | ]; |
| 427 | 445 | |
| 428 | 446 | $notices->add( |
| 429 | - 'spring-campaign-26', | |
| 430 | - $_spring_campaign_notice, | |
| 447 | + '40k_offer', | |
| 448 | + $_offer_notice, | |
| 431 | 449 | [ |
| 432 | 450 | 'start' => $notices->time(), |
| 433 | 451 | 'recurrence' => false, |
| 434 | 452 | 'dismissible' => true, |
| 435 | 453 | 'refresh' => BETTERDOCS_VERSION, |
| 436 | - 'expire' => strtotime( '11:59:59pm May 31, 2026' ), | |
| 437 | - 'display_if' => ! is_plugin_active( 'betterdocs-pro/betterdocs-pro.php' ), | |
| 454 | + 'expire' => strtotime( '11:59:59pm April 30, 2025' ), | |
| 455 | + 'display_if' => ! is_plugin_active( 'betterdocs-pro/betterdocs-pro.php' ) | |
| 438 | 456 | ] |
| 439 | 457 | ); |
| 440 | 458 | |
| 441 | 459 | self::$cache_bank->create_account( $notices ); |
| @@ -683,16 +701,9 @@ | ||
| 683 | 701 | 'betterdocs_pro_version' => betterdocs()->pro_version(), |
| 684 | 702 | 'analytics_older' => version_compare( betterdocs()->pro_version(), '3.3.4', '<=' ), |
| 685 | 703 | 'disabled_embed_model_option' => get_option('disabled_embed_model_option'), |
| 686 | 704 | 'betterdocs_ChatBot_plugin' => is_plugin_active( 'betterdocs-ai-chatbot/betterdocs-ai-chatbot.php' ), |
| 687 | - 'total_doc_category_terms' => wp_count_terms( 'doc_category'), | |
| 688 | - 'github_oauth_nonce' => wp_create_nonce( 'betterdocs_github_oauth_nonce' ), | |
| 689 | - 'git_settings' => [ | |
| 690 | - 'git_repository_url' => betterdocs()->settings->get_raw_field( 'git_repository_url', '' ), | |
| 691 | - 'git_branch' => betterdocs()->settings->get_raw_field( 'git_branch', '' ), | |
| 692 | - 'git_docs_directory' => betterdocs()->settings->get_raw_field( 'git_docs_directory', '' ), | |
| 693 | - 'git_provider' => betterdocs()->settings->get_raw_field( 'git_provider', 'github' ), | |
| 694 | - ], | |
| 705 | + 'total_doc_category_terms' => wp_count_terms( 'doc_category') | |
| 695 | 706 | ] |
| 696 | 707 | ); |
| 697 | 708 | |
| 698 | 709 | // If wp-date (which includes moment.js) is not registered, enqueue your custom moment.js |
| @@ -1089,13 +1100,8 @@ | ||
| 1089 | 1100 | return; |
| 1090 | 1101 | } |
| 1091 | 1102 | |
| 1092 | 1103 | $slug = $this->settings->get( 'encyclopedia_root_slug' ); |
| 1093 | - | |
| 1094 | - global $wp_rewrite; | |
| 1095 | - if ( $wp_rewrite->using_index_permalinks() ) { | |
| 1096 | - $slug = $wp_rewrite->index . '/' . $slug; | |
| 1097 | - } | |
| 1098 | 1104 | |
| 1099 | 1105 | $encyclopedia_url = home_url( $slug ); |
| 1100 | 1106 | |
| 1101 | 1107 | $admin_bar->add_node( |