PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.2
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | includes/Core/Scripts.php +26 -2 4.5.64.9.2 View file →
@@ -7,8 +7,9 @@
7 7
8 8
9 9 use WPDeveloper\BetterDocs\Utils\Base;
10 10 use WPDeveloper\BetterDocs\Utils\Helper;
11 +use WPDeveloper\BetterDocs\FrontEnd\PrintTemplate;
11 12
12 13 class Scripts extends Base {
13 14 protected $settings;
14 15
@@ -76,8 +77,25 @@
76 77 $assets->register( 'betterdocs-reactions', 'shortcodes/js/reactions.js', [ 'jquery' ] );
77 78 $assets->register( 'betterdocs-search', 'shortcodes/js/search.js', [ 'jquery' ] );
78 79 $assets->register( 'betterdocs-search-modal', 'shortcodes/js/search-modal.js', [ 'jquery' ] );
79 80
81 + /**
82 + * Print template config for the single-doc Print / Save-as-PDF button.
83 + *
84 + * These values feed the print *popup* opened by the BetterDocs print
85 + * icon. The browser's own Ctrl/Cmd+P route is handled separately by
86 + * {@see PrintTemplate}, which resolves the same two values — see that
87 + * class for why the two routes use different layout mechanisms.
88 + *
89 + * Both toggles live in `betterdocs_settings` (BetterDocs → Settings →
90 + * Layout → Single Doc → General) rather than theme mods, so they stay
91 + * reachable on block/FSE themes, which have no Customizer. Both default
92 + * to OFF; while a toggle is off the value resolves empty and the print
93 + * script renders nothing for it.
94 + */
95 + $print_logo = PrintTemplate::get_logo();
96 + $print_footer = PrintTemplate::get_footer();
97 +
80 98 $assets->localize(
81 99 'betterdocs',
82 100 'betterdocsConfig',
83 101 [
@@ -84,9 +102,13 @@
84 102 'ajax_url' => admin_url( 'admin-ajax.php' ),
85 103 'copy_text' => __( 'Copied', 'betterdocs' ),
86 104 'sticky_toc_offset' => $this->settings->get( 'sticky_toc_offset' ),
87 105 'summary_nonce' => wp_create_nonce( 'betterdocs_article_summary_nonce' ),
88 - 'summary_error' => __( 'Failed to generate doc summary. Please try again.', 'betterdocs' )
106 + 'summary_error' => __( 'Failed to generate doc summary. Please try again.', 'betterdocs' ),
107 + 'print' => [
108 + 'logo' => $print_logo ? esc_url( $print_logo ) : '',
109 + 'footer' => $print_footer ? wp_kses_post( $print_footer ) : ''
110 + ]
89 111 ]
90 112 );
91 113
92 114 $assets->localize(
@@ -121,9 +143,11 @@
121 143 betterdocs()->assets->localize(
122 144 'betterdocs-category-grid',
123 145 'betterdocsCategoryGridConfig',
124 146 [
125 - 'is_betterdocs_templates' => betterdocs()->helper->is_templates() ? true : false
147 + 'is_betterdocs_templates' => betterdocs()->helper->is_templates() ? true : false,
148 + 'ajax_url' => admin_url( 'admin-ajax.php' ),
149 + 'lazy_load_action' => 'betterdocs_lazy_category_body'
126 150 ]
127 151 );
128 152
129 153 $this->blocks( $assets );