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