PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 1.2.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v1.2.3
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 / setup-wizard / inc / class-betterdocs-setup-wizard.php

class-betterdocs-setup-wizard.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 1.2.3, at admin/setup-wizard/inc/class-betterdocs-setup-wizard.php

637 lines 29.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if( ! class_exists( 'BetterDocsSetupWizard' ) ){
3 class BetterDocsSetupWizard {
4 public static $sections_array = array();
5 public static $optionGroupName = 'betterdocs_settings';
6 public static function load(){
7 // Menu.
8 // add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
9
10 // tab builder
11 add_action( 'admin_enqueue_scripts', array(__CLASS__, 'setup_wizard_scripts'), 30 );
12 add_action('betterdocs_nav_tabs', array(__CLASS__, 'add_nav_tabs'));
13 add_action('betterdocs_tabs_content', array(__CLASS__, 'add_tab_content'));
14 // ajax request
15 add_action( 'wp_ajax_better_docs_quick_setup_wizard_data_save', array(__CLASS__, 'better_docs_quick_setup_wizard_data_save') );
16 // ajax url change
17 add_action( 'wp_ajax_better_docs_setup_generate_live_url', array(__CLASS__, 'better_docs_setup_generate_live_url') );
18 }
19
20 public static function setup_wizard_scripts(){
21 wp_enqueue_style( 'betterdocs-setup-wizard', BETTERDOCS_ADMIN_URL . 'setup-wizard/assets/css/betterdocs-setup-wizard.css' );
22 $BetterDocsQswVersionNumber = date("ymd-Gis", filemtime( BETTERDOCS_ADMIN_DIR_PATH . 'setup-wizard/assets/js/betterdocs-setup-wizard.js' ));
23 wp_enqueue_script( 'betterdocs-setup-wizard', BETTERDOCS_ADMIN_URL . 'setup-wizard/assets/js/betterdocs-setup-wizard.js', array('jquery'), $BetterDocsQswVersionNumber, false );
24
25 // Localize the script with new data
26
27 wp_localize_script( 'betterdocs-setup-wizard', 'bdquicksetup', array(
28 'customizerurl' => betterdocs_setup_get_customizer_setting_url(),
29 'docspageurl' => betterdocs_setup_docs_page_url(),
30 'currentslug' => BetterDocs_DB::get_settings('docs_slug'),
31 ));
32 }
33
34 // add admin page
35 public static function admin_menu() {
36 add_submenu_page(
37 null,
38 'Better Docs Setup',
39 'Better Docs Setup',
40 'manage_options',
41 'betterdocs-setup',
42 array( __CLASS__, 'plugin_setting_page' )
43 );
44 }
45
46 // add admin page
47 public static function knowledge_base_plugins() {
48 include_once(ABSPATH . 'wp-admin/includes/plugin.php');
49 $plugins = array();
50 if (is_plugin_active('wedocs/wedocs.php')) {
51 $plugins[] = array('wedocs', 'weDocs');
52 }
53 if (is_plugin_active('bsf-docs/bsf-docs.php')) {
54 $plugins[] = array('bsf-docs', 'BSF docs');
55 }
56 if (is_plugin_active('documentor-lite/documentor-lite.php')) {
57 $plugins[] = array('documentor-lite', 'Documentor');
58 }
59 if (is_plugin_active('echo-knowledge-base/echo-knowledge-base.php')) {
60 $plugins[] = array('echo-knowledge-base', 'Echo Knowledge Base');
61 }
62 if (is_plugin_active('pressapps-knowledge-base/pressapps-knowledge-base.php')) {
63 $plugins[] = array('pressapps-knowledge-base', 'PressApps Knowledge Base');
64 }
65 return $plugins;
66 }
67
68 // add admin page
69 public static function existing_plugins_data($plugins) {
70 $plugins_data = array();
71 if ($plugins === 'wedocs') {
72 $plugins_data['name'] = 'wedocs';
73 $plugins_data['url'] = 'wedocs/wedocs.php';
74 }
75 if ($plugins === 'bsf-docs') {
76 $plugins_data['name'] = 'bsf-docs';
77 $plugins_data['url'] = 'bsf-docs/bsf-docs.php';
78 }
79 if ($plugins === 'documentor-lite') {
80 $plugins_data['name'] = 'documentor-lite';
81 $plugins_data['url'] = 'documentor-lite/documentor-lite.php';
82 }
83 if ($plugins === 'echo-knowledge-base') {
84 $plugins_data['name'] = 'echo-knowledge-base';
85 $plugins_data['url'] = 'echo-knowledge-base/echo-knowledge-base.php';
86 }
87 if ($plugins === 'pressapps-knowledge-base') {
88 $plugins_data['name'] = 'pressapps-knowledge-base';
89 $plugins_data['url'] = 'pressapps-knowledge-base/pressapps-knowledge-base.php';
90 }
91 return $plugins_data;
92 }
93
94 public static function insert_terms_hierarchically($existing_term, $new_term, $parentId = 0) {
95 $into = array();
96 $cats = get_terms($existing_term, array('hide_empty' => false));
97 if ($cats) {
98 foreach ($cats as $i => $cat) {
99 if ($cat->parent == $parentId) {
100 $into[$cat->term_id] = $cat;
101 unset($cats[$i]);
102 $doc_parent_term = term_exists( $cat->name, $new_term );
103 wp_insert_term (
104 $cat->name,
105 $new_term,
106 array(
107 'alias_of' => $cat->slug,
108 'description' => $cat->description,
109 'slug' => $cat->slug,
110 'parent' => $cat->parent,
111 )
112 );
113 }
114 }
115 if ($cats) {
116 foreach ($cats as $i => $cat) {
117 $get_existing_term = get_term_by('id', $cat->parent, $existing_term);
118 $doc_parent_term = term_exists( $get_existing_term->name, $new_term );
119 wp_insert_term (
120 $cat->name,
121 $new_term,
122 array(
123 'alias_of' => $cat->slug,
124 'description' => $cat->description,
125 'slug' => $cat->slug,
126 'parent' => $doc_parent_term['term_id'],
127 )
128 );
129 }
130 }
131 }
132 }
133
134 public static function insert_posts($existing_post, $existing_cat, $existing_tag) {
135 $args = array(
136 'post_type' => $existing_post,
137 'post_status' => 'any',
138 'posts_per_page' => -1
139 );
140 $postslist = get_posts( $args );
141 if($postslist) {
142 foreach ($postslist as $post) {
143 // Create post object
144 if (!get_page_by_title($post->post_title, 'OBJECT', 'docs') ){
145 $post_args = array(
146 'post_type' => 'docs',
147 'post_title' => $post->post_title,
148 'post_content' => $post->post_content,
149 'post_status' => $post->post_status,
150 'post_author' => $post->post_author,
151 'post_date' => $post->post_date,
152 'post_date_gmt' => $post->post_date_gmt,
153 'post_excerpt' => $post->post_excerpt,
154 'comment_status' => $post->comment_status,
155 'ping_status' => $post->ping_status,
156 'post_password' => $post->post_password,
157 'post_name' => $post->post_name,
158 'to_ping' => $post->to_ping,
159 'pinged' => $post->pinged,
160 'post_modified' => $post->post_modified,
161 'post_modified_gmt' => $post->post_modified_gmt,
162 'post_content_filtered' => $post->post_content_filtered,
163 'post_parent' => $post->post_parent,
164 'post_mime_type' => $post->post_mime_type,
165 'comment_count' => $post->comment_count,
166 'filter' => $post->filter,
167 );
168 // Insert the post into the database
169 $result = wp_insert_post( $post_args );
170 if ( $result && ! is_wp_error( $result ) ) {
171 $cat_list = wp_get_post_terms($post->ID, $existing_cat, array('fields' => 'all'));
172 if($cat_list) {
173 $post_id = $result;
174 wp_set_object_terms( $post_id, array($cat_list['0']->name), 'doc_category', false );
175 }
176 $tag_list = wp_get_post_terms($post->ID, $existing_tag, array('fields' => 'all'));
177 if($tag_list) {
178 $post_id = $result;
179 wp_set_object_terms( $post_id, array($tag_list['0']->name), 'doc_tag', false );
180 }
181 }
182 }
183 }
184 }
185 }
186
187 public static function eco_knowledgerbase_migration() {
188 self::insert_terms_hierarchically('epkb_post_type_1_category', 'doc_category');
189 self::insert_terms_hierarchically('epkb_post_type_1_tag', 'doc_tag');
190 self::insert_posts('epkb_post_type_1', 'epkb_post_type_1_category', 'epkb_post_type_1_tag');
191 }
192
193 public static function pressapps_migration() {
194 self::insert_terms_hierarchically('knowledgebase_category', 'doc_category');
195 self::insert_terms_hierarchically('knowledgebase_tags', 'doc_tag');
196 self::insert_posts('knowledgebase', 'knowledgebase_category', 'knowledgebase_tags');
197 }
198
199 public static function better_docs_quick_setup_wizard_data_save() {
200 check_ajax_referer( 'betterdocsqswnonce', 'security');
201 $oldValue = get_option( self::$optionGroupName, true );
202
203 // duplicate existing plugin data and deactivate
204 if(isset($_POST['activate_plugin'])) {
205 $existing_plugins_data = self::existing_plugins_data($_POST['activate_plugin']);
206 if ( $existing_plugins_data['name'] === 'echo-knowledge-base' ) {
207 self::eco_knowledgerbase_migration();
208 } elseif ( $existing_plugins_data['name'] === 'pressapps-knowledge-base' ) {
209 self::pressapps_migration();
210 }
211 deactivate_plugins( $existing_plugins_data['url'] );
212 }
213 $newValue['builtin_doc_page'] = (isset($_POST['builtin_doc_page']) ? $_POST['builtin_doc_page'] : 'off');
214 $newValue['docs_slug'] = (isset($_POST['docs_slug']) ? $_POST['docs_slug'] : 'docs');
215 $newValue['enable_disable'] = (isset($_POST['enable_disable']) ? $_POST['enable_disable'] : 'off');
216 // new update value
217 $updatedValue = array_merge($oldValue, $newValue);
218 if(!get_option(self::$optionGroupName)) {
219 add_option(self::$optionGroupName, $updatedValue);
220 } else {
221 update_option(self::$optionGroupName, $updatedValue);
222 }
223 wp_die(); // this is required to terminate immediately and return a proper response
224 }
225
226 public static function better_docs_setup_generate_live_url(){
227 $query = [];
228 $query['autofocus[panel]'] = 'betterdocs_customize_options';
229 $query['return'] = admin_url( 'edit.php?post_type=docs' );
230 $docs_slug = (isset($_POST['docs_slug']) ? $_POST['docs_slug'] : null);
231 if($docs_slug){
232 $query['url'] = site_url( '/'.$docs_slug );
233 }
234 $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) );
235
236
237 $result = array(
238 'customizerurl' => $customizer_link,
239 'siteurl' => esc_url( site_url( '/'.$docs_slug ) )
240 );
241 print json_encode( $result);
242 wp_die();
243 }
244
245 public static function plugin_setting_page() {
246 ?>
247 <div id="wpwrap">
248 <div class="betterdocs-settings-wrap">
249 <div class="betterdocs-topbar-logo text-center">
250 <img width="150" src="<?php print esc_url( BETTERDOCS_ADMIN_URL . 'assets/img/betterdocs-logo.svg'); ?>" alt="logo">
251 </div>
252 <!-- setup wizard -->
253 <div class="betterdocs-setup-wizard">
254 <form method="post" action="#">
255 <input type="hidden" name="betterdocsqswnonce" value="<?php print wp_create_nonce( 'betterdocsqswnonce' ); ?>">
256 <div class="betterdocs-tabnav-wrap">
257 <ul class="tab-nav">
258 <?php do_action('betterdocs_nav_tabs'); ?>
259 </ul>
260 </div>
261 <div class="betterdocs-tab-content-wrap">
262 <?php
263 do_action('betterdocs_tabs_content');
264 ?>
265 <div class="betterdocs-button-wrap">
266 <a id="betterdocs-prev-option" href="#" class="btn betterdocs-prev-option"><?php esc_html_e('Previous', 'betterdocs'); ?></a>
267 <a id="betterdocs-next-option" href="#" class="btn betterdocs-next-option"><?php esc_html_e('Next', 'betterdocs'); ?></a>
268 </div>
269 <div class="bottom-notice-left">
270 <p class="whatwecollecttext">We collect non-sensitive diagnostic data and plugin usage <br> information. Your site URL, WordPress & PHP version, <br> plugins & themes and email address to send you the discount <br> coupon. This data lets us make sure this plugin always stays <br> compatible with the most popular plugins and themes. No spam, we promise.</p>
271 <button type="button" class="btn-collect"><?php esc_html_e('What We Collect?', 'betterdocs'); ?></button>
272 </div>
273 <div class="bottom-notice">
274 <button type="button" id="betterdocsqswemailskipbutton" class="btn-skip"><?php esc_html_e('Skip This Step', 'betterdocs'); ?></button>
275 </div>
276 </div>
277 </form>
278 </div>
279 </div>
280 </div>
281 <?php
282 }
283
284 public static function setSection( $section ){
285 // Bail if not array.
286 if ( ! is_array( $section ) ) {
287 return false;
288 }
289
290 self::$sections_array[$section['id']] = $section;
291
292 // Assign to the sections array
293 return self::$sections_array;
294 }
295
296 public static function get_value($args){
297 if($args == null || $args == ''){
298 return;
299 }
300 $optionValue = get_option( self::$optionGroupName ) ;
301 if(isset($optionValue[$args['id']])) {
302 return $optionValue[$args['id']];
303 }else if(isset($args['default'])){
304 return $args['default'];
305 }
306 return;
307 }
308
309 public static function get_field_description($args){
310 if ( ! empty( $args['desc'] ) ) {
311 $desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
312 } else {
313 $desc = '';
314 }
315
316 return $desc;
317 }
318
319 /**
320 * Fields Type: Text
321 * @param array
322 * @return Markup
323 */
324 public static function callback_text($args) {
325 $value = esc_attr( self::get_value($args) );
326 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
327 $type = isset( $args['type'] ) ? $args['type'] : 'text';
328 $field = '';
329 $markup = '';
330 $field = sprintf( '<input type="%1$s" class="%2$s-text" name="%3$s" value="%4$s" placeholder="%5$s"/>', $type, $size, $args['id'], $value, $args['placeholder'] );
331 $field .= self::get_field_description( $args );
332 $markup .= '<tr>
333 <th scope="row">
334 <label for="'.$args['id'].'">'.$args['title'].'</label>
335 </th>
336 <td>
337 '.$field.'
338 </td>
339 </tr>';
340 echo $markup;
341 }
342
343 /**
344 * Fields Type: textarea
345 * @param array
346 * @return Markup
347 */
348 public static function callback_textarea( $args ) {
349 $value = esc_textarea( self::get_value($args) );
350 $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
351 $field = '';
352 $markup = '';
353 $field = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s" name="%3$s" placeholder="%4$s">%5$s</textarea>', $size, $args['id'], $args['id'], $args['placeholder'], $value );
354 $field .= self::get_field_description( $args );
355 $markup .= '<tr>
356 <th scope="row">
357 <label for="'.$args['id'].'">'.$args['title'].'</label>
358 </th>
359 <td>
360 '.$field.'
361 </td>
362 </tr>';
363 echo $markup;
364 }
365
366 /**
367 * Fields Type: checkbox
368 * @param array
369 * @return Markup
370 */
371 public static function callback_checkbox_pro_feature( $args ) {
372 $value = self::get_value($args);
373 $field = '';
374 $markup = '';
375 $field = sprintf( '<input class="%1$s-checkbox" id="%1$s" name="%1$s" type="checkbox" %3$s>', $args['id'], 1, checked( 1, $value, false ) );
376 $field .= self::get_field_description( $args );
377 $markup .= '<tr>
378 <th scope="row">
379 <label for="'.$args['id'].'">'.$args['title'].'</label>
380 </th>
381 <td>';
382 if(!class_exists('Betterdocs_Pro')) {
383 $markup .='<div class="betterdocs-checkbox betterdocs-pro-feature-checkbox" data-id="instant_answer">
384 <input disabled="" type="checkbox" id="instant_answer" name="instant_answer">
385 <label for="instant_answer"></label>
386 <p class="betterdocs-module-title">Instant Answer
387 <sup class="betterdocs-pro-label has-to-update"></sup><sup class="betterdocs-pro-label">Pro</sup>
388 </p>
389 </div>';
390 } else {
391 $markup .= $field;
392 }
393 $markup .='</td>
394 </tr>';
395 echo $markup;
396 }
397
398 /**
399 * Fields Type: link
400 * @param array
401 * @return Markup
402 */
403 public static function callback_link( $args ) {
404 $value = self::get_value($args);
405 $field = '';
406 $markup = '';
407 $field = sprintf( '<input class="%1$s-checkbox" id="%1$s" name="%1$s" type="checkbox" %3$s>', $args['id'], 1, checked( 1, $value, false ) );
408 $field .= self::get_field_description( $args );
409 $markup .= '<tr class="text-center">
410 <td colspan="2">
411 <h2 class="bd-sw-title">'.(isset($args['title']) ? $args['title'] : '').'</h2>
412 <p class="bd-sw-sub-title">'.(isset($args['sub_title']) ? $args['sub_title'] : '').'</p>
413 </td>
414 </tr>
415 <tr>
416 <td>
417 <ul class="betterdocs-setup-feature-list">';
418 if(is_array($args['options'])){
419 foreach($args['options'] as $item){
420 $markup .='<li>
421 <div class="bd-media-left"><span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="#37de89" width="40px"><path d="M 21.1875 9.28125 L 19.78125 10.71875 L 24.0625 15 L 4 15 L 4 17 L 24.0625 17 L 19.78125 21.28125 L 21.1875 22.71875 L 27.90625 16 Z"></path></svg></span></div>
422 <div class="bd-media-body">
423 <h4><a href="'.esc_url($item['url']).'" target="_blank">'.(isset($item['feature_title']) ? $item['feature_title'] : '').'</a></h4>
424 <p>'.(isset($item['feature_content']) ? $item['feature_content'] : '').'</p>
425 <a '.(isset($item['id']) ? 'id="'.$item['id'].'"' : '' ).' href="'.esc_url($item['url']).'" class="btn-setup-wizard" target="_blank">'.$item['title'].'</a>
426 </div>
427 </li>';
428 }
429 }
430 $markup .='</ul>
431 </td>
432 <td>
433 <img src="'.(isset($args['image_url']) ? esc_url($args['image_url']) : '').'" />
434 </td>
435 </tr>';
436 echo $markup;
437 }
438 /**
439 * Fields Type: link
440 * @param array
441 * @return Markup
442 */
443 public static function callback_final_step( $args ) {
444 $value = self::get_value($args);
445 $field = '';
446 $markup = '';
447 $field = sprintf( '<input class="%1$s-checkbox" id="%1$s" name="%1$s" type="checkbox" %3$s>', $args['id'], 1, checked( 1, $value, false ) );
448 $field .= self::get_field_description( $args );
449 $markup .= '<tr class="text-center">
450 <td colspan="2">';
451 if(isset($args['image_url'])){
452 $markup .= '<img src="'.(isset($args['image_url']) ? $args['image_url'] : '').'" alt="" />';
453 }
454 $markup .='<h2 class="bd-sw-title">'.(isset($args['title']) ? $args['title'] : '').'</h2>
455 <p class="bd-sw-sub-title">'.(isset($args['sub_title']) ? $args['sub_title'] : '').'</p>
456 </td>
457 </tr>
458 <tr class="text-center">
459 <td>';
460 foreach($args['options'] as $item){
461 $markup .='<a '.(isset($item['id']) ? 'id="'.$item['id'].'"' : '' ).' href="'.esc_url($item['url']).'" class="btn-setup-wizard" target="_blank">'.$item['title'].'</a>';
462 }
463 $markup .='</td>
464 </tr>';
465 echo $markup;
466 }
467
468 /**
469 * Fields Type: link
470 * @param array
471 * @return Markup
472 */
473 public static function callback_migration( $args ) {
474 $field = '';
475 $markup = '';
476 $markup .= '<tr class="text-center">
477 <td colspan="2">';
478 $markup .='<p class="bd-sw-sub-title">'.(isset($args['sub_title']) ? $args['sub_title'] : '').'</p>
479 </td>
480 </tr>';
481
482 foreach($args['options'] as $item){
483 $field = sprintf( '<input class="%1$s-checkbox activate_plugin" id="%1$s" name="activate_plugin" type="checkbox" value="%1$s" %2$s>', $item['id'], checked( 1, $item['default'], false ) );
484 $markup .= '<tr>
485 <th scope="row">
486 <label for="'.$item['id'].'">'.$item['title'].'</label>
487 </th>
488 <td>
489 '.$field.'
490 </td>
491 </tr>';
492 }
493 echo $markup;
494 }
495
496 /**
497 * Fields Type: checkbox
498 * @param array
499 * @return Markup
500 */
501 public static function callback_checkbox( $args ) {
502 $value = self::get_value($args);
503 $field = '';
504 $markup = '';
505 $field = sprintf( '<input class="%1$s-checkbox" id="%1$s" name="%1$s" type="checkbox" %3$s>', $args['id'], 1, checked( 1, $value, false ) );
506 $field .= self::get_field_description( $args );
507 $markup .= '<tr>
508 <th scope="row">
509 <label for="'.$args['id'].'">'.$args['title'].'</label>
510 </th>
511 <td>
512 '.$field.'
513 </td>
514 </tr>';
515 echo $markup;
516 }
517
518 /**
519 * Fields Type: radio
520 * @param array
521 * @return Markup
522 */
523 public static function callback_radio( $args ) {
524 $value = self::get_value($args);
525 $field = '';
526 $markup = '';
527 if(is_array($args['options'])){
528 foreach($args['options'] as $key => $option){
529 $field .= sprintf( '<input class="%1$s-radio" type="radio" name="%1$s" value="%2$s" %4$s>%3$s', $args['id'], $key, $option, checked( $key, $value, false ) );
530 }
531 }
532 $field .= self::get_field_description( $args );
533 $markup .= '<tr>
534 <th scope="row">
535 <label for="'.$args['id'].'">'.$args['title'].'</label>
536 </th>
537 <td>
538 '.$field.'
539 </td>
540 </tr>';
541 echo $markup;
542 }
543
544
545 public static function callback_select( $args ){
546 $value = self::get_value($args);
547 $field = $markup = '';
548 $field .= sprintf( '<select id="%1$s" class="%1$s-select" name="%1$s" multiple>', $args['id'] );
549 if(is_array($args['options'])){
550 $field .='<option value=""></option>';
551 foreach($args['options'] as $key => $option){
552 $field .= sprintf( '<option value="%1$s" '.(($value != "") ? (in_array($key, $value) ? 'selected' : '') : '').'>%2$s</option>',$key, $option);
553 }
554 }
555 $field .= '</select>';
556 $field .= self::get_field_description( $args );
557 $markup .= '<tr>
558 <th scope="row">
559 <label for="'.$args['id'].'">'.$args['title'].'</label>
560 </th>
561 <td>
562 '.$field.'
563 </td>
564 </tr>';
565 echo $markup;
566 }
567
568 public static function callback_welcome( $args ){
569 $current_user = wp_get_current_user();
570 ?>
571 <tr>
572 <td>
573 <h2 id="<?php print (isset($args['id']) ? $args['id'] : ''); ?>"><?php print (isset($args['title']) ? $args['title'] : ''); ?></h2>
574 <p class="welcome-sub-title"><?php print (isset($args['sub_title']) ? $args['sub_title'] : ''); ?></p>
575 <?php
576 if(isset($args['video_url'])) :
577 ?>
578 <div class="wpscp-getting-started-video">
579 <iframe width="620" height="350" src="<?php print (isset($args['video_url']) ? esc_url($args['video_url']) : '') ?>" frameborder="0"></iframe>
580 </div>
581 <?php
582 endif;
583 ?>
584 </td>
585 </tr>
586 <tr>
587 <td>
588 <div class="betterdocs_getting_started_form text-center">
589 <input type="checkbox" id="betterdocs_user_email_address" name="betterdocs_user_email_address" value="<?php print $current_user->user_email; ?>" checked> Share non-sensitive diagnostic data and plugin usage information.
590 </div>
591 </td>
592 </tr>
593 <?php
594 }
595
596 public static function add_nav_tabs(){
597 $tabNavCounter = 0;
598 $allSections = apply_filters( 'betterdocs_setup_wizard_fields', self::$sections_array );
599 foreach ($allSections as $section) :
600 ?>
601 <li class="nav-item<?php print ($tabNavCounter == 0 ? ' tab-active' : ''); ?>">
602 <span class="text"><?php print (isset($section['title']) ? $section['title'] : ''); ?></span>
603 <span class="number"><?php print (isset($section['sub_title']) ? $section['sub_title'] : ''); ?></span>
604 </li>
605 <?php
606 $tabNavCounter++;
607 endforeach;
608 }
609
610 public static function add_tab_content(){
611 $tabContentCounter = 0;
612 $allSections = apply_filters( 'betterdocs_setup_wizard_fields', self::$sections_array );
613 foreach ($allSections as $section) :
614 ?>
615 <div class="tab-content" id="<?php print (isset($section['id']) ? $section['id'] : 'default-nav'); ?>">
616 <table class="form-table" role="presentation">
617 <tbody>
618 <?php
619 if(isset($section['fields']) && is_array($section['fields'])){
620 foreach ( $section['fields'] as $field ) {
621 $methodName = 'callback_' . $field['type'];
622 self::$methodName($field);
623 }
624 }
625 ?>
626 </tbody>
627 </table>
628 </div>
629 <?php
630 $tabContentCounter++;
631 endforeach;
632 }
633
634
635 }
636 BetterDocsSetupWizard::load();
637 }