PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.0.14
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.0.14
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 / admin / includes / betterdocs-settings-page-helper.php

betterdocs-settings-page-helper.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.0.14, at admin/includes/betterdocs-settings-page-helper.php

828 lines 46.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get all pages
4 */
5 function betterdocs_get_pages() {
6 $pages = [];
7 $_pages = get_posts(array(
8 'post_type' => 'page',
9 'numberposts' => -1,
10 'post_status' => 'publish',
11 'posts_per_page' => -1
12 ));
13
14 if( ! empty( $_pages ) ) {
15 $pages[0] = 'Select a Page';
16 foreach( $_pages as $page ) {
17 $pages[ $page->ID ] = $page->post_title;
18 }
19 }
20
21 return $pages;
22 }
23 function betterdocs_settings_args(){
24 $query['autofocus[panel]'] = 'betterdocs_customize_options';
25 $query['return'] = admin_url( 'edit.php?post_type=docs' );
26 $builtin_doc_page = BetterDocs_DB::get_settings('builtin_doc_page');
27 $docs_slug = BetterDocs_DB::get_settings('docs_slug');
28 $docs_page = BetterDocs_DB::get_settings('docs_page');
29 if ( $builtin_doc_page == 1 && $docs_slug ) {
30 $query['url'] = site_url( '/'.$docs_slug );
31 } elseif ( $builtin_doc_page != 1 && $docs_page ) {
32 $post_info = get_post( $docs_page );
33 $query['url'] = site_url( '/'.$post_info->post_name );
34 }
35 $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) );
36 $advanced_settings = apply_filters( 'betterdocs_advanced_settings_sections', array(
37 'role_management_section' => array(
38 'title' => __('Role Management', 'betterdocs'),
39 'priority' => 0,
40 'fields' => array(
41 'rms_title' => array(
42 'type' => 'title',
43 'label' => __('Role Management', 'betterdocs'),
44 'priority' => 0,
45 ),
46 'article_roles' => array(
47 'type' => 'select',
48 'label' => __('Who Can Write Docs?', 'betterdocs'),
49 'priority' => 1,
50 'multiple' => true,
51 'disable' => true,
52 'default' => 'administrator',
53 'options' => BetterDocs_Settings::get_roles()
54 ),
55 'settings_roles' => array(
56 'type' => 'select',
57 'label' => __('Who Can Edit Settings?', 'betterdocs'),
58 'priority' => 1,
59 'multiple' => true,
60 'disable' => true,
61 'default' => 'administrator',
62 'options' => BetterDocs_Settings::get_roles()
63 ),
64 'analytics_roles' => array(
65 'type' => 'select',
66 'label' => __('Who Can Check Analytics?', 'betterdocs'),
67 'priority' => 1,
68 'multiple' => true,
69 'disable' => true,
70 'default' => 'administrator',
71 'options' => BetterDocs_Settings::get_roles()
72 ),
73 )
74 ),
75 'internal_kb_section' => array(
76 'title' => __('Internal Knowledge Base', 'betterdocs-pro'),
77 'priority' => 1,
78 'fields' => apply_filters( 'betterdocs_internal_kb_fields', array(
79 'content_restriction_title' => array(
80 'type' => 'title',
81 'label' => __('Internal Knowledge Base', 'betterdocs-pro'),
82 'disable' => true,
83 'priority' => 0,
84 ),
85 'enable_content_restriction' => array(
86 'type' => 'checkbox',
87 'disable' => true,
88 'priority' => 1,
89 'label' => __( 'Enable/Disable', 'betterdocs-pro' ),
90 'default' => '',
91 'dependency' => array(
92 1 => array(
93 'fields' => array( 'content_visibility', 'restrict_template', 'restrict_kb', 'restrict_category', 'restricted_redirect_url' ),
94 )
95 )
96 ),
97 'content_visibility' => array(
98 'type' => 'select',
99 'label' => __('Restrict Access to', 'betterdocs-pro'),
100 'help' => __('<strong>Note:</strong> Only selected User Roles will be able to view your Knowledge Base' , 'betterdocs-pro'),
101 'disable' => true,
102 'priority' => 2,
103 'multiple' => true,
104 'default' => 'all',
105 'options' => BetterDocs_Settings::get_all_user_roles()
106 ),
107 'restrict_template' => array(
108 'type' => 'select',
109 'label' => __('Restriction on Docs', 'betterdocs-pro'),
110 'help' => __('<strong>Note:</strong> Selected Docs pages will be restricted' , 'betterdocs-pro'),
111 'disable' => true,
112 'priority' => 3,
113 'multiple' => true,
114 'default' => 'all',
115 'options' => BetterDocs_Settings::get_texanomy()
116 ),
117 'restrict_category' => array(
118 'type' => 'select',
119 'label' => __('Restriction on Docs Categories', 'betterdocs-pro'),
120 'help' => __('<strong>Note:</strong> Selected Docs categories will be restricted ' , 'betterdocs-pro'),
121 'disable' => true,
122 'priority' => 5,
123 'multiple' => true,
124 'default' => 'all',
125 'options' => BetterDocs_Settings::get_terms_list('doc_category')
126 ),
127 'restricted_redirect_url' => array(
128 'type' => 'text',
129 'label' => __('Redirect URL' , 'betterdocs-pro'),
130 'help' => __('<strong>Note:</strong> Set a custom URL to redirect users without permissions when they try to access internal knowledge base. By default, restricted content will redirect to the "404 not found" page' , 'betterdocs-pro'),
131 'default' => '',
132 'placeholder' => 'https://',
133 'disable' => true,
134 'priority' => 6,
135 ),
136 ))
137 )
138 ));
139 if( ! current_user_can('activate_plugins') ) {
140 unset($advanced_settings['role_management_section']);
141 }
142 return apply_filters('betterdocs_settings_tab', array(
143 'general' => array(
144 'title' => __( 'General', 'betterdocs' ),
145 'priority' => 10,
146 'button_text' => __( 'Save Settings' ),
147 'sections' => apply_filters('betterdocs_general_settings_sections', array(
148 'general_settings' => apply_filters('betterdocs_general_settings', array(
149 'title' => __( 'General Settings', 'betterdocs' ),
150 'priority' => 10,
151 'fields' => array(
152 'multiple_kb' => apply_filters( 'betterdocs_multi_kb_settings', array(
153 'type' => 'checkbox',
154 'label' => __('Enable Multiple Knowledge Base' , 'betterdocs'),
155 'default' => '',
156 'priority' => 10,
157 'disable' => true,
158 )),
159 'builtin_doc_page' => array(
160 'type' => 'checkbox',
161 'label' => __('Enable Built-in Documentation Page' , 'betterdocs'),
162 'default' => 1,
163 'priority' => 10,
164 'help' => __('<strong>Note:</strong> if you disable built-in documentation page, you can use shortcode or page builder widgets to design your documentation page.' , 'betterdocs'),
165 'dependency' => array(
166 1 => array(
167 'fields' => array( 'docs_slug' ),
168 ),
169 0 => array(
170 'fields' => array( 'docs_page' ),
171 ),
172 ),
173 ),
174 'breadcrumb_doc_title' => array(
175 'type' => 'text',
176 'label' => __('Documentation Page Title' , 'betterdocs'),
177 'default' => 'Docs',
178 'priority' => 10,
179 ),
180 'docs_slug' => array(
181 'type' => 'text',
182 'label' => __('BetterDocs Root Slug' , 'betterdocs'),
183 'default' => 'docs',
184 'priority' => 10
185 ),
186 'docs_page' => array(
187 'label' => __( 'Docs Page', 'betterdocs' ),
188 'type' => 'select',
189 'priority' => 10,
190 'options' => betterdocs_get_pages(),
191 'help' => __('Note: You will need to insert BetterDocs Shortcode inside the page. This page will be used as docs permalink.' , 'betterdocs'),
192 ),
193 'category_slug' => array(
194 'type' => 'text',
195 'label' => __('Custom Category Slug' , 'betterdocs'),
196 'default' => 'docs-category',
197 'priority' => 10
198 ),
199 'tag_slug' => array(
200 'type' => 'text',
201 'label' => __('Custom Tag Slug' , 'betterdocs'),
202 'default' => 'docs-tag',
203 'priority' => 10
204 ),
205 'disable_root_slug_mkb' => apply_filters( 'betterdocs_disable_root_slug_mkb_settings', array(
206 'type' => 'checkbox',
207 'label' => __('Disable Root slug for KB Archives' , 'betterdocs'),
208 'default' => '',
209 'help' => __('<strong>Note:</strong> if you disable root slug for KB Archives, your individual knowledge base URL will be like this: <b><i>https://example.com/knowledgebase-1</i></b>', 'betterdocs'),
210 'priority' => 10,
211 'disable' => true,
212 )),
213 'permalink_structure' => array(
214 'type' => 'text',
215 'label' => __( 'Single Docs Permalink', 'betterdocs' ),
216 'default' => apply_filters("betterdocs_doc_permalink_default", BetterDocs_Docs_Post_Type::$docs_slug),
217 'priority' => 10,
218 'help' => betterdocs_permalink_structure_tags(),
219 ),
220 ),
221 )),
222
223 )),
224 ),
225 'layout' => array(
226 'title' => __( 'Layout', 'betterdocs' ),
227 'priority' => 10,
228 'button_text' => __( 'Save Settings' ),
229 'sections' => apply_filters('betterdocs_layout_settings_sections', array(
230
231 'layout_inner_tab' => array(
232 'title' => __( 'Layout Tab' ),
233 'tabs' => array(
234 'documentation_page' => apply_filters('betterdocs_layout_documentation_page_settings', array(
235 'title' => __( 'Documentation Page', 'betterdocs' ),
236 'priority' => 10,
237 'fields' => array(
238 'doc_page' => array(
239 'type' => 'title',
240 'label' => __('Documentation Page' , 'betterdocs'),
241 'priority' => 10,
242 ),
243 'live_search' => array(
244 'type' => 'checkbox',
245 'label' => __('Enable Live Search' , 'betterdocs'),
246 'default' => 1,
247 'priority' => 10,
248 ),
249 'advance_search' => apply_filters( 'betterdocs_advance_search_settings', array(
250 'type' => 'checkbox',
251 'label' => __('Enable Advanced Search' , 'betterdocs'),
252 'default' => '',
253 'priority' => 10,
254 'disable' => true,
255 )),
256 'popular_keyword_limit' => apply_filters( 'betterdocs_popular_keyword_limit_settings', array(
257 'type' => 'number',
258 'label' => __('Minimum amount of Keywords Search' , 'betterdocs'),
259 'default' => 5,
260 'priority' => 10,
261 'disable' => true,
262 )),
263 'search_placeholder' => array(
264 'type' => 'text',
265 'label' => __('Search Placeholder' , 'betterdocs'),
266 'default' => 'Search..',
267 'priority' => 10,
268 ),
269 'search_button_text' => apply_filters('betterdocs_search_button_text',array(
270 'type' => 'text',
271 'label' => __('Search Button Text', 'betterdocs-pro'),
272 'priority' => 10,
273 'default' => esc_html__('Search','betterdocs-pro'),
274 'disable' => true
275 )),
276 'search_not_found_text' => array(
277 'type' => 'text',
278 'label' => __('Search Not Found Text' , 'betterdocs'),
279 'default' => 'Sorry, no docs were found.',
280 'priority' => 10,
281 ),
282 'search_result_image' => array(
283 'type' => 'checkbox',
284 'label' => __('Search Result Image' , 'betterdocs'),
285 'default' => 1,
286 'priority' => 10,
287 ),
288 'kb_based_search' => apply_filters( 'betterdocs_kb_based_search_settings', array(
289 'type' => 'checkbox',
290 'label' => __('Search Result based on KB' , 'betterdocs'),
291 'default' => '',
292 'priority' => 10,
293 'disable' => true,
294 )),
295 'masonry_layout' => array(
296 'type' => 'checkbox',
297 'label' => __('Enable Masonry' , 'betterdocs'),
298 'default' => 1,
299 'priority' => 10,
300 ),
301 'terms_orderby' => array(
302 'type' => 'select',
303 'label' => __('Terms Order By' , 'betterdocs'),
304 'default' => 'betterdocs_order',
305 'options' => apply_filters('betterdocs_terms_orderby_options', array(
306 'none' => __('No order', 'betterdocs'),
307 'name' => __('Name', 'betterdocs'),
308 'slug' => __('Slug', 'betterdocs'),
309 'term_group' => __('Term Group', 'betterdocs'),
310 'term_id' => __('Term ID', 'betterdocs'),
311 'id' => __('ID', 'betterdocs'),
312 'description' => __('Description', 'betterdocs'),
313 'parent' => __('Parent', 'betterdocs'),
314 'betterdocs_order' => __('BetterDocs Order', 'betterdocs'),
315 )),
316 'priority' => 10,
317 ),
318 'alphabetically_order_term' => array(
319 'type' => 'checkbox',
320 'label' => __('Order Terms Alphabetically' , 'betterdocs'),
321 'default' => '',
322 'priority' => 10,
323 ),
324 'terms_order' => array(
325 'type' => 'select',
326 'label' => __('Terms Order' , 'betterdocs'),
327 'default' => 'ASC',
328 'options' => [
329 'ASC' => 'Ascending',
330 'DESC' => 'Descending',
331 ],
332 'priority' => 10,
333 ),
334 'alphabetically_order_post' => array(
335 'type' => 'select',
336 'label' => __('Docs Order By' , 'betterdocs'),
337 'default' => apply_filters('betterdocs_post_order_default', 'none'),
338 'options' => apply_filters('betterdocs_post_order_options', array(
339 'none' => __('No order', 'betterdocs'),
340 'ID' => __('Post ID', 'betterdocs'),
341 'author' => __('Post Author', 'betterdocs'),
342 '1' => __('Title', 'betterdocs'), // value is 1 to cope up with existing user data
343 'date' => __('Date', 'betterdocs'),
344 'modified' => __('Last Modified Date', 'betterdocs'),
345 'parent' => __('Parent Id', 'betterdocs'),
346 'rand' => __('Random', 'betterdocs'),
347 'comment_count' => __('Comment Count', 'betterdocs'),
348 'menu_order' => __('Menu Order', 'betterdocs')
349 )),
350 'priority' => 10,
351 ),
352 'docs_order' => array(
353 'type' => 'select',
354 'label' => __('Docs Order' , 'betterdocs'),
355 'default' => 'ASC',
356 'options' => [
357 'ASC' => 'Ascending',
358 'DESC' => 'Descending',
359 ],
360 'priority' => 10,
361 ),
362 'nested_subcategory' => array(
363 'type' => 'checkbox',
364 'label' => __('Nested Subcategory' , 'betterdocs'),
365 'default' => '',
366 'priority' => 10,
367 ),
368 'column_number' => array(
369 'type' => 'number',
370 'label' => __('Number of Columns' , 'betterdocs'),
371 'default' => 3,
372 'priority' => 10
373 ),
374 'posts_number' => array(
375 'type' => 'number',
376 'label' => __('Number of Posts' , 'betterdocs'),
377 'default' => 10,
378 'priority' => 10
379 ),
380 'post_count' => array(
381 'type' => 'checkbox',
382 'label' => __('Enable Post Count' , 'betterdocs'),
383 'default' => 1,
384 'priority' => 10,
385 ),
386 'count_text' => array(
387 'type' => 'text',
388 'label' => __('Count Text' , 'betterdocs'),
389 'default' => __('articles' , 'betterdocs'),
390 'priority' => 10,
391 ),
392 'count_text_singular' => array(
393 'type' => 'text',
394 'label' => __('Count Text Singular' , 'betterdocs'),
395 'default' => __('article' , 'betterdocs'),
396 'priority' => 10,
397 ),
398 'exploremore_btn' => array(
399 'type' => 'checkbox',
400 'label' => __('Enable Explore More Button' , 'betterdocs'),
401 'default' => 1,
402 'priority' => 10,
403 'dependency' => array(
404 1 => array(
405 'fields' => array( 'exploremore_btn_txt' )
406 )
407 ),
408 'hide' => array(
409 0 => array(
410 'fields' => array( 'exploremore_btn_txt' )
411 )
412 )
413 ),
414 'exploremore_btn_txt' => array(
415 'type' => 'text',
416 'label' => __('Button Text' , 'betterdocs'),
417 'default' => __('Explore More' , 'betterdocs'),
418 'priority' => 10
419 ),
420 ),
421 )),
422 'single_doc' => apply_filters('betterdocs_layout_single_doc_settings', array(
423 'title' => __( 'Single Doc', 'betterdocs' ),
424 'priority' => 10,
425 'fields' => array(
426 'doc_single' => array(
427 'type' => 'title',
428 'label' => __('Single Doc' , 'betterdocs'),
429 'priority' => 10,
430 ),
431 'enable_toc' => array(
432 'type' => 'checkbox',
433 'label' => __('Enable Table of Contents (TOC)' , 'betterdocs'),
434 'default' => 1,
435 'priority' => 10,
436 'dependency' => array(
437 1 => array(
438 'fields' => array( 'toc_title', 'enable_sticky_toc', 'toc_hierarchy', 'supported_heading_tag', 'toc_list_number' )
439 )
440 ),
441 'hide' => array(
442 0 => array(
443 'fields' => array( 'enable_sticky_toc', 'toc_hierarchy', 'supported_heading_tag' )
444 )
445 )
446 ),
447 'toc_title' => array(
448 'type' => 'text',
449 'label' => __('TOC Title' , 'betterdocs'),
450 'default' => __('Table of Contents' , 'betterdocs'),
451 'priority' => 10,
452
453 ),
454 'toc_hierarchy' => array(
455 'type' => 'checkbox',
456 'label' => __('TOC Hierarchy' , 'betterdocs'),
457 'default' => 1,
458 'priority' => 10
459 ),
460 'toc_list_number' => array(
461 'type' => 'checkbox',
462 'label' => __('TOC List Number' , 'betterdocs'),
463 'default' => 1,
464 'priority' => 10
465 ),
466 'enable_sticky_toc' => array(
467 'type' => 'checkbox',
468 'label' => __('Enable Sticky TOC' , 'betterdocs'),
469 'default' => 1,
470 'priority' => 10
471 ),
472 'sticky_toc_offset' => array(
473 'type' => 'number',
474 'label' => __('Content Offset' , 'betterdocs'),
475 'default' => 100,
476 'priority' => 10,
477 'description' => __('content offset from top on scroll.' , 'betterdocs'),
478 ),
479 'collapsible_toc_mobile' => array(
480 'type' => 'checkbox',
481 'label' => __('Collapsible TOC on small devices' , 'betterdocs'),
482 'default' => '',
483 'priority' => 10
484 ),
485 'supported_heading_tag' => array(
486 'label' => __( 'TOC Supported Heading Tag', 'betterdocs' ),
487 'type' => 'multi_checkbox',
488 'priority' => 10,
489 'default' => array(1,2,3,4,5,6),
490 'options' => array(
491 '1' => 'h1',
492 '2' => 'h2',
493 '3' => 'h3',
494 '4' => 'h4',
495 '5' => 'h5',
496 '6' => 'h6'
497 ),
498 ),
499 'enable_post_title' => array(
500 'type' => 'checkbox',
501 'label' => __('Enable Post Title' , 'betterdocs'),
502 'default' => 1,
503 'priority' => 10
504 ),
505 'title_link_ctc' => array(
506 'type' => 'checkbox',
507 'label' => __('Title Link Copy To Clipboard' , 'betterdocs'),
508 'default' => 1,
509 'priority' => 10
510 ),
511 'enable_breadcrumb' => array(
512 'type' => 'checkbox',
513 'label' => __('Enable Breadcrumb' , 'betterdocs'),
514 'default' => 1,
515 'priority' => 10,
516 'dependency' => array(
517 1 => array(
518 'fields' => array('breadcrumb_home_text', 'breadcrumb_home_url', 'enable_breadcrumb_category', 'enable_breadcrumb_title')
519 )
520 ),
521 'hide' => array(
522 0 => array(
523 'fields' => array('breadcrumb_home_text', 'breadcrumb_home_url', 'enable_breadcrumb_category', 'enable_breadcrumb_title')
524 )
525 )
526 ),
527 'breadcrumb_home_text' => array(
528 'type' => 'text',
529 'label' => __('Breadcrumb Home Text' , 'betterdocs'),
530 'default' => __('Home' , 'betterdocs'),
531 'priority' => 10,
532
533 ),
534 'breadcrumb_home_url' => array(
535 'type' => 'text',
536 'label' => __('Breadcrumb Home URL' , 'betterdocs'),
537 'priority' => 10,
538 'default' => get_home_url(),
539 ),
540 'enable_breadcrumb_category' => array(
541 'type' => 'checkbox',
542 'label' => __('Enable Category on Breadcrumb' , 'betterdocs'),
543 'default' => 1,
544 'priority' => 10
545 ),
546 'enable_breadcrumb_title' => array(
547 'type' => 'checkbox',
548 'label' => __('Enable Title on Breadcrumb' , 'betterdocs'),
549 'default' => 1,
550 'priority' => 10
551 ),
552 'enable_sidebar_cat_list' => array(
553 'type' => 'checkbox',
554 'label' => __('Enable Sidebar Category List' , 'betterdocs'),
555 'default' => 1,
556 'priority' => 10
557 ),
558 'enable_print_icon' => array(
559 'type' => 'checkbox',
560 'label' => __('Enable Print Icon' , 'betterdocs'),
561 'default' => 1,
562 'priority' => 10
563 ),
564 'enable_tags' => array(
565 'type' => 'checkbox',
566 'label' => __('Enable Tags' , 'betterdocs'),
567 'default' => 1,
568 'priority' => 10
569 ),
570 'email_feedback' => array(
571 'type' => 'checkbox',
572 'label' => __('Enable Email Feedback' , 'betterdocs'),
573 'default' => 1,
574 'priority' => 10,
575 'dependency' => array(
576 1 => array(
577 'fields' => array( 'email_address', 'feedback_link_text', 'feedback_form_title' )
578 )
579 ),
580 'hide' => array(
581 0 => array(
582 'fields' => array( 'email_address', 'feedback_link_text', 'feedback_form_title' )
583 )
584 )
585 ),
586 'feedback_link_text' => array(
587 'type' => 'text',
588 'label' => __('Feedback Link Text' , 'betterdocs'),
589 'default' => esc_html__('Still stuck? How can we help?','betterdocs'),
590 'priority' => 10
591 ),
592 'feedback_url' => array(
593 'type' => 'text',
594 'label' => __('Feedback URL' , 'betterdocs'),
595 'default' => '',
596 'priority' => 10
597 ),
598 'feedback_form_title' => array(
599 'type' => 'text',
600 'label' => __('Feedback Form Title' , 'betterdocs'),
601 'default' => esc_html__('How can we help?','betterdocs'),
602 'priority' => 10
603 ),
604 'email_address' => array(
605 'type' => 'text',
606 'label' => __('Email Address' , 'betterdocs'),
607 'default' => get_option('admin_email'),
608 'priority' => 10,
609 'description' => __('The email address where the Feedback from will be sent' , 'betterdocs'),
610 ),
611 'show_last_update_time' => array(
612 'type' => 'checkbox',
613 'label' => __('Show Last Update Time' , 'betterdocs'),
614 'default' => 1,
615 'priority' => 10
616 ),
617 'enable_navigation' => array(
618 'type' => 'checkbox',
619 'label' => __('Enable Navigation' , 'betterdocs'),
620 'default' => 1,
621 'priority' => 10
622 ),
623 'enable_comment' => array(
624 'type' => 'checkbox',
625 'label' => __('Enable Comment' , 'betterdocs'),
626 'default' => '',
627 'priority' => 10
628 ),
629 'enable_credit' => array(
630 'type' => 'checkbox',
631 'label' => __('Enable Credit' , 'betterdocs'),
632 'default' => 1,
633 'priority' => 10
634 ),
635 ),
636 )),
637 'archive_page' => apply_filters('betterdocs_layout_archive_page_settings', array(
638 'title' => __( 'Archive Page', 'betterdocs' ),
639 'priority' => 10,
640 'fields' => array(
641 'archive_page_title' => array(
642 'type' => 'title',
643 'label' => __('Archive Page' , 'betterdocs'),
644 'priority' => 10,
645 ),
646 'enable_archive_sidebar' => array(
647 'type' => 'checkbox',
648 'label' => __('Enable Sidebar Category List' , 'betterdocs'),
649 'default' => 1,
650 'priority' => 10,
651 ),
652 'archive_nested_subcategory' => array(
653 'type' => 'checkbox',
654 'label' => __('Nested Subcategory' , 'betterdocs'),
655 'default' => 1,
656 'priority' => 10,
657 ),
658 ),
659 )),
660 )
661 )
662
663 )),
664 ),
665 'design' => array(
666 'title' => __( 'Design', 'betterdocs' ),
667 'priority' => 10,
668 'sections' => apply_filters('betterdocs_design_settings_sections', array(
669 'design_settings' => apply_filters('betterdocs_design_settings', array(
670 'title' => __( 'Documentation Page', 'betterdocs' ),
671 'priority' => 10,
672 'fields' => array(
673 'customizer_link' => array(
674 'type' => 'card',
675 'label' => __('Customize BetterDocs','betterdocs'),
676 'url' => esc_url($customizer_link),
677 'priority' => 10
678 ),
679 ),
680 )),
681 )),
682 ),
683 'shortcodes' => array(
684 'title' => __( 'Shortcodes', 'betterdocs' ),
685 'priority' => 10,
686 'sections' => apply_filters('betterdocs_shortcodes_settings_sections', array(
687 'shortcodes_settings' => apply_filters('betterdocs_shortcodes_settings', array(
688 'title' => __( 'Shortcodes', 'betterdocs' ),
689 'priority' => 10,
690 'fields' => apply_filters('betterdocs_shortcode_fields', array(
691 'search_form' => array(
692 'type' => 'text',
693 'label' => __('Search Form' , 'betterdocs'),
694 'default' => '[betterdocs_search_form]',
695 'readonly' => true,
696 'clipboard' => true,
697 'priority' => 10,
698 'help' => __('<strong>You can use:</strong> [betterdocs_search_form placeholder="Search..." heading="Heading" subheading="Subheading" category_search="true" search_button="true" popular_search="true"]' , 'betterdocs'),
699 ),
700 'feedback_form' => array(
701 'type' => 'text',
702 'label' => __('Feedback Form' , 'betterdocs'),
703 'default' => '[betterdocs_feedback_form]',
704 'readonly' => true,
705 'clipboard' => true,
706 'priority' => 10,
707 'help' => __('<strong>You can use:</strong> [betterdocs_feedback_form button_text="Send"]' , 'betterdocs'),
708 ),
709 'category_grid' => array(
710 'type' => 'text',
711 'label' => __('Category Grid- Layout 1' , 'betterdocs'),
712 'default' => '[betterdocs_category_grid]',
713 'readonly' => true,
714 'clipboard' => true,
715 'priority' => 10,
716 'help' => __('<strong>You can use:</strong> [betterdocs_category_grid post_counter="true" icon="true" masonry="true" column="3" posts_per_grid="5" nested_subcategory="true" terms="term_ID, term_ID" terms_orderby="" terms_order="" multiple_knowledge_base="" disable_customizer_style="" kb_slug="" title_tag="h2" orderby="" order="" ]' , 'betterdocs'),
717 ),
718 'category_box' => array(
719 'type' => 'text',
720 'label' => __('Category Box- Layout 2' , 'betterdocs'),
721 'default' => '[betterdocs_category_box]',
722 'readonly' => true,
723 'clipboard' => true,
724 'priority' => 10,
725 'help' => __('<strong>You can use:</strong> [betterdocs_category_box post_type="docs" category="doc_category" orderby="" column="" nested_subcategory="" terms="" terms_orderby="" icon="" kb_slug="" title_tag="h2" multiple_knowledge_base="false" disable_customizer_style="false" border_bottom="false"]' , 'betterdocs'),
726 ),
727 'category_list' => array(
728 'type' => 'text',
729 'label' => __('Category List' , 'betterdocs'),
730 'default' => '[betterdocs_category_list]',
731 'readonly' => true,
732 'clipboard' => true,
733 'priority' => 10,
734 'help' => __('<strong>You can use:</strong> [betterdocs_category_list post_type="docs" category="doc_category" orderby="" order="" masonry="" column="" posts_per_page="" nested_subcategory="" terms="" terms_orderby="" terms_order="" kb_slug="" multiple_knowledge_base="false" title_tag="h2"]' , 'betterdocs'),
735 ),
736 )),
737 )),
738 )),
739 ),
740 'betterdocs_advanced_settings' => array(
741 'title' => __( 'Advanced Settings', 'betterdocs' ),
742 'priority' => 20,
743 'button_text' => __( 'Save Settings' ),
744 'sections' => $advanced_settings
745 ),
746 'betterdocs_instant_answer' => array(
747 'title' => __( 'Instant Answer', 'betterdocs' ),
748 'priority' => 20,
749 'pro' => true,
750 'sections' => array(
751 'enable_instant_answer' => array(
752 'title' => __('Enable/Disable Instant Answer', 'betterdocs'),
753 'priority' => 0,
754 'fields' => array(
755 'ia_title' => array(
756 'type' => 'title',
757 'label' => __('Enable/Disable Instant Answer' , 'betterdocs'),
758 'priority' => 0,
759 ),
760 'ia_description' => array(
761 'type' => 'html',
762 'priority' => 1,
763 'html' => __( 'Display a list of articles or categories in a chat-like widget to give your visitors a chance of self-learning about your website.', 'betterdocs' )
764 ),
765 'enable_disable_free' => array(
766 'type' => 'checkbox',
767 'priority' => 2,
768 'label' => __( 'Enable/Disable', 'betterdocs' ),
769 'default' => '',
770 'disable' => true,
771 ),
772 'ia_enable_preview_free' => array(
773 'type' => 'checkbox',
774 'label' => __('Enable IA Live Preview' , 'betterdocs'),
775 'priority' => 3,
776 'default' => '',
777 'disable' => true,
778 ),
779 'ia_image' => array(
780 'type' => 'image',
781 'url' => BETTERDOCS_ADMIN_URL . 'assets/img/ia-preview.gif',
782 'priority' => 3
783 ),
784 )
785 ),
786 )
787 )
788 ));
789 }
790
791 /**
792 * Undocumented function
793 *
794 * @return string
795 */
796 function betterdocs_permalink_structure_tags(){
797 $tags = apply_filters("betterdocs_doc_permalink_tags", [
798 '%doc_category%' => [
799 'class' => '',
800 'aria-label' => __( 'Docs Categories', 'betterdocs' ),
801 'data-added' => __( 'doc_category added to permalink structure', 'betterdocs' ),
802 'data-used' => __( 'doc_category (already used in permalink structure)', 'betterdocs' ),
803 ],
804 ]);
805
806 $return = __( "<b>Note:</b> Make sure to keep <b>Docs Root Slug</b> in the <b>Single Docs Permalink</b>. You are not able to keep it blank. You can use the available tags from below.", 'betterdocs' );
807 $return .= "
808 <div class='form-table permalink-structure'>
809 <div class='available-structure-tags hide-if-no-js'>
810 <div id='custom_selection_updated' aria-live='assertive' class='screen-reader-text'></div>
811 <ul role='list'>
812 ";
813
814 foreach($tags as $tag => $args){
815 $return .= "
816 <li class='{$args['class']}'>
817 <button type='button' class='button button-secondary' aria-label='{$args['aria-label']}' data-added='{$args['data-added']}' data-used='{$args['data-used']}'>$tag</button>
818 </li>
819 ";
820 }
821
822 $return .= "
823 </ul>
824 </div>
825 </div>
826 ";
827 return $return;
828 }