PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.6.1
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.6.1
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 3.5.2 All 199 releases
betterdocs / includes / Core / SetupWizard.php

SetupWizard.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.6.1, at includes/Core/SetupWizard.php

601 lines 23.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPDeveloper\BetterDocs\Core;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8
9 use WPDeveloper\BetterDocs\Utils\Base;
10 use WPDeveloper\BetterDocs\Admin\Builder\Rules;
11 use WPDeveloper\BetterDocs\Admin\Builder\GlobalFields;
12
13 class SetupWizard extends Base {
14 private $settings;
15 public function __construct( Settings $settings ) {
16 $this->settings = $settings;
17
18 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] );
19 }
20
21 public function enqueue( $hook ) {
22 if ( $hook !== 'betterdocs_page_betterdocs-setup' ) {
23 return;
24 }
25
26 betterdocs()->assets->enqueue( 'betterdocs-quick-setup', 'admin/js/quick-setup.js' );
27 betterdocs()->assets->localize( 'betterdocs-quick-setup', 'betterdocsQuickSetup', GlobalFields::normalize( $this->quickbuilder_setup() ) );
28 betterdocs()->assets->localize(
29 'betterdocs-quick-setup',
30 'betterdocsSampleDocs',
31 [
32 'enabled' => (bool) $this->settings->get( 'enable_ai_sample_docs', true ),
33 'rest_url' => esc_url_raw( rest_url() ),
34 'rest_base' => esc_url_raw( get_rest_url( null, '/betterdocs/v1/sample-docs' ) ),
35 'nonce' => wp_create_nonce( 'wp_rest' ),
36 ]
37 );
38 betterdocs()->assets->localize(
39 'betterdocs-quick-setup',
40 'betterdocsCustomizeLayouts',
41 [
42 'rest_url' => esc_url_raw( rest_url() ),
43 'rest_base' => esc_url_raw( get_rest_url( null, '/betterdocs/v1/customize' ) ),
44 'nonce' => wp_create_nonce( 'wp_rest' ),
45 'groups' => $this->customize_layout_groups(),
46 ]
47 );
48 betterdocs()->assets->enqueue( 'betterdocs-sweetalert', 'vendor/js/sweetalert.min.js', [] );
49 betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin/btd-icon/style.css' );
50 betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-qb-css', 'admin/css/quick-setup.css' );
51 betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-new-css', 'admin/css/setup-wizard.css' );
52 betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin//style.css' );
53 betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-default-js', 'admin/js/setup-wizard.js', [ 'jquery', 'betterdocs-sweetalert' ] );
54
55 // Localize the script with new data
56 betterdocs()->assets->localize(
57 'betterdocs-setup-wizard',
58 'bdquicksetup',
59 [
60 'finish_txt' => __( 'Finish', 'betterdocs' ),
61 'next_txt' => __( 'Next', 'betterdocs' ),
62 'customizerurl' => $this->customizer_settings_url(),
63 'docspageurl' => $this->docs_page_url(),
64 'currentslug' => $this->settings->get( 'docs_slug' ),
65 'redirecturl' => admin_url( '/admin.php?page=betterdocs-settings' )
66 ]
67 );
68 }
69
70 /**
71 * Layout-picker groups for the interactive "Customize" step. Each group's
72 * `current` reflects the saved theme_mod; only the free layouts are offered.
73 *
74 * @return array
75 */
76 private function customize_layout_groups() {
77 $build = function ( $key, $default, $dir, $title, $hint, $cols, array $options ) {
78 $out = [];
79 foreach ( $options as $value => $label ) {
80 $out[] = [
81 'value' => $value,
82 'label' => $label,
83 'image' => betterdocs()->assets->icon( "customizer/{$dir}/{$value}.png", true ),
84 ];
85 }
86 return [
87 'title' => $title,
88 'hint' => $hint,
89 'cols' => $cols,
90 'key' => $key,
91 'current' => get_theme_mod( $key, $default ),
92 'options' => $out,
93 ];
94 };
95
96 return [
97 'docs' => $build(
98 'betterdocs_docs_layout_select',
99 'layout-7',
100 'docs-page',
101 __( 'Docs Page', 'betterdocs' ),
102 __( 'The main knowledge-base landing page.', 'betterdocs' ),
103 4,
104 [
105 'layout-7' => __( 'Sleek', 'betterdocs' ),
106 'layout-1' => __( 'Grid', 'betterdocs' ),
107 'layout-8' => __( 'Slate', 'betterdocs' ),
108 'layout-5' => __( 'Classic', 'betterdocs' ),
109 ]
110 ),
111 'category' => $build(
112 'betterdocs_archive_layout_select',
113 'layout-7',
114 'archive',
115 __( 'Category Page', 'betterdocs' ),
116 __( "Where a single category's articles live.", 'betterdocs' ),
117 4,
118 [
119 'layout-7' => __( 'Sleek', 'betterdocs' ),
120 'layout-1' => __( 'Classic', 'betterdocs' ),
121 'layout-8' => __( 'Slate', 'betterdocs' ),
122 'layout-4' => __( 'Abstract', 'betterdocs' ),
123 ]
124 ),
125 'single' => $build(
126 'betterdocs_single_layout_select',
127 'layout-8',
128 'single',
129 __( 'Single Doc', 'betterdocs' ),
130 __( 'An individual article layout.', 'betterdocs' ),
131 4,
132 [
133 'layout-8' => __( 'Essence', 'betterdocs' ),
134 'layout-9' => __( 'Rustic', 'betterdocs' ),
135 'layout-10' => __( 'Slate', 'betterdocs' ),
136 'layout-1' => __( 'Classic', 'betterdocs' ),
137 ]
138 ),
139 'search' => $build(
140 'betterdocs_search_layout_select',
141 'layout-2',
142 'search',
143 __( 'Search', 'betterdocs' ),
144 __( 'How visitors search your docs.', 'betterdocs' ),
145 4,
146 [
147 'layout-2' => __( 'Modal', 'betterdocs' ),
148 'layout-1' => __( 'Classic', 'betterdocs' ),
149 ]
150 ),
151 ];
152 }
153
154 public function normalize_options( $options ) {
155 return GlobalFields::normalize_fields( $options );
156 }
157
158 public function get_pages() {
159 $_pages = betterdocs()->query->get_posts(
160 [
161 'post_type' => 'page',
162 'numberposts' => -1,
163 'post_status' => 'publish',
164 'posts_per_page' => -1
165 ]
166 );
167
168 $__pages = [];
169
170 if ( ! empty( $_pages ) ) {
171 $__pages[0] = __( 'Select a Page', 'betterdocs' );
172 foreach ( $_pages->posts as $page ) {
173 $__pages[ $page->ID ] = esc_html( $page->post_title );
174 }
175 }
176
177 return $__pages;
178 }
179
180 public function quickbuilder_setup() {
181 $existing_plugins = betterdocs()->kbmigration->knowledge_base_plugins();
182 $quick_setup = [
183 'id' => 'betterdocs_quick_setup_metabox_wrapper',
184 'title' => __( 'Betterdocs Quick Setup', 'betterdocs' ),
185 'object_types' => [ 'betterdocs' ],
186 'context' => 'normal',
187 'priority' => 'high',
188 'show_header' => false,
189 'tab_number' => true,
190 'is_pro_active' => betterdocs()->is_pro_active(),
191 'logoURL' => betterdocs()->assets->icon( 'betterdocs-icon.svg', true ),
192 'layout' => 'vertical',
193 'values' => betterdocs()->is_pro_active() ? array_merge( betterdocs()->settings->get_all(), [ 'enable_credit' => true ] ) : array_merge( betterdocs()->settings->get_all(), [ 'enable_credit' => true ], $this->pro_settings_default_values() ),
194 'config' => [
195 'save_locally' => true,
196 'save' => true,
197 'active' => 'getting-started',
198 'sidebar' => false,
199 'title' => false,
200 'tab_number' => true,
201 'clickable' => true,
202 'completionTrack' => true,
203 'content_heading' => [],
204 'step' => [
205 'show' => true,
206 'buttons' => [
207 'skip' => __( 'Skip for now', 'betterdocs' ),
208 'prev' => [
209 'name' => __( 'Back', 'betterdocs' ),
210 'type' => 'customize',
211 'customName' => __( 'Back', 'betterdocs' ),
212 'condition' => 'getting-started',
213 ],
214 'start' => [
215 'name' => 'Start',
216 'type' => 'customize',
217 'customName' => __( 'Proceed to Next Step', 'betterdocs' ),
218 'condition' => 'getting-started',
219 'ajax' => [
220 'on' => 'click',
221 'api' => '/betterdocs/v1/plugin_insights',
222 'data' => [
223 'product_list' => 'betterdocs'
224 ],
225 'hideSwal' => true
226 ]
227 ],
228 'next' => [
229 'name' => 'Next',
230 'type' => 'customize',
231 'customName' => __( 'Save & Continue', 'betterdocs' ),
232 'condition' => 'getting-started',
233 ]
234 ],
235 // Hide the footer step bar on the first step (its CTA is in
236 // content via showSteps) and on the last step (Finalize's
237 // Finish CTA is in content too, so a lone Back button looked
238 // off). Back-navigation there is still available via the tabs.
239 'rules' => Rules::logicalRule(
240 [
241 Rules::is( 'config.active', 'getting-started', true ),
242 Rules::is( 'config.active', 'finalize', true ),
243 ],
244 'and'
245 )
246 ]
247 ],
248 'submit' => [
249 'show' => false
250 ],
251 'tabs' => apply_filters(
252 'betterdocs_quick_setup_tabs',
253 [
254 'getting-started' => apply_filters(
255 'betterdocs_quick_setup_tab_getting_started',
256 [
257 'id' => 'getting-started',
258 'label' => __( 'Getting Started', 'betterdocs' ),
259 'classes' => 'getting-started',
260 'priority' => 10,
261 'fields' => [
262 'getting_started_header' => [
263 'name' => 'getting_started_header',
264 'type' => 'header',
265 'title' => __( 'Quick Launch', 'betterdocs' ),
266 'direction' => 'column',
267 'description' => __( 'Start your Knowledge Base configuration process with an easy-to-follow setup wizard.', 'betterdocs' ),
268 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"></path><path d="M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"></path><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"></path><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"></path></svg>',
269 'priority' => 1
270 ],
271 'betterdocs-quick-setup-start' => [
272 'name' => 'betterdocs-quick-setup-start',
273 'type' => 'section',
274 'priority' => 2,
275 'showSteps' => true,
276 'fields' => [
277 'betterdocs-quick-setup-start-collapse' => [
278 'name' => 'betterdocs-quick-setup-start-collapse',
279 'type' => 'collapse',
280 'priority' => 2,
281 'label' => __( 'By clicking this button, you are allowing this app to collect your information.', 'betterdocs' ),
282 'collapse_title' => __( 'What do we collect?', 'betterdocs' ),
283 'collapse_message' => __( 'We collect non-sensitive diagnostic data and plugin usage information. Your site URL, WordPress & PHP version, plugins & themes and email address to send you the discount coupon. This data lets us make sure this plugin always stays compatible with the most popular plugins and themes. No spam, we promise.', 'betterdocs' )
284 ]
285 ]
286 ]
287 ]
288 ]
289 ),
290
291 'setup-page' => apply_filters(
292 'betterdocs_quick_setup_tab_setup_page',
293 [
294 'id' => 'setup-page',
295 'label' => __( 'Setup Page', 'betterdocs' ),
296 'classes' => 'setup-page',
297 'priority' => 30,
298 'fields' => [
299 'setup_page_header' => [
300 'name' => 'setup_page_header',
301 'type' => 'header',
302 'title' => __( 'Page Setup Magic', 'betterdocs' ),
303 'direction' => 'row',
304 'description' => __( 'Configure the structure and layout of your documentation pages to match your preferences for an organized Knowledge Base.', 'betterdocs' ),
305 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z"></path><path d="M20 8v12a2 2 0 0 1-2 2h-4.182"></path><path d="m3.305 19.53.923-.382"></path><path d="M4 10.592V4a2 2 0 0 1 2-2h8"></path><path d="m4.228 16.852-.924-.383"></path><path d="m5.852 15.228-.383-.923"></path><path d="m5.852 20.772-.383.924"></path><path d="m8.148 15.228.383-.923"></path><path d="m8.53 21.696-.382-.924"></path><path d="m9.773 16.852.922-.383"></path><path d="m9.773 19.148.922.383"></path><circle cx="7" cy="18" r="3"></circle></svg>',
306 'priority' => 1
307 ],
308 'betterdocs-quick-setup-fields' => [
309 'name' => 'betterdocs-quick-setup-fields',
310 'type' => 'section',
311 'priority' => 2,
312 'fields' => [
313 'builtin_doc_page' => [
314 'name' => 'builtin_doc_page',
315 'type' => 'toggle',
316 'label' => __( 'Built-in Documentation Page', 'betterdocs' ),
317 'enable_disable_text_active' => true,
318 'default' => 1,
319 'priority' => 1,
320 'label_subtitle' => sprintf(
321 /* translators: %s: example knowledge base URL */
322 __( 'If you disable root slug for KB Archives, your individual knowledge base URL will be like this: %s', 'betterdocs' ),
323 'https://example.com/knowledgebase-1'
324 )
325 ],
326 'docs_page' => [
327 'name' => 'docs_page',
328 'label' => __( 'Docs Page', 'betterdocs' ),
329 'type' => 'select',
330 'default' => 0,
331 'priority' => 2,
332 'search' => true,
333 'options' => $this->normalize_options( $this->get_pages() ),
334 'label_subtitle' => __( 'You will need to insert BetterDocs Shortcode inside the page. This page will be used as docs permalink.', 'betterdocs' ),
335 'rules' => Rules::is( 'builtin_doc_page', false )
336 ],
337 'breadcrumb_doc_title' => [
338 'name' => 'breadcrumb_doc_title',
339 'type' => 'text',
340 'label' => __( 'Documentation Page Title', 'betterdocs' ),
341 'default' => __( 'Docs', 'betterdocs' ),
342 'priority' => 3,
343 'rules' => Rules::is( 'builtin_doc_page', true )
344 ],
345 'docs_slug' => [
346 'name' => 'docs_slug',
347 'type' => 'text',
348 'label' => __( 'BetterDocs Root Slug', 'betterdocs' ),
349 'default' => 'docs',
350 'priority' => 4,
351 'rules' => Rules::is( 'builtin_doc_page', true )
352 ],
353 'permalink_structure' => [
354 'name' => 'permalink_structure',
355 'type' => 'permalink_structure',
356 'label' => __( 'Single Docs Permalink', 'betterdocs' ),
357 'default' => PostType::permalink_structure(),
358 'priority' => 4,
359 'tags' => $this->normalize_options(
360 [
361 '%doc_category%' => '%doc_category%',
362 '%knowledge_base%' => '%knowledge_base%'
363 ]
364 ),
365 'label_subtitle' => __( 'Make sure to keep Docs Root Slug in the Single Docs Permalink. You are not able to keep it blank. You can use the available tags from below.', 'betterdocs' )
366 ],
367
368 'enable_glossaries' => [
369 'name' => 'enable_glossaries',
370 'type' => 'toggle',
371 'label' => __( 'Show Glossary', 'betterdocs' ),
372 'label_subtitle' => __( 'Enable the glossary feature to allow users to look up definitions for terms used within your encyclopedia or glossaries themselves.', 'betterdocs' ),
373 'enable_disable_text_active' => true,
374 'default' => false,
375 'priority' => 5,
376 'is_pro' => true
377 ],
378 'enable_encyclopedia' => [
379 'name' => 'enable_encyclopedia',
380 'type' => 'toggle',
381 'label' => __( 'Built-in Encyclopedia Page', 'betterdocs' ),
382 'enable_disable_text_active' => true,
383 'default' => false,
384 'priority' => 6,
385 'is_pro' => true
386 ],
387 'enable_credit' => [
388 'name' => 'enable_credit',
389 'type' => 'toggle',
390 'label' => __( 'Show Powered by BetterDocs', 'betterdocs' ),
391 'enable_disable_text_active' => true,
392 'default' => true,
393 'priority' => 7
394 ],
395 'enable_faq_schema' => [
396 'name' => 'enable_faq_schema',
397 'type' => 'toggle',
398 'label' => __( 'FAQ Schema', 'betterdocs' ),
399 'enable_disable_text_active' => true,
400 'default' => '',
401 'priority' => 8
402 ],
403 'advance_search' => apply_filters(
404 'betterdocs_advance_search_settings',
405 [
406 'name' => 'advance_search',
407 'type' => 'toggle',
408 'label' => __( 'Advanced Search', 'betterdocs' ),
409 'enable_disable_text_active' => true,
410 'default' => true,
411 'priority' => 9,
412 'is_pro' => true
413 ]
414 ),
415 'enable_disable' => apply_filters(
416 'betterdocs_setup_wizard_instant_answer',
417 [
418 'name' => 'enable_disable',
419 'type' => 'toggle',
420 'priority' => 10,
421 'label' => __( 'Instant Answer', 'betterdocs' ),
422 'enable_disable_text_active' => true,
423 'default' => false,
424 'is_pro' => true
425 ]
426 ),
427 ]
428 ]
429 ]
430 ]
431 ),
432 'create-content' => apply_filters(
433 'betterdocs_quick_setup_tab_create-content',
434 [
435 'id' => 'create-content',
436 'label' => __( 'Create Content', 'betterdocs' ),
437 'classes' => 'create-content',
438 'priority' => 40,
439 'fields' => [
440 'create_content_header' => [
441 'name' => 'create_content_header',
442 'type' => 'header',
443 'title' => __( 'Content Crafting', 'betterdocs' ),
444 'direction' => 'row',
445 'description' => __( 'Craft categories & articles for your Knowledge Base to efficiently organize and manage your repository with respective categories.', 'betterdocs' ),
446 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4a1 1 0 0 1 1-1h9l5 5v3"></path><path d="M4 4v15a1 1 0 0 0 1 1h6"></path><path d="M14 3v5h5"></path><path d="M18.5 13.5a2.1 2.1 0 0 1 3 3L16 22l-4 1 1-4z"></path></svg>',
447 'priority' => 1
448 ],
449 'create_content_generator' => [
450 'name' => 'create_content_generator',
451 'type' => 'sample_docs_generator',
452 'priority' => 2
453 ]
454 ]
455 ]
456 ),
457 'customize' => apply_filters(
458 'betterdocs_quick_setup_tab_customize',
459 [
460 'id' => 'customize',
461 'label' => __( 'Customize', 'betterdocs' ),
462 'classes' => 'customize',
463 'priority' => 50,
464 'fields' => [
465 'customize_header' => [
466 'name' => 'customize_header',
467 'type' => 'header',
468 'title' => __( 'Style Your Documentation', 'betterdocs' ),
469 'direction' => 'row',
470 'description' => __( 'Pick a layout for your docs page, categories, single articles, and search — applied when you finish setup. Fine-tune the details anytime in the Customizer.', 'betterdocs' ),
471 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5"></rect><path d="M3 9h18M9 9v11"></path></svg>',
472 'priority' => 1
473 ],
474 'customize_layouts' => [
475 'name' => 'customize_layouts',
476 'type' => 'layout_customizer',
477 'priority' => 2
478 ]
479 ]
480 ]
481 ),
482 'finalize' => apply_filters(
483 'betterdocs_quick_setup_tab_finalize',
484 [
485 'id' => 'finalize',
486 'label' => __( 'Finalize', 'betterdocs' ),
487 'classes' => 'finalize',
488 'priority' => 60,
489 'fields' => [
490 'finalize_header' => [
491 'name' => 'finalize_header',
492 'type' => 'header',
493 'title' => __( 'One last step', 'betterdocs' ),
494 'direction' => 'row',
495 'description' => __( 'Review your setup below. When you\'re ready, finish to save your settings and apply BetterDocs across your site — you can change anything later in Settings.', 'betterdocs' ),
496 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="m3 17 2 2 4-4"></path><path d="m3 7 2 2 4-4"></path><path d="M13 6h8"></path><path d="M13 12h8"></path><path d="M13 18h8"></path></svg>',
497 'priority' => 1
498 ],
499 'finalize_finish' => [
500 'name' => 'finalize_finish',
501 'type' => 'finish_panel',
502 'priority' => 2
503 ]
504 ]
505 ]
506 )
507 ]
508 )
509 ];
510
511 if ( $existing_plugins ) {
512 $quick_setup['tabs']['migration'] = apply_filters(
513 'betterdocs_quick_setup_tab_migration',
514 [
515 'id' => 'migration',
516 'label' => __( 'Migration', 'betterdocs' ),
517 'classes' => 'migration',
518 'priority' => 20,
519 'fields' => [
520 'migration_header' => [
521 'name' => 'migration_header',
522 'type' => 'header',
523 'title' => __( 'Migration', 'betterdocs' ),
524 'direction' => 'column',
525 'description' => __( 'We detected another Knoledge Base Plugin installed in this site. For BetterDocs to work efficiently, we will migrate the data from the plugin listed below, and deactivate the plugins, to avoid conflict.', 'betterdocs' ),
526 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/migration.svg', true ) . '"/>',
527 'priority' => 1,
528 ],
529 'betterdocs-quick-setup-migrate' => [
530 'name' => 'betterdocs-quick-setup-migrate',
531 'type' => 'section',
532 'priority' => 2,
533 'fields' => [
534 'migration_step' => [
535 'name' => 'migration_step',
536 'type' => 'migration',
537 'kb' => $existing_plugins[0][0],
538 'label' => sprintf(
539 /* translators: %s is the name of the plugin being migrated. */
540 __( 'Migrate %s', 'betterdocs' ),
541 $existing_plugins[0][1]
542 ),
543 'priority' => 10
544 ]
545 ]
546 ]
547 ]
548 ]
549 );
550 }
551
552 return $quick_setup;
553 }
554
555 public function views() {
556 betterdocs()->views->get( 'admin/setup-wizard' );
557 }
558
559 public function customizer_settings_url() {
560 $query = [
561 'autofocus[panel]' => 'betterdocs_customize_options',
562 'return' => admin_url( 'edit.php?post_type=docs' )
563 ];
564
565 $docs_slug = $this->settings->get( 'docs_slug', 'docs' );
566 if ( $docs_slug ) {
567 $query['url'] = site_url( '/' . $docs_slug );
568 }
569 $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) );
570
571 return esc_url( $customizer_link );
572 }
573
574 public function docs_page_url() {
575 return esc_url( site_url( '/' . $this->settings->get( 'docs_slug', 'docs' ) ) );
576 }
577
578 /**
579 * Call This Function As Helper, When Pro Is Deactivated, To Be Used As Settings Default Values, When Betterdocs Pro Is Deactivated
580 *
581 * @return array
582 */
583 public function pro_settings_default_values() {
584 return [
585 'multiple_kb' => false,
586 'enable_glossaries' => false,
587 'enable_encyclopedia' => false,
588 'analytics_from' => false,
589 'unique_visitor_count' => false,
590 'exclude_bot_analytics' => false,
591 'show_attachment' => false,
592 'show_related_docs' => false,
593 'advance_search' => false,
594 'child_category_exclude' => false,
595 'kb_based_search' => false,
596 'enable_disable' => false,
597 'enable_content_restriction' => false
598 ];
599 }
600 }
601