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

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

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