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