PluginProbe ʕ •ᴥ•ʔ
AutoWP – AI Content Writer & Rewriter / 2.3.0
AutoWP – AI Content Writer & Rewriter v2.3.0
2.3.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.10 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9
autowp-ai-content-writer-rewriter / includes / new-wp-website-form.php
autowp-ai-content-writer-rewriter / includes Last commit date
new-ai-website-form.php 1 month ago new-gtrends-website-form.php 1 month ago new-news-website-form.php 1 month ago new-own-ai-agent-form.php 1 month ago new-rss-website-form.php 1 month ago new-wp-website-form.php 1 month ago
new-wp-website-form.php
852 lines
1 <?php
2 function autowp_wp_page_handler()
3 {
4 global $wpdb;
5
6 $table = new AutoWP_Wordpress_Websites();
7
8 $table->prepare_items();
9
10 $message = '';
11 if ('delete_all' === $table->current_action()) {
12
13 // Good idea to make sure things are set before using them
14 $deleted_items_ids = isset($_POST['id']) ? array_map('absint', (array)$_POST['id']) : array();
15
16 // Sanitize the array using array_map and absint
17 $deleted_items_ids = array_map('absint', $deleted_items_ids);
18
19 // Validate the IDs, make sure they are positive integers
20 $deleted_items_ids = array_filter($deleted_items_ids, function ($id) {
21 return $id > 0;
22 });
23
24 $message = 'Items deleted: ' . count($deleted_items_ids);
25
26 // Escape the message before outputting it
27 $message = esc_html($message);
28 }
29
30
31 if ('delete' === $table->current_action()) {
32 // Sanitize and escape the 'id' parameter
33 $deleted_item_id = isset($_REQUEST['id']) ? absint($_REQUEST['id']) : 0;
34
35 // Escape the output and use the sprintf function for better readability
36 $message = 'Item deleted : ' . $deleted_item_id;
37 }
38
39
40 ?>
41 <div class="wrap">
42
43 <div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
44 <h2><?php esc_html_e('Websites', 'autowp'); ?> <a class="add-new-h2"
45 href="<?php echo esc_url(get_admin_url(get_current_blog_id(), 'admin.php?page=autowp_add_new_website_form')); ?>"><?php esc_html_e('Add new', 'autowp'); ?></a>
46 </h2>
47
48 <?php
49 if($message && !empty($message)){
50 echo '<div class="updated below-h2" id="message"><p>' . esc_html($message) . '</p></div>';
51
52 }
53 ?>
54
55 <form id="contacts-table" method="POST">
56 <?php
57 // Sanitize and escape the 'page' parameter
58 $page_value = isset($_REQUEST['page']) ? sanitize_text_field($_REQUEST['page']) : '';
59 ?>
60 <input type="hidden" name="page" value="<?php echo esc_html($page_value); ?>"/>
61 <?php $table->display() ?>
62 </form>
63
64
65 </div>
66 <?php
67 }
68
69
70 function autowp_wp_website_form_page_handler(){
71 global $wpdb;
72 $table_name = $wpdb->prefix . 'autowp_wordpress_websites';
73
74 $message = '';
75 $notice = '';
76
77
78 $default = array(
79 'id' => 0,
80 'website_name' => '',
81 'domain_name' => '',
82 'category_id' => '',
83 'website_category_id' => '',
84 'aigenerated_title' => '',
85 'aigenerated_content' => '',
86 'aigenerated_tags' => '',
87 'aigenerated_image' => '',
88 'post_count' => '',
89 'post_order' => '',
90 'title_prompt' => '',
91 'content_prompt' => '',
92 'tags_prompt' => '',
93 'image_prompt' => '',
94 'image_generating_status' => '',
95 'author_selection' => '',
96 'active' => '',
97
98
99 );
100
101
102 if ( isset($_REQUEST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])), basename(__FILE__))) {
103
104
105
106
107 // Process only the specific values needed
108 $item = array(
109 'id' => isset($_POST['id']) ? intval($_POST['id']) : 0,
110 'website_name' => sanitize_text_field($_POST['website_name']),
111 'domain_name' => sanitize_url($_POST['domain_name']),
112 'category_id' => isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array(),
113 'website_category_id'=> isset($_POST['website_category_id']) ? array_map('intval', $_POST['website_category_id']) : array(),
114 'aigenerated_title' => '1',
115 'aigenerated_content'=> '1',
116 'aigenerated_tags' => '1',
117 'aigenerated_image' => '1',
118 'post_count' => 5,
119 'post_order' => sanitize_text_field($_POST['post_order']),
120 'title_prompt' => sanitize_textarea_field($_POST['title_prompt']),
121
122 'content_prompt' => '[autowp-rewriting-promptcode]' .
123 sanitize_text_field($_POST['languageSelect']) . ',' .
124 sanitize_text_field($_POST['subtitleSelect']) . ',' .
125 sanitize_text_field($_POST['narrationSelect']) .
126 '[/autowp-rewriting-promptcode]',
127
128 'tags_prompt' => sanitize_textarea_field($_POST['tags_prompt']),
129 'image_prompt' => sanitize_textarea_field($_POST['image_prompt']),
130 'image_generating_status' => sanitize_textarea_field($_POST['image_generating_status']),
131 'website_type' => 'wordpress',
132 'author_selection' => sanitize_text_field($_POST['author_selection']),
133 'active' => sanitize_text_field(($_POST['active'])) ?? '1'
134 );
135 //Convert category_id array to text
136 $category_ids = implode(",", $item['category_id']);
137 $item['category_id'] = $category_ids;
138 //Convert website_category_id to text
139 if($item['website_category_id']){
140 $website_category_ids = implode(",", $item['website_category_id']);
141 $item['website_category_id'] = $website_category_ids;
142 }
143
144
145 if ($item['aigenerated_title'] !== '1'){
146 $item['aigenerated_title'] = '0';
147 }
148
149 if($item['aigenerated_content'] !== '1'){
150 $item['aigenerated_content'] = '0';
151 }
152
153 if($item['aigenerated_tags'] !== '1'){
154 $item['aigenerated_tags'] = '0';
155 }
156
157 if($item['aigenerated_image'] !== '1'){
158 $item['aigenerated_image'] = '0';
159 }
160
161 $item['website_type'] = 'wordpress';
162
163 // Set WP-CRON
164
165 $settings = unserialize(get_option('autowp_settings'));
166
167 $wpcron_status = $settings['wpcron_status'];
168
169 if(!isset($wpcron_status)){
170 autowp_update_wp_cron_status('1');
171 }
172
173 $time_value_type = $settings['selected_time_type'];
174
175 $user_wpcron_time = autowp_get_wpcron_time($time_value_type);
176 $next_two_minutes = time() + 2 * 60;
177
178 // Schedule WP-Cron
179 if (!wp_next_scheduled('autowp_cron')) {
180 wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron');
181
182 } else {
183 wp_clear_scheduled_hook('autowp_cron');
184 wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron');
185 }
186
187
188
189 $item_valid = autowp_validate_website($item);
190 if ($item_valid === true) {
191 if ($item['id'] == 0) {
192 $result = $wpdb->insert($table_name, $item);
193 $item['id'] = $wpdb->insert_id;
194 if ($result) {
195 $message = __('New process was successfully saved! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp');
196 } else {
197 $notice = __('There was an error while saving item', 'autowp');
198 }
199 } else {
200 $result = $wpdb->update($table_name, $item, array('id' => $item['id']));
201 if ($result) {
202 $message = __('New process was successfully updated! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp');
203 } else {
204 $notice = __('There was an error while updating item', 'autowp');
205 }
206 }
207 } else {
208
209 $notice = $item_valid;
210 }
211 }
212 else {
213
214 $item = $default;
215 if (isset($_REQUEST['id'])) {
216 $sanitized_id = absint($_REQUEST['id']); // Sanitize as an integer
217 $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE id = %d", $sanitized_id), ARRAY_A);
218 if (!$item) {
219 $item = $default;
220 $notice = __('Item not found', 'autowp');
221 }
222 }
223
224 }
225
226
227 add_meta_box('websites_form_meta_box', __('Website Form', 'autowp'), 'autowp_websites_form_meta_box_handler', 'add_new_wp_website_form', 'normal', 'default');
228
229 ?>
230 <div class="wrap">
231 <div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
232 <h2><?php esc_html_e('Add New', 'autowp'); ?> <a class="add-new-h2"
233 href="<?php echo esc_url(get_admin_url(get_current_blog_id(), 'admin.php?page=autowp_automaticPost')); ?>"><?php esc_html_e('Back to List', 'autowp'); ?></a>
234 </h2>
235
236
237 <?php if (!empty($notice)): ?>
238 <div id="notice" class="error"><p><?php echo esc_attr($notice) ?></p></div>
239 <?php endif;?>
240 <?php if (!empty($message)): ?>
241 <div id="message" class="updated"><p><?php echo esc_attr($message) ?></p></div>
242 <?php endif;?>
243
244 <form id="form" method="POST">
245 <input type="hidden" name="nonce" value="<?php echo esc_attr(wp_create_nonce(basename(__FILE__))); ?>"/>
246
247 <input type="hidden" name="id" value="<?php echo esc_attr($item['id']) ?>"/>
248
249 <div class="metabox-holder" id="poststuff">
250 <div id="post-body">
251 <div id="post-body-content">
252
253 <?php do_meta_boxes('add_new_wp_website_form', 'normal', $item); ?>
254 <input type="submit" value="<?php esc_attr_e('Save', 'autowp')?>" id="submit" class="button-primary" name="submit">
255 </div>
256 </div>
257 </div>
258 </form>
259 </div>
260 <?php
261 }
262
263
264 function autowp_get_categories_from_wordpress_website($user_domainname, $user_email, $website_domainname) {
265
266 $url = 'https://api.autowp.app/getWebsiteCategories';
267
268 // Set request data
269 $data = array(
270 'user_domainname' => $user_domainname,
271 'user_email' => $user_email,
272 'website_domainname' => $website_domainname
273 );
274
275 $response = wp_remote_post(
276 $url,
277 array(
278 'timeout' => 120,
279 'headers' => array(
280 'Content-Type' => 'application/json'
281 ),
282 'body' => json_encode($data)
283 )
284 );
285
286 $response_data = wp_remote_retrieve_body($response);
287 $responseData = json_decode($response_data, true);
288 return $responseData;
289
290
291
292 if ( is_wp_error( $response ) ) {
293 $error_message = $response->get_error_message();
294 return "Something went wrong: $error_message";
295 } else {
296 $response_data = wp_remote_retrieve_body($response);
297 $responseData = json_decode($response_data, true);
298 return $responseData;
299 }
300
301
302
303 }
304
305
306 function autowp_get_admin_email(){
307 $admin_email = get_option('admin_email', false);
308 if ($admin_email !== false) {
309
310
311 } else {
312 $admin_email = 'email@example.com';
313 }
314 return $admin_email;
315 }
316
317
318
319
320 function autowp_websites_form_meta_box_handler($item)
321 {
322
323 // Parsing the example content_prompt
324 $parsed_values = autowp_parse_rewriting_prompt_code($item['content_prompt']) ?? '';
325
326
327 $promptcode_language = $parsed_values['language'] ?? '';
328 $promptcode_subtitle = $parsed_values['subtitle'] ?? '';
329 $promptcode_narration = $parsed_values['narration'] ?? '';
330 ?>
331 <div id="loading">
332 <div class="loader">
333 <div class="inner one"></div>
334 <div class="inner two"></div>
335 <div class="inner three"></div>
336 </div>
337 </div>
338
339 <tbody >
340 <form>
341 <div class="form2bc">
342 <div class="container">
343 <form class="row g-3">
344 <div class="col-md-6">
345 <label for="website_name" class="form-label">Website Name:</label>
346 <?php
347 //Get admin domain name
348 $autowp_admin_email = autowp_get_admin_email();
349 $autowp_domain_name = esc_url(get_site_url());
350
351 $is_empty = empty($item['domain_name']);
352 ?>
353
354 <input type="hidden" id="autowp_admin_email" value="<?php echo esc_attr($autowp_admin_email); ?>">
355 <input type="hidden" id="autowp_domain_name" value="<?php echo esc_attr($autowp_domain_name); ?>">
356
357 <input id="website_name" name="website_name" type="text" class="form-control" value="<?php echo esc_attr($item['website_name']); ?>" required>
358 </div>
359 <div class="col-md-6">
360 <label for="domain_name" class="form-label">Domain Name:</label>
361 <input id="domain_name" name="domain_name" type="url" class="form-control" value="<?php echo esc_attr($item['domain_name']); ?>" required>
362 </div>
363
364 <div class="col-md-6">
365 <label class="form-label">Author Selection</label>
366 <select name="author_selection" class="form-select">
367 <?php
368 $authors = get_users();
369
370 foreach ($authors as $author) {
371 $author_id = $author->ID;
372 $author_name = $author->display_name;
373 $author_description = get_the_author_meta('description', $author_id); // Yazarın açıklamasını al
374
375 if ($item['author_selection'] === strval($author_id)) {
376 echo '<option value="' . esc_attr($author_id) . '" selected>' . esc_html($author_name) . '</option>';
377 continue;
378 }
379
380 echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>';
381 }
382 ?>
383 </select>
384 <p class="form-text">Select an author from the list.</p>
385 </div>
386
387 <div class="col-md-6">
388 <label for="website_category_id" class="form-label">Website Categories:</label><br>
389 <select id="website_category_id" name="website_category_id[]" multiple class="form-select" <?php
390 if ($is_empty) {
391 echo 'style="display: none;"';
392 }
393 ?>>
394 <?php
395
396 //Get selected categories
397 $selected_website_categories = $item['website_category_id'];
398 //Turn categories to array list
399 $selected_website_categories = explode(',', $selected_website_categories);
400
401 //Get website categories from domain
402 if (!$is_empty) {
403
404 $autowp_wp_website_domain_name = esc_url($item['domain_name']);
405 $website_categories = autowp_get_categories_from_wordpress_website($autowp_domain_name, $autowp_domain_name, $autowp_wp_website_domain_name);
406
407 if (!$website_categories['error']) {
408
409 foreach ($website_categories as $website_category) {
410 if (in_array($website_category['id'], $selected_website_categories)) {
411 echo '<option value="' . esc_attr($website_category['id']) . '" selected>' . esc_html($website_category['name']) . '</option>';
412 continue;
413 }
414 echo '<option value="' . esc_attr($website_category['id']) . '">' . esc_html($website_category['name']) . '</option>';
415 }
416 }
417 }
418 ?>
419 </select>
420 <button type="button" class="btn btn-primary" onclick="refreshWebsiteCategories()">
421 <i class="bi bi-arrow-clockwise"></i>
422 <?php
423 $category_button_name = 'Get Categories';
424
425 if (!$is_empty) {
426 $category_button_name = 'Refresh';
427 }
428
429 echo esc_html($category_button_name);
430 ?>
431 </button>
432 </div>
433 <br>
434 <div class="col-md-6">
435 <label for="category_id" class="form-label">Categories:</label>
436 <select id="category_id" name="category_id[]" required multiple class="form-select">
437 <?php
438
439 //Get selected categories
440 $selected_categories = $item['category_id'];
441 //Turn categories to array list
442 $selected_categories = explode(',', $selected_categories);
443
444 $categories = get_categories(array(
445 'orderby' => 'name',
446 'order' => 'ASC',
447 'hide_empty' => false
448 ));
449
450 foreach ($categories as $category) {
451
452 if (isset($selected_categories) && in_array($category->term_id, $selected_categories)) {
453 echo '<option value="' . esc_attr($category->term_id) . '" selected>' . esc_html($category->name) . '</option>';
454 continue;
455 }
456 echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>';
457 }
458 ?>
459 </select>
460 </div>
461 <br>
462
463
464 <div class="col-md-6">
465 <label class="form-label" for="image_generating_status"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label>
466 <select name="image_generating_status" class="form-select">
467 <option value="0" <?php if ($item['image_generating_status'] === '0') {
468 echo 'selected';
469 } ?>><?php esc_html_e('FLUX Realism LoRA', 'autowp'); ?></option>
470 <option value="1" <?php if ($item['image_generating_status'] === '1') {
471 echo 'selected';
472 } ?>><?php esc_html_e('Stable Diffusion Ultra', 'autowp'); ?></option>
473 <option value="2" <?php if ($item['image_generating_status'] === '2') {
474 echo 'selected';
475 } ?>><?php esc_html_e('Stable Diffusion Core', 'autowp'); ?></option>
476 <option value="3" <?php if ($item['image_generating_status'] === '3') {
477 echo 'selected';
478 } ?>><?php esc_html_e('GPT Image 1 Mini', 'autowp'); ?></option>
479 <option value="4" <?php if ($item['image_generating_status'] === '4') {
480 echo 'selected';
481 } ?>><?php esc_html_e('GPT Image 2', 'autowp'); ?></option>
482 <option value="5" <?php if ($item['image_generating_status'] === '5') {
483 echo 'selected';
484 } ?>><?php esc_html_e('DuckDuckGo Search', 'autowp'); ?></option>
485
486
487 <option value="6" <?php if ($item['image_generating_status'] === '6') {
488 echo 'selected';
489 } ?>><?php esc_html_e('Default Image', 'autowp'); ?></option>
490
491 <option value="7" <?php if ($item['image_generating_status'] === '7') {
492 echo 'selected';
493 } ?>><?php esc_html_e('No Image', 'autowp'); ?></option>
494
495 <option value="8" <?php if ($item['image_generating_status'] === '8') {
496 echo 'selected';
497 } ?>><?php esc_html_e('Original Image', 'autowp'); ?></option>
498 </select>
499 <p class="form-text"><?php esc_html_e('By default No Image is selected. Use DuckDuckGo Search to find images in the internet.', 'autowp'); ?></p>
500 </div>
501
502
503 <div class="col-md-6">
504 <label for="post_order" class="form-label">Post Order:</label>
505 <select id="post_order" name="post_order" class="form-select">
506 <option value="desc" <?php if ($item['post_order'] === 'desc') {
507 echo 'selected';
508 } ?>>Latest First</option>
509 <option value="asc" <?php if ($item['post_order'] === 'asc') {
510 echo 'selected';
511 } ?>>Oldest First</option>
512 <option value="rand" <?php if ($item['post_order'] === 'rand') {
513 echo 'selected';
514 } ?>>Random</option>
515 </select>
516 </div>
517
518
519
520
521 <h4 style="font-weight: bold;">Post Settings</h4>
522 <br>
523 <div class="col-md-6">
524 <label for="languageSelect" class="form-label">Post Language:</label>
525 <select class="form-select" id="languageSelect" name="languageSelect">
526 <?php
527 $languages = [
528 "Afrikaans",
529 "Albanian",
530 "Arabic",
531 "Armenian",
532 "Basque",
533 "Bengali",
534 "Bulgarian",
535 "Catalan",
536 "Cambodian",
537 "Chinese (Mandarin)",
538 "Croatian",
539 "Czech",
540 "Danish",
541 "Dutch",
542 "English",
543 "Estonian",
544 "Fiji",
545 "Finnish",
546 "French",
547 "Georgian",
548 "German",
549 "Greek",
550 "Gujarati",
551 "Hebrew",
552 "Hindi",
553 "Hungarian",
554 "Icelandic",
555 "Indonesian",
556 "Irish",
557 "Italian",
558 "Japanese",
559 "Javanese",
560 "Korean",
561 "Latin",
562 "Latvian",
563 "Lithuanian",
564 "Macedonian",
565 "Malay",
566 "Malayalam",
567 "Maltese",
568 "Maori",
569 "Marathi",
570 "Mongolian",
571 "Nepali",
572 "Norwegian",
573 "Persian",
574 "Polish",
575 "Portuguese",
576 "Punjabi",
577 "Quechua",
578 "Romanian",
579 "Russian",
580 "Samoan",
581 "Serbian",
582 "Slovak",
583 "Slovenian",
584 "Spanish",
585 "Swahili",
586 "Swedish",
587 "Tamil",
588 "Tatar",
589 "Telugu",
590 "Thai",
591 "Tibetan",
592 "Tonga",
593 "Turkish",
594 "Ukrainian",
595 "Urdu",
596 "Uzbek",
597 "Vietnamese",
598 "Welsh",
599 "Xhosa"
600 ];
601 ?>
602
603
604 <?php foreach ($languages as $language): ?>
605 <option value="<?php echo esc_attr($language); ?>" <?php echo ($language === $promptcode_language) ? 'selected' : ''; ?>>
606 <?php echo esc_html($language); ?>
607 </option>
608 <?php endforeach; ?>
609
610
611 </select>
612 </div>
613 <br>
614 <div class="col-md-6">
615 <label for="subtitleSelect" class="form-label">Subheading Count:</label>
616 <select class="form-select" id="subtitleSelect" name="subtitleSelect">
617 <?php
618 for ($i = 1; $i <= 10; $i++) {
619 $selected = ($promptcode_subtitle == strval($i)) ? 'selected' : '';
620 echo '<option value="' . esc_attr($i) . '" ' . esc_attr($selected) . '>' . esc_html($i) . '</option>';
621 }
622 ?>
623 </select>
624 </div>
625 <br>
626 <div class="col-md-6">
627 <label for="narrationSelect" class="form-label">Writing Style:</label>
628 <select class="form-select" id="narrationSelect" name="narrationSelect">
629 <?php
630 $is_inactive = (isset($item['active']) && $item['active'] === '0');
631 $styles = [
632 "Descriptive" => "Descriptive",
633 "Narrative" => "Narrative",
634 "Explanatory" => "Explanatory",
635 "Argumentative" => "Argumentative",
636 "Comparative" => "Comparative",
637 "Process Analysis" => "Process Analysis",
638 "Allegorical" => "Allegorical",
639 "Chronological" => "Chronological",
640 "Ironic" => "Ironic",
641 "ConsistencyAndRepetition" => "Consistency and Repetition",
642 "LanguagePlayAndPoeticExpression" => "Language Play and Poetic Expression",
643 "InternalMonologue" => "Internal Monologue",
644 "Dialogical" => "Dialogical"
645 ];
646 foreach ($styles as $value => $name) {
647 $selected = ($promptcode_narration == $value) ? 'selected' : '';
648 echo "<option value='" . esc_attr($value) . "' " . esc_attr($selected) . ">" . esc_html($name) . "</option>";
649
650
651 }
652 ?>
653
654 </select>
655
656 </div>
657 <br>
658 <h4 style="font-weight: bold;">Source Status</h4>
659
660
661 <!-- Status Field (Active/Inactive) -->
662 <div class="col-md-6">
663 <label for="active" class="form-label">Status:</label>
664
665
666 <select id="active" name="active" class="form-select">
667 <option value="1" <?php echo (!$is_inactive) ? 'selected' : ''; ?>>
668 Active
669 </option>
670 <option value="0" <?php echo ($is_inactive) ? 'selected' : ''; ?>>
671 Inactive
672 </option>
673 </select>
674
675 <p>
676 When the cron job is triggered, any task marked as "Active" will be executed.
677 If you select "Inactive," this task will be skipped, and the cron job will move
678 on to the remaining active tasks. This makes it easy to enable or disable tasks
679 without removing them entirely.
680 </p>
681 </div>
682
683
684 <br>
685
686
687 </form>
688 </div>
689
690
691
692
693
694
695
696
697 </form>
698
699
700 </tbody>
701 <?php
702 }
703
704 function autowp_website_selection_page_handler(){
705 ?>
706 <!-- Add this in the <head> section of your HTML -->
707
708 <div class="wrap">
709 <h2><?php esc_attr_e('Add New Source', 'autowp')?></h2>
710 <p><?php esc_attr_e('Please select the type of source you want to add for automatic generating:', 'autowp')?></p>
711 <ul class="list-group">
712 <li class="list-group-item">
713 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=add_new_wp_website_form')); ?>" class="d-flex justify-content-between align-items-center">
714 <div class="d-flex align-items-center">
715 <img src="<?php echo esc_url( plugins_url( '../assets/images/wordpress-icon.png', __FILE__ ) ); ?>" alt="<?php echo esc_attr( 'WordPress Website' ); ?>" class="me-3" style="width: 80px; height: 80px;">
716 <div>
717 <h5><?php esc_attr_e('AI-Rewrite From Wordpress Website', 'autowp')?></h5>
718 <p><?php esc_attr_e('Fetch posts from WordPress site and rewrite with artificial intelligence.', 'autowp')?></p>
719 </div>
720 </div>
721 </a>
722 </li>
723 <li class="list-group-item">
724 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=add_new_rss_website_form')); ?>" class="d-flex justify-content-between align-items-center">
725 <div class="d-flex align-items-center">
726 <img src="<?php echo esc_url(plugins_url('../assets/images/rss-icon.png', __FILE__)); ?>" alt="<?php esc_attr_e('RSS Website'); ?>" class="me-3" style="width: 80px; height: 80px;">
727 <div>
728 <h5><?php esc_attr_e('AI-Rewrite From RSS Website', 'autowp')?></h5>
729 <p><?php esc_attr_e('Fetch content with RSS and rewrite with artificial intelligence.', 'autowp')?></p>
730 </div>
731 </div>
732 </a>
733 </li>
734
735
736 <li class="list-group-item">
737 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=add_new_ai_website_form')); ?>" class="d-flex justify-content-between align-items-center">
738 <div class="d-flex align-items-center">
739 <img src="<?php echo esc_url(plugins_url('../assets/images/robot-icon.png', __FILE__)); ?>" alt="<?php esc_attr_e('Artificial Intelligence'); ?>" class="me-3" style="width: 80px; height: 80px;">
740 <div>
741 <h5><?php esc_attr_e('AI Agents with Web Research Tools', 'autowp')?></h5>
742 <p><?php esc_attr_e('Create original content from scratch using AutoWP AI Agent with web research tool !', 'autowp')?></p>
743 </div>
744 </div>
745 </a>
746 </li>
747
748
749 <li class="list-group-item">
750 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=add_new_agenticscraper_form')); ?>" class="d-flex justify-content-between align-items-center">
751 <div class="d-flex align-items-center">
752 <img src="<?php echo esc_url(plugins_url('../assets/images/robot-icon.png', __FILE__)); ?>" alt="<?php esc_attr_e('Artificial Intelligence'); ?>" class="me-3" style="width: 80px; height: 80px;">
753 <div>
754 <h5><?php esc_attr_e('Agentic Scraper with Custom Tools and Prompts', 'autowp')?></h5>
755 <p><?php esc_attr_e('Create your own Agentic Scraper with your customize tools and prompts!', 'autowp')?></p>
756 </div>
757 </div>
758 </a>
759 </li>
760
761
762
763
764 <li class="list-group-item">
765 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=add_new_news_website_form')); ?>" class="d-flex justify-content-between align-items-center">
766 <div class="d-flex align-items-center">
767 <img src="<?php echo esc_url(plugins_url('../assets/images/gnews.png', __FILE__)); ?>" alt="<?php esc_attr_e('Rewrite With AI From News'); ?>" class="me-3" style="width: 80px; height: 80px;">
768 <div>
769 <h5><?php esc_html_e('AI-Rewrite News From Google News ', 'autowp')?></h5>
770 <p><?php esc_html_e('Fetch content from Google News and rewrite with artificial intelligence.', 'autowp')?></p>
771 </div>
772 </div>
773 </a>
774 </li>
775
776
777
778 <!-- New item with modal trigger -->
779 <li class="list-group-item">
780 <a href="#" data-bs-toggle="modal" data-bs-target="#tutorialModal" class="d-flex justify-content-between align-items-center">
781 <div class="d-flex align-items-center">
782 <img src="<?php echo esc_url(plugins_url( '../assets/images/tutorial.png', __FILE__ )); ?>" alt="Tutorial" class="me-3" style="width: 80px; height: 80px;">
783 <div>
784 <h5><?php esc_html_e('Video Tutorials', 'autowp')?></h5>
785 <p><?php esc_html_e('Learn how to add new process.', 'autowp')?></p>
786 </div>
787 </div>
788 </a>
789 </li>
790
791
792 <!-- Bootstrap Modal -->
793 <div class="modal fade" id="tutorialModal" tabindex="-1" aria-labelledby="tutorialModalLabel" aria-hidden="true">
794 <div class="modal-dialog modal-dialog-centered">
795 <div class="modal-content">
796 <div class="modal-header">
797 <h5 class="modal-title" id="tutorialModalLabel">Video Tutorials</h5>
798 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
799 </div>
800 <div class="modal-body">
801 <div class="mb-3">
802 <h5>Manual Processes:</h5>
803 <p>After clicking the "Generate Post" button at the bottom, your process will start running in the background. The average duration of this process is around 5 minutes. If an error occurs, you can find detailed information at the top of your WordPress admin panel.</p>
804 </div>
805
806 <div class="mb-3">
807 <h5>Automatic Processes:</h5>
808 <p>For each added process, it will be automatically triggered at the specified time interval (you can set this in the settings, under the cron section). Therefore, after adding processes, you need to set the time and wait for the posts to be generated automatically.</p>
809 </div>
810 <!-- Video Tutorials -->
811 <div class="mb-3">
812 <h6>How to Use - Detailed Tutorial</h6>
813 <iframe width="450" height="350" src="https://www.youtube.com/embed/idN8NNyyjW8" frameborder="0" allowfullscreen></iframe>
814 </div>
815
816 <!-- Timestamp Links -->
817 <div class="video-timestamps">
818 <ul>
819 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=0s" target="_blank"><strong>0:00</strong> - Setup AutoWP</a></li>
820 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=46s" target="_blank"><strong>0:46</strong> - Add WordPress website as a source</a></li>
821 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=90s" target="_blank"><strong>1:30</strong> - Add RSS Feed as a source</a></li>
822 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=126s" target="_blank"><strong>2:06</strong> - Add Google News as a source</a></li>
823 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=178s" target="_blank"><strong>2:58</strong> - Posts generated by AutoWP</a></li>
824 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=204s" target="_blank"><strong>3:24</strong> - Content Planner – Adding a Section with Your Own Prompt</a></li>
825 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=440s" target="_blank"><strong>7:20</strong> - Content Planner – Adding a Fixed HTML Section</a></li>
826 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=455s" target="_blank"><strong>7:35</strong> - Content Planner – Ready-Made Section Templates</a></li>
827 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=466s" target="_blank"><strong>7:46</strong> - Content Planner – Adding/Removing Ready-Made Section Templates</a></li>
828 <li><a href="https://www.youtube.com/watch?v=idN8NNyyjW8&t=487s" target="_blank"><strong>8:07</strong> - Exit</a></li>
829 </ul>
830 </div>
831
832
833
834
835 <!-- End Video Tutorials -->
836 </div>
837 <div class="modal-footer">
838 <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
839 </div>
840 </div>
841 </div>
842 </div>
843
844
845
846 </ul>
847
848 </div>
849 <?php
850 }
851
852