PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 6.0.7
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v6.0.7
8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 All 534 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 6.0.7, at inc/qcld_openai_floating_content.php

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