PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 7.3.2
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v7.3.2
8.7.9 8.7.8 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 All 535 releases
chatbot / inc / qcld_openai_floating_content.php

qcld_openai_floating_content.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 7.3.2, at inc/qcld_openai_floating_content.php

1,940 lines 123.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') or die("You can't access this file directly.");
4
5
6 add_action( 'admin_enqueue_scripts', 'qcld_wpbotpro_floating_openai_floating_admin_enqueue_styles' );
7 if ( ! function_exists( 'qcld_wpbotpro_floating_openai_floating_admin_enqueue_styles' ) ) {
8 function qcld_wpbotpro_floating_openai_floating_admin_enqueue_styles() {
9
10
11 wp_enqueue_script('qc_wpbotpro_floating_openai_bootstrap_script', QCLD_wpCHATBOT_PLUGIN_URL. 'inc/bootstrap.js');
12
13 wp_enqueue_style('qc_wpbotpro_floating_openai_floating_icon_css', QCLD_wpCHATBOT_PLUGIN_URL. 'inc/qcld-floating-icons.css' );
14
15 wp_enqueue_script('qc_wpbotpro_floating_openai_floating_icon', QCLD_wpCHATBOT_PLUGIN_URL. 'inc/qcld-floating-icons.js' );
16
17 wp_localize_script(
18 'qc_wpbotpro_floating_openai_floating_icon',
19 'qc_wpbotpro_floating_vars',
20 array(
21 'ajaxurl' => admin_url('admin-ajax.php'),
22 'ajax_nonce' => wp_create_nonce('kbx-qc'),
23 )
24 );
25 }
26
27 $qcld_disable_floating_icon = get_option('qc_wpbotpro_disable_floating_icon');
28
29 //var_dump( $qcld_disable_floating_icon );
30 //wp_die();
31 if($qcld_disable_floating_icon !== "1" ){
32 add_action('admin_footer', 'qcld_wpbotpro_floating_icon_content_html');
33 }
34 if ( ! function_exists( 'qcld_wpbotpro_floating_icon_content_html' ) ) {
35 function qcld_wpbotpro_floating_icon_content_html(){
36
37 $screen = get_current_screen();
38 //var_dump( $screen->post_type );
39 //wp_die();
40 //if( isset( $screen->post_type ) && ( $screen->post_type == 'page' || $screen->post_type == 'post' ) ){
41
42 ?>
43 <div class="qc_wpbotpro_content_wrap">
44 <label for="linkbait-post-class"><?php echo esc_html__( "AI", 'chatbot' ); ?></label>
45
46 <div class="qc_wpbotpro_content_wrap_inn">
47 <img src="<?php echo esc_url(QCLD_wpCHATBOT_PLUGIN_URL.'inc/ai.png') ?>" alt="loading">
48 <input type="button" class="button" id="qc_wpbotpro_content_generator" value="Generate">
49 </div>
50 </div>
51 <div class="qc_wpbotpro_floating-outer">
52 <div class="qc_wpbotpro_floating">
53
54 <!-- Sidebar Right -->
55 <div class="modal fade right" id="qc_wpbotpro_content_generator_modal" tabindex="-1" role="dialog" data-bs-backdrop="static" >
56 <div class="modal-dialog" role="document">
57 <div class="modal-content">
58 <div class="modal-header">
59 <h5 class="modal-title" id="keywords_resultLabel"><?php echo esc_html__('Content Generator', 'chatbot' ); ?></h5>
60 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
61 </div>
62 <div class="modal-body">
63 <div class="modal-list">
64 <?php
65
66
67 $open_ai_api_key = get_option('open_ai_api_key');
68 if( empty($open_ai_api_key) ){
69
70 ?>
71 <p style="color:red;"><b><?php esc_html_e('Please add API key from','chatbot'); ?> <a href="<?php echo esc_url(admin_url('admin.php?page=wpbot_openAi')); ?>" target="_blank"><?php esc_html_e('Settings.','chatbot'); ?></a> <?php esc_html_e('Otherwise, AI will not work.', 'chatbot'); ?></b></p>
72 <?php } ?>
73 <ul class="nav nav-tabs" id="myTab" role="tablist">
74 <li class="nav-item" role="presentation">
75 <button class="nav-link active" id="article-tab" data-bs-toggle="tab" data-bs-target="#article-tab-pane" type="button" role="tab" aria-controls="article-tab-pane" aria-selected="true"><?php esc_html_e('Generate New Article', 'chatbot'); ?></button>
76 </li>
77 <li class="nav-item" role="presentation">
78 <button class="nav-link" id="content-tab" data-bs-toggle="tab" data-bs-target="#content-tab-pane" type="button" role="tab" aria-controls="content-tab-pane" aria-selected="false"><?php esc_html_e('Rewrite Contents', 'chatbot'); ?></button>
79 </li>
80 <li class="nav-item" role="presentation">
81 <button class="nav-link" id="content-tab" data-bs-toggle="tab" data-bs-target="#playground-tab-pane" type="button" role="tab" aria-controls="playground-tab-pane" aria-selected="false"><?php esc_html_e('Playground', 'chatbot'); ?></button>
82 </li>
83 </ul>
84
85 <div class="tab-content" id="myTabContent">
86 <div class="tab-pane fade show active" id="article-tab-pane" role="tabpanel" aria-labelledby="article-tab" tabindex="0">
87 <div class="qc_wpbotpro_floating">
88 <div class="qc_wpbotpro_floating-input">
89 <div class="qc_wpbotpro_floating-input-field">
90 <label for="qc_wpbotpro_floating_openai_keyword_suggestion" class="form-label"><?php esc_html_e('Prompt', 'chatbot'); ?></label><br>
91 <input type="text" id="qc_wpbotpro_floating_openai_keyword_suggestion_mf" class="form-control" data-press="qc_wpbotpro_floating_openai_keyword_suggestion" placeholder="<?php esc_html_e( "Write me a long article on how to make money online", 'chatbot' ); ?>"><br>
92 <p><?php esc_html_e( "Ex: Write me a long article on how to make money online", 'chatbot' ); ?></p>
93 </div>
94
95 </div>
96 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
97 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
98 <div class="qc_wpbotpro_ai_con">
99 <label for="qc_wpbotpro_article_number_of_heading"><?php esc_html_e( "How many headings?", 'chatbot' ); ?> </label>
100 <input type="number" placeholder="e.g. 5" id="qc_wpbotpro_article_number_of_heading" class="qc_wpbotpro_article_number_of_heading" name="qc_wpbotpro_article_number_of_heading" value="">
101 </div>
102
103 <div class="qc_wpbotpro_ai_con">
104 <label for="qc_wpbotpro_article_heading_tag"><?php esc_html_e( "Heading Tag", 'chatbot' ); ?> </label>
105 <select name="qc_wpbotpro_article_heading_tag" id="qc_wpbotpro_article_heading_tag">
106 <option value="h1"><?php esc_html_e( "h1", 'chatbot' ); ?></option>
107 <option value="h2"><?php esc_html_e( "h2", 'chatbot' ); ?></option>
108 <option value="h3"><?php esc_html_e( "h3", 'chatbot' ); ?></option>
109 <option value="h4"><?php esc_html_e( "h4", 'chatbot' ); ?></option>
110 <option value="h5"><?php esc_html_e( "h5", 'chatbot' ); ?></option>
111 <option value="h6"><?php esc_html_e( "h6", 'chatbot' ); ?></option>
112 </select>
113 </div>
114
115 <div class="qc_wpbotpro_ai_con">
116 <label for="qc_wpbotpro_article_heading_style"><?php esc_html_e( "Writing Style", 'chatbot' ); ?> </label>
117 <select name="qc_wpbotpro_article_heading_style" id="qc_wpbotpro_article_heading_style">
118 <option value="infor"><?php esc_html_e( "Informative", 'chatbot' ); ?></option>
119 <option value="analy"><?php esc_html_e( "Analytical", 'chatbot' ); ?></option>
120 <option value="argum"><?php esc_html_e( "Argumentative", 'chatbot' ); ?></option>
121 <option value="creat"><?php esc_html_e( "Creative", 'chatbot' ); ?></option>
122 <option value="criti"><?php esc_html_e( "Critical", 'chatbot' ); ?></option>
123 <option value="descr"><?php esc_html_e( "Descriptive", 'chatbot' ); ?></option>
124 <option value="evalu"><?php esc_html_e( "Evaluative", 'chatbot' ); ?></option>
125 <option value="expos"><?php esc_html_e( "Expository", 'chatbot' ); ?></option>
126 <option value="journ"><?php esc_html_e( "Journalistic", 'chatbot' ); ?></option>
127 <option value="narra"><?php esc_html_e( "Narrative", 'chatbot' ); ?></option>
128 <option value="persu"><?php esc_html_e( "Persuasive", 'chatbot' ); ?></option>
129 <option value="refle"><?php esc_html_e( "Reflective", 'chatbot' ); ?></option>
130 <option value="simpl"><?php esc_html_e( "Simple", 'chatbot' ); ?></option>
131 <option value="techn"><?php esc_html_e( "Technical", 'chatbot' ); ?></option>
132 <option value="repor"><?php esc_html_e( "Report", 'chatbot' ); ?></option>
133 <option value="resea"><?php esc_html_e( "Research", 'chatbot' ); ?></option>
134 </select>
135 </div>
136 </div>
137 </div>
138 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
139 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
140
141 <div class="qc_wpbotpro_ai_con">
142 <label for="qc_wpbotpro_article_heading_tone"><?php esc_html_e( "Writing Tone", 'chatbot' ); ?> </label>
143 <select name="qc_wpbotpro_article_heading_tone" id="qc_wpbotpro_article_heading_tone">
144 <option value="formal"><?php esc_html_e( "Formal", 'chatbot' ); ?></option>
145 <option value="asser"><?php esc_html_e( "Assertive", 'chatbot' ); ?></option>
146 <option value="cheer"><?php esc_html_e( "Cheerful", 'chatbot' ); ?></option>
147 <option value="humor"><?php esc_html_e( "Humorous", 'chatbot' ); ?></option>
148 <option value="informal"><?php esc_html_e( "Informal", 'chatbot' ); ?></option>
149 <option value="inspi"><?php esc_html_e( "Inspirational", 'chatbot' ); ?></option>
150 <option value="neutr"><?php esc_html_e( "Neutral", 'chatbot' ); ?></option>
151 <option value="profe"><?php esc_html_e( "Professional", 'chatbot' ); ?></option>
152 <option value="sarca"><?php esc_html_e( "Sarcastic", 'chatbot' ); ?></option>
153 <option value="skept"><?php esc_html_e( "Skeptical", 'chatbot' ); ?></option>
154 <option value="curio"><?php esc_html_e( "Curious", 'chatbot' ); ?></option>
155 <option value="disap"><?php esc_html_e( "Disappointed", 'chatbot' ); ?></option>
156 <option value="encou"><?php esc_html_e( "Encouraging", 'chatbot' ); ?></option>
157 <option value="optim"><?php esc_html_e( "Optimistic", 'chatbot' ); ?></option>
158 <option value="surpr"><?php esc_html_e( "Surprised", 'chatbot' ); ?></option>
159 <option value="worry"><?php esc_html_e( "Worried", 'chatbot' ); ?></option>
160
161
162 </select>
163 </div>
164
165 <div class="qc_wpbotpro_ai_con">
166 <label for="qc_wpbotpro_article_img_size" ><?php esc_html_e('Image Size', 'chatbot'); ?> </label>
167 <select name="qc_wpbotpro_article_img_size" id="qc_wpbotpro_article_img_size">
168 <!-- <option value="256x256"><?php esc_html_e( "256x256", 'chatbot' ); ?> </option>
169 <option value="512x512"><?php esc_html_e( "512x512", 'chatbot' ); ?> </option> -->
170 <option value="1024x1024"><?php esc_html_e( "1024x1024", 'chatbot' ); ?> </option>
171 <option value="1792x1024"><?php esc_html_e('1792x1024', 'chatbot'); ?></option>
172 <option value="1024x1792"><?php esc_html_e('1024x1792', 'chatbot'); ?></option>
173 </select>
174 </div>
175
176 <div class="qc_wpbotpro_ai_con">
177 <label for="qc_wpbotpro_article_language"><?php esc_html_e( "Language", 'chatbot' ); ?> </label>
178 <select name="qc_wpbotpro_article_language" id="qc_wpbotpro_article_language">
179 <option value="en"><?php esc_html_e( "English", 'chatbot' ); ?> </option>
180 <option value="ar"><?php esc_html_e( "Arabic", 'chatbot' ); ?> </option>
181 <option value="bg"><?php esc_html_e( "Bulgarian", 'chatbot' ); ?> </option>
182 <option value="zh"><?php esc_html_e( "Chinese", 'chatbot' ); ?> </option>
183 <option value="cs"><?php esc_html_e( "Czech", 'chatbot' ); ?> </option>
184 <option value="nl"><?php esc_html_e( "Dutch", 'chatbot' ); ?> </option>
185 <option value="fr"> <?php esc_html_e( "French", 'chatbot' ); ?> </option>
186 <option value="de"> <?php esc_html_e( "German", 'chatbot' ); ?> </option>
187 <option value="el"> <?php esc_html_e( "Greek", 'chatbot' ); ?> </option>
188 <option value="hi"> <?php esc_html_e( "Hindi", 'chatbot' ); ?> </option>
189 <option value="hu"> <?php esc_html_e( "Hungarian", 'chatbot' ); ?> </option>
190 <option value="id"> <?php esc_html_e( "Indonesian", 'chatbot' ); ?> </option>
191 <option value="it"> <?php esc_html_e( "Italian", 'chatbot' ); ?> </option>
192 <option value="ja"> <?php esc_html_e( "Japanese", 'chatbot' ); ?> </option>
193 <option value="ko"> <?php esc_html_e( "Korean", 'chatbot' ); ?> </option>
194 <option value="pl"> <?php esc_html_e( "Polish", 'chatbot' ); ?> </option>
195 <option value="pt"> <?php esc_html_e( "Portuguese", 'chatbot' ); ?> </option>
196 <option value="ro"> <?php esc_html_e( "Romanian", 'chatbot' ); ?> </option>
197 <option value="ru"> <?php esc_html_e( "Russian", 'chatbot' ); ?> </option>
198 <option value="es"> <?php esc_html_e( "Spanish", 'chatbot' ); ?> </option>
199 <option value="sv"> <?php esc_html_e( "Swedish", 'chatbot' ); ?> </option>
200 <option value="tr"> <?php esc_html_e( "Turkish", 'chatbot' ); ?> </option>
201 <option value="uk"> <?php esc_html_e( "Ukranian", 'chatbot' ); ?> </option>
202 </select>
203 </div>
204 </div>
205 </div>
206 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
207 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
208
209 <div class="qc_wpbotpro_ai_con">
210 <label for="qc_wpbotpro_article_label_anchor_text"><?php esc_html_e( "Anchor Text", 'chatbot' ); ?> </label>
211 <input type="text" id="qc_wpbotpro_article_label_anchor_text" placeholder="e.g. battery life" class="qc_wpbotpro_article_label_anchor_text" name="qc_wpbotpro_article_label_anchor_text" >
212 </div>
213
214 <div class="qc_wpbotpro_ai_con">
215 <label for="qc_wpbotpro_article_target_url"><?php esc_html_e( "Target URL", 'chatbot' ); ?> </label>
216 <input type="url" id="qc_wpbotpro_article_target_url" placeholder="https://..." class="qc_wpbotpro_article_target_url" name="qc_wpbotpro_article_target_url">
217 </div>
218
219 <div class="qc_wpbotpro_ai_con">
220 <label for="qc_wpbotpro_article_target_label_cta"><?php esc_html_e( "Add Call-to-Action", 'chatbot' ); ?> </label>
221 <input type="url" id="qc_wpbotpro_article_target_label_cta" placeholder="https://..." class="qc_wpbotpro_article_target_label_cta" name="qc_wpbotpro_article_target_label_cta">
222 </div>
223
224
225 </div>
226 </div>
227 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
228 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
229
230
231 <div class="qc_wpbotpro_ai_con">
232 <label for="qc_wpbotpro_article_cta_pos"><?php esc_html_e( "Call-to-Action Position", 'chatbot' ); ?> </label>
233 <select name="qc_wpbotpro_article_cta_pos" id="qc_wpbotpro_article_cta_pos">
234 <option value="beg"><?php esc_html_e( "Beginning", 'chatbot' ); ?></option>
235 <option value="end"><?php esc_html_e( "End", 'chatbot' ); ?></option>
236 </select>
237 <p><i><?php esc_html_e( "Use Call-to-Action Position", 'chatbot' ); ?></i></p>
238 </div>
239
240 <div class="qc_wpbotpro_ai_con">
241 <label for="qc_wpbotpro_article_label_keywords"><?php esc_html_e( "Add Keywords", 'chatbot' ); ?> </label>
242 <input type="text" id="qc_wpbotpro_article_label_keywords" placeholder="Write Keywords..." class="qc_wpbotpro_article_label_keywords" name="qc_wpbotpro_article_label_keywords">
243 <p><i><?php esc_html_e( "Use comma to seperate keywords", 'chatbot' ); ?></i></p>
244 </div>
245
246 <div class="qc_wpbotpro_ai_con">
247 <label for="qc_wpbotpro_article_label_word_to_avoid"><?php esc_html_e( "Keywords to Avoid", 'chatbot' ); ?> </label>
248 <input type="text" id="qc_wpbotpro_article_label_word_to_avoid" placeholder="Write Keywords..." class="qc_wpbotpro_article_label_word_to_avoid" name="qc_wpbotpro_article_label_word_to_avoid" value="">
249 <p><i><?php esc_html_e( "Use comma to seperate keywords", 'chatbot' ); ?></i></p>
250 </div>
251 </div>
252 </div>
253
254 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
255 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
256
257 <div class="qc_wpbotpro_ai_con">
258 <label for="qc_wpbotpro_article_label_keywords_bold"><?php esc_html_e( "Make Keywords Bold", 'chatbot' ); ?> </label>
259 <input type="checkbox" id="qc_wpbotpro_article_label_keywords_bold" class="qc_wpbotpro_article_label_keywords_bold" name="qc_wpbotpro_article_label_keywords_bold" value="1">
260 </div>
261
262 <div class="qc_wpbotpro_ai_con">
263 <label for="qc_wpbotpro_article_heading_img"><?php esc_html_e( "Add Image", 'chatbot' ); ?> </label>
264 <input type="checkbox" name="qc_wpbotpro_article_heading_img" id="qc_wpbotpro_article_heading_img" class="qc_wpbotpro_article_heading_img" value="1"/>
265 </div>
266
267 <div class="qc_wpbotpro_ai_con">
268 <label for="qc_wpbotpro_article_heading_tagline"><?php esc_html_e( "Add Tagline", 'chatbot' ); ?> </label>
269 <input type="checkbox" id="qc_wpbotpro_article_heading_tagline" name="qc_wpbotpro_article_heading_tagline" class="qc_wpbotpro_article_heading_tagline" value="1" />
270 </div>
271
272
273 </div>
274 </div>
275 <div class="qc_wpbotpro_floating-input qc_wpbotpro_floating_pro_feature_content">
276 <div class="qc_wpbotpro_floating-input-field qc_wpbotpro_floating-input-field_ai_wrap">
277
278 <div class="qc_wpbotpro_ai_con">
279 <label for="qc_wpbotpro_article_heading_intro"><?php esc_html_e( "Add Introduction", 'chatbot' ); ?> </label>
280 <input type="checkbox" id="qc_wpbotpro_article_heading_intro" name="qc_wpbotpro_article_heading_intro" class="qc_wpbotpro_article_heading_intro" value="1"/>
281 </div>
282
283 <div class="qc_wpbotpro_ai_con">
284 <label for="qc_wpbotpro_article_heading_conclusion"><?php esc_html_e( "Add Conclusion", 'chatbot' ); ?> </label>
285 <input type="checkbox" id="qc_wpbotpro_article_heading_conclusion" name="qc_wpbotpro_article_heading_conclusion" class="qc_wpbotpro_article_heading_conclusion" value="1" />
286 </div>
287
288 <div class="qc_wpbotpro_ai_con">
289 <label for="qc_wpbotpro_article_heading_faq"><?php esc_html_e( "Add Faq", 'chatbot' ); ?> </label>
290 <input type="checkbox" id="qc_wpbotpro_article_heading_faq" name="qc_wpbotpro_article_heading_faq" class="qc_wpbotpro_article_heading_faq" value="1" />
291 </div>
292
293 </div>
294 </div>
295 <button id="qc_wpbotpro_floating_openai_keyword_suggestion" class="btn btn-info" ><?php esc_html_e('Generate', 'chatbot'); ?></button>
296 <p style="color:red;"><b><?php esc_html_e('(Please','chatbot'); ?> <a href="<?php echo esc_url('https://platform.openai.com/settings/organization/billing/'); ?>" target="_blank"><?php esc_html_e('Pre-purchase credit','chatbot'); ?></a> <?php esc_html_e('from OpenAI API platform and increase the API usage limit. Otherwise, AI features will not work','chatbot'); ?></b></p>
297 <hr/>
298 <div class="qc_wpbotpro_floating_bait_single_field">
299 <div id="qc_wpbotpro_floating_bait_article_keyword_data">
300 <div class="qcld_copied-content-wrap">
301 <div class="qcld_copied-content_text btn d-none link-success"><?php esc_html_e("Copied", 'chatbot'); ?></div>
302 <a class="btn btn-sm btn-secondary qcld-copied-content_text"><span class="dashicons dashicons-admin-page"></span></a>
303 </div>
304 <?php
305 wp_editor('','qc_wpbotpro_floating_content_result_msg', array('media_buttons' => false, 'textarea_name' => 'qc_wpbotpro_floating_content_result_msg', 'editor_height' => 400 ) );
306 ?>
307 <div class="qc_wpbotpro_floating_content_result_wrap">
308 <div class="qc_wpbotpro_floating_rewrite_result_count"></div>
309 </div>
310 </div>
311
312 <div class="qcld_seo-playground-buttons">
313 <button class="button button-primary qc_wpbotpro_floating_openai_article_save" ><?php esc_html_e("Save as Draft", 'chatbot'); ?></button>
314 <button class="button qc_wpbotpro_floating_openai_article_clear"><?php esc_html_e("Clear", 'chatbot'); ?></button>
315 </div>
316 </div>
317 </div>
318
319 </div>
320 <div class="tab-pane fade" id="content-tab-pane" role="tabpanel" aria-labelledby="content-tab" tabindex="0">
321
322
323 <div class="qc_wpbotpro_floating">
324 <h5><?php esc_html_e( 'Rewrite Contents', 'chatbot' ); ?> </h5>
325 <textarea id="qc_wpbotpro_floating_content_rewrite" class="form-control" data-press="qc_wpbotpro_floating_content_rewrite"></textarea>
326 <div class="qc_wpbotpro_floating_content_rewrite_count_wrap"><span class="qc_wpbotpro_floating_content_rewrite_count">0</span></div>
327 <button id="qc_wpbotpro_floating_openai_keyword_rewrite_article" class="btn btn-info"><?php esc_html_e( 'Generate', 'chatbot' ); ?></button>
328 <div id="qc_wpbotpro_floating_content_rewrite_result">
329 <div class="qcld_copied-content-wrap">
330 <div class="qcld_copied-content btn d-none link-success"><?php esc_html_e("Copied", 'chatbot'); ?></div>
331 <a class="btn btn-sm btn-secondary qcld-copied-content"><span class="dashicons dashicons-admin-page"></span></a>
332 </div>
333 <?php
334 wp_editor('','qc_wpbotpro_floating_content_rewrite_result_msg', array('media_buttons' => false, 'textarea_name' => 'qc_wpbotpro_floating_content_rewrite_result_msg', 'editor_height' => 400 ) );
335 ?>
336 <div class="qc_wpbotpro_floating_rewrite_result_count_wrap">
337 <div class="qc_wpbotpro_floating_rewrite_result_count"></div>
338 </div>
339 </div>
340 </div>
341
342 </div>
343 <div class="tab-pane fade" id="playground-tab-pane" role="tabpanel" aria-labelledby="content-tab" tabindex="0">
344
345
346 <div class="qc_wpbotpro_floating qc_wpbotpro_floating-playground">
347 <table class="form-table form-table-prompt">
348 <tbody>
349 <tr>
350 <th scope="row"><?php esc_html_e("Enter your prompt", 'chatbot'); ?></th>
351 <td>
352 <input type="text" class="regular-text qc_wpbotpro_floating_prompt" placeholder="Write Your Prompt">
353 &nbsp;<button class="btn btn-info qc_wpbotpro_floating_openai_generator_button"><?php esc_html_e("Generate", 'chatbot'); ?></button>
354 &nbsp;<button class="btn btn-info qc_wpbotpro_floating_openai_generator_stop"><?php esc_html_e("Stop", 'chatbot'); ?></button>
355 <p style="color:red;"><b><?php esc_html_e('(Please','chatbot'); ?> <a href="<?php echo esc_url('https://platform.openai.com/settings/organization/billing/'); ?>" target="_blank"><?php esc_html_e('Pre-purchase credit','chatbot'); ?></a> <?php esc_html_e('from OpenAI API platform and increase the API usage limit. Otherwise, AI features will not work)','chatbot'); ?></b></p>
356 </td>
357 </tr>
358 <tr>
359 <th scope="row"><?php esc_html_e("Result", 'chatbot'); ?></th>
360 <td>
361 <?php
362 wp_editor('','qc_wpbotpro_floating_generator_result', array('media_buttons' => false, 'textarea_name' => 'qc_wpbotpro_floating_generator_result'));
363 ?>
364 <p class="qcld_seo-playground-buttons">
365 <button class="button button-primary qc_wpbotpro_floating_openai_playground_save"><?php esc_html_e("Save as Draft", 'chatbot'); ?></button>
366 <button class="button qc_wpbotpro_floating_openai_playground_clear"><?php esc_html_e("Clear", 'chatbot'); ?></button>
367 </p>
368 </td>
369 </tr>
370 </tbody>
371 </table>
372
373 </div>
374
375 </div>
376 </div>
377
378
379 </div>
380 </div>
381 </div>
382
383 </div>
384 </div>
385 </div>
386 </div>
387 <?php
388 //}
389 }
390 }
391
392
393 add_action( 'wp_ajax_qc_wpbotpro_floating_openai_keyword_suggestion_content_function', 'qc_wpbotpro_floating_openai_keyword_suggestion_content_callback' );
394 add_action( 'wp_ajax_nopriv_qc_wpbotpro_floating_openai_keyword_suggestion_content_function', 'qc_wpbotpro_floating_openai_keyword_suggestion_content_callback' );
395
396 if ( ! function_exists( 'qc_wpbotpro_floating_openai_keyword_suggestion_content_callback' ) ) {
397 function qc_wpbotpro_floating_openai_keyword_suggestion_content_callback(){
398
399 check_ajax_referer( 'kbx-qc', 'security');
400
401 set_time_limit(600);
402
403 $OPENAI_API_KEY = get_option('open_ai_api_key');
404 $ai_engines = get_option('openai_engines');
405 $max_token = get_option('openai_max_tokens') ? get_option('openai_max_tokens') : 4000;
406 $temperature = get_option('openai_temperature') ? get_option('openai_temperature') : 0;
407 $ppenalty = get_option('presence_penalty');
408 $fpenalty = get_option('frequency_penalty');
409
410 $qc_wpbotpro_article_text = isset($_POST['keyword']) ? sanitize_text_field( $_POST['keyword'] ) : '';
411 $keyword_number = isset( $_POST['keyword_number'] ) ? sanitize_text_field( $_POST['keyword_number'] ) : '';
412 $qc_wpbotpro_article_language = isset($_POST['qc_wpbotpro_article_language']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_language'] ) : '';
413 $qc_wpbotpro_article_number_of_heading = isset($_POST['qc_wpbotpro_article_number_of_heading']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_number_of_heading'] ) : '';
414 $qc_wpbotpro_article_heading_tag = isset($_POST['qc_wpbotpro_article_heading_tag']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_tag'] ) : '';
415 $qc_wpbotpro_article_heading_style = isset($_POST['qc_wpbotpro_article_heading_style']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_style'] ) : '';
416 $qc_wpbotpro_article_heading_tone = isset($_POST['qc_wpbotpro_article_heading_tone']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_tone'] ) : '';
417 $qc_wpbotpro_article_heading_img = isset($_POST['qc_wpbotpro_article_heading_img']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_img'] ) : '';
418 $qc_wpbotpro_article_heading_tagline = isset($_POST['qc_wpbotpro_article_heading_tagline']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_tagline'] ) : '';
419 $qc_wpbotpro_article_heading_intro = isset($_POST['qc_wpbotpro_article_heading_intro']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_intro'] ) : '';
420 $qc_wpbotpro_article_heading_conclusion = isset($_POST['qc_wpbotpro_article_heading_conclusion']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_heading_conclusion'] ) : '';
421 $qc_wpbotpro_article_label_anchor_text = isset($_POST['qc_wpbotpro_article_label_anchor_text']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_label_anchor_text'] ) : '';
422 $qc_wpbotpro_article_target_url = isset($_POST['qc_wpbotpro_article_target_url']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_target_url'] ) : '';
423 $qc_wpbotpro_article_target_label_cta = isset($_POST['qc_wpbotpro_article_target_label_cta']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_target_label_cta'] ) : '';
424 $qc_wpbotpro_article_cta_pos = isset($_POST['qc_wpbotpro_article_cta_pos']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_cta_pos'] ) : '';
425 $qc_wpbotpro_article_label_keywords = isset($_POST['qc_wpbotpro_article_label_keywords']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_label_keywords'] ) : '';
426 $qc_wpbotpro_article_label_word_to_avoid = isset($_POST['qc_wpbotpro_article_label_word_to_avoid']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_label_word_to_avoid'] ) : '';
427 $qc_wpbotpro_article_label_keywords_bold = isset($_POST['qc_wpbotpro_article_label_keywords_bold']) ? intval( $_POST['qc_wpbotpro_article_label_keywords_bold'] ) : '';
428 $qc_wpbotpro_article_heading_faq = isset($_POST['qc_wpbotpro_article_heading_faq']) ? intval( $_POST['qc_wpbotpro_article_heading_faq'] ) : '';
429
430 $img_size = isset($_POST['qc_wpbotpro_article_img_size']) ? sanitize_text_field( $_POST['qc_wpbotpro_article_img_size'] ) : '1024x1024';
431 //$img_size = "512x512";
432
433 if ( empty($qc_wpbotpro_article_language) ) {
434 $qc_wpbotpro_article_language = "en";
435 }
436 // if number of heading is not set, set it to 5
437 if ( empty($qc_wpbotpro_article_number_of_heading) ) {
438 $qc_wpbotpro_article_number_of_heading = 2;
439 }
440 // if writing style is not set, set it to descriptive
441 if ( empty($qc_wpbotpro_article_heading_style) ) {
442 $qc_wpbotpro_article_heading_style = "infor";
443 }
444 // if writing tone is not set, set it to assertive
445 if ( empty($qc_wpbotpro_article_heading_tone) ) {
446 $qc_wpbotpro_article_heading_tone = "formal";
447 }
448 // if heading tag is not set, set it to h2
449 if ( empty($qc_wpbotpro_article_heading_tag) ) {
450 $qc_wpbotpro_article_heading_tag = "h2";
451 }
452
453 $writing_style = apply_filters('qc_wpbotpro_floating_openai_filter_for_style', $qc_wpbotpro_article_heading_style, $qc_wpbotpro_article_language );
454 $tone_text = apply_filters('qc_wpbotpro_floating_openai_filter_for_tone', $qc_wpbotpro_article_heading_tone, $qc_wpbotpro_article_language );
455
456 if ( $qc_wpbotpro_article_language == "en" ) {
457
458 if ( $qc_wpbotpro_article_number_of_heading == 1 ) {
459 $prompt_text = " blog topic about ";
460 } else {
461 $prompt_text = " blog topics about ";
462 }
463
464 $intro_text = "Write an introduction about ";
465 $conclusion_text = "Write a conclusion about ";
466 $tagline_text = "Write a tagline about ";
467 $introduction = "Introduction";
468 $conclusion = "Conclusion";
469 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " questions and answers about " . $qc_wpbotpro_article_text . ".";
470 $faq_heading = "Q&A";
471 $style_text = "Writing style: " . $writing_style . ".";
472
473 if ( empty($qc_wpbotpro_article_label_keywords) ) {
474 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
475 } else {
476 $keyword_text = ". Keywords: " . $qc_wpbotpro_article_label_keywords . ".";
477 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
478 }
479
480 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
481
482 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
483 $avoid_text = " Exclude following keywords: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
484 $myprompt = $myprompt . $avoid_text;
485 }
486
487 $myintro = $intro_text . $qc_wpbotpro_article_text;
488 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
489 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
490 $mycta = "Write a Call to action about: " . $qc_wpbotpro_article_text . " and create a href tag link to: " . $qc_wpbotpro_article_target_label_cta . ".";
491
492 } else if ( $qc_wpbotpro_article_language == "de" ) {
493 $prompt_text = " blog-Themen über ";
494 $intro_text = "Schreiben Sie eine Einführung über ";
495 $conclusion_text = "Schreiben Sie ein Fazit über ";
496 $tagline_text = "Schreiben Sie eine Tagline über ";
497 $introduction = "Einführung";
498 $conclusion = "Fazit";
499 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " Fragen und Antworten über " . $qc_wpbotpro_article_text . ".";
500 $faq_heading = "Fragen und Antworten";
501 $style_text = "Schreibstil: " . $writing_style . ".";
502
503 if ( empty($qc_wpbotpro_article_label_keywords) ) {
504 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
505 } else {
506 $keyword_text = ". Schlüsselwörter: " . $qc_wpbotpro_article_label_keywords . ".";
507 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
508 }
509
510 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
511
512 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
513 $avoid_text = " Ausschließen folgende Schlüsselwörter: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
514 $myprompt = $myprompt . $avoid_text;
515 }
516
517 $myintro = $intro_text . $qc_wpbotpro_article_text;
518 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
519 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
520 $mycta = "Schreiben Sie eine Call to action über: " . $qc_wpbotpro_article_text . " und erstellen Sie einen href-Tag-Link zu: " . $qc_wpbotpro_article_target_label_cta . ".";
521 } else if ( $qc_wpbotpro_article_language == "fr" ) {
522 $prompt_text = " sujets de blog sur ";
523 $intro_text = "Écrivez une introduction sur ";
524 $conclusion_text = "Écrivez une conclusion sur ";
525 $tagline_text = "Rédigez un slogan sur ";
526 $introduction = "Introduction";
527 $conclusion = "Conclusion";
528 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " questions et réponses sur " . $qc_wpbotpro_article_text . ".";
529 $faq_heading = "Questions et réponses";
530 $style_text = "Style d'écriture: " . $writing_style . ".";
531
532 if ( empty($qc_wpbotpro_article_label_keywords) ) {
533 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
534 } else {
535 $keyword_text = ". Mots clés: " . $qc_wpbotpro_article_label_keywords . ".";
536 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
537 }
538
539 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
540
541 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
542 $avoid_text = " Exclure les mots-clés suivants: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
543 $myprompt = $myprompt . $avoid_text;
544 }
545
546 $myintro = $intro_text . $qc_wpbotpro_article_text;
547 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
548 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
549 $mycta = "Écrivez un appel à l'action sur: " . $qc_wpbotpro_article_text . " et créez un lien href tag vers: " . $qc_wpbotpro_article_target_label_cta . ".";
550
551 } else if ( $qc_wpbotpro_article_language == "es" ) {
552 $prompt_text = " temas de blog sobre ";
553 $intro_text = "Escribe una introducción sobre ";
554 $conclusion_text = "Escribe una conclusión sobre ";
555 $tagline_text = "Escribe una eslogan sobre ";
556 $introduction = "Introducción";
557 $conclusion = "Conclusión";
558 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " preguntas y respuestas sobre " . $qc_wpbotpro_article_text . ".";
559 $faq_heading = "Preguntas y respuestas";
560 $style_text = "Estilo de escritura: " . $writing_style . ".";
561
562 if ( empty($qc_wpbotpro_article_label_keywords) ) {
563 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
564 } else {
565 $keyword_text = ". Palabras clave: " . $qc_wpbotpro_article_label_keywords . ".";
566 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
567 }
568
569 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
570
571 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
572 $avoid_text = " Excluir las siguientes palabras clave: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
573 $myprompt = $myprompt . $avoid_text;
574 }
575
576 $myintro = $intro_text . $qc_wpbotpro_article_text;
577 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
578 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
579 $mycta = "Escribe una llamada a la acción sobre: " . $qc_wpbotpro_article_text . " y cree un enlace de etiqueta html <a href> para: " . $qc_wpbotpro_article_target_label_cta . ".";
580
581 } else if ( $qc_wpbotpro_article_language == "it" ) {
582 $prompt_text = " argomenti di blog su ";
583 $intro_text = "Scrivi un'introduzione su ";
584 $conclusion_text = "Scrivi una conclusione su ";
585 $tagline_text = "Scrivi un slogan su ";
586 $introduction = "Introduzione";
587 $conclusion = "Conclusione";
588 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " domande e risposte su " . $qc_wpbotpro_article_text . ".";
589 $faq_heading = "Domande e risposte";
590 $style_text = "Stile di scrittura: " . $writing_style . ".";
591
592 if ( empty($qc_wpbotpro_article_label_keywords) ) {
593 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
594 } else {
595 $keyword_text = ". Parole chiave: " . $qc_wpbotpro_article_label_keywords . ".";
596 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
597 }
598
599 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
600
601 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
602 $avoid_text = " Escludere le seguenti parole chiave: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
603 $myprompt = $myprompt . $avoid_text;
604 }
605
606 $myintro = $intro_text . $qc_wpbotpro_article_text;
607 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
608 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
609 $mycta = "Scrivi un call to action su: " . $qc_wpbotpro_article_text . " e crea un href tag link a: " . $qc_wpbotpro_article_target_label_cta . ".";
610
611 } else if ( $qc_wpbotpro_article_language == "pt" ) {
612 $prompt_text = " tópicos de blog sobre ";
613 $intro_text = "Escreva uma introdução sobre ";
614 $conclusion_text = "Escreva uma conclusão sobre ";
615 $tagline_text = "Escreva um slogan sobre ";
616 $introduction = "Introdução";
617 $conclusion = "Conclusão";
618 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " perguntas e respostas sobre " . $qc_wpbotpro_article_text . ".";
619 $faq_heading = "Perguntas e respostas";
620 $style_text = "Estilo de escrita: " . $writing_style . ".";
621
622 if ( empty($qc_wpbotpro_article_label_keywords) ) {
623 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
624 } else {
625 $keyword_text = ". Palavras-chave: " . $qc_wpbotpro_article_label_keywords . ".";
626 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
627 }
628
629 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
630
631 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
632 $avoid_text = " Excluir as seguintes palavras-chave: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
633 $myprompt = $myprompt . $avoid_text;
634 }
635
636 $myintro = $intro_text . $qc_wpbotpro_article_text;
637 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
638 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
639 $mycta = "Escreva um call to action sobre: " . $qc_wpbotpro_article_text . " e crie um href tag link para: " . $qc_wpbotpro_article_target_label_cta . ".";
640
641 } else if ( $qc_wpbotpro_article_language == "nl" ) {
642 $prompt_text = " blogonderwerpen over ";
643 $intro_text = "Schrijf een inleiding over ";
644 $conclusion_text = "Schrijf een conclusie over ";
645 $tagline_text = "Schrijf een slogan over ";
646 $introduction = "Inleiding";
647 $conclusion = "Conclusie";
648 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " vragen en antwoorden over " . $qc_wpbotpro_article_text . ".";
649 $faq_heading = "Vragen en antwoorden";
650 $style_text = "Schrijfstijl: " . $writing_style . ".";
651
652 if ( empty($qc_wpbotpro_article_label_keywords) ) {
653 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
654 } else {
655 $keyword_text = ". Trefwoorden: " . $qc_wpbotpro_article_label_keywords . ".";
656 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
657 }
658
659 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
660
661 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
662 $avoid_text = " Sluit de volgende trefwoorden uit: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
663 $myprompt = $myprompt . $avoid_text;
664 }
665
666 $myintro = $intro_text . $qc_wpbotpro_article_text;
667 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
668 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
669 $mycta = "Schrijf een call to action over: " . $qc_wpbotpro_article_text . " en maak een href tag link naar: " . $qc_wpbotpro_article_target_label_cta . ".";
670
671 } else if ( $qc_wpbotpro_article_language == "ru" ) {
672 $prompt_text = "Перечислите ";
673 $prompt_last = " идей блога о ";
674 $intro_text = "Напишите введение о ";
675 $conclusion_text = "Напишите заключение о ";
676 $tagline_text = "Напишите слоган о ";
677 $introduction = "Введение";
678 $conclusion = "Заключение";
679 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " вопросов и ответов о " . $qc_wpbotpro_article_text . ".";
680 $faq_heading = "Вопросы и ответы";
681 $style_text = "Стиль написания: " . $writing_style . ".";
682
683 if ( empty($qc_wpbotpro_article_label_keywords) ) {
684 $myprompt = $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $qc_wpbotpro_article_text . ".";
685 } else {
686 $keyword_text = ". Ключевые слова: " . $qc_wpbotpro_article_label_keywords . ".";
687 $myprompt = $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $qc_wpbotpro_article_text . $keyword_text;
688 }
689
690 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
691
692 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
693 $avoid_text = " Исключите следующие ключевые слова: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
694 $myprompt = $myprompt . $avoid_text;
695 }
696
697 $myintro = $intro_text . $qc_wpbotpro_article_text;
698 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
699 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
700 $mycta = "Напишите call to action о: " . $qc_wpbotpro_article_text . " и сделайте href tag link на: " . $qc_wpbotpro_article_target_label_cta . ".";
701
702 } else if ( $qc_wpbotpro_article_language == "ja" ) {
703 $prompt_text = " に関するブログのアイデアを ";
704 $prompt_last = " つ挙げてください";
705 $intro_text = " について紹介文を書く";
706 $conclusion_text = " についての結論を書く";
707 $tagline_text = " についてのスローガンを書く";
708 $introduction = "序章";
709 $conclusion = "結論";
710 $faq_text = $qc_wpbotpro_article_text . " に関する " . strval( $qc_wpbotpro_article_number_of_heading ) . " の質問と回答.";
711 $faq_heading = "よくある質問";
712 $style_text = "書き方: " . $writing_style . ".";
713
714 if ( empty($qc_wpbotpro_article_label_keywords) ) {
715 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . ".";
716 } else {
717 $keyword_text = ". キーワード: " . $qc_wpbotpro_article_label_keywords . ".";
718 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $keyword_text;
719 }
720
721 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
722
723 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
724 $avoid_text = " 次のキーワードを除外します。 " . $qc_wpbotpro_article_label_word_to_avoid . ".";
725 $myprompt = $myprompt . $avoid_text;
726 }
727
728 $myintro = $qc_wpbotpro_article_text . $intro_text;
729 $myconclusion = $qc_wpbotpro_article_text . $conclusion_text;
730 $mytagline = $qc_wpbotpro_article_text . $tagline_text;
731 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
732 $mycta = $qc_wpbotpro_article_text . " についてのコール・トゥ・アクションを書き、hrefタグリンクを作成します。 " . $qc_wpbotpro_article_target_label_cta . ".";
733
734 } else if ( $qc_wpbotpro_article_language == "zh" ) {
735 $prompt_text = " �
736 �于 ";
737 $of_text = "";
738 $piece_text = " 个博客创意";
739 $intro_text = "写一篇�
740 �于 ";
741 $intro_last = " 的介绍";
742 $conclusion_text = "写一篇�
743 �于 ";
744 // write a tagline about
745 $tagline_text = "写一个标语�
746 �于 ";
747 $conclusion_last = " 的结论";
748 $introduction = "介绍";
749 $conclusion = "结论";
750 $faq_text = $qc_wpbotpro_article_text . "" . strval( $qc_wpbotpro_article_number_of_heading ) . " 个问题和答案.";
751 $faq_heading = "常见问题";
752 $style_text = "写作风格: " . $writing_style . ".";
753
754 if ( empty($qc_wpbotpro_article_label_keywords) ) {
755 $myprompt = $prompt_text . $qc_wpbotpro_article_text . $of_text . strval( $qc_wpbotpro_article_number_of_heading ) . $piece_text . ".";
756 } else {
757 $keyword_text = ". �
758 �键字: " . $qc_wpbotpro_article_label_keywords . ".";
759 $myprompt = $prompt_text . $qc_wpbotpro_article_text . $of_text . strval( $qc_wpbotpro_article_number_of_heading ) . $piece_text . $keyword_text;
760 }
761
762 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
763
764 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
765 $avoid_text = " 排除以下�
766 �键字:" . $qc_wpbotpro_article_label_word_to_avoid . ".";
767 $myprompt = $myprompt . $avoid_text;
768 }
769
770 $myintro = $intro_text . $qc_wpbotpro_article_text . $intro_last;
771 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text . $conclusion_last;
772 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
773 // 写一个�
774 �于 123 的号召性用语并创建一个 <a href> html 标签链接到:
775 $mycta = "写一个�
776 �于 " . $qc_wpbotpro_article_text . " 的号召性用语并创建一个 <a href> html 标签链接到: " . $qc_wpbotpro_article_target_label_cta . ".";
777
778 } else if ( $qc_wpbotpro_article_language == "ko" ) {
779 $prompt_text = " 다음과 관련된 ";
780 $prompt_last = "가지 블로그 아이디어: ";
781 $intro_text = "블로그 토픽에 대한 소개를 작성하십시오 ";
782 $conclusion_text = "블로그 토픽에 대한 결론을 작성하십시오 ";
783 $introduction = "소개";
784 $conclusion = "결론";
785 $faq_text = $qc_wpbotpro_article_text . "에 대한 " . strval( $qc_wpbotpro_article_number_of_heading ) . "개의 질문과 답변.";
786 $faq_heading = "자주 묻는 질문";
787 // write a tagline about
788 $tagline_text = "에 대한 태그라인 작성 ";
789 $style_text = "작성 스타일: " . $writing_style . ".";
790
791 if ( empty($qc_wpbotpro_article_label_keywords) ) {
792 $myprompt = $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $qc_wpbotpro_article_text . ".";
793 } else {
794 $keyword_text = ". 키워드: " . $qc_wpbotpro_article_label_keywords . ".";
795 $myprompt = $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $qc_wpbotpro_article_text . $keyword_text;
796 }
797
798 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
799
800 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
801 $avoid_text = " 다음 키워드를 제외하십시오. " . $qc_wpbotpro_article_label_word_to_avoid . ".";
802 $myprompt = $myprompt . $avoid_text;
803 }
804
805 $myintro = $intro_text . $qc_wpbotpro_article_text;
806 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
807 $mytagline = $qc_wpbotpro_article_text . $tagline_text;
808 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
809 $mycta = $qc_wpbotpro_article_text . "에 대한 호출 행동을 작성하고 href 태그 링크를 만듭니다. " . $qc_wpbotpro_article_target_label_cta . ".";
810
811 } else if ( $qc_wpbotpro_article_language == "id" ) {
812 $prompt_text = " topik blog tentang ";
813 $intro_text = "Tulis pengantar tentang ";
814 $conclusion_text = "Tulis kesimpulan tentang ";
815 $introduction = "Pengantar";
816 $conclusion = "Kesimpulan";
817 $faq_text = strval( $qc_wpbotpro_article_number_of_heading ) . " pertanyaan dan jawaban tentang " . $qc_wpbotpro_article_text . ".";
818 $faq_heading = "Pertanyaan dan jawaban";
819 // write a tagline about
820 $tagline_text = "Tulis tagline tentang ";
821 $style_text = "Gaya penulisan: " . $writing_style . ".";
822
823 if ( empty($qc_wpbotpro_article_label_keywords) ) {
824 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
825 } else {
826 $keyword_text = ". Kata kunci: " . $qc_wpbotpro_article_label_keywords . ".";
827 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
828 }
829
830 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
831
832 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
833 $avoid_text = " Hindari kata kunci berikut: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
834 $myprompt = $myprompt . $avoid_text;
835 }
836
837 $myintro = $intro_text . $qc_wpbotpro_article_text;
838 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
839 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
840 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
841 $mycta = "Tulis panggilan tindakan tentang " . $qc_wpbotpro_article_text . " dan buat tautan tag href ke: " . $qc_wpbotpro_article_target_label_cta . ".";
842
843 } else if ( $qc_wpbotpro_article_language == "tr" ) {
844 $prompt_text = " hakkında ";
845 $prompt_last = " blog başlığı listele.";
846 $intro_text = " ile ilgili bir giriş yazısı yaz.";
847 $conclusion_text = " ile ilgili bir sonuç yazısı yaz.";
848 $introduction = "Giriş";
849 $conclusion = "Sonuç";
850 $faq_text = $qc_wpbotpro_article_text . " hakkında " . strval( $qc_wpbotpro_article_number_of_heading ) . " soru ve cevap.";
851 $faq_heading = "SSS";
852 // write a tagline about
853 $tagline_text = " ile ilgili bir slogan yaz.";
854 $style_text = "Yazı stili: " . $writing_style . ".";
855
856 if ( empty($qc_wpbotpro_article_label_keywords) ) {
857 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . ".";
858 } else {
859 $keyword_text = ". Anahtar kelimeler: " . $qc_wpbotpro_article_label_keywords . ".";
860 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $keyword_text;
861 }
862
863 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
864
865 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
866 $avoid_text = " Bu anahtar kelimeleri kullanma: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
867 $myprompt = $myprompt . $avoid_text;
868 }
869
870 $myintro = $qc_wpbotpro_article_text . $intro_text;
871 $myconclusion = $qc_wpbotpro_article_text . $conclusion_text;
872 $mytagline = $qc_wpbotpro_article_text . $tagline_text;
873 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
874 $mycta = $qc_wpbotpro_article_text . " hakkında bir çağrıyı harekete geçir ve bir href etiketi bağlantısı oluştur: " . $qc_wpbotpro_article_target_label_cta . ".";
875
876 } else if ( $qc_wpbotpro_article_language == "hi" ) {
877 $prompt_text = " के बारे में ";
878 $prompt_last = " ब्लॉग विषय सूचीबद्ध करें.";
879 $intro_text = "का परिचय लिखिए ";
880 $conclusion_text = "के बारे में निष्कर्ष लिखिए ";
881 $introduction = "प्रस्तावना";
882 $conclusion = "निष्कर्ष";
883 $faq_text = $qc_wpbotpro_article_text . " के बारे में " . strval( $qc_wpbotpro_article_number_of_heading ) . " प्रश्न और उत्तर.";
884 $faq_heading = "सामान्य प्रश्न";
885 // write a tagline about
886 $tagline_text = " के बारे में एक नारा लिखिए";
887 $style_text = "लेखन शैली: " . $writing_style . ".";
888
889 if ( empty($qc_wpbotpro_article_label_keywords) ) {
890 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . ".";
891 } else {
892 $keyword_text = ". कीवर्ड: " . $qc_wpbotpro_article_label_keywords . ".";
893 $myprompt = $qc_wpbotpro_article_text . $prompt_text . strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_last . $keyword_text;
894 }
895
896 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
897
898 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
899 $avoid_text = " निम्नलिखित खोजशब्दों को बाहर करें: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
900 $myprompt = $myprompt . $avoid_text;
901 }
902
903 $myintro = $intro_text . $qc_wpbotpro_article_text;
904 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
905 $mytagline = $qc_wpbotpro_article_text . $tagline_text;
906 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
907 $mycta = $qc_wpbotpro_article_text . " के बारे में कोई कॉल एक्शन लिखें और एक href टैग लिंक बनाएं: " . $qc_wpbotpro_article_target_label_cta . ".";
908
909 } else if ( $qc_wpbotpro_article_language == "pl" ) {
910 $prompt_text = " tematów blogów o ";
911 $intro_text = "Napisz wprowadzenie o ";
912 $conclusion_text = "Napisz konkluzja o ";
913 $introduction = "Wstęp";
914 $conclusion = "Konkluzja";
915 $faq_text = "Napisz " . strval( $qc_wpbotpro_article_number_of_heading ) . " pytania i odpowiedzi o " . $qc_wpbotpro_article_text . ".";
916 $faq_heading = "Pytania i odpowiedzi";
917 // write a tagline about
918 $tagline_text = "Napisz slogan o ";
919 $style_text = "Styl pisania: " . $writing_style . ".";
920
921 if ( empty($qc_wpbotpro_article_label_keywords) ) {
922 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
923 } else {
924 $keyword_text = ". Słowa kluczowe:: " . $qc_wpbotpro_article_label_keywords . ".";
925 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text . ".";
926 }
927
928 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
929
930 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
931 $avoid_text = " Wyklucz następuj�
932 ce słowa kluczowe: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
933 $myprompt = $myprompt . $avoid_text;
934 }
935
936 $myintro = $intro_text . $qc_wpbotpro_article_text;
937 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
938 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
939 $mycta = "Napisz wezwanie do działania dotycz�
940 ce " . $qc_wpbotpro_article_text . " i utwórz link tagu HTML <a href> do: " . $qc_wpbotpro_article_target_label_cta . ".";
941
942 } else if ( $qc_wpbotpro_article_language == "uk" ) {
943 $prompt_text = " теми блогів про ";
944 $intro_text = "Напишіть вступ про ";
945 $conclusion_text = "Напишіть висновок про ";
946 $introduction = "Вступ";
947 $conclusion = "Висновок";
948 $faq_text = "Напишіть " . strval( $qc_wpbotpro_article_number_of_heading ) . " питання та відповіді про " . $qc_wpbotpro_article_text . ".";
949 $faq_heading = "Питання та відповіді";
950 // write a tagline about
951 $tagline_text = "Напишіть слоган про ";
952 $style_text = "Стиль письма: " . $writing_style . ".";
953
954 if ( empty($qc_wpbotpro_article_label_keywords) ) {
955 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
956 } else {
957 $keyword_text = ". Ключові слова: " . $qc_wpbotpro_article_label_keywords . ".";
958 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
959 }
960
961 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
962
963 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
964 $avoid_text = " Виключіть такі ключові слова: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
965 $myprompt = $myprompt . $avoid_text;
966 }
967
968 $myintro = $intro_text . $qc_wpbotpro_article_text;
969 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
970 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
971 // Напишіть заклик до дії про Google і створіть посилання на тег html <a href> для:
972 $mycta = "Напишіть заклик до дії про " . $qc_wpbotpro_article_text . " і створіть посилання на тег html <a href> для: " . $qc_wpbotpro_article_target_label_cta . ".";
973
974 } else if ( $qc_wpbotpro_article_language == "ar" ) {
975 $prompt_text = " �
976 وضوعات ال�
977 دونات على ";
978 $intro_text = "اكتب �
979 قد�
980 ة عن: ";
981 $conclusion_text = "اكتب استنتاجًا عن: ";
982 $introduction = "�
983 قد�
984 ة";
985 $conclusion = "استنتاج";
986 $faq_text = "اكتب " . strval( $qc_wpbotpro_article_number_of_heading ) . " أسئلة وأجوبة عن " . $qc_wpbotpro_article_text . ".";
987 $faq_heading = "الأسئلة الشائعة";
988 // write a tagline about اكتب شعارًا عن
989 $tagline_text = " اكتب شعارًا عن ";
990 $style_text = "ن�
991 ط الكتابة: " . $writing_style . ".";
992
993 if ( empty($qc_wpbotpro_article_label_keywords) ) {
994 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
995 } else {
996 $keyword_text = ". الكل�
997 ات الدالة: " . $qc_wpbotpro_article_label_keywords . ".";
998 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
999 }
1000
1001 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1002
1003 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1004 $avoid_text = " تجنب الكل�
1005 ات التالية: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1006 $myprompt = $myprompt . $avoid_text;
1007 }
1008
1009 $myintro = $intro_text . $qc_wpbotpro_article_text;
1010 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1011 $mytagline = $qc_wpbotpro_article_text . $tagline_text;
1012 $mycta = "اكتب عبارة تحث ال�
1013 ستخد�
1014 على اتخاذ إجراء بشأن " . $qc_wpbotpro_article_text . " وأنشئ <a href> رابط وس�
1015 html �
1016 ن أجل: " . $qc_wpbotpro_article_target_label_cta . ".";
1017
1018 } else if ( $qc_wpbotpro_article_language == "ro" ) {
1019 $prompt_text = " subiecte de blog despre ";
1020 $intro_text = "Scrieți o introducere despre ";
1021 $conclusion_text = "Scrieți o concluzie despre ";
1022 $introduction = "Introducere";
1023 $conclusion = "Concluzie";
1024 $faq_text = "Scrieți " . strval( $qc_wpbotpro_article_number_of_heading ) . " întrebări și răspunsuri despre " . $qc_wpbotpro_article_text . ".";
1025 $faq_heading = "Întrebări și răspunsuri";
1026 // write a tagline about
1027 $tagline_text = "Scrieți un slogan despre ";
1028 $style_text = "Stilul de scriere: " . $writing_style . ".";
1029
1030 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1031 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1032 } else {
1033 $keyword_text = ". Cuvinte cheie: " . $qc_wpbotpro_article_label_keywords . ".";
1034 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1035 }
1036
1037 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1038
1039 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1040 $avoid_text = " Evitați cuvintele: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1041 $myprompt = $myprompt . $avoid_text;
1042 }
1043
1044 $myintro = $intro_text . $qc_wpbotpro_article_text;
1045 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1046 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1047 // Scrieți un îndemn despre Google și creați o etichetă html <a href> link către:
1048 $mycta = "Scrieți un îndemn despre " . $qc_wpbotpro_article_text . " și creați o etichetă html <a href> link către: " . $qc_wpbotpro_article_target_label_cta . ".";
1049
1050 } else if ( $qc_wpbotpro_article_language == "hu" ) {
1051 // Írj 5 blogtémát a Google-ról
1052 $prompt_text = " blog témákat a következő témában: ";
1053 $intro_text = "Írj bevezetést ";
1054 $conclusion_text = "Írj következtetést ";
1055 $introduction = "Bevezetés";
1056 $conclusion = "Következtetés";
1057 $faq_text = "Írj " . strval( $qc_wpbotpro_article_number_of_heading ) . " kérdést és választ a következő témában: " . $qc_wpbotpro_article_text . ".";
1058 $faq_heading = "GYIK";
1059 // write a tagline about
1060 $tagline_text = "Írj egy tagline-t ";
1061 $style_text = "Írásmód: " . $writing_style . ".";
1062
1063 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1064 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1065 } else {
1066 $keyword_text = ". Kulcsszavak: " . $qc_wpbotpro_article_label_keywords . ".";
1067 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1068 }
1069
1070 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1071
1072 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1073 $avoid_text = " Kerülje a következő szavakat: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1074 $myprompt = $myprompt . $avoid_text;
1075 }
1076
1077 $myintro = $intro_text . $qc_wpbotpro_article_text;
1078 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1079 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1080 // Írjon cselekvésre ösztönzést a 123-ról, és hozzon létre egy <a href> html címke hivatkozást:
1081 $mycta = "Írjon cselekvésre ösztönzést a " . $qc_wpbotpro_article_text . "-rol, témában, és hozzon létre egy <a href> html címke hivatkozást: " . $qc_wpbotpro_article_target_label_cta . ".";
1082
1083 } else if ( $qc_wpbotpro_article_language == "cs" ) {
1084 $prompt_text = " blog témata o ";
1085 $intro_text = "Napi úvodní zprávy o ";
1086 $conclusion_text = "Napi závěrečná zpráva o ";
1087 $introduction = "Úvodní zpráva";
1088 $conclusion = "Závěrečná zpráva";
1089 $faq_text = "Napi " . strval( $qc_wpbotpro_article_number_of_heading ) . " otázky a odpovědi o " . $qc_wpbotpro_article_text . ".";
1090 $faq_heading = "Často kladené otázky";
1091 // write a tagline about
1092 $tagline_text = "Napi tagline o ";
1093 $style_text = "Styl psaní: " . $writing_style . ".";
1094
1095 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1096 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1097 } else {
1098 $keyword_text = ". Klíčová slova: " . $qc_wpbotpro_article_label_keywords . ".";
1099 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1100 }
1101
1102 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1103
1104 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1105 $avoid_text = " Vyhněte se slovům: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1106 $myprompt = $myprompt . $avoid_text;
1107 }
1108
1109 $myintro = $intro_text . $qc_wpbotpro_article_text;
1110 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1111 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1112 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
1113 $mycta = "Napi hovor k akci o " . $qc_wpbotpro_article_text . " a vytvořte href tag link na: " . $qc_wpbotpro_article_target_label_cta . ".";
1114
1115 } else if ( $qc_wpbotpro_article_language == "el" ) {
1116 $prompt_text = " θέματα ιστολογίο�
1117 για ";
1118 $intro_text = "Γράψτε μια εισαγωγή για ";
1119 $conclusion_text = "Γράψτε μια σ�
1120 μπέραση για ";
1121 $introduction = "Εισαγωγή";
1122 $conclusion = "Σ�
1123 μπέραση";
1124 $faq_text = "Γράψτε " . strval( $qc_wpbotpro_article_number_of_heading ) . " ερωτήσεις και απαντήσεις για " . $qc_wpbotpro_article_text . ".";
1125 $faq_heading = "Σ�
1126 χνές ερωτήσεις";
1127 // write a tagline about
1128 $tagline_text = "Γράψτε μια tagline για ";
1129 $style_text = "Στ�
1130 λ σ�
1131 γγραφής: " . $writing_style . ".";
1132
1133 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1134 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1135 } else {
1136 $keyword_text = ". Λέξεις-κλειδιά: " . $qc_wpbotpro_article_label_keywords . ".";
1137 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1138 }
1139
1140 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1141
1142 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1143 $avoid_text = " Αποφύγετε τις εξής λέξεις: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1144 $myprompt = $myprompt . $avoid_text;
1145 }
1146
1147 $myintro = $intro_text . $qc_wpbotpro_article_text;
1148 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1149 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1150 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
1151 $mycta = "Γράψτε μια κλήση σε ενέργεια για " . $qc_wpbotpro_article_text . " και δημιο�
1152 ργήστε έναν σύνδεσμο href tag στο: " . $qc_wpbotpro_article_target_label_cta . ".";
1153
1154 } else if ( $qc_wpbotpro_article_language == "bg" ) {
1155 $prompt_text = " блог теми за ";
1156 $intro_text = "Напишете въведение за ";
1157 $conclusion_text = "Напишете заключение за ";
1158 $introduction = "Въведение";
1159 $conclusion = "Заключение";
1160 $faq_text = "Напишете " . strval( $qc_wpbotpro_article_number_of_heading ) . " въпроси и отговори за " . $qc_wpbotpro_article_text . ".";
1161 $faq_heading = "Често задавани въпроси";
1162 // write a tagline about
1163 $tagline_text = "Напишете tagline за ";
1164 $style_text = "Стил на писане: " . $writing_style . ".";
1165
1166 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1167 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1168 } else {
1169 $keyword_text = ". Ключови думи: " . $qc_wpbotpro_article_label_keywords . ".";
1170 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1171 }
1172
1173 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1174
1175 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1176 $avoid_text = " Избягвайте думите: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1177 $myprompt = $myprompt . $avoid_text;
1178 }
1179
1180 $myintro = $intro_text . $qc_wpbotpro_article_text;
1181 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1182 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1183 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
1184 $mycta = "Напишете действие за " . $qc_wpbotpro_article_text . " и създайте връзка href tag към: " . $qc_wpbotpro_article_target_label_cta . ".";
1185
1186 } else if ( $qc_wpbotpro_article_language == "sv" ) {
1187 $prompt_text = " bloggämnen om ";
1188 $intro_text = "Skriv en introduktion om ";
1189 $conclusion_text = "Skriv en slutsats om ";
1190 $introduction = "Introduktion";
1191 $conclusion = "Slutsats";
1192 $faq_text = "Skriv " . strval( $qc_wpbotpro_article_number_of_heading ) . " frågor och svar om " . $qc_wpbotpro_article_text . ".";
1193 $faq_heading = "FAQ";
1194 // write a tagline about
1195 $tagline_text = "Skriv en tagline om ";
1196 $style_text = "Skrivstil: " . $writing_style . ".";
1197
1198 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1199 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1200 } else {
1201 $keyword_text = ". Nyckelord: " . $qc_wpbotpro_article_label_keywords . ".";
1202 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1203 }
1204
1205 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1206
1207 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1208 $avoid_text = " Undvik ord: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1209 $myprompt = $myprompt . $avoid_text;
1210 }
1211
1212 $myintro = $intro_text . $qc_wpbotpro_article_text;
1213 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1214 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1215 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
1216 $mycta = "Skriv ett åtgärdsförslag om " . $qc_wpbotpro_article_text . " och skapa en href tag-länk till: " . $qc_wpbotpro_article_target_label_cta . ".";
1217
1218 } else {
1219 $prompt_text = " blog topics about ";
1220 $intro_text = "Write an introduction about ";
1221 $conclusion_text = "Write a conclusion about ";
1222 $introduction = "Introduction";
1223 $conclusion = "Conclusion";
1224 $faq_text = "Write " . strval( $qc_wpbotpro_article_number_of_heading ) . " questions and answers about " . $qc_wpbotpro_article_text . ".";
1225 $faq_heading = "Q&A";
1226 // write a tagline about
1227 $tagline_text = "Write a tagline about ";
1228 $style_text = "Writing style: " . $writing_style . ".";
1229
1230 if ( empty($qc_wpbotpro_article_label_keywords) ) {
1231 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . ".";
1232 } else {
1233 $keyword_text = ". Keywords: " . $qc_wpbotpro_article_label_keywords . ".";
1234 $myprompt = strval( $qc_wpbotpro_article_number_of_heading ) . $prompt_text . $qc_wpbotpro_article_text . $keyword_text;
1235 }
1236
1237 // if $qc_wpbotpro_article_label_word_to_avoid is not empty, add it to the prompt
1238
1239 if ( !empty($qc_wpbotpro_article_label_word_to_avoid) ) {
1240 $avoid_text = " Exclude the following keywords: " . $qc_wpbotpro_article_label_word_to_avoid . ".";
1241 $myprompt = $myprompt . $avoid_text;
1242 }
1243
1244 $myintro = $intro_text . $qc_wpbotpro_article_text;
1245 $myconclusion = $conclusion_text . $qc_wpbotpro_article_text;
1246 $mytagline = $tagline_text . $qc_wpbotpro_article_text;
1247 // Write a call to action about $qc_wpbotpro_article_text and create a href tag link to: $qc_wpbotpro_article_target_label_cta.
1248 $mycta = "Write a call to action about " . $qc_wpbotpro_article_text . " and create a href tag link to: " . $qc_wpbotpro_article_target_label_cta . ".";
1249
1250 }
1251
1252
1253
1254 $result_data = '';
1255
1256 if(!empty($qc_wpbotpro_article_text)){
1257
1258 $qcld_ai_settings_open_ai = get_option('qcld_ai_settings_open_ai');
1259
1260 if( $ai_engines == 'gpt-3.5-turbo' || $ai_engines == 'gpt-4' || $ai_engines == 'gpt-4o' || $ai_engines == 'gpt-4o-mini' ){
1261 $gptkeyword = [];
1262 $ch = curl_init();
1263 $url = 'https://api.openai.com/v1/chat/completions';
1264
1265 array_push($gptkeyword, array(
1266 "role" => "user",
1267 "content" => $myprompt
1268 ));
1269
1270 $post_fields = array(
1271 "model" => $ai_engines,
1272 "messages" => $gptkeyword,
1273 "max_tokens" => (int)$max_token,
1274 "temperature" => ( float ) $temperature
1275 );
1276 $header = [
1277 'Content-Type: application/json',
1278 'Authorization: Bearer ' . $OPENAI_API_KEY
1279 ];
1280 curl_setopt($ch, CURLOPT_URL, $url);
1281 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1282 curl_setopt($ch, CURLOPT_POST, 1);
1283 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_fields));
1284 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
1285 $result = curl_exec($ch);
1286 if (curl_errno($ch)) {
1287 echo esc_html('Error: ') . esc_html(curl_error($ch));
1288 }
1289 curl_close($ch);
1290 $complete = json_decode( $result );
1291 // we need to catch the error here
1292
1293 if ( isset( $complete->error ) ) {
1294 $complete = $complete->error->message;
1295 // exit
1296 echo esc_html( $complete ) ;
1297 exit;
1298 } else {
1299 //$complete = $complete->choices[0]->message->content;
1300 $complete = isset( $complete->choices[0]->message->content ) ? trim( $complete->choices[0]->message->content ) : '';
1301 }
1302
1303 }else{
1304
1305 $request_body = [
1306 "prompt" => $myprompt,
1307 "model" => $ai_engines,
1308 "max_tokens" => (int)$max_token,
1309 "temperature" => (float)$temperature,
1310 "presence_penalty" => (float)$ppenalty,
1311 "frequency_penalty" => (float)$fpenalty,
1312 "top_p" => 1,
1313 "best_of" => 1,
1314 ];
1315 $data = json_encode($request_body);
1316 $url = "https://api.openai.com/v1/completions";
1317 $apt_key = "Authorization: Bearer ". $OPENAI_API_KEY;
1318
1319 $curl = curl_init($url);
1320 curl_setopt($curl, CURLOPT_URL, $url);
1321 curl_setopt($curl, CURLOPT_POST, true);
1322 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1323 $headers = array(
1324 "Content-Type: application/json",
1325 $apt_key ,
1326 );
1327 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1328 curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
1329 $result = curl_exec($curl);
1330 curl_close($curl);
1331 // $results = json_decode($result);
1332
1333 // $result_data = isset( $results->choices[0]->text ) ? trim( $results->choices[0]->text ) : '';
1334
1335
1336 $complete = json_decode( $result );
1337 // we need to catch the error here
1338
1339 if ( isset( $complete->error ) ) {
1340 $complete = $complete->error->message;
1341 // exit
1342 echo esc_html( $complete ) ;
1343 exit;
1344 } else {
1345 //$complete = $complete->choices[0]->text;
1346 $complete = isset( $complete->choices[0]->text ) ? trim( $complete->choices[0]->text ) : '';
1347 }
1348
1349 }
1350
1351 // trim the text
1352 $complete = !empty( $complete ) ? trim( $complete ) : '';
1353 $mylist = array();
1354 $mylist = preg_split( "/\r\n|\n|\r/", $complete );
1355 // delete 1. 2. 3. etc from beginning of the line
1356 $mylist = preg_replace( '/^\\d+\\.\\s/', '', $mylist );
1357 $allresults = "";
1358 $qc_wpbotpro_article_heading_tag = sanitize_text_field( $_REQUEST["qc_wpbotpro_article_heading_tag"] );
1359
1360
1361 $allresults = apply_filters('qcld_wpbotpro_floating_openai_article_heading_tag', $allresults, $mylist, $myprompt, $qc_wpbotpro_article_heading_tag, $style_text, $tone_text, $avoid_text, $qc_wpbotpro_article_label_word_to_avoid );
1362
1363
1364
1365 if ( $qc_wpbotpro_article_heading_intro == "1" ) {
1366 // we need to catch the error here
1367
1368 $allresults = apply_filters('qc_wpbotpro_floating_openai_article_heading_intro', $allresults, $myintro, $introduction );
1369
1370 }
1371
1372 // if wpai_add_faq is checked then call api with faq prompt
1373
1374 if ( $qc_wpbotpro_article_heading_faq == "1" ) {
1375 // we need to catch the error here
1376
1377 $allresults = apply_filters('qc_wpbotpro_floating_openai_article_heading_faq', $allresults, $faq_text, $faq_heading );
1378
1379
1380 }
1381
1382 //if myconclusion is not empty,calls the openai api
1383
1384 if ( $qc_wpbotpro_article_heading_conclusion == "1" ) {
1385
1386 $allresults = apply_filters('qc_wpbotpro_floating_openai_article_heading_conclusion', $allresults, $myconclusion, $conclusion );
1387
1388
1389 }
1390
1391 // qc_wpbotpro_article_heading_tagline is checked then call the openai api
1392
1393 if ( $qc_wpbotpro_article_heading_tagline == "1" ) {
1394
1395 $allresults = apply_filters('qcld_wpbotpro_floating_openai_article_heading_tag', $allresults, $mytagline, $conclusion );
1396
1397
1398 }
1399
1400 // if qc_wpbotpro_article_label_keywords_bold is checked then then find all keywords and bold them. keywords are separated by comma
1401 if ( $qc_wpbotpro_article_label_keywords_bold == "1" ) {
1402 // check to see at least one keyword is entered
1403
1404 if ( $qc_wpbotpro_article_label_keywords != "" ) {
1405 // split keywords by comma if there are more than one but if there is only one then it will not split
1406
1407 if ( strpos( $qc_wpbotpro_article_label_keywords, ',' ) !== false ) {
1408 $keywords = explode( ",", $qc_wpbotpro_article_label_keywords );
1409 } else {
1410 $keywords = array( $qc_wpbotpro_article_label_keywords );
1411 }
1412
1413 // loop through keywords and bold them
1414 foreach ( $keywords as $keyword ) {
1415 $keyword = trim( $keyword );
1416 // replace keyword with bold keyword but make sure exact match is found. for example if the keyword is "the" then it should not replace "there" with "there".. capital dont matter
1417 $allresults = preg_replace( '/\\b' . $keyword . '\\b/', '<strong>' . $keyword . '</strong>', $allresults );
1418 }
1419 }
1420
1421 }
1422 // if qc_wpbotpro_article_target_url and qc_wpbotpro_article_label_anchor_text is not empty then find qc_wpbotpro_article_label_anchor_text in the text and create a link using qc_wpbotpro_article_target_url
1423 if ( $qc_wpbotpro_article_target_url != "" && $qc_wpbotpro_article_label_anchor_text != "" ) {
1424 // create a link if anchor text found.. rules: 1. only for first occurance 2. exact match 3. case insensitive 4. if anchor text found inside any h1,h2,h3,h4,h5,h6, a then skip it. 5. use anchor text to create link dont replace it with existing text
1425 $allresults = preg_replace(
1426 '/(?<!<h[1-6]><a href=")(?<!<a href=")(?<!<h[1-6]>)(?<!<h[1-6]><strong>)(?<!<strong>)(?<!<h[1-6]><em>)(?<!<em>)(?<!<h[1-6]><strong><em>)(?<!<strong><em>)(?<!<h[1-6]><em><strong>)(?<!<em><strong>)\\b' . $qc_wpbotpro_article_label_anchor_text . '\\b(?![^<]*<\\/a>)(?![^<]*<\\/h[1-6]>)(?![^<]*<\\/strong>)(?![^<]*<\\/em>)(?![^<]*<\\/strong><\\/em>)(?![^<]*<\\/em><\\/strong>)/i',
1427 '<a href="' . $qc_wpbotpro_article_target_url . '">' . $qc_wpbotpro_article_label_anchor_text . '</a>',
1428 $allresults,
1429 1
1430 );
1431 }
1432
1433
1434 // if qc_wpbotpro_article_target_label_cta is not empty then call api to get cta text and create a link using qc_wpbotpro_article_target_label_cta
1435
1436 if ( $qc_wpbotpro_article_target_label_cta != "" ) {
1437
1438
1439 $gptkeyword = [];
1440
1441 $qcld_ai_settings_open_ai = get_option('qcld_ai_settings_open_ai');
1442
1443 if( $ai_engines == 'gpt-3.5-turbo' || $ai_engines == 'gpt-4' || $ai_engines == 'gpt-4o' || $ai_engines == 'gpt-4o-mini'){
1444 $ch = curl_init();
1445 $url = 'https://api.openai.com/v1/chat/completions';
1446
1447 array_push($gptkeyword, array(
1448 "role" => "user",
1449 "content" => $mycta
1450 ));
1451
1452 $post_fields = array(
1453 "model" => $ai_engines,
1454 "messages" => $gptkeyword,
1455 "max_tokens" => (int)$max_token,
1456 "temperature" => ( float ) $temperature
1457 );
1458 $header = [
1459 'Content-Type: application/json',
1460 'Authorization: Bearer ' . $OPENAI_API_KEY
1461 ];
1462 curl_setopt($ch, CURLOPT_URL, $url);
1463 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1464 curl_setopt($ch, CURLOPT_POST, 1);
1465 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_fields));
1466 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
1467 $result = curl_exec($ch);
1468 if (curl_errno($ch)) {
1469 echo esc_html('Error: ') . esc_html(curl_error($ch));
1470 }
1471 curl_close($ch);
1472 //$complete = json_decode( $result );
1473 // $complete = isset($complete->choices[0]->message->content) ? $complete->choices[0]->message->content : '';
1474
1475 // we need to catch the error here
1476 $completecta = json_decode( $result );
1477
1478 if ( isset( $completecta->error ) ) {
1479 $completecta = $completecta->error->message;
1480 // exit
1481 echo esc_html( $completecta ) ;
1482 exit;
1483 } else {
1484 //$completecta = $completecta->choices[0]->message->content;
1485 $completecta = isset( $completecta->choices[0]->message->content ) ? trim( $completecta->choices[0]->message->content ) : '';
1486 // trim the text
1487 $completecta = !empty($completecta) ? trim( $completecta ) : '';
1488 // add <p> to the beginning of the text
1489 $completecta = "<p>" . $completecta . "</p>"."\n";
1490
1491 if ( $wpai_cta_pos == "beg" ) {
1492 $allresults = preg_replace(
1493 '/(<h[1-6]>)/',
1494 $completecta . ' $1',
1495 $allresults,
1496 1
1497 );
1498 } else {
1499 $allresults = $allresults . $completecta;
1500 }
1501
1502 }
1503
1504 }else{
1505
1506 // call api to get cta text
1507 $request_body = [
1508 "prompt" => $mycta,
1509 "model" => $ai_engines,
1510 "max_tokens" => (int)$max_token,
1511 "temperature" => (float)$temperature,
1512 "presence_penalty" => (float)$ppenalty,
1513 "frequency_penalty" => (float)$fpenalty,
1514 "top_p" => 1,
1515 "best_of" => 1,
1516 ];
1517 $data = json_encode($request_body);
1518 $url = "https://api.openai.com/v1/completions";
1519 $apt_key = "Authorization: Bearer ". $OPENAI_API_KEY;
1520
1521 $curl = curl_init($url);
1522 curl_setopt($curl, CURLOPT_URL, $url);
1523 curl_setopt($curl, CURLOPT_POST, true);
1524 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1525 $headers = array(
1526 "Content-Type: application/json",
1527 $apt_key ,
1528 );
1529 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1530 curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
1531 $result = curl_exec($curl);
1532 curl_close($curl);
1533
1534 // we need to catch the error here
1535 $completecta = json_decode( $result );
1536
1537 if ( isset( $completecta->error ) ) {
1538 $completecta = $completecta->error->message;
1539 // exit
1540 echo esc_html( $completecta ) ;
1541 exit;
1542 } else {
1543 //$completecta = $completecta->choices[0]->text;
1544 $completecta = isset( $completecta->choices[0]->text ) ? trim( $completecta->choices[0]->text ) : '';
1545 // trim the text
1546 $completecta = !empty($completecta) ? trim( $completecta ) : '';
1547 // add <p> to the beginning of the text
1548 $completecta = "<p>" . $completecta . "</p>"."\n";
1549
1550 if ( $wpai_cta_pos == "beg" ) {
1551 $allresults = preg_replace(
1552 '/(<h[1-6]>)/',
1553 $completecta . ' $1',
1554 $allresults,
1555 1
1556 );
1557 } else {
1558 $allresults = $allresults . $completecta;
1559 }
1560
1561 }
1562
1563 }
1564
1565 }
1566
1567 // if add image is checked then we should send api request to get image
1568
1569 if ( $qc_wpbotpro_article_heading_img == "1" ) {
1570
1571 $imgresult = apply_filters('qc_wpbotpro_floating_openai_article_heading_img', $qc_wpbotpro_article_text, $img_size );
1572
1573 //var_dump( $imgresult );
1574 //wp_die();
1575
1576 // get half of qc_wpbotpro_article_number_of_heading and insert image in the middle
1577 $half = intval( $qc_wpbotpro_article_number_of_heading ) / 2;
1578 $half = round( $half );
1579 $half = $half - 1;
1580 // use qc_wpbotpro_article_heading_tag to add heading tag to image
1581 $allresults = explode( "</" . $qc_wpbotpro_article_heading_tag . ">", $allresults );
1582 $allresults[$half] = $allresults[$half] . $imgresult;
1583 $allresults = implode( "</" . $qc_wpbotpro_article_heading_tag . ">", $allresults );
1584
1585 $Qcld_Parsedown = new Qcld_Parsedown();
1586
1587 $allresults = !empty( $allresults ) ? $Qcld_Parsedown->text( $allresults ) : $allresults;
1588
1589 wp_send_json( [ 'status' => 'success', 'keywords' => $allresults ] );
1590 wp_die();
1591
1592 } else {
1593
1594 wp_send_json( [ 'status' => 'success', 'keywords' => $allresults ] );
1595 wp_die();
1596 }
1597
1598
1599 }
1600
1601 wp_send_json( [ 'status' => 'success', 'keywords' => $result_data ] );
1602 wp_die();
1603
1604 // var_dump($dataresponse);wp_die();
1605
1606 }
1607 }
1608
1609 add_action( 'wp_ajax_qc_wpbotpro_floating_openai_save_draft_post_extra', 'qc_wpbotpro_floating_openai_save_draft_post_callback' );
1610 add_action( 'wp_ajax_nopriv_qc_wpbotpro_floating_openai_save_draft_post_extra', 'qc_wpbotpro_floating_openai_save_draft_post_callback' );
1611
1612 if ( ! function_exists( 'qc_wpbotpro_floating_openai_save_draft_post_callback' ) ) {
1613 function qc_wpbotpro_floating_openai_save_draft_post_callback(){
1614
1615 check_ajax_referer( 'kbx-qc', 'security');
1616
1617 $qc_wpbotpro_floating_result = array(
1618 'status' => 'error',
1619 'msg' => 'Something went wrong',
1620 );
1621
1622 if ( isset( $_POST['title'] ) && !empty($_POST['title']) && isset( $_POST['content'] ) && !empty($_POST['content']) ) {
1623
1624 $qc_wpbotpro_floating_allowed_html_content_post = wp_kses_allowed_html( 'post' );
1625 $qc_wpbotpro_floating_title = sanitize_text_field( $_POST['title'] );
1626 $qc_wpbotpro_floating_content = wp_kses( $_POST['content'], $qc_wpbotpro_floating_allowed_html_content_post );
1627 $qc_wpbotpro_floating_post_id = wp_insert_post( array(
1628 'post_title' => $qc_wpbotpro_floating_title,
1629 'post_content' => $qc_wpbotpro_floating_content,
1630 )
1631 );
1632
1633 if ( !is_wp_error( $qc_wpbotpro_floating_post_id ) ) {
1634 if ( array_key_exists( 'qc_wpbotpro_floating_settings', $_POST ) ) {
1635 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_meta_key', $_POST['qc_wpbotpro_floating_settings'] );
1636 }
1637 if ( array_key_exists( 'qc_wpbotpro_floating_language', $_POST ) ) {
1638 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_language', $_POST['qc_wpbotpro_floating_language'] );
1639 }
1640 if ( array_key_exists( 'qc_wpbotpro_floating_preview_title', $_POST ) ) {
1641 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_preview_title', $_POST['qc_wpbotpro_floating_preview_title'] );
1642 }
1643 if ( array_key_exists( 'qc_wpbotpro_floating_number_of_heading', $_POST ) ) {
1644 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_number_of_heading', $_POST['qc_wpbotpro_floating_number_of_heading'] );
1645 }
1646 if ( array_key_exists( 'qc_wpbotpro_floating_heading_tag', $_POST ) ) {
1647 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_heading_tag', $_POST['qc_wpbotpro_floating_heading_tag'] );
1648 }
1649 if ( array_key_exists( 'qc_wpbotpro_floating_writing_style', $_POST ) ) {
1650 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_writing_style', $_POST['qc_wpbotpro_floating_writing_style'] );
1651 }
1652 if ( array_key_exists( 'qc_wpbotpro_floating_writing_tone', $_POST ) ) {
1653 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_writing_tone', $_POST['qc_wpbotpro_floating_writing_tone'] );
1654 }
1655 if ( array_key_exists( 'qc_wpbotpro_floating_modify_headings', $_POST ) ) {
1656 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_modify_headings', $_POST['qc_wpbotpro_floating_modify_headings'] );
1657 }
1658 if ( array_key_exists( 'qc_wpbotpro_floating_add_img', $_POST ) ) {
1659 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_add_img', $_POST['qc_wpbotpro_floating_add_img'] );
1660 }
1661 if ( array_key_exists( 'qc_wpbotpro_floating_add_tagline', $_POST ) ) {
1662 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_add_tagline', $_POST['qc_wpbotpro_floating_add_tagline'] );
1663 }
1664 if ( array_key_exists( 'qc_wpbotpro_floating_add_intro', $_POST ) ) {
1665 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_add_intro', $_POST['qc_wpbotpro_floating_add_intro'] );
1666 }
1667 if ( array_key_exists( 'qc_wpbotpro_floating_add_conclusion', $_POST ) ) {
1668 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_add_conclusion', $_POST['qc_wpbotpro_floating_add_conclusion'] );
1669 }
1670 if ( array_key_exists( 'qc_wpbotpro_floating_anchor_text', $_POST ) ) {
1671 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_anchor_text', $_POST['qc_wpbotpro_floating_anchor_text'] );
1672 }
1673 if ( array_key_exists( 'qc_wpbotpro_floating_target_url', $_POST ) ) {
1674 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_target_url', $_POST['qc_wpbotpro_floating_target_url'] );
1675 }
1676 if ( array_key_exists( 'qc_wpbotpro_floating_generated_text', $_POST ) ) {
1677 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_generated_text', $_POST['qc_wpbotpro_floating_generated_text'] );
1678 }
1679 // qc_wpbotpro_floating_cta_pos
1680 if ( array_key_exists( 'qc_wpbotpro_floating_cta_pos', $_POST ) ) {
1681 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_cta_pos', $_POST['qc_wpbotpro_floating_cta_pos'] );
1682 }
1683 // qc_wpbotpro_floating_target_url_cta
1684 if ( array_key_exists( 'qc_wpbotpro_floating_target_url_cta', $_POST ) ) {
1685 update_post_meta( $qc_wpbotpro_floating_post_id, 'qc_wpbotpro_floating_target_url_cta', $_POST['qc_wpbotpro_floating_target_url_cta'] );
1686 }
1687 $qc_wpbotpro_floating_result['status'] = 'success';
1688 $qc_wpbotpro_floating_result['msg'] = esc_html('Data Successfully Submitted.');
1689 $qc_wpbotpro_floating_result['id'] = $qc_wpbotpro_floating_post_id;
1690 $qc_wpbotpro_floating_result['post_link'] = esc_url( admin_url('edit.php') );
1691
1692 }
1693
1694 }
1695
1696 wp_send_json( $qc_wpbotpro_floating_result );
1697 }
1698 }
1699
1700
1701 add_action( 'wp_ajax_qc_wpbotpro_floating_openai_keyword_rewrite_article', 'qc_wpbotpro_floating_openai_keyword_rewrite_article_callback' );
1702 add_action( 'wp_ajax_nopriv_qc_wpbotpro_floating_openai_keyword_rewrite_article', 'qc_wpbotpro_floating_openai_keyword_rewrite_article_callback' );
1703 if ( ! function_exists( 'qc_wpbotpro_floating_openai_keyword_rewrite_article_callback' ) ) {
1704 function qc_wpbotpro_floating_openai_keyword_rewrite_article_callback () {
1705
1706 check_ajax_referer( 'kbx-qc', 'security');
1707
1708 set_time_limit(600);
1709
1710 $keyword = isset( $_POST['keyword'] ) ? $_POST['keyword'] : '';
1711 $OPENAI_API_KEY = get_option('open_ai_api_key');
1712 $ai_engines = get_option('openai_engines');
1713 $max_token = get_option('openai_max_tokens') ? get_option('openai_max_tokens') : 4000;
1714 $temperature = get_option('openai_temperature') ? get_option('openai_temperature') : 0;
1715 $ppenalty = get_option('presence_penalty');
1716 $fpenalty = get_option('frequency_penalty');
1717
1718 $datas = explode("\n",$keyword);
1719
1720 $result_data = '';
1721
1722 foreach( $datas as $data ) {
1723
1724 if(!empty($data)){
1725
1726 $prompt = "rewrite this paragraph for a unique artical:\n\n" . $data;
1727
1728 $gptkeyword = [];
1729
1730 if($ai_engines == 'gpt-3.5-turbo' || $ai_engines == 'gpt-4' || $ai_engines == 'gpt-4o' || $ai_engines == 'gpt-4o-mini' ){
1731
1732 $ch = curl_init();
1733 $url = 'https://api.openai.com/v1/chat/completions';
1734
1735 array_push($gptkeyword, array(
1736 "role" => "user",
1737 "content" => $prompt
1738 ));
1739
1740 $post_fields = array(
1741 "model" => $ai_engines,
1742 "messages" => $gptkeyword,
1743 "max_tokens" => (int)$max_token,
1744 "temperature" => 0
1745 );
1746 $header = [
1747 'Content-Type: application/json',
1748 'Authorization: Bearer ' . $OPENAI_API_KEY
1749 ];
1750 curl_setopt($ch, CURLOPT_URL, $url);
1751 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1752 curl_setopt($ch, CURLOPT_POST, 1);
1753 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_fields));
1754 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
1755 $result = curl_exec($ch);
1756 if (curl_errno($ch)) {
1757 echo esc_html('Error: ') . esc_html(curl_error($ch));
1758 }
1759 curl_close($ch);
1760
1761 $complete = json_decode($result);
1762
1763 $Qcld_Parsedown = new Qcld_Parsedown();
1764
1765 $result_data .= isset( $complete->choices[0]->message->content ) ? $Qcld_Parsedown->text( trim( $complete->choices[0]->message->content ) ) : '';
1766
1767
1768 }else{
1769
1770 $request_body = [
1771 "prompt" => $prompt,
1772 "model" => $ai_engines,
1773 "max_tokens" => (int)$max_token,
1774 "temperature" => (float)$temperature,
1775 "presence_penalty" => (float)$ppenalty,
1776 "frequency_penalty" => (float)$fpenalty,
1777 ];
1778 $data = json_encode($request_body);
1779 $url = "https://api.openai.com/v1/completions";
1780 $apt_key = "Authorization: Bearer ". $OPENAI_API_KEY;
1781
1782 $curl = curl_init($url);
1783 curl_setopt($curl, CURLOPT_URL, $url);
1784 curl_setopt($curl, CURLOPT_POST, true);
1785 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1786 $headers = array(
1787 "Content-Type: application/json",
1788 $apt_key ,
1789 );
1790 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1791 curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
1792 $result = curl_exec($curl);
1793 curl_close($curl);
1794 $results = json_decode($result);
1795
1796 $Qcld_Parsedown = new Qcld_Parsedown();
1797
1798 $result_data .= isset( $results->choices[0]->text ) ? $Qcld_Parsedown->text( trim( $results->choices[0]->text ) ) : '';
1799
1800 }
1801
1802 }
1803
1804 }
1805
1806
1807 wp_send_json( [ 'status' => 'success', 'keywords' => $result_data ] );
1808 wp_die();
1809
1810 }
1811 }
1812
1813
1814
1815 add_action( 'wp_ajax_qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax', 'qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax_callback' );
1816 add_action( 'wp_ajax_nopriv_qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax', 'qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax_callback' );
1817 if ( ! function_exists( 'qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax_callback' ) ) {
1818 function qc_wpbotpro_floating_openai_qc_wpbotpro_content_generator_by_ajax_callback(){
1819
1820
1821 check_ajax_referer( 'kbx-qc', 'security');
1822
1823 $qc_wpbotpro_floating_result = array(
1824 'status' => 'error',
1825 'msg' => 'Something went wrong',
1826 );
1827
1828 if(isset($_REQUEST['title']) && !empty($_REQUEST['title'])) {
1829 $qc_wpbotpro_floating_prompt = sanitize_text_field($_REQUEST['title']);
1830
1831 $OPENAI_API_KEY = get_option('open_ai_api_key');
1832 $ai_engines = get_option('openai_engines');
1833 $max_token = get_option('openai_max_tokens') ? get_option('openai_max_tokens') : 4000;
1834 $temperature = get_option('openai_temperature') ? get_option('openai_temperature') : 0;
1835 $ppenalty = get_option('presence_penalty');
1836 $fpenalty = get_option('frequency_penalty');
1837
1838 if ( isset( $qc_wpbotpro_floating_prompt ) && !empty( $qc_wpbotpro_floating_prompt ) ) {
1839
1840 $gptkeyword = [];
1841 if($ai_engines == 'gpt-3.5-turbo' || $ai_engines == 'gpt-4' || $ai_engines == 'gpt-4o' || $ai_engines == 'gpt-4o-mini'){
1842 $ch = curl_init();
1843 $url = 'https://api.openai.com/v1/chat/completions';
1844
1845 array_push($gptkeyword, array(
1846 "role" => "user",
1847 "content" => $qc_wpbotpro_floating_prompt
1848 ));
1849
1850 $post_fields = array(
1851 "model" => $ai_engines,
1852 "messages" => $gptkeyword,
1853 "max_tokens" => (int)$max_token,
1854 "temperature" => ( float ) $temperature
1855 );
1856 $header = [
1857 'Content-Type: application/json',
1858 'Authorization: Bearer ' . $OPENAI_API_KEY
1859 ];
1860 curl_setopt($ch, CURLOPT_URL, $url);
1861 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1862 curl_setopt($ch, CURLOPT_POST, 1);
1863 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_fields));
1864 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
1865 $result = curl_exec($ch);
1866 if (curl_errno($ch)) {
1867 echo esc_html('Error: ') . esc_html(curl_error($ch));
1868 }
1869 curl_close($ch);
1870
1871
1872 $complete = json_decode($result);
1873
1874 if ( isset( $complete->error ) ) {
1875 $qc_wpbotpro_floating_result['msg'] = esc_html( trim( $complete->error->message ) );
1876 } else {
1877 $qc_wpbotpro_floating_result['data'] = $complete->choices[0]->message->content;
1878 $qc_wpbotpro_floating_result['status'] = 'success';
1879 }
1880
1881 //return $qc_wpbotpro_floating_result;
1882
1883 wp_send_json( $qc_wpbotpro_floating_result );
1884
1885
1886
1887 }else{
1888
1889 $ai_engines = 'text-davinci-003';
1890 $request_body = [
1891 "prompt" => $qc_wpbotpro_floating_prompt,
1892 "model" => $ai_engines,
1893 "max_tokens" => (int)$max_token,
1894 "temperature" => (float)$temperature,
1895 "presence_penalty" => (float)$ppenalty,
1896 "frequency_penalty" => (float)$fpenalty,
1897 "stream" => true,
1898 ];
1899
1900 $data = json_encode($request_body);
1901 $url = "https://api.openai.com/v1/completions";
1902 $apt_key = "Authorization: Bearer ". $OPENAI_API_KEY;
1903
1904 $curl = curl_init($url);
1905 curl_setopt($curl, CURLOPT_URL, $url);
1906 curl_setopt($curl, CURLOPT_POST, true);
1907 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1908 $headers = array(
1909 "Content-Type: application/json",
1910 $apt_key,
1911 );
1912 curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1913 curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
1914 $result = curl_exec($curl);
1915 curl_close($curl);
1916
1917 //return $qc_wpbotpro_floating_result;
1918 $complete = json_decode($result);
1919
1920 if ( isset( $complete->error ) ) {
1921 $qc_wpbotpro_floating_result['msg'] = esc_html( trim( $complete->error->message ) );
1922 } else {
1923 $qc_wpbotpro_floating_result['data'] = $complete->choices[0]->text;
1924 $qc_wpbotpro_floating_result['status'] = 'success';
1925 }
1926
1927 wp_send_json( $qc_wpbotpro_floating_result );
1928
1929
1930 }
1931
1932
1933 }
1934
1935
1936 }
1937 }
1938
1939 }
1940 }