PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 6.0.0
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v6.0.0
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / includes / openai / admin / data_post_converter.php

data_post_converter.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 6.0.0, at includes/openai/admin/data_post_converter.php

107 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $wpchatbot_pro_professional_init,$wpchatbot_pro_master_init;
3 if((isset($wpchatbot_pro_master_init) && $wpchatbot_pro_master_init->is_valid()) || (isset($wpchatbot_pro_professional_init) && $wpchatbot_pro_professional_init->is_valid()) || (function_exists('get_openaiaddon_valid_license') && get_openaiaddon_valid_license())){
4 ?>
5 <div class="row">
6 <div class="col-md-12">
7 <div class="alert alert-danger my-4">
8 <?php esc_html_e('This feature is still experimental and development is ongoing because of the difficulties in cleaning up the multitudes of tags added by page builders'); ?>
9 </div>
10 <form class="file_form my-4">
11 <div id="wp-chatbot-post-converter">
12 <ul class="checkbox-list">
13 <?php
14 $get_cpt_args = array(
15 'public' => true,
16 );
17 $post_types = get_post_types( $get_cpt_args, 'object' );
18 foreach ($post_types as $post_type) {
19 if($post_type->name != "attachment"){
20 ?>
21 <div class="form-check form-check-inline">
22 <input
23 id="wp_chatbot_data_converter_<?php echo esc_attr( $post_type->name ); ?>"
24 type="checkbox"
25 name="wp_chatbot_data_converter_list[]"
26 value="<?php echo esc_attr( $post_type->name ); ?>" >
27 <label class="form-check-label" for="wp_chatbot_data_converter_<?php echo esc_attr( $post_type->name ); ?>"> <?php echo esc_attr( $post_type->name ); ?></label>
28 </div>
29 <?php
30 }
31 }
32 ?>
33 </ul>
34 </div>
35 <a class="btn btn-default qcld_convert_data"><?php esc_html_e('Convert Data'); ?></a>
36 </form>
37 <h3><?php esc_html_e('Conversions Files'); ?></h3>
38
39 <?php
40
41 global $wpdb;
42
43 $qcld_openai_files_page = isset($_GET['wpage']) && !empty($_GET['wpage']) ? sanitize_text_field($_GET['wpage']) : 1;
44
45 $qcld_openai_files_per_page = 20;
46
47 $qcld_openai_files_offset = ( $qcld_openai_files_page * $qcld_openai_files_per_page ) - $qcld_openai_files_per_page;
48
49 $qcld_openai_files_count_sql = $wpdb->prepare("SELECT COUNT(*) FROM ".$wpdb->posts." f WHERE f.post_type='qcldopenai_convert' AND f.post_status='publish'"); //DB: Nothing to pass as PREPARED STATEMENTS ARGUMENT
50
51 $qcld_openai_files_sql = $wpdb->prepare("SELECT f.* FROM ".$wpdb->posts." f WHERE f.post_type='qcldopenai_convert' AND f.post_status='publish' ORDER BY f.post_date DESC LIMIT %d, %d", $qcld_openai_files_offset, $qcld_openai_files_per_page);
52
53 $qcld_openai_files = $wpdb->get_results( $qcld_openai_files_sql ); //DB Call OK, No Caching OK
54
55 $qcld_openai_files_total = $wpdb->get_var( $qcld_openai_files_count_sql ); //DB Call OK, No Caching OK
56
57 ?>
58
59 <div class="table-responsive">
60 <table class="table table-striped table-bordered qcld_convert_datatable">
61 <thead><tr><td><?php esc_html_e( 'Filename','openai_addon');?></td><td><?php esc_html_e( 'Fine tune with','openai_addon');?></td><td><?php esc_html_e( 'Date of creation','openai_addon');?></td><td><?php esc_html_e( 'Size','openai_addon');?></td><td> <?php esc_html_e( 'Action','openai_addon');?></td></tr></thead>
62 <tbody id="post_conversion_files">
63 <?php
64 if($qcld_openai_files && is_array($qcld_openai_files) && count($qcld_openai_files)):
65 foreach($qcld_openai_files as $qcld_openai_file):
66 $file = wp_upload_dir()['basedir'].'/qcldopenai_site_training/'.$qcld_openai_file->post_title;
67 if(file_exists($file)):
68 $type = explode('_',$qcld_openai_file->post_title);
69 $type = (sizeof($type) == 2) ? 'GPT3.5' : 'Davinci, ADA etc.';
70 ?>
71 <tr>
72 <td><?php echo esc_html($qcld_openai_file->post_title);?></td>
73 <td><?php echo esc_html($type);?></td>
74 <td><?php echo esc_html( date('d.m.Y H:i',strtotime($qcld_openai_file->post_date)) );?></td>
75 <td><?php echo esc_html( date('d.m.Y H:i',strtotime($qcld_openai_file->post_modified)) );?></td>
76 <td><?php echo esc_html( size_format(filesize($file)) );?></td>
77 <td>
78 <a class="button button-small" href="<?php echo esc_url( wp_upload_dir()['baseurl'].'/qcldopenai_site_training/'.esc_html($qcld_openai_file->post_title) )?>" download><?php esc_html_e('Download'); ?></a>
79 <a class="button button-small qcld_delete_training_file" data-file="<?php echo esc_url( wp_upload_dir()['basedir'].'/qcldopenai_site_training/'.esc_html($qcld_openai_file->post_title) )?>" ><?php esc_html_e('Delete'); ?></a>
80 <button class="button button-small qcld_convert_upload" data-lines="<?php echo count(file($file))?>" data-file="<?php echo esc_html($qcld_openai_file->post_title)?>"><?php esc_html_e('Upload As FT Model'); ?></button>
81 </td>
82 </tr>
83 <?php
84 endif;
85 endforeach;
86 endif;
87 ?>
88 </tbody>
89 </table>
90 </div>
91 </div>
92 </div>
93 <?php
94 } else { ?>
95 <div class="row my-4">
96 <div class="col-md-12">
97 <?php esc_html_e('Fine tuning and training is available with the ');?>
98 <a href="https://www.wpbot.pro/pricing/"><?php esc_html_e('WPBot Pro Professional'); ?></a>
99 <?php esc_html_e(' and '); ?>
100 <a href="https://www.wpbot.pro/pricing/"><?php esc_html_e('Master'); ?></a>
101 <?php esc_html_e(' Licenses'); ?>
102
103 </div>
104 </div>
105 <?php } ?>
106
107