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