PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.5.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.5.3
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/SetupWizard.php +374 -473 4.5.63.5.3 View file →
@@ -1,500 +1,401 @@
1 1 <?php
2 +
2 3 namespace WPDeveloper\BetterDocs\Core;
3 4
4 -if ( ! defined( 'ABSPATH' ) ) {
5 - exit;
6 -}
7 -
8 -
9 5 use WPDeveloper\BetterDocs\Utils\Base;
10 6 use WPDeveloper\BetterDocs\Admin\Builder\Rules;
11 7 use WPDeveloper\BetterDocs\Admin\Builder\GlobalFields;
12 8
13 9 class SetupWizard extends Base {
14 - private $settings;
15 - public function __construct( Settings $settings ) {
16 - $this->settings = $settings;
10 + private $settings;
11 + public function __construct( Settings $settings ) {
12 + $this->settings = $settings;
17 13
18 - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] );
19 - }
14 + add_action( 'admin_enqueue_scripts', [$this, 'enqueue'] );
15 + }
20 16
21 - public function enqueue( $hook ) {
22 - if ( $hook !== 'betterdocs_page_betterdocs-setup' ) {
23 - return;
24 - }
17 + public function enqueue( $hook ) {
18 + if ( $hook !== 'betterdocs_page_betterdocs-setup' ) {
19 + return;
20 + }
25 21
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->enqueue( 'betterdocs-sweetalert', 'vendor/js/sweetalert.min.js', [] );
29 - betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin/btd-icon/style.css' );
30 - betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-qb-css', 'admin/css/quick-setup.css' );
31 - betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-new-css', 'admin/css/setup-wizard.css' );
32 - betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin//style.css' );
33 - betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-default-js', 'admin/js/setup-wizard.js', [ 'jquery', 'betterdocs-sweetalert' ] );
22 + betterdocs()->assets->enqueue( 'betterdocs-quick-setup', 'admin/js/quick-setup.js' );
23 + betterdocs()->assets->localize( 'betterdocs-quick-setup', 'betterdocsQuickSetup', GlobalFields::normalize( $this->quickbuilder_setup() ) );
24 + betterdocs()->assets->enqueue( 'betterdocs-sweetalert', 'vendor/js/sweetalert.min.js', [] );
25 + betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin/btd-icon/style.css' );
26 + betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-qb-css', 'admin/css/quick-setup.css' );
27 + betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-new-css', 'admin/css/setup-wizard.css' );
28 + betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin//style.css' );
29 + betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-default-js', 'admin/js/setup-wizard.js', ['jquery', 'betterdocs-sweetalert'] );
34 30
35 - // Localize the script with new data
36 - betterdocs()->assets->localize(
37 - 'betterdocs-setup-wizard',
38 - 'bdquicksetup',
39 - [
40 - 'finish_txt' => __( 'Finish', 'betterdocs' ),
41 - 'next_txt' => __( 'Next', 'betterdocs' ),
42 - 'customizerurl' => $this->customizer_settings_url(),
43 - 'docspageurl' => $this->docs_page_url(),
44 - 'currentslug' => $this->settings->get( 'docs_slug' ),
45 - 'redirecturl' => admin_url( '/admin.php?page=betterdocs-settings' )
46 - ]
47 - );
48 - }
31 + // Localize the script with new data
32 + betterdocs()->assets->localize( 'betterdocs-setup-wizard', 'bdquicksetup', [
33 + 'finish_txt' => __( 'Finish', 'betterdocs' ),
34 + 'next_txt' => __( 'Next', 'betterdocs' ),
35 + 'customizerurl' => $this->customizer_settings_url(),
36 + 'docspageurl' => $this->docs_page_url(),
37 + 'currentslug' => $this->settings->get( 'docs_slug' ),
38 + 'redirecturl' => admin_url( '/admin.php?page=betterdocs-settings' )
39 + ] );
40 + }
49 41
50 - public function normalize_options( $options ) {
51 - return GlobalFields::normalize_fields( $options );
52 - }
42 + public function normalize_options( $options ) {
43 + return GlobalFields::normalize_fields( $options );
44 + }
53 45
54 - public function get_pages() {
55 - $_pages = betterdocs()->query->get_posts(
56 - [
57 - 'post_type' => 'page',
58 - 'numberposts' => -1,
59 - 'post_status' => 'publish',
60 - 'posts_per_page' => -1
61 - ]
62 - );
46 + public function get_pages() {
47 + $_pages = betterdocs()->query->get_posts( [
48 + 'post_type' => 'page',
49 + 'numberposts' => -1,
50 + 'post_status' => 'publish',
51 + 'posts_per_page' => -1
52 + ] );
63 53
64 - $__pages = [];
54 + $__pages = [];
65 55
66 - if ( ! empty( $_pages ) ) {
67 - $__pages[0] = __( 'Select a Page', 'betterdocs' );
68 - foreach ( $_pages->posts as $page ) {
69 - $__pages[ $page->ID ] = esc_html( $page->post_title );
70 - }
71 - }
56 + if ( ! empty( $_pages ) ) {
57 + $__pages[0] = __( 'Select a Page', 'betterdocs' );
58 + foreach ( $_pages->posts as $page ) {
59 + $__pages[$page->ID] = esc_html( $page->post_title );
60 + }
61 + }
72 62
73 - return $__pages;
74 - }
63 + return $__pages;
64 + }
75 65
76 - public function quickbuilder_setup() {
77 - $existing_plugins = betterdocs()->kbmigration->knowledge_base_plugins();
78 - $quick_setup = [
79 - 'id' => 'betterdocs_quick_setup_metabox_wrapper',
80 - 'title' => __( 'Betterdocs Quick Setup', 'betterdocs' ),
81 - 'object_types' => [ 'betterdocs' ],
82 - 'context' => 'normal',
83 - 'priority' => 'high',
84 - 'show_header' => false,
85 - 'tab_number' => true,
86 - 'is_pro_active' => betterdocs()->is_pro_active(),
87 - 'logoURL' => betterdocs()->assets->icon( 'betterdocs-icon.svg', true ),
88 - 'layout' => 'vertical',
89 - '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() ),
90 - 'config' => [
91 - 'save_locally' => true,
92 - 'save' => true,
93 - 'active' => 'getting-started',
94 - 'sidebar' => false,
95 - 'title' => false,
96 - 'tab_number' => true,
97 - 'clickable' => false,
98 - 'completionTrack' => true,
99 - 'content_heading' => [],
100 - 'step' => [
101 - 'show' => true,
102 - 'buttons' => [
103 - 'skip' => __( 'Skip This Step', 'betterdocs' ),
104 - 'prev' => [
105 - 'name' => __( 'Previous', 'betterdocs' ),
106 - 'type' => 'customize',
107 - 'customName' => __( 'Previous', 'betterdocs' ),
108 - 'condition' => 'getting-started',
109 - ],
110 - 'start' => [
111 - 'name' => 'Start',
112 - 'type' => 'customize',
113 - 'customName' => __( 'Proceed to Next Step', 'betterdocs' ),
114 - 'condition' => 'getting-started',
115 - 'ajax' => [
116 - 'on' => 'click',
117 - 'api' => '/betterdocs/v1/plugin_insights',
118 - 'data' => [
119 - 'product_list' => 'betterdocs'
120 - ],
121 - 'hideSwal' => true
122 - ]
123 - ],
124 - 'next' => [
125 - 'name' => 'Next',
126 - 'type' => 'customize',
127 - 'customName' => __( 'Next', 'betterdocs' ),
128 - 'condition' => 'getting-started',
129 - ],
130 - 'quick-builder-publish' => [
131 - 'name' => 'quick-builder-publish',
132 - 'type' => 'action',
133 - 'action' => 'btd_quick_build_launch'
134 - ]
135 - ],
136 - 'rules' => Rules::is( 'config.active', 'getting-started', true )
137 - ]
138 - ],
139 - 'submit' => [
140 - 'show' => false
141 - ],
142 - 'tabs' => apply_filters(
143 - 'betterdocs_quick_setup_tabs',
144 - [
145 - 'getting-started' => apply_filters(
146 - 'betterdocs_quick_setup_tab_getting_started',
147 - [
148 - 'id' => 'getting-started',
149 - 'label' => __( 'Getting Started', 'betterdocs' ),
150 - 'classes' => 'getting-started',
151 - 'priority' => 10,
152 - 'fields' => [
153 - 'getting_started_header' => [
154 - 'name' => 'getting_started_header',
155 - 'type' => 'header',
156 - 'title' => __( 'Quick Launch', 'betterdocs' ),
157 - 'direction' => 'column',
158 - 'description' => __( 'Start your Knowledge Base configuration process with an easy-to-follow setup wizard.', 'betterdocs' ),
159 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/rocket.svg', true ) . '"/>',
160 - 'priority' => 1
161 - ],
162 - 'betterdocs-quick-setup-start' => [
163 - 'name' => 'betterdocs-quick-setup-start',
164 - 'type' => 'section',
165 - 'priority' => 2,
166 - 'showSteps' => true,
167 - 'fields' => [
168 - 'betterdocs-quick-setup-start-collapse' => [
169 - 'name' => 'betterdocs-quick-setup-start-collapse',
170 - 'type' => 'collapse',
171 - 'priority' => 2,
172 - 'label' => __( 'By clicking this button, you are allowing this app to collect your information.', 'betterdocs' ),
173 - 'collapse_title' => __( 'What We Collect?', 'betterdocs' ),
174 - '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' )
175 - ]
176 - ]
177 - ]
178 - ]
179 - ]
180 - ),
66 + public function quickbuilder_setup() {
67 + $existing_plugins = betterdocs()->kbmigration->knowledge_base_plugins();
68 + $quick_setup = [
69 + 'id' => 'betterdocs_quick_setup_metabox_wrapper',
70 + 'title' => __( 'Betterdocs Quick Setup', 'betterdocs' ),
71 + 'object_types' => ['betterdocs'],
72 + 'context' => 'normal',
73 + 'priority' => 'high',
74 + 'show_header' => false,
75 + 'tab_number' => true,
76 + 'is_pro_active' => betterdocs()->is_pro_active(),
77 + 'logoURL' => betterdocs()->assets->icon( 'betterdocs-icon.svg', true ),
78 + 'layout' => 'vertical',
79 + 'values' => array_merge(betterdocs()->settings->get_all(), ['enable_credit' => true]),
80 + 'config' => [
81 + 'save_locally' => true,
82 + 'save' => true,
83 + 'active' => 'getting-started',
84 + 'sidebar' => false,
85 + 'title' => false,
86 + 'tab_number' => true,
87 + 'clickable' => false,
88 + 'completionTrack' => true,
89 + 'content_heading' => [],
90 + 'step' => [
91 + 'show' => true,
92 + 'buttons' => [
93 + 'skip' => __( 'Skip This Step', 'betterdocs' ),
94 + 'prev' => __( 'Previous', 'betterdocs' ),
95 + 'next' => [
96 + 'name' => 'Next',
97 + 'type' => 'customize',
98 + 'customName' => 'Proceed to Next Step',
99 + 'condition' => 'getting-started',
100 + // 'ajax' => [
101 + // 'api' => "/betterdocs/v1/plugin_insights",
102 + // 'data' => [
103 + // 'type' => "@type",
104 + // 'source' => "@source",
105 + // 'field' => "product_list"
106 + // ],
107 + // 'rules' => Rules::is( 'config.active', 'getting-started', false ),
108 + // 'hideSwal' => true
109 + // ]
110 + ],
111 + 'quick-builder-publish' => [
112 + 'name' => 'quick-builder-publish',
113 + 'type' => 'action',
114 + 'action' => 'btd_quick_build_launch'
115 + ]
116 + ],
117 + 'rules' => Rules::is( 'config.active', 'getting-started', true )
118 + ]
119 + ],
120 + 'submit' => [
121 + 'show' => false
122 + ],
123 + 'tabs' => apply_filters( 'betterdocs_quick_setup_tabs', [
124 + 'getting-started' => apply_filters( 'betterdocs_quick_setup_tab_getting_started', [
125 + 'id' => 'getting-started',
126 + 'label' => __( 'Getting Started', 'betterdocs' ),
127 + 'classes' => 'getting-started',
128 + 'priority' => 10,
129 + 'fields' => [
130 + 'getting_started_header' => [
131 + 'name' => 'getting_started_header',
132 + 'type' => 'header',
133 + 'title' => __( 'Quick Launch', 'betterdocs' ),
134 + 'direction' => 'column',
135 + 'description' => __( 'Start your Knowledge Base configuration process with an easy-to-follow setup wizard.', 'betterdocs' ),
136 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/rocket.svg', true ) . '"/>',
137 + 'priority' => 1
138 + ],
139 + 'betterdocs-quick-setup-start' => [
140 + 'name' => 'betterdocs-quick-setup-start',
141 + 'type' => 'section',
142 + 'priority' => 2,
143 + 'showSteps' => true,
144 + 'fields' => [
145 + 'betterdocs-quick-setup-start-collapse' => [
146 + 'name' => 'betterdocs-quick-setup-start-collapse',
147 + 'type' => 'collapse',
148 + 'priority' => 2,
149 + 'label' => __( 'By clicking this button, you are allowing this app to collect your information.', 'betterdocs' ),
150 + 'collapse_title' => __( 'What We Collect?', 'betterdocs' ),
151 + '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' )
152 + ]
153 + ]
154 + ]
155 + ]
156 + ] ),
181 157
182 - 'setup-page' => apply_filters(
183 - 'betterdocs_quick_setup_tab_setup_page',
184 - [
185 - 'id' => 'setup-page',
186 - 'label' => __( 'Setup Page', 'betterdocs' ),
187 - 'classes' => 'setup-page',
188 - 'priority' => 30,
189 - 'fields' => [
190 - 'setup_page_header' => [
191 - 'name' => 'setup_page_header',
192 - 'type' => 'header',
193 - 'title' => __( 'Page Setup Magic', 'betterdocs' ),
194 - 'direction' => 'row',
195 - 'description' => __( 'Configure the structure and layout of your documentation pages to match your preferences for an organized Knowledge Base.', 'betterdocs' ),
196 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/content-setting.svg', true ) . '"/>',
197 - 'priority' => 1
198 - ],
199 - 'betterdocs-quick-setup-fields' => [
200 - 'name' => 'betterdocs-quick-setup-fields',
201 - 'type' => 'section',
202 - 'priority' => 2,
203 - 'fields' => [
204 - 'builtin_doc_page' => [
205 - 'name' => 'builtin_doc_page',
206 - 'type' => 'toggle',
207 - 'label' => __( 'Built-in Documentation Page', 'betterdocs' ),
208 - 'enable_disable_text_active' => true,
209 - 'default' => 1,
210 - 'priority' => 1,
211 - 'label_subtitle' => sprintf(
212 - /* translators: %s: example knowledge base URL */
213 - __( 'If you disable root slug for KB Archives, your individual knowledge base URL will be like this: %s', 'betterdocs' ),
214 - 'https://example.com/knowledgebase-1'
215 - )
216 - ],
217 - 'docs_page' => [
218 - 'name' => 'docs_page',
219 - 'label' => __( 'Docs Page', 'betterdocs' ),
220 - 'type' => 'select',
221 - 'default' => 0,
222 - 'priority' => 2,
223 - 'search' => true,
224 - 'options' => $this->normalize_options( $this->get_pages() ),
225 - 'label_subtitle' => __( 'You will need to insert BetterDocs Shortcode inside the page. This page will be used as docs permalink.', 'betterdocs' ),
226 - 'rules' => Rules::is( 'builtin_doc_page', false )
227 - ],
228 - 'breadcrumb_doc_title' => [
229 - 'name' => 'breadcrumb_doc_title',
230 - 'type' => 'text',
231 - 'label' => __( 'Documentation Page Title', 'betterdocs' ),
232 - 'default' => __( 'Docs', 'betterdocs' ),
233 - 'priority' => 3,
234 - 'rules' => Rules::is( 'builtin_doc_page', true )
235 - ],
236 - 'docs_slug' => [
237 - 'name' => 'docs_slug',
238 - 'type' => 'text',
239 - 'label' => __( 'BetterDocs Root Slug', 'betterdocs' ),
240 - 'default' => 'docs',
241 - 'priority' => 4,
242 - 'rules' => Rules::is( 'builtin_doc_page', true )
243 - ],
244 - 'permalink_structure' => [
245 - 'name' => 'permalink_structure',
246 - 'type' => 'permalink_structure',
247 - 'label' => __( 'Single Docs Permalink', 'betterdocs' ),
248 - 'default' => PostType::permalink_structure(),
249 - 'priority' => 4,
250 - 'tags' => $this->normalize_options(
251 - [
252 - '%doc_category%' => '%doc_category%',
253 - '%knowledge_base%' => '%knowledge_base%'
254 - ]
255 - ),
256 - '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' )
257 - ],
158 + 'setup-page' => apply_filters( 'betterdocs_quick_setup_tab_setup_page', [
159 + 'id' => 'setup-page',
160 + 'label' => __( 'Setup Page', 'betterdocs' ),
161 + 'classes' => 'setup-page',
162 + 'priority' => 30,
163 + 'fields' => [
164 + 'setup_page_header' => [
165 + 'name' => 'setup_page_header',
166 + 'type' => 'header',
167 + 'title' => __( 'Page Setup Magic', 'betterdocs' ),
168 + 'direction' => 'row',
169 + 'description' => __( 'Configure the structure and layout of your documentation pages to match your preferences for an organized Knowledge Base.', 'betterdocs' ),
170 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/content-setting.svg', true ) . '"/>',
171 + 'priority' => 1
172 + ],
173 + 'betterdocs-quick-setup-fields' => [
174 + 'name' => 'betterdocs-quick-setup-fields',
175 + 'type' => 'section',
176 + 'priority' => 2,
177 + 'fields' => [
178 + 'builtin_doc_page' => [
179 + 'name' => 'builtin_doc_page',
180 + 'type' => 'toggle',
181 + 'label' => __( 'Built-in Documentation Page', 'betterdocs' ),
182 + 'enable_disable_text_active' => true,
183 + 'default' => 1,
184 + 'priority' => 1,
185 + 'label_subtitle' => __( 'If you disable root slug for KB Archives, your individual knowledge base URL will be like this: https://example.com/knowledgebase-1', 'betterdocs' )
186 + ],
187 + 'docs_page' => [
188 + 'name' => 'docs_page',
189 + 'label' => __( 'Docs Page', 'betterdocs' ),
190 + 'type' => 'select',
191 + 'default' => 0,
192 + 'priority' => 2,
193 + 'search' => true,
194 + 'options' => $this->normalize_options( $this->get_pages() ),
195 + 'label_subtitle' => __( 'You will need to insert BetterDocs Shortcode inside the page. This page will be used as docs permalink.', 'betterdocs' ),
196 + 'rules' => Rules::is( 'builtin_doc_page', false )
197 + ],
198 + 'breadcrumb_doc_title' => [
199 + 'name' => 'breadcrumb_doc_title',
200 + 'type' => 'text',
201 + 'label' => __( 'Documentation Page Title', 'betterdocs' ),
202 + 'default' => __( 'Docs', 'betterdocs' ),
203 + 'priority' => 3,
204 + 'rules' => Rules::is( 'builtin_doc_page', true )
205 + ],
206 + 'docs_slug' => [
207 + 'name' => 'docs_slug',
208 + 'type' => 'text',
209 + 'label' => __( 'BetterDocs Root Slug', 'betterdocs' ),
210 + 'default' => 'docs',
211 + 'priority' => 4,
212 + 'rules' => Rules::is( 'builtin_doc_page', true )
213 + ],
214 + 'permalink_structure' => [
215 + 'name' => 'permalink_structure',
216 + 'type' => 'permalink_structure',
217 + 'label' => __( 'Single Docs Permalink', 'betterdocs' ),
218 + 'default' => PostType::permalink_structure(),
219 + 'priority' => 4,
220 + 'tags' => $this->normalize_options( [
221 + '%doc_category%' => '%doc_category%',
222 + '%knowledge_base%' => '%knowledge_base%'
223 + ] ),
224 + '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' )
225 + ],
226 + 'enable_credit' => [
227 + 'name' => 'enable_credit',
228 + 'type' => 'toggle',
229 + 'label' => __( 'Show Powered by BetterDocs', 'betterdocs' ),
230 + 'enable_disable_text_active' => true,
231 + 'default' => true,
232 + 'priority' => 5
233 + ],
234 + 'enable_faq_schema' => [
235 + 'name' => 'enable_faq_schema',
236 + 'type' => 'toggle',
237 + 'label' => __( 'FAQ Schema', 'betterdocs' ),
238 + 'enable_disable_text_active' => true,
239 + 'default' => '',
240 + 'priority' => 6
241 + ],
242 + 'advance_search' => apply_filters( 'betterdocs_advance_search_settings', [
243 + 'name' => 'advance_search',
244 + 'type' => 'toggle',
245 + 'label' => __( 'Advanced Search', 'betterdocs' ),
246 + 'enable_disable_text_active' => true,
247 + 'default' => true,
248 + 'priority' => 7,
249 + 'is_pro' => true
250 + ] ),
251 + 'enable_disable' => [
252 + 'name' => 'enable_disable',
253 + 'type' => 'toggle',
254 + 'priority' => 8,
255 + 'label' => __( 'Instant Answer', 'betterdocs' ),
256 + 'enable_disable_text_active' => true,
257 + 'default' => true,
258 + 'is_pro' => true
259 + ]
260 + ]
261 + ]
262 + ]
263 + ] ),
264 + 'create-content' => apply_filters( 'betterdocs_quick_setup_tab_create-content', [
265 + 'id' => 'create-content',
266 + 'label' => __( 'Create Content', 'betterdocs' ),
267 + 'classes' => 'create-content',
268 + 'priority' => 40,
269 + 'fields' => [
270 + 'create_content_header' => [
271 + 'name' => 'create_content_header',
272 + 'type' => 'header',
273 + 'title' => __( 'Content Crafting', 'betterdocs' ),
274 + 'direction' => 'row',
275 + 'description' => __( 'Craft categories & articles for your Knowledge Base to efficiently organize and manage your repository with respective categories.', 'betterdocs' ),
276 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/create-content.svg', true ) . '"/>',
277 + 'priority' => 1
278 + ],
279 + 'create_content_video' => [
280 + 'name' => 'create_content_video',
281 + 'type' => 'image',
282 + 'media' => [
283 + 'url' => betterdocs()->assets->icon( 'setup-wizard/DocCreate.gif', true )
284 + ],
285 + 'priority' => 2
286 + ]
287 + ]
288 + ] ),
289 + 'customize' => apply_filters( 'betterdocs_quick_setup_tab_customize', [
290 + 'id' => 'customize',
291 + 'label' => __( 'Customize', 'betterdocs' ),
292 + 'classes' => 'customize',
293 + 'priority' => 50,
294 + 'fields' => [
295 + 'customize_header' => [
296 + 'name' => 'customize_header',
297 + 'type' => 'header',
298 + 'title' => __( 'Style Your Documentation', 'betterdocs' ),
299 + 'direction' => 'row',
300 + 'description' => __( 'Personalize the appearance of your documentation page, articles, and archive pages using the power of this Customizer.', 'betterdocs' ),
301 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/customize.svg', true ) . '"/>',
302 + 'priority' => 1
303 + ],
304 + 'customize_video' => [
305 + 'name' => 'customize_video',
306 + 'type' => 'image',
307 + 'media' => [
308 + 'url' => betterdocs()->assets->icon( 'setup-wizard/Customizer.gif', true )
309 + ],
310 + 'priority' => 2
311 + ]
312 + ]
313 + ] ),
314 + 'finalize' => apply_filters( 'betterdocs_quick_setup_tab_finalize', [
315 + 'id' => 'finalize',
316 + 'label' => __( 'Finalize', 'betterdocs' ),
317 + 'classes' => 'finalize',
318 + 'priority' => 60,
319 + 'fields' => [
320 + 'finalize_header' => [
321 + 'name' => 'finalize_header',
322 + 'type' => 'header',
323 + 'title' => __( 'Congratulations!', 'betterdocs' ),
324 + 'direction' => 'row',
325 + 'description' => __( 'Your documentation page is now ready for use. Enrich it with more articles to ensure proper categorization and valuable resources.', 'betterdocs' ),
326 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/thumbs-up.svg', true ) . '"/>',
327 + 'priority' => 1
328 + ],
329 + 'finalize_video' => [
330 + 'name' => 'finalize_video',
331 + 'type' => 'image',
332 + 'media' => [
333 + 'url' => betterdocs()->assets->icon( 'setup-wizard/ThankYou.gif', true )
334 + ],
335 + 'priority' => 2
336 + ]
337 + ]
338 + ] )
339 + ] )
340 + ];
258 341
259 - 'enable_glossaries' => [
260 - 'name' => 'enable_glossaries',
261 - 'type' => 'toggle',
262 - 'label' => __( 'Show Glossary', 'betterdocs' ),
263 - 'label_subtitle' => __( 'Enable the glossary feature to allow users to look up definitions for terms used within your encyclopedia or glossaries themselves.', 'betterdocs' ),
264 - 'enable_disable_text_active' => true,
265 - 'default' => false,
266 - 'priority' => 5,
267 - 'is_pro' => true
268 - ],
269 - 'enable_encyclopedia' => [
270 - 'name' => 'enable_encyclopedia',
271 - 'type' => 'toggle',
272 - 'label' => __( 'Built-in Encyclopedia Page', 'betterdocs' ),
273 - 'enable_disable_text_active' => true,
274 - 'default' => false,
275 - 'priority' => 6,
276 - 'is_pro' => true
277 - ],
278 - 'enable_credit' => [
279 - 'name' => 'enable_credit',
280 - 'type' => 'toggle',
281 - 'label' => __( 'Show Powered by BetterDocs', 'betterdocs' ),
282 - 'enable_disable_text_active' => true,
283 - 'default' => true,
284 - 'priority' => 7
285 - ],
286 - 'enable_faq_schema' => [
287 - 'name' => 'enable_faq_schema',
288 - 'type' => 'toggle',
289 - 'label' => __( 'FAQ Schema', 'betterdocs' ),
290 - 'enable_disable_text_active' => true,
291 - 'default' => '',
292 - 'priority' => 8
293 - ],
294 - 'advance_search' => apply_filters(
295 - 'betterdocs_advance_search_settings',
296 - [
297 - 'name' => 'advance_search',
298 - 'type' => 'toggle',
299 - 'label' => __( 'Advanced Search', 'betterdocs' ),
300 - 'enable_disable_text_active' => true,
301 - 'default' => true,
302 - 'priority' => 9,
303 - 'is_pro' => true
304 - ]
305 - ),
306 - 'enable_disable' => apply_filters(
307 - 'betterdocs_setup_wizard_instant_answer',
308 - [
309 - 'name' => 'enable_disable',
310 - 'type' => 'toggle',
311 - 'priority' => 10,
312 - 'label' => __( 'Instant Answer', 'betterdocs' ),
313 - 'enable_disable_text_active' => true,
314 - 'default' => false,
315 - 'is_pro' => true
316 - ]
317 - ),
318 - ]
319 - ]
320 - ]
321 - ]
322 - ),
323 - 'create-content' => apply_filters(
324 - 'betterdocs_quick_setup_tab_create-content',
325 - [
326 - 'id' => 'create-content',
327 - 'label' => __( 'Create Content', 'betterdocs' ),
328 - 'classes' => 'create-content',
329 - 'priority' => 40,
330 - 'fields' => [
331 - 'create_content_header' => [
332 - 'name' => 'create_content_header',
333 - 'type' => 'header',
334 - 'title' => __( 'Content Crafting', 'betterdocs' ),
335 - 'direction' => 'row',
336 - 'description' => __( 'Craft categories & articles for your Knowledge Base to efficiently organize and manage your repository with respective categories.', 'betterdocs' ),
337 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/create-content.svg', true ) . '"/>',
338 - 'priority' => 1
339 - ],
340 - 'create_content_video' => [
341 - 'name' => 'create_content_video',
342 - 'type' => 'image',
343 - 'media' => [
344 - 'url' => betterdocs()->assets->icon( 'setup-wizard/DocCreate.gif', true )
345 - ],
346 - 'priority' => 2
347 - ]
348 - ]
349 - ]
350 - ),
351 - 'customize' => apply_filters(
352 - 'betterdocs_quick_setup_tab_customize',
353 - [
354 - 'id' => 'customize',
355 - 'label' => __( 'Customize', 'betterdocs' ),
356 - 'classes' => 'customize',
357 - 'priority' => 50,
358 - 'fields' => [
359 - 'customize_header' => [
360 - 'name' => 'customize_header',
361 - 'type' => 'header',
362 - 'title' => __( 'Style Your Documentation', 'betterdocs' ),
363 - 'direction' => 'row',
364 - 'description' => __( 'Personalize the appearance of your documentation page, articles, and archive pages using the power of this Customizer.', 'betterdocs' ),
365 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/customize.svg', true ) . '"/>',
366 - 'priority' => 1
367 - ],
368 - 'customize_video' => [
369 - 'name' => 'customize_video',
370 - 'type' => 'image',
371 - 'media' => [
372 - 'url' => betterdocs()->assets->icon( 'setup-wizard/Customizer.gif', true )
373 - ],
374 - 'priority' => 2
375 - ]
376 - ]
377 - ]
378 - ),
379 - 'finalize' => apply_filters(
380 - 'betterdocs_quick_setup_tab_finalize',
381 - [
382 - 'id' => 'finalize',
383 - 'label' => __( 'Finalize', 'betterdocs' ),
384 - 'classes' => 'finalize',
385 - 'priority' => 60,
386 - 'fields' => [
387 - 'finalize_header' => [
388 - 'name' => 'finalize_header',
389 - 'type' => 'header',
390 - 'title' => __( 'Congratulations!', 'betterdocs' ),
391 - 'direction' => 'row',
392 - 'description' => __( 'Your documentation page is now ready for use. Enrich it with more articles to ensure proper categorization and valuable resources.', 'betterdocs' ),
393 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/thumbs-up.svg', true ) . '"/>',
394 - 'priority' => 1
395 - ],
396 - 'finalize_video' => [
397 - 'name' => 'finalize_video',
398 - 'type' => 'image',
399 - 'media' => [
400 - 'url' => betterdocs()->assets->icon( 'setup-wizard/ThankYou.gif', true )
401 - ],
402 - 'priority' => 2
403 - ]
404 - ]
405 - ]
406 - )
407 - ]
408 - )
409 - ];
342 + if ( $existing_plugins ) {
343 + $quick_setup['tabs']['migration'] = apply_filters( 'betterdocs_quick_setup_tab_migration', [
344 + 'id' => 'migration',
345 + 'label' => __( 'Migration', 'betterdocs' ),
346 + 'classes' => 'migration',
347 + 'priority' => 20,
348 + 'fields' => [
349 + 'migration_header' => [
350 + 'name' => 'migration_header',
351 + 'type' => 'header',
352 + 'title' => __( 'Migration', 'betterdocs' ),
353 + 'direction' => 'column',
354 + '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' ),
355 + 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/migration.svg', true ) . '"/>',
356 + 'priority' => 1,
357 + ],
358 + 'betterdocs-quick-setup-migrate' => [
359 + 'name' => 'betterdocs-quick-setup-migrate',
360 + 'type' => 'section',
361 + 'priority' => 2,
362 + 'fields' => [
363 + 'migration_step' => [
364 + 'name' => "migration_step",
365 + 'type' => 'migration',
366 + 'kb' => $existing_plugins[0][0],
367 + 'label' => __( 'Migrate ' . $existing_plugins[0][1], 'betterdocs' ),
368 + 'priority' => 10
369 + ]
370 + ]
371 + ]
372 + ]
373 + ] );
374 + }
410 375
411 - if ( $existing_plugins ) {
412 - $quick_setup['tabs']['migration'] = apply_filters(
413 - 'betterdocs_quick_setup_tab_migration',
414 - [
415 - 'id' => 'migration',
416 - 'label' => __( 'Migration', 'betterdocs' ),
417 - 'classes' => 'migration',
418 - 'priority' => 20,
419 - 'fields' => [
420 - 'migration_header' => [
421 - 'name' => 'migration_header',
422 - 'type' => 'header',
423 - 'title' => __( 'Migration', 'betterdocs' ),
424 - 'direction' => 'column',
425 - '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' ),
426 - 'icon' => '<img src="' . betterdocs()->assets->icon( 'icons/migration.svg', true ) . '"/>',
427 - 'priority' => 1,
428 - ],
429 - 'betterdocs-quick-setup-migrate' => [
430 - 'name' => 'betterdocs-quick-setup-migrate',
431 - 'type' => 'section',
432 - 'priority' => 2,
433 - 'fields' => [
434 - 'migration_step' => [
435 - 'name' => 'migration_step',
436 - 'type' => 'migration',
437 - 'kb' => $existing_plugins[0][0],
438 - 'label' => sprintf(
439 - /* translators: %s is the name of the plugin being migrated. */
440 - __( 'Migrate %s', 'betterdocs' ),
441 - $existing_plugins[0][1]
442 - ),
443 - 'priority' => 10
444 - ]
445 - ]
446 - ]
447 - ]
448 - ]
449 - );
450 - }
376 + return $quick_setup;
377 + }
451 378
452 - return $quick_setup;
453 - }
379 + public function views() {
380 + betterdocs()->views->get( 'admin/setup-wizard' );
381 + }
454 382
455 - public function views() {
456 - betterdocs()->views->get( 'admin/setup-wizard' );
457 - }
383 + public function customizer_settings_url() {
384 + $query = [
385 + 'autofocus[panel]' => 'betterdocs_customize_options',
386 + 'return' => admin_url( 'edit.php?post_type=docs' )
387 + ];
458 388
459 - public function customizer_settings_url() {
460 - $query = [
461 - 'autofocus[panel]' => 'betterdocs_customize_options',
462 - 'return' => admin_url( 'edit.php?post_type=docs' )
463 - ];
389 + $docs_slug = $this->settings->get( 'docs_slug', 'docs' );
390 + if ( $docs_slug ) {
391 + $query['url'] = site_url( '/' . $docs_slug );
392 + }
393 + $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) );
464 394
465 - $docs_slug = $this->settings->get( 'docs_slug', 'docs' );
466 - if ( $docs_slug ) {
467 - $query['url'] = site_url( '/' . $docs_slug );
468 - }
469 - $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) );
395 + return esc_url( $customizer_link );
396 + }
470 397
471 - return esc_url( $customizer_link );
472 - }
473 -
474 - public function docs_page_url() {
475 - return esc_url( site_url( '/' . $this->settings->get( 'docs_slug', 'docs' ) ) );
476 - }
477 -
478 - /**
479 - * Call This Function As Helper, When Pro Is Deactivated, To Be Used As Settings Default Values, When Betterdocs Pro Is Deactivated
480 - *
481 - * @return array
482 - */
483 - public function pro_settings_default_values() {
484 - return [
485 - 'multiple_kb' => false,
486 - 'enable_glossaries' => false,
487 - 'enable_encyclopedia' => false,
488 - 'analytics_from' => false,
489 - 'unique_visitor_count' => false,
490 - 'exclude_bot_analytics' => false,
491 - 'show_attachment' => false,
492 - 'show_related_docs' => false,
493 - 'advance_search' => false,
494 - 'child_category_exclude' => false,
495 - 'kb_based_search' => false,
496 - 'enable_disable' => false,
497 - 'enable_content_restriction' => false
498 - ];
499 - }
398 + public function docs_page_url() {
399 + return esc_url( site_url( '/' . $this->settings->get( 'docs_slug', 'docs' ) ) );
400 + }
500 401 }