PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.5.7
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.5.7
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.5.7, at inc/qcld_openai_floating_content.php

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