PluginProbe ʕ •ᴥ•ʔ
AutoWP – AI Content Writer & Rewriter / 1.0.2
AutoWP – AI Content Writer & Rewriter v1.0.2
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 / autowp.php
autowp-ai-content-writer-rewriter Last commit date
assets 2 years ago includes 2 years ago languages 2 years ago LICENSE.txt 2 years ago autowp.php 2 years ago index.php 2 years ago readme.txt 2 years ago
autowp.php
3480 lines
1 <?php
2
3
4
5 /**
6 * Plugin Name: AutoWP - AI Content Writer & Rewriter
7 * Plugin URI: https://autowp.app
8 * Description: AI Content Writer & Rewriter. Write content with AI from zero. Import content from RSS, Wordpress and rewrite with AI. Generate SEO optimized content,tags,title and generate image. ChatGPT, Content Writer, Auto Content Writer, Image Generator, AutoGPT, ChatPDF, SEO optimizer, AI Training.
9 * Version: 1.0.0
10 * Requires at least: 5.2
11 * Requires PHP: 7.2
12 * Author: Neuralabz LTD.
13 * Author URI: https://neuralabz.limited
14 * License: GPL v2 or later
15 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
16 * Text Domain: autowp
17 * Domain Path: /languages
18 */
19
20
21
22 defined( 'ABSPATH' ) or die( 'PERMİSSİON ERROR!' );
23
24 require plugin_dir_path( __FILE__ ) . 'includes/new-wp-website-form.php';
25 require plugin_dir_path( __FILE__ ) . 'includes/new-rss-website-form.php';
26 require plugin_dir_path( __FILE__ ) . 'includes/new-ai-website-form.php';
27 require plugin_dir_path( __FILE__ ) . 'includes/new-news-website-form.php';
28
29
30
31
32 // Enqueque JS Files
33 function autowp_enqueue_scripts() {
34 $autowp_my_plugin_dir = plugin_dir_url(__FILE__);
35
36
37 //Enqueque AutoWP JS File
38 wp_register_script( 'bootstrapjs',$autowp_my_plugin_dir.'/assets/js/bootstrap.min.js' , array('jquery'), false, true );
39 wp_enqueue_script( 'bootstrapjs' );
40
41 wp_register_script( 'autowpjs',$autowp_my_plugin_dir.'/assets/js/autowp.js' , array('jquery'), false, true );
42 wp_enqueue_script( 'autowpjs' );
43 }
44
45 add_action('admin_enqueue_scripts','autowp_enqueue_scripts');
46
47
48 //Enqueque CSS Files
49 function autowp_enqueue_styles(){
50 $my_plugin_dir = plugin_dir_url(__FILE__);
51
52 $screen = get_current_screen();
53 $slug = $screen->id;
54
55
56
57
58
59 if($slug == 'toplevel_page_autowp_menu' || $slug == 'autowp_page_autowp_manualPost' || $slug == 'autowp_page_autowp_automaticPost' || $slug == 'admin_page_add_new_wp_website_form' || $slug == 'autowp_page_autowp_settings' || $slug == 'admin_page_add_new_rss_website_form' || $slug == 'admin_page_add_new_ai_website_form' || $slug == 'autowp_page_autowp_add_new_website_form' || $slug == 'admin_page_manual_post_wp_website_form' || $slug == 'admin_page_manual_post_rss_website_form' || $slug == 'admin_page_manual_post_ai_website_form' || $slug == 'admin_page_manual_post_news_website_form' || $slug == 'admin_page_add_new_news_website_form' ){
60 wp_register_style('autowp_bootstrap', $my_plugin_dir.'assets/css/bootstrap.min.css', array(), 1);
61 wp_enqueue_style('autowp_bootstrap');
62
63
64 wp_register_style('autowp_loader', $my_plugin_dir.'assets/css/loader.css', array(), 1);
65 wp_enqueue_style('autowp_loader');
66
67 wp_register_style('autowp_style', $my_plugin_dir.'assets/css/style.css', array(), 1);
68 wp_enqueue_style('autowp_style');
69 }
70
71
72
73
74 }
75
76 add_action('admin_print_styles','autowp_enqueue_styles');
77
78 //Register AutoWP API with Domain
79
80 function autowp_register_to_api() {
81 // Do something when plugin is activated
82 //Register with Domain
83
84 $admin_email = get_option( 'admin_email', false );
85 if ( ! $admin_email ) {
86 $admin_email = 'email@example.com';
87 }
88
89
90 $args = array(
91 'method' => 'POST',
92 'timeout' => 45,
93 'redirection' => 5,
94 'httpversion' => '1.0',
95 'blocking' => true,
96 'headers' => array(),
97 'body' => array(
98 'userDomain' => sanitize_url(esc_url(get_site_url())),
99 'userEmail' => sanitize_email($admin_email)
100 ),
101 'cookies' => array(),
102 );
103
104 $response = wp_remote_post( 'https://api.autowp.app/registerNewDomain', $args );
105 }
106
107 register_activation_hook( __FILE__, 'autowp_register_to_api' );
108
109
110 function autowp_get_page_slug_from_website_type($website_type){
111
112 switch($website_type){
113 case 'wordpress':
114 return 'add_new_wp_website_form';
115 case 'rss':
116 return 'add_new_rss_website_form';
117 case 'ai':
118 return 'add_new_ai_website_form';
119 case 'news':
120 return 'add_new_news_website_form';
121 default:
122 return '';
123 }
124
125 }
126
127 //WP-CRON START
128
129
130 function autowp_get_wpcron_time($time){
131
132 switch($time){
133 case 1:
134 return 'hourly';
135 case 2:
136 return 'twicedaily';
137 case 3:
138 return 'daily';
139 case 4:
140 return 'weekly';
141 default:
142 return 'hourly';
143
144 }
145
146 }
147
148
149 function autowp_set_featured_image($image_url, $post_id) {
150 $upload_dir = wp_upload_dir();
151
152 // Kullanılacak güvenli fonksiyon: wp_remote_get
153 $response = wp_remote_get($image_url);
154
155 // HTTP hata kontrolü
156 if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
157 return false;
158 }
159
160 $image_data = wp_remote_retrieve_body($response);
161
162 if ($image_data) {
163 $filename = sanitize_file_name(basename($image_url));
164 $file_path = trailingslashit($upload_dir['path']) . $filename;
165 $file_path = wp_unique_filename($upload_dir['path'], $filename); // Make sure the file name is unique
166
167 // Güvenli bir şekilde dosyayı kaydet
168 $file_saved = wp_upload_bits($filename, null, $image_data);
169
170 if (!$file_saved['error']) {
171 $file = $file_saved['file'];
172
173 $wp_filetype = wp_check_filetype($file, null);
174
175 $attachment = array(
176 'post_mime_type' => $wp_filetype['type'],
177 'post_title' => $filename,
178 'post_content' => '',
179 'post_status' => 'inherit'
180 );
181
182 // Use the 'wp_insert_attachment_data' filter to modify attachment data before insertion
183 $attachment = apply_filters('wp_insert_attachment_data', $attachment, $file, $post_id);
184
185 $attach_id = wp_insert_attachment($attachment, $file, $post_id);
186
187 if (!is_wp_error($attach_id)) {
188 require_once ABSPATH . 'wp-admin/includes/image.php';
189 $attach_data = wp_generate_attachment_metadata($attach_id, $file);
190 wp_update_attachment_metadata($attach_id, $attach_data);
191
192 return $attach_id;
193 } else {
194 // If there's an error in attachment insertion, delete the file
195 unlink($file);
196 }
197 }
198 }
199
200 return false;
201 }
202
203
204
205
206
207
208 function autowp_upload_image_to_media($image_url) {
209 require_once(ABSPATH . 'wp-admin/includes/image.php');
210 require_once(ABSPATH . 'wp-admin/includes/file.php');
211 require_once(ABSPATH . 'wp-admin/includes/media.php');
212
213 // Using WordPress HTTP API to get image data
214 $response = wp_safe_remote_get($image_url);
215
216 if (is_wp_error($response)) {
217 return false;
218 }
219
220 $image_data = wp_remote_retrieve_body($response);
221
222 // Get the file name and extension
223 $file_name = basename($image_url);
224 $file_array = wp_upload_bits($file_name, null, $image_data);
225
226 // Check for errors during upload
227 if ($file_array['error']) {
228 return false;
229 }
230
231 // Create the attachment post
232 $attachment = array(
233 'post_mime_type' => $file_array['type'],
234 'post_title' => sanitize_file_name($file_name),
235 'post_content' => '',
236 'post_status' => 'inherit',
237 );
238
239 // Insert the attachment into the media library
240 $attachment_id = wp_insert_attachment($attachment, $file_array['file']);
241
242 // Generate the metadata for the attachment
243 $attachment_data = wp_generate_attachment_metadata($attachment_id, $file_array['file']);
244
245 // Update the attachment metadata
246 wp_update_attachment_metadata($attachment_id, $attachment_data);
247
248 // Return the upload URL of the image
249 return wp_get_attachment_url($attachment_id);
250 }
251
252
253
254 function autowp_upload_and_replace_image_sources($html) {
255 $dom = new DOMDocument();
256 $dom->encoding = 'UTF-8';
257 libxml_use_internal_errors(true);
258 $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
259 libxml_clear_errors();
260
261 $images = $dom->getElementsByTagName('img');
262 foreach ($images as $image) {
263 $src = $image->getAttribute('src');
264 $new_image_url = autowp_upload_image_to_media($src);
265 if ($new_image_url) {
266 $image->setAttribute('src', $new_image_url);
267 }
268 }
269
270 return $dom->saveHTML();
271 }
272
273
274
275
276 function autowp_set_new_post($post_title, $post_content, $post_status, $post_author, $post_type, $featured_image_url, $post_category, $post_tags, $focus_keyword) {
277
278 $post_content = autowp_upload_and_replace_image_sources($post_content);
279
280 //Set SEO
281 //focus keyword
282 $title_explode = explode(" ", $post_title);
283 // $focus_keyword = //$title_explode[0] . " " . $title_explode[1];
284
285 //Meta desc
286 $meta_desc = substr(strip_tags($post_content), 0, 155);
287
288 $meta_input = ["_yoast_wpseo_title" => $post_title, "_yoast_wpseo_metadesc" => $meta_desc, "_yoast_wpseo_focuskw" => $focus_keyword, "rank_math_title" => $post_title, "rank_math_description" => $meta_desc, "rank_math_focus_keyword" => $focus_keyword];
289
290
291
292 $post = array(
293 'post_title' => $post_title,
294 'post_content' => $post_content,
295 'post_status' => $post_status, // "publish" olarak ayarla
296 'post_author' => $post_author, // 1 olarak ayarla
297 'post_type' => $post_type, // "post" olarak ayarla
298 'post_category' => $post_category, //category array
299 'tags_input' => $post_tags, //tags
300 'meta_input' => $meta_input, //meta inputs
301
302 );
303
304
305
306 $new_post_id = wp_insert_post($post);
307
308 if (!empty($featured_image_url)) {
309 $image_id = autowp_set_featured_image($featured_image_url, $new_post_id);
310 if ($image_id !== false) {
311 set_post_thumbnail($new_post_id, $image_id);
312 }
313 }
314 }
315
316
317
318
319
320
321 function autowp_wpcron_setAutoPosting(){
322
323 $settings = unserialize(get_option('autowp_settings'));
324
325 $wpcron_status = $settings['wpcron_status'];
326
327 if($wpcron_status === '1'){
328 autowp_wordpress_post();
329 }
330
331 }
332
333 add_filter('autowp_cron','autowp_wpcron_setAutoPosting');
334
335 function autowp_get_wp_autowp_wordpress_websites() {
336 global $wpdb;
337 $table_name = $wpdb->prefix . 'autowp_wordpress_websites';
338 $sql = "SELECT * FROM $table_name";
339 $results = $wpdb->get_results($wpdb->prepare($sql), ARRAY_A);
340 return $results;
341 }
342
343
344
345 function autowp_stringToArray($input) {
346 $numbers = explode(",", $input);
347 $result = array();
348
349 foreach ($numbers as $number) {
350 $result[] = (int)$number;
351 }
352
353 return $result;
354 }
355
356
357 function autowp_update_published_post_ids($new_post_ids) {
358 $autowp_settings = get_option('autowp_post_settings');
359 $autowp_settings = unserialize($autowp_settings);
360
361 // Update the published_post_ids value
362 $autowp_settings['published_post_ids'] = $new_post_ids;
363
364 // Serialize and update the option value
365 update_option('autowp_post_settings', serialize($autowp_settings));
366 }
367
368 function autowp_update_wp_cron_status($new_status) {
369 $autowp_settings = get_option('autowp_settings');
370 $autowp_settings = unserialize($autowp_settings);
371
372 // Update the published_post_ids value
373 $autowp_settings['wpcron_status'] = $new_status;
374
375 // Serialize and update the option value
376 update_option('autowp_settings', serialize($autowp_settings));
377 }
378
379 add_action('admin_notices', 'autowp_create_alert');
380
381 function autowp_create_alert() {
382 $alerts = get_option('autowp_alerts');
383
384 if ($alerts != "") {
385 echo '
386 <div class="notice notice-info is-dismissible">
387 <div class="alert alert-info" style="background-color: #ffdd57; border-color: #e9c515; color: #333;">
388 <p style="font-weight: bold; font-size: 18px; margin-bottom: 0;">AutoWP</p>
389 <p style="margin-bottom: 0;">'.esc_html($alerts).'</p>
390 <b><p style="margin-bottom: 0;"><a href="admin.php?page=autowp_menu" style="color: #333;">UPGRADE MEMBERSHİP</a></p></b>
391 </div>
392 </div>';
393 }
394 }
395
396
397
398
399 function autowp_wordpress_post(){
400 $wordpress_websites = autowp_get_wp_autowp_wordpress_websites();
401
402 foreach($wordpress_websites as $wordpress_website){
403 $user_domainname = esc_url(get_site_url());
404 $user_email = autowp_get_admin_email();
405 $website_domainname = sanitize_url($wordpress_website['domain_name']);
406 $website_categories = $wordpress_website['website_category_id'];
407 $wordpress_categories = $wordpress_website['category_id'];
408
409
410 $post_count = $wordpress_website['post_count'];
411 $post_order = $wordpress_website['post_order'];
412
413 $title_prompt = $wordpress_website['title_prompt'];
414 $content_prompt = $wordpress_website['content_prompt'];
415 $tags_prompt = $wordpress_website['tags_prompt'];
416 $image_prompt = $wordpress_website['image_prompt'];
417
418 $aigenerated_title = $wordpress_website['aigenerated_title'];
419 $aigenerated_content = $wordpress_website['aigenerated_content'];
420 $aigenerated_tags = $wordpress_website['aigenerated_tags'];
421 $aigenerated_image = $wordpress_website['aigenerated_image'];
422
423 $source_type = $wordpress_website['website_type'];
424
425 $image_generating_status = $wordpress_website['image_generating_status'];
426
427 $author_selection = $wordpress_website['author_selection'];
428
429 //News
430
431 $news_keyword = $wordpress_website['news_keyword'];
432 $news_country = $wordpress_website['news_country'];
433 $news_language = $wordpress_website['news_language'];
434 $news_time_published = $wordpress_website['news_time_published'];
435 $is_html = true;
436
437
438
439 $image_settings = json_decode(json_encode(unserialize(get_option('autowp_settings'))));
440
441
442
443 $get_data_from_api = autowp_get_posts_from_wp_website($user_domainname, $user_email, $website_domainname, $website_categories, $post_count,$post_order,'',$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status,$news_keyword,$news_country,$news_language,$news_time_published,$is_html);
444 $wp_posts = $get_data_from_api['autowp-api'];
445
446 if($get_data_from_api['error']){
447 update_option('autowp_alerts', $get_data_from_api['error']);
448 }else{
449 update_option('autowp_alerts', '');
450 }
451
452
453
454 foreach($wp_posts as $post){
455 $post_title = $post['post_title'];
456 $post_content = $post['content'];
457 $post_featured_image = $post['preview_image_original'];
458 $post_tags = $post['tags'];
459 $post_status = 'publish';
460 $post_author = $author_selection;
461 $post_type = 'post';
462 $focus_keyword = $post['focus_keyword'];
463
464
465
466
467 autowp_set_new_post($post_title,$post_content,$post_status,$post_author,$post_type,$post_featured_image, autowp_stringToArray($wordpress_categories),$post_tags,$focus_keyword);
468
469
470 }
471
472
473
474
475
476 }
477 }
478
479
480 function autowp_get_posts_from_wp_website($user_domainname, $user_email, $website_domainname, $website_categories, $post_count,$post_order,$post_ids,$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status,$news_keyword = '',$news_country = '',$news_language = '',$news_time_published = '',$is_html = false) {
481
482 $url = 'https://api.autowp.app/latest-posts';
483
484 $data = array(
485 'user_domainname' => $user_domainname,
486 'user_email' => $user_email,
487 'website_domainname' => $website_domainname,
488 'website_categories' => $website_categories,
489 'post_count' => $post_count,
490 'post_order' => $post_order,
491 'published_post_ids' => $post_ids,
492
493 'title_prompt' => $title_prompt,
494 'content_prompt' => $content_prompt,
495 'tags_prompt' => $tags_prompt,
496 'image_prompt' => $image_prompt,
497
498
499 'aigenerated_title' => $aigenerated_title,
500 'aigenerated_content' => $aigenerated_content,
501 'aigenerated_tags' => $aigenerated_tags,
502 'aigenerated_image' => $aigenerated_image,
503
504
505 'image_settings' => $image_settings,
506
507
508 'source_type' => $source_type,
509
510 'image_generating_status' => $image_generating_status,
511
512 'news_keyword' => $news_keyword,
513 'news_country' => $news_country,
514 'news_language' => $news_language,
515 'news_time_published' => $news_time_published,
516 'is_html' => $is_html
517 );
518
519
520
521 $response = wp_remote_post($url, array(
522
523 'timeout' => 2400, // Timeout set to 4 minutes.
524
525 'body' => $data,
526
527 ));
528
529 if (is_wp_error($response)) {
530 $error_message = wp_remote_retrieve_response_message($response);
531 return 'Error: ' . $error_message;
532 }
533
534
535 $body = wp_remote_retrieve_body($response);
536
537
538 $result = json_decode($body, true);
539
540 return $result;
541 }
542
543
544 function autowp_set_wpcron(){
545 // Current settings
546 $current_settings = unserialize(get_option('autowp_settings'));
547
548 // Received data from user
549 $received_data = array(
550 "selected_time_type" => '2',
551 "wpcron_status" => '1',
552 "watermark_link" => '',
553 "contrast" => '',
554 "brightness" => '',
555 "text" => '',
556 "text_position_x" => 0,
557 "text_position_y" => 0,
558 "text_color" => '',
559 "text_size" => 0,
560 "text_angle" => 0,
561 "image_modification_status" => '0',
562 "image_generating_status" => '0',
563 "ai_image_width" => 512,
564 "ai_image_height" => 512,
565 "stable_diffusion_style" => 'None'
566 );
567
568 if(empty($current_settings)){
569
570 // Serialize and update options
571 update_option('autowp_settings', serialize($received_data), "yes");
572
573 }
574
575 $time_value_type = sanitize_text_field('2');
576
577 $user_wpcron_time = autowp_get_wpcron_time($time_value_type);
578
579
580 // Schedule WP-Cron
581 if (!wp_next_scheduled('autowp_cron')) {
582 wp_schedule_event(time(), $user_wpcron_time, 'autowp_cron');
583 } else {
584 wp_clear_scheduled_hook('autowp_cron');
585 wp_schedule_event(time(), $user_wpcron_time, 'autowp_cron');
586 }
587 }
588
589
590
591 register_activation_hook(__FILE__, 'autowp_set_wpcron');
592
593 function autowp_unset_wpcron(){
594
595 // find out when the last event was scheduled
596 $timestamp = wp_next_scheduled ('autowp_cron');
597 // unschedule previous event if any
598 wp_unschedule_event ($timestamp, 'autowp_cron');
599
600 }
601
602 register_deactivation_hook(__FILE__,'autowp_unset_wpcron');
603
604 //WP-CRON END
605
606 // Dil desteği için 'autowp' önekini kullanarak metinleri çevirelim
607
608
609
610 function autowp_get_user_from_autowp_api() {
611 //Get Credit from autowp.APP API
612 $url = 'https://api.autowp.app/getUserByDomain';
613 $admin_email = get_option('admin_email', false);
614 if ($admin_email !== false) {
615 // if email is not NULL , just get it
616 }else{
617 // if email is NULL , set it to example email
618 $admin_email='email@example.com';}
619 //argumnts of user
620 $args = array('body' => array('user_domainname' => esc_url(get_site_url()),'user_email' => sanitize_email($admin_email)));
621 $response = wp_remote_post($url, $args); //wordprss json prse user dataa
622 $json = json_decode(wp_remote_retrieve_body($response), true);
623 return $json;
624 }
625
626
627
628 function autowp_generalSettings(){ ?>
629
630 <!-- Logo Eklemesi -->
631 <img src="<?php echo plugins_url( '/assets/images/logo512.png', __FILE__ ) ?>" alt="AutoWP" style="position: absolute; top: 50px; right: 150px; width: 400px; height: 400px;">
632
633
634
635 <form method="post" class="form-horizontal">
636 <fieldset>
637
638 <!-- Form Name -->
639
640 <?php
641
642
643
644 $user = autowp_get_user_from_autowp_api();
645 $isUserPremium = $user['product_name'] ?? 'Free Users';
646
647 // Eğer kullanıcının AIContentGenerator kredisi ve premium üyeliği yoksa
648 if ($isUserPremium == 'Free User') {
649 echo '<div class="alert alert-warning" role="alert">' .
650 esc_html__('You are not a premium user so you have limited balance. If you want to generate more posts or image, you should upgrade to premium membership.','autowp') . ' ' .
651 '</div>';
652 }
653
654 ?>
655
656 <div class="form-group">
657 <div class="card text-center">
658 <div class="card-body">
659 <h4 class="card-title"><img src="<?php echo plugins_url( '/assets/images/logo128.png', __FILE__ ) ?>" alt="AutoWP" style="height: 100px; width: 100px;"></h4>
660 <p class="card-text"> <?php echo esc_html__('User Type:', 'autowp'); ?> <?php echo esc_html($isUserPremium); ?></p>
661 <p class="card-text"> <?php echo esc_html__('Renewal Date:', 'autowp'); ?> <?php echo esc_html($user['renewal_date'] ?? esc_html__('Free User', 'autowp')); ?></p>
662 <p class="card-text"> <?php echo esc_html__('Total Post Balance:', 'autowp'); ?> <?php echo esc_html($user['total_post_balance']) . ' ' . esc_html__('Posts', 'autowp'); ?></p>
663 <p class="card-text"> <?php echo esc_html__('AI-Generated Post Balance:', 'autowp'); ?> <?php echo esc_html($user['aigenerated_post_balance']) . ' ' . esc_html__('Posts', 'autowp'); ?></p>
664 <p class="card-text"> <?php echo esc_html__('AI-Generated Image Balance:', 'autowp'); ?> <?php echo esc_html($user['aigenerated_image_balance']) . ' ' . esc_html__('Images', 'autowp'); ?></p>
665 <br>
666 <a href="https://api.whatsapp.com/send/?phone=905522071696" class="btn btn-primary"><?php echo esc_html__('Contact Us', 'autowp'); ?></a>
667 </div>
668 </div>
669 </div>
670
671
672 <br>
673
674 <div class="columns">
675 <ul class="price">
676 <li class="header"><?php echo esc_html__('Free','autowp'); ?></li>
677 <li class="grey">£0.00 / <?php echo esc_html__('Month','autowp'); ?></li>
678 <li>3 <?php echo esc_html__('AI-Generated Post per Month','autowp'); ?></li>
679 <li>10 <?php echo esc_html__('Post per Month','autowp'); ?></li>
680 <li>3 <?php echo esc_html__('AI-Generated Image Per Month','autowp'); ?></li>
681 <li><?php echo esc_html__('Auto Image Editing','autowp'); ?></li>
682 </ul>
683 </div>
684 <div class="columns">
685 <ul class="price">
686 <li class="header"><?php echo esc_html__('Golden','autowp'); ?></li>
687 <li class="grey">£9.99 / <?php echo esc_html__('Month','autowp'); ?></li>
688 <li>20 <?php echo esc_html__('AI-Generated Post per Month','autowp'); ?></li>
689 <li>50 <?php echo esc_html__('Post per Month','autowp'); ?></li>
690 <li>20 <?php echo esc_html__('AI-Generated Image Per Month','autowp'); ?></li>
691 <li><?php echo esc_html__('Auto Image Editing','autowp'); ?></li>
692 <?php
693
694 if($user['product_name'] !== 'Golden'){
695
696 echo '<li class="grey"><a href="https://api.autowp.app/subscribe?membership=golden&user_domainname=' . esc_url(get_site_url()) . '" class="button">' . esc_html__('Sign Up') . '</a></li>';
697
698
699 }
700
701
702 ?>
703
704
705 </ul>
706 </div>
707 <div class="columns">
708 <ul class="price">
709 <li class="header"><?php echo esc_html__('Platin'); ?></li>
710 <li class="grey">£24.99 / <?php echo esc_html__('Month'); ?></li>
711 <li>100 <?php echo esc_html__('AI-Generated Post per Month'); ?></li>
712 <li>150 <?php echo esc_html__('Post per Month'); ?></li>
713 <li>100 <?php echo esc_html__('AI-Generated Image Per Month'); ?></li>
714 <li><?php echo esc_html__('Auto Image Editing'); ?></li>
715 <?php
716
717 if($user['product_name'] !== 'Platin'){
718 echo '<li class="grey"><a href="https://api.autowp.app/subscribe?membership=platin&user_domainname=' . esc_url(get_site_url()) . '" class="button">' . esc_html__('Sign Up') . '</a></li>';
719 }
720
721
722 ?>
723 </ul>
724 </div>
725 </form>
726
727
728
729
730 <?php
731 }
732
733
734 // Loading WP_List_Table class file
735 // We need to load it as it's not automatically loaded by WordPress
736 if (!class_exists('WP_List_Table')) {
737 require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
738 }
739
740
741 function autowp_create_table() {
742 global $wpdb;
743 $table_name = $wpdb->prefix . 'autowp_wordpress_websites';
744
745 // Check if the table already exists
746 $prepared_query = $wpdb->prepare("SHOW TABLES LIKE %s", $table_name);
747 if ($wpdb->get_var($prepared_query) === $table_name) {
748 return;
749 }
750
751
752 $charset_collate = $wpdb->get_charset_collate();
753
754 // Define the table structure
755 $sql = "CREATE TABLE $table_name (
756 `id` int(11) NOT NULL AUTO_INCREMENT,
757 `website_name` varchar(255) NOT NULL,
758 `website_type` text NOT NULL,
759 `domain_name` varchar(255) NOT NULL,
760 `category_id` text NOT NULL,
761 `website_category_id` text NOT NULL,
762 `aigenerated_title` text NOT NULL,
763 `aigenerated_content` text NOT NULL,
764 `aigenerated_tags` text NOT NULL,
765 `aigenerated_image` text NOT NULL,
766 `post_count` text NOT NULL,
767 `post_order` text NOT NULL,
768 `title_prompt` text NOT NULL,
769 `content_prompt` text NOT NULL,
770 `tags_prompt` text NOT NULL,
771 `image_prompt` text NOT NULL,
772 `image_generating_status` text NOT NULL,
773 `author_selection` text NOT NULL,
774
775
776 `news_time_published` text NOT NULL,
777 `news_language` text NOT NULL,
778 `news_country` text NOT NULL,
779 `news_keyword` text NOT NULL,
780
781 PRIMARY KEY (`id`)
782 );";
783
784
785 // Include the necessary file for dbDelta()
786 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
787
788 // Create the table
789 dbDelta($sql);
790 }
791 register_activation_hook(__FILE__, 'autowp_create_table');
792
793
794
795 // Plugin menu callback function
796 function autowp_automaticPost()
797 {
798 // Creating an instance
799 $table = new AutoWP_Wordpress_Websites();
800
801 echo '<div class="wrap"><h2>SupportHost Admin Table</h2>';
802 echo '<form method="post">';
803
804 // Add nonce field
805 wp_nonce_field('autowp_websites_menu_nonce', '_wpnonce');
806 // Prepare table
807 $table->prepare_items();
808 // Search form
809 $table->search_box('search', 'search_id');
810 // Display table
811 $table->display();
812 echo '</div></form>';
813 }
814
815
816 // Extending class
817 class AutoWP_Wordpress_Websites extends WP_List_Table
818 {
819 // Here we will add our code
820
821 // Define table columns
822 function get_columns()
823 {
824 $columns = array(
825 'cb' => '<input type="checkbox" />',
826 'website_type' => __('Website Type', 'autowp'),
827 'website_name' => __('Website Name', 'autowp'),
828 'domain_name' => __('Domain Name', 'autowp'),
829 'category_id' => __('Your Categories', 'autowp'),
830 'website_category_id' => __('Website Categories', 'autowp'),
831
832 );
833 return $columns;
834 }
835
836
837 // define $table_data property
838 private $table_data;
839
840 // Bind table with columns, data and all
841 function prepare_items()
842 {
843 //data
844 if ( isset( $_POST['s'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_websites_menu_nonce' ) ) {
845 $search_query = sanitize_text_field($_POST['s']);
846 $this->table_data = $this->get_table_data($search_query);
847 } else {
848 $this->table_data = $this->get_table_data();
849 }
850
851
852 $columns = $this->get_columns();
853 $hidden = ( is_array(get_user_meta( get_current_user_id(), 'managetoplevel_page_list_tablecolumnshidden', true)) ) ? get_user_meta( get_current_user_id(), 'managetoplevel_page_list_tablecolumnshidden', true) : array();
854 $sortable = $this->get_sortable_columns();
855 $primary = 'name';
856 $this->_column_headers = array($columns, $hidden, $sortable, $primary);
857 $this->process_bulk_action();
858 $this->table_data = $this->get_table_data();
859
860 usort($this->table_data, array($this, 'usort_reorder'));
861
862 /* pagination */
863 $per_page = $this->get_items_per_page('elements_per_page', 10);
864 $current_page = $this->get_pagenum();
865 $total_items = count($this->table_data);
866
867 $this->table_data = array_slice($this->table_data, (($current_page - 1) * $per_page), $per_page);
868
869 $this->set_pagination_args(array(
870 'total_items' => $total_items, // total number of items
871 'per_page' => $per_page, // items to show on a page
872 'total_pages' => ceil( $total_items / $per_page ) // use ceil to round up
873 ));
874
875 $this->items = $this->table_data;
876 }
877
878
879
880 function column_website_type($item){
881
882 $website_type = $item['website_type'];
883 $website_page = autowp_get_page_slug_from_website_type($website_type);
884
885
886
887 $actions = array(
888 'edit' => sprintf('<a href="?page=' . $website_page . '&id=%s">%s</a>', $item['id'], __('Edit', 'autowp')),
889 'delete' => sprintf('<a href="?page=%s&action=delete&id=%s">%s</a>', sanitize_text_field($_REQUEST['page']), $item['id'], __('Delete', 'autowp')),
890 );
891
892 return sprintf('%s %s',
893 $item['website_type'],
894 $this->row_actions($actions)
895 );
896 }
897
898
899
900
901 // To show bulk action dropdown
902 function get_bulk_actions()
903 {
904 $actions = array(
905 'delete_all' => __('Delete', 'autowp'),
906
907 );
908 return $actions;
909 }
910
911 function process_bulk_action()
912 {
913 global $wpdb;
914
915 $table = $wpdb->prefix . 'autowp_wordpress_websites';
916
917 if ('delete_all' === $this->current_action() || ('delete' === $this->current_action() && isset($_REQUEST['id']))) {
918 $request_id = isset($_REQUEST['id']) ? array_map('absint', (array) $_REQUEST['id']) : array();
919
920 if (!empty($request_id)) {
921 // Prepare the DELETE query with proper escaping
922 $placeholders = implode(',', array_fill(0, count($request_id), '%d'));
923 $query = $wpdb->prepare("DELETE FROM $table WHERE id IN($placeholders)", $request_id);
924
925 // Execute the query
926 $wpdb->query($query);
927 }
928 }
929 }
930
931
932
933 // Get table data
934 private function get_table_data( $search = '' ) {
935 global $wpdb;
936
937 $table = $wpdb->prefix."autowp_wordpress_websites";
938
939
940 if ( ! empty( $search ) ) {
941 $prepared_search = $wpdb->esc_like( $search );
942 $prepared_search = '%' . $wpdb->esc_like( $search ) . '%';
943
944 return $wpdb->get_results(
945 $wpdb->prepare(
946 "SELECT * FROM {$table} WHERE website_name LIKE %s OR domain_name LIKE %s OR category_id LIKE %s",
947 $prepared_search,
948 $prepared_search,
949 $prepared_search
950 ),
951 ARRAY_A
952 );
953 } else {
954
955 return $wpdb->get_results(
956 $wpdb->prepare(
957 "SELECT * FROM {$table}",
958 $table
959 ),
960 ARRAY_A
961 );
962
963 }
964 }
965
966 function column_default($item, $column_name)
967 {
968
969
970 switch ($column_name) {
971 case 'id':
972 case 'website_type':
973 case 'website_name':
974 case 'domain_name':
975 case 'category_id':
976 case 'website_category_id':
977 default:
978 return $item[$column_name];
979 }
980 }
981
982 function column_cb($item){
983 return sprintf(
984 '<input type="checkbox" name="id[]" value="%s" />',
985 $item['id']
986 );
987 }
988
989 protected function get_sortable_columns(){
990 $sortable_columns = array(
991 'website_name' => array('website_name', false),
992 'domain_name' => array('website_name', false),
993 'id' => array('id', true)
994 );
995 return $sortable_columns;
996 }
997
998 // Sorting function
999 function usort_reorder($a, $b)
1000 {
1001 // If no sort, default to user_login
1002 $sanitized_orderby = sanitize_text_field($_GET['orderby']);
1003 $orderby = (!empty($sanitized_orderby)) ? $sanitized_orderby : 'website_name';
1004
1005 // If no order, default to asc
1006 $sanitized_get_id = sanitize_text_field($_GET['id']);
1007 $order = (!empty($sanitized_get_id)) ? $sanitized_get_id : 'asc';
1008
1009 // Determine sort order
1010 $result = strcmp($a[$orderby], $b[$orderby]);
1011
1012 // Send final sort direction to usort
1013 return ($order === 'asc') ? $result : -$result;
1014 }
1015
1016
1017
1018
1019 }
1020
1021 // add screen options
1022 function autowp_wordpress_websites_options() {
1023
1024 global $autowp_wordpress_website_list_page;
1025 global $table;
1026
1027 $screen = get_current_screen();
1028
1029 // get out of here if we are not on our settings page
1030 if(!is_object($screen) || $screen->id != $autowp_wordpress_website_list_page)
1031 return;
1032
1033 $args = array(
1034 'label' => __('Elements per page', 'autowp'),
1035 'default' => 2,
1036 'option' => 'elements_per_page'
1037 );
1038 add_screen_option( 'per_page', $args );
1039
1040 $table = new AutoWP_Wordpress_Websites();
1041
1042 }
1043
1044 function autowp_isValidDomain($domain) {
1045 // WordPress wp_http_validate_url fonksiyonunu kullanarak URL'yi doğrula
1046 $valid_url = wp_http_validate_url( $domain);
1047
1048 // Eğer geçerli bir URL dönerse, alan adı geçerlidir
1049 if (!is_wp_error($valid_url)) {
1050 return true;
1051 } else {
1052 return false;
1053 }
1054 }
1055
1056
1057 function autowp_is_site_working($site_url, $site_type) {
1058 $response = false;
1059
1060 if ($site_type === 'wordpress') {
1061 // Check if the WordPress REST API is accessible
1062 $api_url = rtrim($site_url, '/') . '/wp-json/wp/v2/posts';
1063 $headers = @get_headers($api_url);
1064 if ($headers && strpos($headers[0], '200') !== false) {
1065 $response = true;
1066 }
1067 } elseif ($site_type === 'rss') {
1068 // Check if the RSS feed is accessible
1069 $rss = @simplexml_load_file($site_url);
1070 if ($rss) {
1071 $response = true;
1072 }
1073 }
1074
1075 return $response;
1076 }
1077
1078
1079
1080
1081 function autowp_validate_website($item)
1082 {
1083 $messages = array();
1084
1085 if($item['website_type'] !== 'ai'){
1086
1087 if( !autowp_isValidDomain(sanitize_text_field($item['domain_name'])) ){
1088 $messages[] = __('Domain name should be valid.', 'autowp');
1089 }
1090
1091 if($item['website_type'] !== 'news'){
1092 if (empty($item['domain_name'])) $messages[] = __('Domain Name is required', 'autowp');
1093
1094
1095
1096 if(!autowp_is_site_working(sanitize_text_field($item['domain_name']), sanitize_text_field($item['website_type']))){
1097 $messages[] = __('Domain name should be valid.', 'autowp');
1098 }
1099
1100 }else{
1101
1102 if (empty($item['news_keyword'])) $messages[] = __('Keyword is required', 'autowp');
1103
1104 }
1105
1106
1107
1108 }else{
1109
1110 if(empty($item['title_prompt']) && empty($item['content_prompt']) && empty($item['tags_prompt']) && empty($item['image_prompt']) ){
1111 $messages[] = __('You should enter at least 1 prompt! ', 'autowp');
1112 }
1113
1114 if(str_contains($item['content_prompt'],'autowp-promptcode') && !autowp_validate_prompt_code($item['content_prompt'] )){
1115 $messages[] = __('invalid prompt code. ', 'autowp');
1116 }
1117
1118 if(str_contains($item['title_prompt'],'autowp-promptcode') || str_contains($item['tags_prompt'],'autowp-promptcode') || str_contains($item['image_prompt'],'autowp-promptcode') ){
1119 $messages[] = __('only content prompt can use prompt codes. ', 'autowp');
1120 }
1121
1122
1123 }
1124
1125 if (empty($item['website_name'])) $messages[] = __('Website name is required', 'autowp');
1126 if (empty($item['category_id'])) $messages[] = __('Category is required', 'autowp');
1127 if (empty($messages)) return true;
1128 return implode('<br />', $messages);
1129 }
1130
1131
1132 function autowp_validate_prompt_code($input) {
1133 // "autowp-promptcode" yapısını arayın ve içeriğini alın
1134 preg_match('/\[autowp-promptcode\](.*?)\[\/autowp-promptcode\]/s', $input, $matches);
1135
1136 if (empty($matches) || count($matches) < 2) {
1137 // Eğer "autowp-promptcode" yapısı bulunamazsa veya içeriği eksikse false döndürün
1138 return false;
1139 }
1140
1141 $content = $matches[1]; // "autowp-promptcode" içeriğini alın
1142 $fields = explode(',', $content); // Virgülle ayrılmış alanları parçalayın
1143
1144 // Gerekli sayıda alanın olduğunu ve her bir alanın dolu olduğunu kontrol edin
1145 if (count($fields) != 6) {
1146 return false;
1147 }
1148
1149 foreach ($fields as $field) {
1150 if (empty(trim($field))) {
1151 return false;
1152 }
1153 }
1154
1155 return true; // Geçerli ise true döndürün
1156 }
1157
1158
1159
1160
1161 function autowp_settings_page_set_options() {
1162
1163 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_settings_nonce')) {
1164
1165
1166 $time_value_type = sanitize_text_field($_POST["selected_time_type"]);
1167
1168 $user_wpcron_time = autowp_get_wpcron_time($time_value_type);
1169
1170
1171 // Setting API Key
1172 $received_data = array(
1173 "selected_time_type" => sanitize_text_field($_POST["selected_time_type"]),
1174 "wpcron_status" => sanitize_text_field($_POST['wpcron_status']),
1175 "watermark_link" => sanitize_text_field($_POST['watermark_link']),
1176 "contrast" => sanitize_text_field($_POST['contrast']),
1177 "brightness" => sanitize_text_field($_POST['brightness']),
1178 "text" => sanitize_text_field($_POST['text']),
1179 "text_position_x" => absint($_POST['text_position_x']),
1180 "text_position_y" => absint($_POST['text_position_y']),
1181 "text_color" => sanitize_text_field($_POST['text_color']),
1182 "text_size" => absint($_POST['text_size']),
1183 "text_angle" => absint($_POST['text_angle']),
1184 "image_modification_status" => sanitize_text_field($_POST['image_modification_status']),
1185 "ai_image_width" => absint($_POST['ai_image_width']),
1186 "ai_image_height" => absint($_POST['ai_image_height']),
1187 "stable_diffusion_style" => sanitize_text_field($_POST['stable_diffusion_style']),
1188
1189
1190
1191 );
1192 $save = serialize($received_data);
1193
1194 update_option('autowp_settings', $save, "yes");
1195
1196 // Show success message if successfully saved, if not show error message
1197 if (get_option('autowp_settings') == $save) {
1198 echo '<div class="alert alert-success" role="alert">' . esc_html__('Settings saved successfully!', 'autowp') . '</div>';
1199 } else {
1200 echo '<div class="alert alert-danger" role="alert">' . esc_html__('Error saving settings!', 'autowp') . '</div>';
1201 }
1202
1203 // Schedule WP-Cron
1204 if (!wp_next_scheduled('autowp_cron')) {
1205 wp_schedule_event(time(), $user_wpcron_time, 'autowp_cron');
1206 } else {
1207 wp_clear_scheduled_hook('autowp_cron');
1208 wp_schedule_event(time(), $user_wpcron_time, 'autowp_cron');
1209 }
1210 }
1211 }
1212
1213
1214 function autowp_settings_page_handler() {
1215
1216 autowp_settings_page_set_options();
1217 ?>
1218
1219 <form method="post" class="form-horizontal">
1220 <?php wp_nonce_field('autowp_settings_nonce', '_wpnonce'); ?>
1221 <fieldset>
1222 <!-- Form Name -->
1223 <legend><?php esc_html_e('Cron Settings', 'autowp'); ?></legend>
1224
1225 <!-- Time Type -->
1226 <div class="form-group">
1227 <label class="col-md-4 control-label" for="selected_time_type"><?php esc_html_e('Time Type', 'autowp'); ?></label>
1228 <div class="col-md-4">
1229 <select id="selected_time_type" name="selected_time_type" class="form-control">
1230 <option value="1" <?php if(unserialize(get_option("autowp_settings"))["selected_time_type"] === '1') {echo ' selected'; } ?>><?php esc_html_e('Hour', 'autowp'); ?></option>
1231 <option value="2" <?php if(unserialize(get_option("autowp_settings"))["selected_time_type"] === '2') {echo ' selected'; } ?>><?php esc_html_e('Twice Daily', 'autowp'); ?></option>
1232 <option value="3" <?php if(unserialize(get_option("autowp_settings"))["selected_time_type"] === '3') {echo ' selected'; } ?>><?php esc_html_e('Daily', 'autowp'); ?></option>
1233 <option value="4" <?php if(unserialize(get_option("autowp_settings"))["selected_time_type"] === '4') {echo ' selected'; } ?>><?php esc_html_e('Weekly', 'autowp'); ?></option>
1234 </select>
1235 </div>
1236 </div>
1237
1238
1239
1240 <!-- WP-Cron Status -->
1241 <div class="form-group">
1242 <label class="col-md-4 control-label" for="wpcron_status"><?php esc_html_e('WP-Cron Status', 'autowp'); ?></label>
1243 <div class="col-md-4">
1244 <label class="radio-inline">
1245 <input type="radio" name="wpcron_status" value="1" <?php $settings = unserialize(get_option('autowp_settings')); if($settings['wpcron_status'] === '1' || !isset($settings['wpcron_status']) ){ echo 'checked="checked"'; } ?> ><?php esc_html_e('Active', 'autowp'); ?>
1246 </label>
1247 <label class="radio-inline">
1248 <input type="radio" name="wpcron_status" value="2" <?php $settings = unserialize(get_option('autowp_settings')); if($settings['wpcron_status'] !== '1' && isset($settings['wpcron_status']) ){ echo 'checked="checked"'; } ?> ><?php esc_html_e('Passive', 'autowp'); ?>
1249 </label>
1250 </div>
1251 </div>
1252
1253 <!-- Description -->
1254 <div class="form-group">
1255 <label class="col-md-4 control-label" for="description"><?php esc_html_e('If you want to stop generating new posts, you should set WP-Cron to passive.', 'autowp'); ?></label>
1256 <div class="col-md-4">
1257 <label><?php esc_html_e('', 'autowp'); ?></label>
1258 </div>
1259 </div>
1260
1261 <!-- Image Generating Settings -->
1262 <legend><?php esc_html_e('Image Generating Settings', 'autowp'); ?></legend>
1263
1264
1265
1266
1267
1268
1269
1270 <!-- Width -->
1271 <div class="form-group">
1272 <label class="col-md-4 control-label" for="ai_image_width"><?php esc_html_e('Width', 'autowp'); ?></label>
1273 <div class="col-md-4">
1274 <input id="ai_image_width" name="ai_image_width" type="number" class="form-control" value="<?php
1275 if (isset(unserialize(get_option("autowp_settings"))["ai_image_width"])) {
1276 echo esc_html(unserialize(get_option("autowp_settings"))["ai_image_width"]);
1277 } else{
1278 echo '512';
1279 }
1280 ?>" placeholder="Enter width">
1281 </div>
1282 </div>
1283
1284 <!-- Height -->
1285 <div class="form-group">
1286 <label class="col-md-4 control-label" for="ai_image_height"><?php esc_html_e('Height', 'autowp'); ?></label>
1287 <div class="col-md-4">
1288 <input id="ai_image_height" name="ai_image_height" type="number" class="form-control" value="<?php
1289 if (isset(unserialize(get_option("autowp_settings"))["ai_image_height"])){
1290 echo esc_html(unserialize(get_option("autowp_settings"))["ai_image_height"]);
1291 }else{
1292 echo '512';
1293 }
1294 ?>" placeholder="Enter height">
1295 <p class="help-block"><?php esc_html_e('If not specified, default is 512.', 'autowp'); ?></p>
1296 </div>
1297 </div>
1298
1299
1300 <!-- Stable Diffusion Style -->
1301 <div class="form-group">
1302 <label class="col-md-4 control-label" for="stable_diffusion_style"><?php esc_html_e('Stable Diffusion Style', 'autowp'); ?></label>
1303 <div class="col-md-4">
1304 <select id="stable_diffusion_style" name="stable_diffusion_style" class="form-control">
1305 <?php
1306 $styles = array('None', 'enhance', 'anime', 'photographic', 'digital-art','comic-book','fantasy-art','line-art','analog-film','neon-punk','isometric','low-poly','origami','modeling-compound','cinematic','3d-model','pixel-art','tile-texture');
1307 $selected_style = isset(unserialize(get_option("autowp_settings"))["stable_diffusion_style"]) ? unserialize(get_option("autowp_settings"))["stable_diffusion_style"] : 'None';
1308
1309 foreach ($styles as $style) {
1310 $selected = ($style === $selected_style) ? 'selected' : '';
1311 echo '<option value="' . esc_attr($style) . '" ' . esc_attr($selected) . '>' . esc_html($style) . '</option>';
1312 }
1313
1314 ?>
1315 </select>
1316 </div>
1317 </div>
1318
1319
1320 <!-- Image Motification Settings -->
1321 <legend><?php esc_html_e('Image Settings', 'autowp'); ?></legend>
1322
1323
1324
1325 <!-- Image Modification Status -->
1326 <div class="form-group">
1327 <label class="col-md-4 control-label" for="image_modification_status"><?php esc_html_e('Image Modification Status', 'autowp'); ?></label>
1328 <div class="col-md-4">
1329 <label class="radio-inline">
1330 <input type="radio" name="image_modification_status" value="1" <?php if(unserialize(get_option("autowp_settings"))["image_modification_status"] === '1') {echo ' checked'; } ?>><?php esc_html_e('Active', 'autowp'); ?>
1331 </label>
1332 <label class="radio-inline">
1333 <input type="radio" name="image_modification_status" value="0" <?php if(unserialize(get_option("autowp_settings"))["image_modification_status"] !== '1') {echo ' checked'; } ?>><?php esc_html_e('Inactive', 'autowp'); ?>
1334 </label>
1335 <p class="help-block"><?php esc_html_e('If inactive, the images will be published without any modification.', 'autowp'); ?></p>
1336 </div>
1337 </div>
1338
1339
1340
1341
1342 <!-- Watermark Link -->
1343 <div class="form-group">
1344 <label class="col-md-4 control-label" for="watermark_link"><?php esc_html_e('Watermark Link', 'autowp'); ?></label>
1345 <div class="col-md-4">
1346 <input id="watermark_link" name="watermark_link" type="text" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["watermark_link"]) ?>" placeholder="<?php esc_html_e('Enter the watermark link for post cover images', 'autowp'); ?>">
1347 <p class="help-block"><?php esc_html_e('Leave it empty if you do not want to add a watermark.', 'autowp'); ?></p>
1348 </div>
1349 </div>
1350
1351 <!-- Contrast -->
1352 <div class="form-group">
1353 <label class="col-md-4 control-label" for="contrast"><?php esc_html_e('Contrast', 'autowp'); ?></label>
1354 <div class="col-md-4">
1355 <input id="contrast" name="contrast" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["contrast"]) ?>" placeholder="<?php esc_html_e('Enter the contrast value (-100 to +100)', 'autowp'); ?>">
1356 </div>
1357 </div>
1358
1359 <!-- Brightness -->
1360 <div class="form-group">
1361 <label class="col-md-4 control-label" for="brightness"><?php esc_html_e('Brightness', 'autowp'); ?></label>
1362 <div class="col-md-4">
1363 <input id="brightness" name="brightness" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["brightness"]) ?>" placeholder="<?php esc_html_e('Enter the brightness value (-100 to +100)', 'autowp'); ?>">
1364 <p class="help-block"><?php esc_html_e('Leave it empty if you do not want to adjust contrast and brightness.', 'autowp'); ?></p>
1365 </div>
1366 </div>
1367
1368
1369 <!-- Text -->
1370 <div class="form-group">
1371 <label class="col-md-4 control-label" for="text"><?php esc_html_e('Text', 'autowp'); ?></label>
1372 <div class="col-md-4">
1373 <input id="text" name="text" type="text" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text"]) ?>" placeholder="<?php esc_html_e('Enter the text to be added', 'autowp'); ?>">
1374 </div>
1375 </div>
1376
1377 <!-- Text Position X -->
1378 <div class="form-group">
1379 <label class="col-md-4 control-label" for="text_position_x"><?php esc_html_e('Text Position (X)', 'autowp'); ?></label>
1380 <div class="col-md-4">
1381 <input id="text_position_x" name="text_position_x" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text_position_x"]) ?>" placeholder="<?php esc_html_e('Enter the X position of the text', 'autowp'); ?>">
1382 </div>
1383 </div>
1384
1385 <!-- Text Position Y -->
1386 <div class="form-group">
1387 <label class="col-md-4 control-label" for="text_position_y"><?php esc_html_e('Text Position (Y)', 'autowp'); ?></label>
1388 <div class="col-md-4">
1389 <input id="text_position_y" name="text_position_y" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text_position_y"]) ?>" placeholder="<?php esc_html_e('Enter the Y position of the text', 'autowp'); ?>">
1390 </div>
1391 </div>
1392
1393 <!-- Text Color -->
1394 <div class="form-group">
1395 <label class="col-md-4 control-label" for="text_color"><?php esc_html_e('Text Color', 'autowp'); ?></label>
1396 <div class="col-md-4">
1397 <input id="text_color" name="text_color" type="text" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text_color"]) ?>" placeholder="<?php esc_html_e('Enter the color of the text', 'autowp'); ?>">
1398 </div>
1399 </div>
1400
1401 <!-- Text Size -->
1402 <div class="form-group">
1403 <label class="col-md-4 control-label" for="text_size"><?php esc_html_e('Text Size', 'autowp'); ?></label>
1404 <div class="col-md-4">
1405 <input id="text_size" name="text_size" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text_size"]) ?>" placeholder="<?php esc_html_e('Enter the size of the text', 'autowp'); ?>">
1406 </div>
1407 </div>
1408
1409 <!-- Text Angle -->
1410 <div class="form-group">
1411 <label class="col-md-4 control-label" for="text_angle"><?php esc_html_e('Text Angle', 'autowp'); ?></label>
1412 <div class="col-md-4">
1413 <input id="text_angle" name="text_angle" type="number" class="form-control" value="<?php echo esc_html(unserialize(get_option("autowp_settings"))["text_angle"]) ?>" placeholder="<?php esc_html_e('Enter the angle of the text', 'autowp'); ?>">
1414 </div>
1415 </div>
1416
1417 <!-- Button -->
1418 <div class="form-group">
1419 <label class="col-md-4 control-label" for="singlebutton"></label>
1420 <div class="col-md-4">
1421 <button id="singlebutton" name="singlebutton" class="btn btn-primary"><?php esc_html_e('Save', 'autowp'); ?></button>
1422 </div>
1423 </div>
1424 </fieldset>
1425 </form>
1426
1427
1428
1429 <?php
1430 }
1431
1432 function autowp_show_alert_with_message($isSuccess,$message) {
1433 if ($isSuccess) {
1434 $alertType = "success";
1435 } else {
1436 $alertType = "danger";
1437 }
1438
1439 echo '<div class="alert alert-' . esc_html($alertType) . ' alert-dismissible fade show" role="alert">';
1440 echo esc_html($message);
1441 echo '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>';
1442 echo '</div>';
1443 }
1444
1445
1446 function autowp_manual_post_rss_form_page_setOptions(){
1447
1448
1449
1450 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_manual_post_rss_nonce')) {
1451
1452
1453 $autowp_admin_email = autowp_get_admin_email();
1454 $autowp_domain_name = esc_url(get_site_url());
1455 $website_domainname = sanitize_url($_POST['domain_name']);
1456 $website_categories = '1,2,3';
1457 $post_count = sanitize_text_field($_POST['post_count']);
1458 $post_order = sanitize_text_field($_POST['post_order']);
1459 $post_ids = '';
1460 $title_prompt = sanitize_text_field($_POST['title_prompt']);
1461 $content_prompt = sanitize_text_field($_POST['content_prompt']);
1462 $tags_prompt = sanitize_text_field($_POST['tags_prompt']);
1463 $image_prompt = sanitize_text_field($_POST['image_prompt']);
1464
1465 $image_generating_status = sanitize_text_field($_POST['image_generating_status']);
1466
1467 $author_selection = sanitize_text_field($_POST['author_selection']) ?? 1;
1468
1469
1470 $aigenerated_title = '0';
1471 $aigenerated_content = '0';
1472 $aigenerated_tags = '0';
1473 $aigenerated_image = '0';
1474
1475 if(isset($_POST['aigenerated_title'])){
1476 $aigenerated_title = sanitize_text_field($_POST['aigenerated_title']);
1477 }
1478
1479 if(isset($_POST['aigenerated_content'])){
1480 $aigenerated_content = sanitize_text_field($_POST['aigenerated_content']);
1481 }
1482
1483 if(isset($_POST['aigenerated_tags'])){
1484 $aigenerated_tags = sanitize_text_field($_POST['aigenerated_tags']);
1485 }
1486
1487 if(isset($_POST['aigenerated_image'])){
1488 $aigenerated_image = sanitize_text_field($_POST['aigenerated_image']);
1489 }
1490
1491
1492
1493
1494 $image_settings = json_decode(json_encode(unserialize(get_option('autowp_settings'))));
1495 $source_type = 'rss';
1496
1497
1498 $wordpress_categories = isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array();
1499
1500 $image_generating_status = sanitize_text_field($_POST['image_generating_status']);
1501
1502 if(true){
1503
1504 $get_data_from_api = autowp_get_posts_from_wp_website($autowp_domain_name, $autowp_admin_email, $website_domainname, $website_categories, $post_count,$post_order,$post_ids,$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status);
1505 $wp_posts = $get_data_from_api['autowp-api'];
1506
1507
1508
1509 if($get_data_from_api['error']){
1510 update_option('autowp_alerts', $get_data_from_api['error']);
1511 autowp_show_alert_with_message(false,$get_data_from_api['error']);
1512 }else{
1513 update_option('autowp_alerts', '');
1514 if(!empty($wp_posts)){
1515 autowp_show_alert_with_message(true,'Success!');
1516 }
1517 }
1518
1519
1520
1521 foreach($wp_posts as $post){
1522
1523 $post_ids = $post_ids . ',' . $post['post_id'];
1524 $post_title = $post['post_title'];
1525 $post_content = $post['content'];
1526 $post_featured_image = $post['preview_image_original'];
1527 $post_tags = $post['tags'];
1528 $post_status = 'publish';
1529 $post_author = $author_selection;
1530 $post_type = 'post';
1531 $focus_keyword = $post['focus_keyword'];
1532
1533 autowp_set_new_post($post_title,$post_content,$post_status,$post_author,$post_type,$post_featured_image, $wordpress_categories,$post_tags,$focus_keyword);
1534
1535 }
1536 autowp_update_published_post_ids($post_ids);
1537
1538
1539 }
1540 }
1541 }
1542
1543 function autowp_manual_post_wp_form_page_setOptions(){
1544
1545 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_manual_post_wp_nonce')) {
1546
1547 $autowp_admin_email = autowp_get_admin_email();
1548 $autowp_domain_name = esc_url(get_site_url());
1549 $website_domainname = sanitize_url($_POST['domain_name']);
1550 $website_categories = implode(",", array_map('sanitize_text_field', $_POST['website_category_id']));
1551 $post_count = sanitize_text_field($_POST['post_count']);
1552 $post_order = sanitize_text_field($_POST['post_order']);
1553 $post_ids = '';
1554 $title_prompt = sanitize_text_field($_POST['title_prompt']);
1555 $content_prompt = sanitize_text_field($_POST['content_prompt']);
1556 $tags_prompt = sanitize_text_field($_POST['tags_prompt']);
1557 $image_prompt = sanitize_text_field($_POST['image_prompt']);
1558
1559 $author_selection = sanitize_text_field($_POST['author_selection']) ?? 1;
1560
1561 $aigenerated_title = '0';
1562 $aigenerated_content = '0';
1563 $aigenerated_tags = '0';
1564 $aigenerated_image = '0';
1565
1566 if(isset($_POST['aigenerated_title'])){
1567 $aigenerated_title = sanitize_text_field($_POST['aigenerated_title']);
1568 }
1569
1570 if(isset($_POST['aigenerated_content'])){
1571 $aigenerated_content = sanitize_text_field($_POST['aigenerated_content']);
1572 }
1573
1574 if(isset($_POST['aigenerated_tags'])){
1575 $aigenerated_tags = sanitize_text_field($_POST['aigenerated_tags']);
1576 }
1577
1578 if(isset($_POST['aigenerated_image'])){
1579 $aigenerated_image = sanitize_text_field($_POST['aigenerated_image']);
1580 }
1581
1582
1583
1584
1585 $image_settings = json_decode(json_encode(unserialize(get_option('autowp_settings'))));
1586 $source_type = 'wordpress';
1587
1588
1589 $wordpress_categories = isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array();
1590
1591 $image_generating_status = sanitize_text_field($_POST['image_generating_status']);
1592
1593 $get_data_from_api = autowp_get_posts_from_wp_website($autowp_domain_name, $autowp_admin_email, $website_domainname, $website_categories, $post_count,$post_order,$post_ids,$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status);
1594 $wp_posts = $get_data_from_api['autowp-api'];
1595
1596
1597
1598
1599 if($get_data_from_api['error']){
1600 update_option('autowp_alerts', $get_data_from_api['error']);
1601 autowp_show_alert_with_message(false,$get_data_from_api['error']);
1602 }else{
1603 update_option('autowp_alerts', '');
1604 if(!empty($wp_posts)){
1605 autowp_show_alert_with_message(true,'Success!');
1606 }
1607 }
1608
1609
1610
1611 foreach($wp_posts as $post){
1612
1613 $post_ids = $post_ids . ',' . $post['post_id'] . $post['slug'];
1614 $post_title = $post['post_title'];
1615 $post_content = $post['content'];
1616 $post_featured_image = $post['preview_image_original'];
1617 $post_tags = $post['tags'];
1618 $post_status = 'publish';
1619 $post_author = $author_selection;
1620 $post_type = 'post';
1621 $focus_keyword = $post['focus_keyword'];
1622
1623
1624 autowp_set_new_post($post_title,$post_content,$post_status,$post_author,$post_type,$post_featured_image, $wordpress_categories,$post_tags,$focus_keyword);
1625
1626
1627 }
1628
1629 autowp_update_published_post_ids($post_ids);
1630
1631
1632
1633
1634
1635
1636
1637 }
1638
1639 }
1640
1641 function autowp_manual_post_news_form_page_setOptions(){
1642
1643 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_manual_post_news_nonce')) {
1644
1645 $autowp_admin_email = autowp_get_admin_email();
1646 $autowp_domain_name = esc_url(get_site_url());
1647 $website_domainname = sanitize_url($_POST['domain_name']);
1648 $website_categories = '1,2,3';
1649 $post_count = sanitize_text_field($_POST['post_count']);
1650 $post_order = sanitize_text_field($_POST['post_order']);
1651 $post_ids = '';
1652 $title_prompt = sanitize_text_field($_POST['title_prompt']);
1653 $content_prompt = sanitize_text_field($_POST['content_prompt']);
1654 $tags_prompt = sanitize_text_field($_POST['tags_prompt']);
1655 $image_prompt = sanitize_text_field($_POST['image_prompt']);
1656
1657 $author_selection = sanitize_text_field($_POST['author_selection']) ?? 1;
1658
1659 $aigenerated_title = '0';
1660 $aigenerated_content = '0';
1661 $aigenerated_tags = '0';
1662 $aigenerated_image = '0';
1663
1664 if(isset($_POST['aigenerated_title'])){
1665 $aigenerated_title = sanitize_text_field($_POST['aigenerated_title']);
1666 }
1667
1668 if(isset($_POST['aigenerated_content'])){
1669 $aigenerated_content = sanitize_text_field($_POST['aigenerated_content']);
1670 }
1671
1672 if(isset($_POST['aigenerated_tags'])){
1673 $aigenerated_tags = sanitize_text_field($_POST['aigenerated_tags']);
1674 }
1675
1676 if(isset($_POST['aigenerated_image'])){
1677 $aigenerated_image = sanitize_text_field($_POST['aigenerated_image']);
1678 }
1679
1680
1681
1682
1683 $image_settings = json_decode(json_encode(unserialize(get_option('autowp_settings'))));
1684 $source_type = 'news';
1685
1686
1687 $wordpress_categories = isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array();
1688
1689 $image_generating_status = sanitize_text_field($_POST['image_generating_status']);
1690
1691
1692
1693 $news_keyword = sanitize_text_field($_POST['news_keyword']); // New field for News website
1694 $news_country = sanitize_text_field($_POST['news_country']);
1695 $news_language = sanitize_text_field($_POST['news_language']);
1696 $news_time_published = sanitize_text_field($_POST['news_time_published']);
1697
1698
1699 $get_data_from_api = autowp_get_posts_from_wp_website($autowp_domain_name, $autowp_admin_email, $website_domainname, $website_categories, $post_count,$post_order,$post_ids,$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status,$news_keyword,$news_country,$news_language,$news_time_published);
1700 $wp_posts = $get_data_from_api['autowp-api'];
1701
1702
1703
1704
1705 if($get_data_from_api['error']){
1706 update_option('autowp_alerts', $get_data_from_api['error']);
1707 autowp_show_alert_with_message(false,$get_data_from_api['error']);
1708 }else{
1709 update_option('autowp_alerts', '');
1710 if(!empty($wp_posts)){
1711 autowp_show_alert_with_message(true,'Success!');
1712 }else{
1713 //Bura düzeltilecek - test
1714 autowp_show_alert_with_message(true,'Success!');
1715 }
1716 }
1717
1718
1719
1720 foreach($wp_posts as $post){
1721
1722 $post_ids = $post_ids . ',' . $post['post_id'] . $post['slug'];
1723 $post_title = $post['post_title'];
1724 $post_content = $post['content'];
1725 $post_featured_image = $post['preview_image_original'];
1726 $post_tags = $post['tags'];
1727 $post_status = 'publish';
1728 $post_author = $author_selection;
1729 $post_type = 'post';
1730 $focus_keyword = $post['focus_keyword'];
1731
1732
1733 autowp_set_new_post($post_title,$post_content,$post_status,$post_author,$post_type,$post_featured_image, $wordpress_categories,$post_tags,$focus_keyword);
1734
1735
1736 }
1737
1738 autowp_update_published_post_ids($post_ids);
1739
1740
1741
1742
1743
1744
1745
1746 }
1747
1748 }
1749
1750
1751 function autowp_manual_post_news_form_page_handler(){
1752 autowp_manual_post_news_form_page_setOptions();
1753
1754 ?>
1755 <div class="wrap">
1756 <h1>Manual Post - News</h1>
1757 <a href="javascript:history.back()" class="btn btn-primary">Go Back</a>
1758
1759 <div id="poststuff">
1760 <div id="post-body" class="metabox-holder columns-2">
1761 <!-- Main Content -->
1762 <div id="post-body-content">
1763 <div class="meta-box-sortables ui-sortable">
1764 <div class="postbox">
1765 <h2 class="hndle ui-sortable-handle">Manual News Settings</h2>
1766 <div class="inside">
1767 <div id="loading">
1768 <div class="loader">
1769 <div class="inner one"></div>
1770 <div class="inner two"></div>
1771 <div class="inner three"></div>
1772 </div>
1773 </div>
1774 <form id="autowp_manual_post_form" method="post">
1775 <?php wp_nonce_field('autowp_manual_post_news_nonce', '_wpnonce'); ?>
1776
1777 <div class="form2bc">
1778 <div class="container">
1779 <form class="row g-3" id="post_generation_form">
1780 <div class="col-md-6">
1781 <label for="website_name" class="form-label">Name:</label>
1782 <input id="website_name" name="website_name" type="text" value="" class="form-control" required>
1783 </div>
1784 <div class="col-md-6">
1785 <label class="form-label" for="author_selection">Author Selection:</label>
1786 <select name="author_selection" id="author_selection" class="form-select">
1787 <?php
1788 $authors = get_users();
1789
1790 foreach ($authors as $author) {
1791 $author_id = $author->ID;
1792 $author_name = $author->display_name;
1793
1794 echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>';
1795 }
1796 ?>
1797 </select>
1798 </div>
1799
1800 <div class="col-md-6">
1801 <label for="category_id" class="form-label">Categories:</label>
1802 <select id="category_id" name="category_id[]" class="form-select" required multiple>
1803 <?php
1804
1805
1806 $categories = get_categories(array(
1807 'orderby' => 'name',
1808 'order' => 'ASC',
1809 'hide_empty' => false
1810 ));
1811
1812 foreach ($categories as $category) {
1813
1814 echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>';
1815 }
1816 ?>
1817 </select>
1818 </div>
1819
1820 <div class="col-md-6">
1821 <label for="news_keyword" class="form-label">Keyword:</label>
1822 <input id="news_keyword" name="news_keyword" type="text" value="" class="form-control">
1823 </div>
1824
1825 <div class="col-md-6">
1826 <label class="form-label" for="news_country">News Country:</label>
1827 <select name="news_country" class="form-select">
1828 <!-- ISO 3166-1 alpha-2 country codes -->
1829 <!-- Replace with actual country codes and names -->
1830 <?php
1831 $countries = [
1832 'any' => 'Anywhere',
1833 'AF' => 'Afghanistan',
1834 'AX' => '�
1835 land Islands',
1836 'AL' => 'Albania',
1837 'DZ' => 'Algeria',
1838 'AS' => 'American Samoa',
1839 'AD' => 'Andorra',
1840 'AO' => 'Angola',
1841 'AI' => 'Anguilla',
1842 'AQ' => 'Antarctica',
1843 'AG' => 'Antigua and Barbuda',
1844 'AR' => 'Argentina',
1845 'AM' => 'Armenia',
1846 'AW' => 'Aruba',
1847 'AU' => 'Australia',
1848 'AT' => 'Austria',
1849 'AZ' => 'Azerbaijan',
1850 'BS' => 'Bahamas',
1851 'BH' => 'Bahrain',
1852 'BD' => 'Bangladesh',
1853 'BB' => 'Barbados',
1854 'BY' => 'Belarus',
1855 'BE' => 'Belgium',
1856 'BZ' => 'Belize',
1857 'BJ' => 'Benin',
1858 'BM' => 'Bermuda',
1859 'BT' => 'Bhutan',
1860 'BO' => 'Bolivia, Plurinational State of',
1861 'BQ' => 'Bonaire, Sint Eustatius and Saba',
1862 'BA' => 'Bosnia and Herzegovina',
1863 'BW' => 'Botswana',
1864 'BV' => 'Bouvet Island',
1865 'BR' => 'Brazil',
1866 'IO' => 'British Indian Ocean Territory',
1867 'BN' => 'Brunei Darussalam',
1868 'BG' => 'Bulgaria',
1869 'BF' => 'Burkina Faso',
1870 'BI' => 'Burundi',
1871 'KH' => 'Cambodia',
1872 'CM' => 'Cameroon',
1873 'CA' => 'Canada',
1874 'CV' => 'Cape Verde',
1875 'KY' => 'Cayman Islands',
1876 'CF' => 'Central African Republic',
1877 'TD' => 'Chad',
1878 'CL' => 'Chile',
1879 'CN' => 'China',
1880 'CX' => 'Christmas Island',
1881 'CC' => 'Cocos (Keeling) Islands',
1882 'CO' => 'Colombia',
1883 'KM' => 'Comoros',
1884 'CG' => 'Congo',
1885 'CD' => 'Congo, the Democratic Republic of the',
1886 'CK' => 'Cook Islands',
1887 'CR' => 'Costa Rica',
1888 'CI' => "Côte d'Ivoire",
1889 'HR' => 'Croatia',
1890 'CU' => 'Cuba',
1891 'CW' => 'Curaçao',
1892 'CY' => 'Cyprus',
1893 'CZ' => 'Czech Republic',
1894 'DK' => 'Denmark',
1895 'DJ' => 'Djibouti',
1896 'DM' => 'Dominica',
1897 'DO' => 'Dominican Republic',
1898 'EC' => 'Ecuador',
1899 'EG' => 'Egypt',
1900 'SV' => 'El Salvador',
1901 'GQ' => 'Equatorial Guinea',
1902 'ER' => 'Eritrea',
1903 'EE' => 'Estonia',
1904 'ET' => 'Ethiopia',
1905 'FK' => 'Falkland Islands (Malvinas)',
1906 'FO' => 'Faroe Islands',
1907 'FJ' => 'Fiji',
1908 'FI' => 'Finland',
1909 'FR' => 'France',
1910 'GF' => 'French Guiana',
1911 'PF' => 'French Polynesia',
1912 'TF' => 'French Southern Territories',
1913 'GA' => 'Gabon',
1914 'GM' => 'Gambia',
1915 'GE' => 'Georgia',
1916 'DE' => 'Germany',
1917 'GH' => 'Ghana',
1918 'GI' => 'Gibraltar',
1919 'GR' => 'Greece',
1920 'GL' => 'Greenland',
1921 'GD' => 'Grenada',
1922 'GP' => 'Guadeloupe',
1923 'GU' => 'Guam',
1924 'GT' => 'Guatemala',
1925 'GG' => 'Guernsey',
1926 'GN' => 'Guinea',
1927 'GW' => 'Guinea-Bissau',
1928 'GY' => 'Guyana',
1929 'HT' => 'Haiti',
1930 'HM' => 'Heard Island and McDonald Islands',
1931 'VA' => 'Holy See (Vatican City State)',
1932 'HN' => 'Honduras',
1933 'HK' => 'Hong Kong',
1934 'HU' => 'Hungary',
1935 'IS' => 'Iceland',
1936 'IN' => 'India',
1937 'ID' => 'Indonesia',
1938 'IR' => 'Iran, Islamic Republic of',
1939 'IQ' => 'Iraq',
1940 'IE' => 'Ireland',
1941 'IM' => 'Isle of Man',
1942 'IL' => 'Israel',
1943 'IT' => 'Italy',
1944 'JM' => 'Jamaica',
1945 'JP' => 'Japan',
1946 'JE' => 'Jersey',
1947 'JO' => 'Jordan',
1948 'KZ' => 'Kazakhstan',
1949 'KE' => 'Kenya',
1950 'KI' => 'Kiribati',
1951 'KP' => "Korea, Democratic People's Republic of",
1952 'KR' => 'Korea, Republic of',
1953 'KW' => 'Kuwait',
1954 'KG' => 'Kyrgyzstan',
1955 'LA' => "Lao People's Democratic Republic",
1956 'LV' => 'Latvia',
1957 'LB' => 'Lebanon',
1958 'LS' => 'Lesotho',
1959 'LR' => 'Liberia',
1960 'LY' => 'Libya',
1961 'LI' => 'Liechtenstein',
1962 'LT' => 'Lithuania',
1963 'LU' => 'Luxembourg',
1964 'MO' => 'Macao',
1965 'MK' => 'Macedonia, The Former Yugoslav Republic of',
1966 'MG' => 'Madagascar',
1967 'MW' => 'Malawi',
1968 'MY' => 'Malaysia',
1969 'MV' => 'Maldives',
1970 'ML' => 'Mali',
1971 'MT' => 'Malta',
1972 'MH' => 'Marshall Islands',
1973 'MQ' => 'Martinique',
1974 'MR' => 'Mauritania',
1975 'MU' => 'Mauritius',
1976 'YT' => 'Mayotte',
1977 'MX' => 'Mexico',
1978 'FM' => 'Micronesia, Federated States of',
1979 'MD' => 'Moldova, Republic of',
1980 'MC' => 'Monaco',
1981 'MN' => 'Mongolia',
1982 'ME' => 'Montenegro',
1983 'MS' => 'Montserrat',
1984 'MA' => 'Morocco',
1985 'MZ' => 'Mozambique',
1986 'MM' => 'Myanmar',
1987 'NA' => 'Namibia',
1988 'NR' => 'Nauru',
1989 'NP' => 'Nepal',
1990 'NL' => 'Netherlands',
1991 'NC' => 'New Caledonia',
1992 'NZ' => 'New Zealand',
1993 'NI' => 'Nicaragua',
1994 'NE' => 'Niger',
1995 'NG' => 'Nigeria',
1996 'NU' => 'Niue',
1997 'NF' => 'Norfolk Island',
1998 'MP' => 'Northern Mariana Islands',
1999 'NO' => 'Norway',
2000 'OM' => 'Oman',
2001 'PK' => 'Pakistan',
2002 'PW' => 'Palau',
2003 'PS' => 'Palestinian Territory, Occupied',
2004 'PA' => 'Panama',
2005 'PG' => 'Papua New Guinea',
2006 'PY' => 'Paraguay',
2007 'PE' => 'Peru',
2008 'PH' => 'Philippines',
2009 'PN' => 'Pitcairn',
2010 'PL' => 'Poland',
2011 'PT' => 'Portugal',
2012 'PR' => 'Puerto Rico',
2013 'QA' => 'Qatar',
2014 'RE' => 'Réunion',
2015 'RO' => 'Romania',
2016 'RU' => 'Russian Federation',
2017 'RW' => 'Rwanda',
2018 'BL' => 'Saint Barthélemy',
2019 'SH' => 'Saint Helena, Ascension and Tristan da Cunha',
2020 'KN' => 'Saint Kitts and Nevis',
2021 'LC' => 'Saint Lucia',
2022 'MF' => 'Saint Martin (French part)',
2023 'PM' => 'Saint Pierre and Miquelon',
2024 'VC' => 'Saint Vincent and the Grenadines',
2025 'WS' => 'Samoa',
2026 'SM' => 'San Marino',
2027 'ST' => 'Sao Tome and Principe',
2028 'SA' => 'Saudi Arabia',
2029 'SN' => 'Senegal',
2030 'RS' => 'Serbia',
2031 'SC' => 'Seychelles',
2032 'SL' => 'Sierra Leone',
2033 'SG' => 'Singapore',
2034 'SX' => 'Sint Maarten (Dutch part)',
2035 'SK' => 'Slovakia',
2036 'SI' => 'Slovenia',
2037 'SB' => 'Solomon Islands',
2038 'SO' => 'Somalia',
2039 'ZA' => 'South Africa',
2040 'GS' => 'South Georgia and the South Sandwich Islands',
2041 'SS' => 'South Sudan',
2042 'ES' => 'Spain',
2043 'LK' => 'Sri Lanka',
2044 'SD' => 'Sudan',
2045 'SR' => 'Suriname',
2046 'SJ' => 'Svalbard and Jan Mayen',
2047 'SZ' => 'Swaziland',
2048 'SE' => 'Sweden',
2049 'CH' => 'Switzerland',
2050 'SY' => 'Syrian Arab Republic',
2051 'TW' => 'Taiwan, Province of China',
2052 'TJ' => 'Tajikistan',
2053 'TZ' => 'Tanzania, United Republic of',
2054 'TH' => 'Thailand',
2055 'TL' => 'Timor-Leste',
2056 'TG' => 'Togo',
2057 'TK' => 'Tokelau',
2058 'TO' => 'Tonga',
2059 'TT' => 'Trinidad and Tobago',
2060 'TN' => 'Tunisia',
2061 'TR' => 'Turkey',
2062 'TM' => 'Turkmenistan',
2063 'TC' => 'Turks and Caicos Islands',
2064 'TV' => 'Tuvalu',
2065 'UG' => 'Uganda',
2066 'UA' => 'Ukraine',
2067 'AE' => 'United Arab Emirates',
2068 'GB' => 'United Kingdom',
2069 'US' => 'United States',
2070 'UM' => 'United States Minor Outlying Islands',
2071 'UY' => 'Uruguay',
2072 'UZ' => 'Uzbekistan',
2073 'VU' => 'Vanuatu',
2074 'VE' => 'Venezuela, Bolivarian Republic of',
2075 'VN' => 'Viet Nam',
2076 'VG' => 'Virgin Islands, British',
2077 'VI' => 'Virgin Islands, U.S.',
2078 'WF' => 'Wallis and Futuna',
2079 'EH' => 'Western Sahara',
2080 'YE' => 'Yemen',
2081 'ZM' => 'Zambia',
2082 'ZW' => 'Zimbabwe',
2083 ];
2084
2085 foreach ($countries as $code => $name) {
2086
2087 echo "<option value='$code'>$name</option>";
2088 }
2089 ?>
2090 </select>
2091 </div>
2092
2093
2094 <div class="col-md-6">
2095 <label class="form-label" for="news_language">Language:</label>
2096 <select name="news_language" class="form-select">
2097 <!-- ISO 639-1 alpha-2 language codes -->
2098 <!-- Replace with actual language codes and names -->
2099 <?php
2100 $languages = [
2101 'any' => 'Any Language',
2102 'af' => 'Afrikaans',
2103 'sq' => 'Albanian',
2104 'am' => 'Amharic',
2105 'ar' => 'Arabic',
2106 'hy' => 'Armenian',
2107 'az' => 'Azerbaijani',
2108 'eu' => 'Basque',
2109 'be' => 'Belarusian',
2110 'bn' => 'Bengali',
2111 'bs' => 'Bosnian',
2112 'bg' => 'Bulgarian',
2113 'ca' => 'Catalan',
2114 'ceb' => 'Cebuano',
2115 'ny' => 'Chichewa',
2116 'zh-CN' => 'Chinese',
2117 'co' => 'Corsican',
2118 'hr' => 'Croatian',
2119 'cs' => 'Czech',
2120 'da' => 'Danish',
2121 'nl' => 'Dutch',
2122 'en' => 'English',
2123 'eo' => 'Esperanto',
2124 'et' => 'Estonian',
2125 'tl' => 'Filipino',
2126 'fi' => 'Finnish',
2127 'fr' => 'French',
2128 'fy' => 'Frisian',
2129 'gl' => 'Galician',
2130 'ka' => 'Georgian',
2131 'de' => 'German',
2132 'el' => 'Greek',
2133 'gu' => 'Gujarati',
2134 'ht' => 'Haitian Creole',
2135 'ha' => 'Hausa',
2136 'haw' => 'Hawaiian',
2137 'iw' => 'Hebrew',
2138 'hi' => 'Hindi',
2139 'hmn' => 'Hmong',
2140 'hu' => 'Hungarian',
2141 'is' => 'Icelandic',
2142 'ig' => 'Igbo',
2143 'id' => 'Indonesian',
2144 'ga' => 'Irish',
2145 'it' => 'Italian',
2146 'ja' => 'Japanese',
2147 'jw' => 'Javanese',
2148 'kn' => 'Kannada',
2149 'kk' => 'Kazakh',
2150 'km' => 'Khmer',
2151 'ko' => 'Korean',
2152 'ku' => 'Kurdish (Kurmanji)',
2153 'ky' => 'Kyrgyz',
2154 'lo' => 'Lao',
2155 'la' => 'Latin',
2156 'lv' => 'Latvian',
2157 'lt' => 'Lithuanian',
2158 'lb' => 'Luxembourgish',
2159 'mk' => 'Macedonian',
2160 'mg' => 'Malagasy',
2161 'ms' => 'Malay',
2162 'ml' => 'Malayalam',
2163 'mt' => 'Maltese',
2164 'mi' => 'Maori',
2165 'mr' => 'Marathi',
2166 'mn' => 'Mongolian',
2167 'my' => 'Myanmar (Burmese)',
2168 'ne' => 'Nepali',
2169 'no' => 'Norwegian',
2170 'ps' => 'Pashto',
2171 'fa' => 'Persian',
2172 'pl' => 'Polish',
2173 'pt' => 'Portuguese',
2174 'pa' => 'Punjabi',
2175 'ro' => 'Romanian',
2176 'ru' => 'Russian',
2177 'sm' => 'Samoan',
2178 'gd' => 'Scots Gaelic',
2179 'sr' => 'Serbian',
2180 'st' => 'Sesotho',
2181 'sn' => 'Shona',
2182 'sd' => 'Sindhi',
2183 'si' => 'Sinhala',
2184 'sk' => 'Slovak',
2185 'sl' => 'Slovenian',
2186 'so' => 'Somali',
2187 'es' => 'Spanish',
2188 'su' => 'Sundanese',
2189 'sw' => 'Swahili',
2190 'sv' => 'Swedish',
2191 'tg' => 'Tajik',
2192 'ta' => 'Tamil',
2193 'te' => 'Telugu',
2194 'th' => 'Thai',
2195 'tr' => 'Turkish',
2196 'uk' => 'Ukrainian',
2197 'ur' => 'Urdu',
2198 'uz' => 'Uzbek',
2199 'vi' => 'Vietnamese',
2200 'cy' => 'Welsh',
2201 'xh' => 'Xhosa',
2202 'yi' => 'Yiddish',
2203 'yo' => 'Yoruba',
2204 'zu' => 'Zulu',
2205 ];
2206
2207 foreach ($languages as $code => $name) {
2208
2209 echo "<option value='$code'>$name</option>";
2210 }
2211 ?>
2212 </select>
2213 </div>
2214
2215 <div class="col-md-6">
2216 <label class="form-label" for="news_time_published">Time Published:</label>
2217 <select name="news_time_published" class="form-select">
2218 <?php
2219 $time_options = [
2220 'anytime' => 'Anytime',
2221 '1h' => 'Last Hour',
2222 '1d' => 'Last Day',
2223 '7d' => 'Last 7 Days',
2224 '1y' => 'Last Year',
2225 ];
2226
2227 foreach ($time_options as $value => $label) {
2228
2229 echo "<option value='$value'>$label</option>";
2230 }
2231 ?>
2232 </select>
2233 </div>
2234
2235
2236 <div class="col-md-6">
2237 <label for="domain_name" class="form-label">Source URL:</label>
2238 <input id="domain_name" name="domain_name" type="text" value="" class="form-control">
2239 </div>
2240 <br>
2241 <p>If you want to get news from a specific source website, enter the site's address here. It is not mandatory to fill in this field.</p>
2242
2243 <div class="col-md-12">
2244 <label for="rewrite_settings" class="form-label">Rewrite Post:</label>
2245 <div class="form-check">
2246 <input type="checkbox" id="aigenerated_title" name="aigenerated_title" value="1" class="form-check-input">
2247 <label class="form-check-label" for="aigenerated_title">Re-write title with AI (SEO Friendly)</label>
2248 </div>
2249 <div class="form-check">
2250 <input type="checkbox" id="aigenerated_content" name="aigenerated_content" value="1" class="form-check-input">
2251 <label class="form-check-label" for="aigenerated_content">Re-write content with AI (SEO Friendly)</label>
2252 </div>
2253 <div class="form-check">
2254 <input type="checkbox" id="aigenerated_tags" name="aigenerated_tags" value="1" class="form-check-input">
2255 <label class="form-check-label" for="aigenerated_tags">Rewrite tags with AI (SEO Friendly)</label>
2256 </div>
2257 <div class="form-check">
2258 <input type="checkbox" id="aigenerated_image" name="aigenerated_image" value="1" class="form-check-input">
2259 <label class="form-check-label" for="aigenerated_image">Generated thumbnail with AI (SEO Friendly)</label>
2260 </div>
2261 </div>
2262 <div class="col-md-6">
2263 <label class="form-label" for="image_generating_status"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label>
2264 <select name="image_generating_status" class="form-select">
2265 <option value="0"><?php esc_html_e('Stable Diffusion', 'autowp'); ?></option>
2266 <option value="1"><?php esc_html_e('DALL-E', 'autowp'); ?></option>
2267 <option value="2"><?php esc_html_e('DuckDuckGo Images', 'autowp'); ?></option>
2268 </select>
2269 <p class="form-text"><?php esc_html_e('By default stable diffusion is selected.', 'autowp'); ?></p>
2270 </div>
2271 <div class="col-md-6">
2272 <label for="post_order" class="form-label">Post Order:</label>
2273 <select id="post_order" name="post_order" class="form-select">
2274 <option value="desc">Latest First</option>
2275 <option value="asc">Oldest First</option>
2276 <option value="rand">Random</option>
2277 </select>
2278 </div>
2279
2280
2281 <div class="col-md-6">
2282 <label for="post_count" class="form-label">Post Count:</label>
2283 <select name="post_count" id="postCount" class="form-select">
2284 <option value="1">Get 1 Post for Each Category</option>
2285 <option value="2">Get 2 Posts for Each Category</option>
2286 <option value="3">Get 3 Posts for Each Category</option>
2287 <option value="4">Get 4 Posts for Each Category</option>
2288 <option value="5">Get 5 Posts for Each Category</option>
2289 </select>
2290 </div>
2291 <div class="col-md-6">
2292 <label for="title_prompt" class="form-label">Prompt for Title:</label>
2293 <textarea id="title_prompt" name="title_prompt" rows="7" cols="75" class="form-control"></textarea>
2294 </div>
2295 <div class="col-md-6">
2296 <label for="content_prompt" class="form-label">Prompt for Content:</label>
2297 <textarea id="content_prompt" name="content_prompt" rows="7" cols="75" class="form-control"></textarea>
2298 </div>
2299
2300 <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#rewritePromptModal">Prompt Example</button>
2301
2302 <div class="modal fade" id="rewritePromptModal" tabindex="-1" aria-labelledby="rewritePromptModalLabel" aria-hidden="true">
2303 <div class="modal-dialog modal-lg">
2304 <div class="modal-content">
2305 <div class="modal-header">
2306 <h5 class="modal-title" id="rewritePromptModalLabel">Generate Prompt</h5>
2307 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
2308 </div>
2309 <div class="modal-body">
2310 <textarea class="form-control" id="rewritePromptTextarea" rows="4">Rewrite the text in HTML format that I will give you, in accordance with SEO rules and with your own unique sentences. Give output in HTML format. Breaking the HTML structure. Write the text in [English].</textarea>
2311 </div>
2312 <div class="modal-footer">
2313 <button type="button" class="btn btn-primary" id="rewriteGeneratePromptButton">OK</button>
2314 </div>
2315 </div>
2316 </div>
2317 </div>
2318
2319 <br>
2320 <p>It is highly recommended to look at <span class="bold-text">prompt examples</span> for better results.</p>
2321
2322
2323
2324 <div class="col-md-6">
2325 <label for="tags_prompt" class="form-label">Prompt for Tags:</label>
2326 <textarea id="tags_prompt" rows="7" name="tags_prompt" cols="75" class="form-control"></textarea>
2327 </div>
2328 <div class="col-md-6">
2329 <label for="image_prompt" class="form-label">Prompt for Thumbnail:</label>
2330 <textarea id="image_prompt" rows="7" name="image_prompt" cols="75" class="form-control"></textarea>
2331 <p class="form-text">For prompt examples, visit <a href="https://www.aiprm.com/prompts/" class="link">aiprm.com/prompts</a></p>
2332 </div>
2333
2334 <div class="mb-3">
2335 <p class="submit">
2336 <input type="submit" name="submit" id="submit" class="btn btn-primary" value="Generate Post">
2337 </p>
2338 </div>
2339
2340 </form>
2341 </div>
2342
2343 </form>
2344 </div>
2345 </div>
2346 </div>
2347 </div>
2348 <!-- Sidebar -->
2349 <div id="postbox-container-1" class="postbox-container">
2350 <!-- Sidebar content here (if any) -->
2351 </div>
2352 </div>
2353 <br class="clear">
2354 </div>
2355 </div>
2356 <?php
2357
2358 }
2359
2360
2361 function autowp_manual_post_wp_form_page_handler() {
2362 autowp_manual_post_wp_form_page_setOptions();
2363
2364 ?>
2365 <div class="wrap">
2366 <h1>Manual Post - Wordpress</h1>
2367 <a href="javascript:history.back()" class="btn btn-primary">Go Back</a>
2368
2369 <div id="poststuff">
2370 <div id="post-body" class="metabox-holder columns-2">
2371 <!-- Main Content -->
2372 <div id="post-body-content">
2373 <div class="meta-box-sortables ui-sortable">
2374 <div class="postbox">
2375 <h2 class="hndle ui-sortable-handle">Wordpress Settings</h2>
2376 <div class="inside">
2377 <div id="loading">
2378 <div class="loader">
2379 <div class="inner one"></div>
2380 <div class="inner two"></div>
2381 <div class="inner three"></div>
2382 </div>
2383 </div>
2384 <form id="autowp_manual_post_form" method="post">
2385 <?php wp_nonce_field('autowp_manual_post_wp_nonce', '_wpnonce'); ?>
2386
2387 <div class="form2bc">
2388 <div class="container">
2389 <form class="row g-3" id="post_generation_form">
2390 <div class="col-md-6">
2391 <label for="website_name" class="form-label">Website Name:</label>
2392 <?php
2393 $autowp_admin_email = autowp_get_admin_email();
2394 $autowp_domain_name = esc_url(get_site_url());
2395 $is_empty = empty($item['domain_name']);
2396 ?>
2397 <input type="hidden" id="autowp_admin_email" value="<?= esc_attr($autowp_admin_email) ?>">
2398 <input type="hidden" id="autowp_domain_name" value="<?= esc_attr($autowp_domain_name) ?>">
2399 <input id="website_name" name="website_name" type="text" class="form-control" required>
2400 </div>
2401 <div class="col-md-6">
2402 <label for="domain_name" class="form-label">Domain Name:</label>
2403 <input id="domain_name" name="domain_name" type="text" class="form-control" required>
2404 </div>
2405
2406 <div class="col-md-6">
2407 <label for="author_selection" class="form-label"><?php esc_html_e('Author Selection', 'autowp'); ?></label>
2408 <select name="author_selection" class="form-select">
2409 <?php
2410 $authors = get_users();
2411 foreach ($authors as $author) {
2412 $author_id = $author->ID;
2413 $author_name = $author->display_name;
2414 $author_description = get_the_author_meta('description', $author_id);
2415 echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>';
2416 }
2417 ?>
2418 </select>
2419 <p class="form-text"><?php esc_html_e('Select an author from the list.', 'autowp'); ?></p>
2420 </div>
2421
2422 <div class="col-md-6">
2423 <label for="website_category_id" class="form-label">Website Categories:</label>
2424 <br>
2425 <select id="website_category_id" name="website_category_id[]" multiple style="display: none;"></select>
2426 <button type="button" class="btn btn-primary" onclick="refreshWebsiteCategories()">
2427 <i class="bi bi-arrow-clockwise"></i>
2428 Get Categories
2429 </button>
2430 </div>
2431 <br>
2432 <div class="col-md-6">
2433 <label for="category_id" class="form-label">Categories:</label>
2434 <select id="category_id" name="category_id[]" required multiple class="form-select">
2435 <?php
2436 $categories = get_categories(array(
2437 'orderby' => 'name',
2438 'order' => 'ASC',
2439 'hide_empty' => false
2440 ));
2441
2442 foreach ($categories as $category) {
2443 echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>';
2444 }
2445 ?>
2446 </select>
2447 </div>
2448
2449 <div class="col-md-6">
2450 <label for="rewrite_settings" class="form-label">Rewrite Post:</label>
2451 <div class="form-check">
2452 <input type="checkbox" id="aigenerated_title" name="aigenerated_title" value="1" class="form-check-input">
2453 <label for="aigenerated_title" class="form-check-label">Re-write title with AI (SEO Friendly)</label>
2454 </div>
2455 <div class="form-check">
2456 <input type="checkbox" id="aigenerated_content" name="aigenerated_content" value="1" class="form-check-input">
2457 <label for="aigenerated_content" class="form-check-label">Re-write content with AI (SEO Friendly)</label>
2458 </div>
2459 <div class="form-check">
2460 <input type="checkbox" id="aigenerated_tags" name="aigenerated_tags" value="1" class="form-check-input">
2461 <label for="aigenerated_tags" class="form-check-label">Rewrite tags with AI (SEO Friendly)</label>
2462 </div>
2463 <div class="form-check">
2464 <input type="checkbox" id="aigenerated_image" name="aigenerated_image" value="1" class="form-check-input">
2465 <label for="aigenerated_image" class="form-check-label">Generated thumbnail with AI (SEO Friendly)</label>
2466 </div>
2467 </div>
2468
2469 <div class="col-md-6">
2470 <label for="image_generating_status" class="form-label"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label>
2471 <select name="image_generating_status" class="form-select">
2472 <option value="0"><?php esc_html_e('Stable Diffusion', 'autowp'); ?></option>
2473 <option value="1"><?php esc_html_e('DALL-E', 'autowp'); ?></option>
2474 <option value="2"><?php esc_html_e('DuckDuckGo Images', 'autowp'); ?></option>
2475 </select>
2476 <p class="form-text"><?php esc_html_e('By default stable diffusion is selected.', 'autowp'); ?></p>
2477 </div>
2478
2479 <div class="col-md-6">
2480 <label for="post_order" class="form-label">Post Order:</label>
2481 <select id="post_order" name="post_order" class="form-select">
2482 <option value="desc">Latest First</option>
2483 <option value="asc">Oldest First</option>
2484 <option value="rand">Random</option>
2485 </select>
2486 </div>
2487
2488 <div class="col-md-6">
2489 <label for="postCount" class="form-label">Post Count:</label>
2490 <select name="post_count" id="postCount" class="form-select">
2491 <option value="1">Get 1 Post for Each Category</option>
2492 <option value="2">Get 2 Posts for Each Category</option>
2493 <option value="3">Get 3 Posts for Each Category</option>
2494 <option value="4">Get 4 Posts for Each Category</option>
2495 <option value="5">Get 5 Posts for Each Category</option>
2496 </select>
2497 </div>
2498
2499 <div class="col-md-6">
2500 <label for="title_prompt" class="form-label">Prompt for Title:</label>
2501 <textarea id="title_prompt" name="title_prompt" rows="6" cols="80" class="form-control"></textarea>
2502 </div>
2503 <div class="col-md-6">
2504 <label for="content_prompt" class="form-label">Prompt for Content:</label>
2505 <textarea id="content_prompt" name="content_prompt" rows="6" cols="80" class="form-control"></textarea>
2506 </div>
2507
2508 <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#rewritePromptModal">Prompt Example</button>
2509
2510 <div class="modal fade" id="rewritePromptModal" tabindex="-1" aria-labelledby="rewritePromptModalLabel" aria-hidden="true">
2511 <div class="modal-dialog modal-lg">
2512 <div class="modal-content">
2513 <div class="modal-header">
2514 <h5 class="modal-title" id="rewritePromptModalLabel">Generate Prompt</h5>
2515 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
2516 </div>
2517 <div class="modal-body">
2518 <textarea class="form-control" id="rewritePromptTextarea" rows="4">Rewrite the text in HTML format that I will give you, in accordance with SEO rules and with your own unique sentences. Give output in HTML format. Breaking the HTML structure. Write the text in [English].</textarea>
2519 </div>
2520 <div class="modal-footer">
2521 <button type="button" class="btn btn-primary" id="rewriteGeneratePromptButton">OK</button>
2522 </div>
2523 </div>
2524 </div>
2525 </div>
2526
2527 <br>
2528 <p>It is highly recommended to look at <span class="bold-text">prompt examples</span> for better results.</p>
2529
2530 <div class="col-md-6">
2531 <label for="tags_prompt" class="form-label">Prompt for Tags:</label>
2532 <textarea id="tags_prompt" rows="6" name="tags_prompt" cols="80" class="form-control"></textarea>
2533 </div>
2534 <div class="col-md-6">
2535 <label for="image_prompt" class="form-label">Prompt for Thumbnail:</label>
2536 <textarea id="image_prompt" rows="6" name="image_prompt" cols="80" class="form-control"></textarea>
2537 </div>
2538 <div class="col-md-12">
2539 <p class="message">For prompt examples, visit <a class="link" href="https://www.aiprm.com/prompts/">aiprm.com/prompts</a></p>
2540 </div>
2541 <div class="col-12">
2542 <input type="submit" name="submit" id="submit" class="btn btn-primary" value="Generate Post">
2543 </div>
2544 </form>
2545 </div>
2546
2547 </form>
2548 </div>
2549 </div>
2550 </div>
2551 </div>
2552 <!-- Sidebar -->
2553 <div id="postbox-container-1" class="postbox-container">
2554 <!-- Sidebar content here (if any) -->
2555 </div>
2556 </div>
2557 <br class="clear">
2558 </div>
2559 </div>
2560 <?php
2561 }
2562
2563
2564
2565 function autowp_manual_post_rss_form_page_handler() {
2566
2567 autowp_manual_post_rss_form_page_setOptions();
2568 ?>
2569
2570 <div class="wrap">
2571 <h1>Manual Post - RSS</h1>
2572 <a href="javascript:history.back()" class="btn btn-primary">Go Back</a>
2573
2574 <div id="poststuff">
2575 <div id="post-body" class="metabox-holder columns-2">
2576 <!-- Main Content -->
2577 <div id="post-body-content">
2578 <div class="meta-box-sortables ui-sortable">
2579 <div class="postbox">
2580 <h2 class="hndle ui-sortable-handle">RSS Settings</h2>
2581 <div class="inside">
2582 <div id="loading">
2583 <div class="loader">
2584 <div class="inner one"></div>
2585 <div class="inner two"></div>
2586 <div class="inner three"></div>
2587 </div>
2588 </div>
2589 <form id="autowp_manual_post_form" method="post">
2590 <?php wp_nonce_field('autowp_manual_post_rss_nonce', '_wpnonce'); ?>
2591 <tbody>
2592 <div class="form2bc">
2593
2594 <div class="container">
2595 <form class="row g-3" id="post_generation_form">
2596 <div class="col-md-6">
2597 <label for="domain_name" class="form-label">RSS Feed URL:</label>
2598 <input id="domain_name" name="domain_name" type="text" class="form-control" value="" required>
2599 <p class="form-text"><?php esc_html_e('E.g https://kelimelerbenim.com/feed', 'autowp'); ?></p>
2600 </div>
2601
2602 <div class="col-md-6">
2603 <label for="category_id" class="form-label">Categories:</label>
2604 <select id="category_id" name="category_id[]" required multiple class="form-select">
2605 <?php
2606 $categories = get_categories(array(
2607 'orderby' => 'name',
2608 'order' => 'ASC',
2609 'hide_empty' => false
2610 ));
2611
2612 foreach ($categories as $category) {
2613 echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>';
2614 }
2615 ?>
2616 </select>
2617 </div>
2618
2619 <div class="col-md-6">
2620 <label for="author_selection" class="form-label"><?php esc_html_e('Author Selection', 'autowp'); ?></label>
2621 <select name="author_selection" class="form-select">
2622 <?php
2623 $authors = get_users();
2624 foreach ($authors as $author) {
2625 $author_id = $author->ID;
2626 $author_name = $author->display_name;
2627 $author_description = get_the_author_meta('description', $author_id);
2628 echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>';
2629 }
2630 ?>
2631 </select>
2632 <p class="form-text"><?php esc_html_e('Select an author from the list.', 'autowp'); ?></p>
2633 </div>
2634
2635 <div class="col-md-6">
2636 <label for="rewrite_settings" class="form-label">Rewrite Post:</label>
2637 <div class="form-check">
2638 <input type="checkbox" id="aigenerated_title" name="aigenerated_title" value="1" class="form-check-input">
2639 <label for="aigenerated_title" class="form-check-label">Re-write title with AI (SEO Friendly)</label>
2640 </div>
2641 <div class="form-check">
2642 <input type="checkbox" id="aigenerated_content" name="aigenerated_content" value="1" class="form-check-input">
2643 <label for="aigenerated_content" class="form-check-label">Re-write content with AI (SEO Friendly)</label>
2644 </div>
2645 <div class="form-check">
2646 <input type="checkbox" id="aigenerated_tags" name="aigenerated_tags" value="1" class="form-check-input">
2647 <label for="aigenerated_tags" class="form-check-label">Rewrite tags with AI (SEO Friendly)</label>
2648 </div>
2649 <div class="form-check">
2650 <input type="checkbox" id="aigenerated_image" name="aigenerated_image" value="1" class="form-check-input">
2651 <label for="aigenerated_image" class="form-check-label">Generated thumbnail with AI (SEO Friendly)</label>
2652 </div>
2653 </div>
2654
2655 <div class="col-md-6">
2656 <label for="image_generating_status" class="form-label"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label>
2657 <select name="image_generating_status" class="form-select">
2658 <option value="0"><?php esc_html_e('Stable Diffusion', 'autowp'); ?></option>
2659 <option value="1"><?php esc_html_e('DALL-E', 'autowp'); ?></option>
2660 <option value="2"><?php esc_html_e('DuckDuckGo Images', 'autowp'); ?></option>
2661 </select>
2662 <p class="form-text"><?php esc_html_e('By default stable diffusion is selected.', 'autowp'); ?></p>
2663 </div>
2664
2665 <div class="col-md-6">
2666 <label for="post_order" class="form-label">Post Order:</label>
2667 <select id="post_order" name="post_order" class="form-select">
2668 <option value="desc">Latest First</option>
2669 <option value="asc">Oldest First</option>
2670 <option value="rand">Random</option>
2671 </select>
2672 </div>
2673
2674 <div class="col-md-6">
2675 <label for="postCount" class="form-label">Post Count:</label>
2676 <select name="post_count" id="postCount" class="form-select">
2677 <option value="1">Get 1 Post for Each Category</option>
2678 <option value="2">Get 2 Posts for Each Category</option>
2679 <option value="3">Get 3 Posts for Each Category</option>
2680 <option value="4">Get 4 Posts for Each Category</option>
2681 <option value="5">Get 5 Posts for Each Category</option>
2682 </select>
2683 </div>
2684
2685 <div class="col-md-6">
2686 <label for="title_prompt" class="form-label">Prompt for Title:</label>
2687 <textarea id="title_prompt" name="title_prompt" rows="6" cols="80" class="form-control"></textarea>
2688 </div>
2689
2690 <div class="col-md-6">
2691 <label for="content_prompt" class="form-label">Prompt for Content:</label>
2692 <textarea id="content_prompt" name="content_prompt" rows="6" cols="80" class="form-control"></textarea>
2693 </div>
2694
2695 <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#rewritePromptModal">Prompt Example</button>
2696
2697 <div class="modal fade" id="rewritePromptModal" tabindex="-1" aria-labelledby="rewritePromptModalLabel" aria-hidden="true">
2698 <div class="modal-dialog modal-lg">
2699 <div class="modal-content">
2700 <div class="modal-header">
2701 <h5 class="modal-title" id="rewritePromptModalLabel">Generate Prompt</h5>
2702 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
2703 </div>
2704 <div class="modal-body">
2705 <textarea class="form-control" id="rewritePromptTextarea" rows="4">Rewrite the text in HTML format that I will give you, in accordance with SEO rules and with your own unique sentences. Give output in HTML format. Breaking the HTML structure. Write the text in [English].</textarea>
2706 </div>
2707 <div class="modal-footer">
2708 <button type="button" class="btn btn-primary" id="rewriteGeneratePromptButton">OK</button>
2709 </div>
2710 </div>
2711 </div>
2712 </div>
2713
2714 <br>
2715 <p>It is highly recommended to look at <span class="bold-text">prompt examples</span> for better results.</p>
2716
2717 <div class="col-md-6">
2718 <label for="tags_prompt" class="form-label">Prompt for Tags:</label>
2719 <textarea id="tags_prompt" rows="6" name="tags_prompt" cols="80" class="form-control"></textarea>
2720 </div>
2721
2722 <div class="col-md-6">
2723 <label for="image_prompt" class="form-label">Prompt for Thumbnail:</label>
2724 <textarea id="image_prompt" rows="6" name="image_prompt" cols="80" class="form-control"></textarea>
2725 </div>
2726
2727 <div class="col-md-12">
2728 <p class="message">For prompt examples, visit <a class="link" href="https://www.aiprm.com/prompts/">aiprm.com/prompts</a></p>
2729 </div>
2730 <div class="col-12">
2731 <input type="submit" name="submit" id="submit" class="btn btn-primary" value="Generate Post">
2732 </div>
2733
2734 </form>
2735 </div>
2736
2737 </div>
2738 </tbody>
2739
2740 </form>
2741 </div>
2742 </div>
2743 </div>
2744 </div>
2745 <!-- Sidebar -->
2746 <div id="postbox-container-1" class="postbox-container">
2747 <!-- Sidebar content here (if any) -->
2748 </div>
2749 </div>
2750 <br class="clear">
2751 </div>
2752 </div>
2753
2754
2755 <?php
2756 }
2757
2758 function autowp_manual_post_ai_form_page_setOptions(){
2759
2760 if (isset($_POST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'autowp_manual_post_ai_nonce')) { //dönülecek
2761 $autowp_admin_email = autowp_get_admin_email();
2762 $autowp_domain_name = esc_url(get_site_url());
2763 $website_domainname = '';
2764 $website_categories = '';
2765 $post_count = '';
2766 $post_order = '';
2767 $post_ids = '';
2768 $title_prompt = sanitize_text_field($_POST['title_prompt']);
2769 $content_prompt = sanitize_text_field($_POST['content_prompt']);
2770 $tags_prompt = sanitize_text_field($_POST['tags_prompt']);
2771 $image_prompt = sanitize_text_field($_POST['image_prompt']);
2772
2773 $author_selection = sanitize_text_field($_POST['author_selection']) ?? 1;
2774
2775 $aigenerated_title = '1';
2776 $aigenerated_content = '1';
2777 $aigenerated_tags = '1';
2778 $aigenerated_image = '0';
2779
2780 if(isset($_POST['aigenerated_image'])){
2781 $aigenerated_image = sanitize_text_field($_POST['aigenerated_image']);
2782 }
2783
2784 $image_settings = json_decode(json_encode(unserialize(get_option('autowp_settings'))));
2785 $source_type = 'ai';
2786
2787
2788 $wordpress_categories = isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array();
2789
2790 $image_generating_status = sanitize_text_field($_POST['image_generating_status']);
2791
2792 $get_data_from_api = autowp_get_posts_from_wp_website($autowp_domain_name, $autowp_admin_email, $website_domainname, $website_categories, $post_count,$post_order,$post_ids,$title_prompt,$content_prompt,$tags_prompt,$image_prompt,$aigenerated_title,$aigenerated_content,$aigenerated_tags,$aigenerated_image,$image_settings,$source_type,$image_generating_status);
2793 $wp_posts = $get_data_from_api['autowp-api'];
2794
2795
2796
2797
2798
2799 if($get_data_from_api['error']){
2800 update_option('autowp_alerts', $get_data_from_api['error']);
2801 autowp_show_alert_with_message(false,$get_data_from_api['error']);
2802 }else{
2803 update_option('autowp_alerts', '');
2804 if(!empty($wp_posts)){
2805 autowp_show_alert_with_message(true,'Success!');
2806 }
2807 }
2808
2809
2810
2811 foreach($wp_posts as $post){
2812
2813 $post_ids = $post_ids . ',' . $post['post_id'] . $post['slug'];
2814 $post_title = $post['post_title'];
2815 $post_content = $post['content'];
2816 $post_featured_image = $post['preview_image_original'];
2817 $post_tags = $post['tags'];
2818 $post_status = 'publish';
2819 $post_author = $author_selection;
2820 $post_type = 'post';
2821 $focus_keyword = $post['focus_keyword'];
2822
2823
2824
2825
2826 autowp_set_new_post($post_title,$post_content,$post_status,$post_author,$post_type,$post_featured_image, $wordpress_categories,$post_tags,$focus_keyword);
2827
2828
2829 }
2830
2831 autowp_update_published_post_ids($post_ids);
2832
2833 }
2834
2835 }
2836
2837
2838 function autowp_manual_post_ai_form_page_handler() {
2839 autowp_manual_post_ai_form_page_setOptions();
2840 ?>
2841
2842 <div class="wrap">
2843 <h1>Manual Post - AI</h1>
2844 <a href="javascript:history.back()" class="btn btn-primary">Go Back</a>
2845
2846 <div id="poststuff">
2847 <div id="post-body" class="metabox-holder">
2848 <!-- Main Content -->
2849 <div id="post-body-content" class="row">
2850 <div class="col-md-8">
2851 <div class="meta-box-sortables ui-sortable">
2852 <div class="postbox">
2853 <h2 class="hndle ui-sortable-handle">AI Settings</h2>
2854 <div class="inside">
2855 <form method="post">
2856 <?php wp_nonce_field('autowp_manual_post_ai_nonce', '_wpnonce'); ?>
2857 <form class="row g-3" id="post_generation_form">
2858 <div class="col-md-6">
2859 <div class="mb-3">
2860 <label for="author_selection" class="form-label"><?php esc_html_e('Author Selection', 'autowp'); ?></label>
2861 <select name="author_selection" class="form-select">
2862 <?php
2863 $authors = get_users();
2864
2865 foreach ($authors as $author) {
2866 $author_id = $author->ID;
2867 $author_name = $author->display_name;
2868 $author_description = get_the_author_meta('description', $author_id);
2869
2870 echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>';
2871 }
2872 ?>
2873 </select>
2874 <p class="form-text"><?php esc_html_e('Select an author from the list.', 'autowp'); ?></p>
2875 </div>
2876
2877 <div class="mb-3">
2878 <label for="category_id" class="form-label">Categories:</label>
2879 <select id="category_id" name="category_id[]" required multiple class="form-select">
2880 <?php
2881 $categories = get_categories(array(
2882 'orderby' => 'name',
2883 'order' => 'ASC',
2884 'hide_empty' => false
2885 ));
2886
2887 foreach ($categories as $category) {
2888 echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>';
2889 }
2890 ?>
2891 </select>
2892 </div>
2893
2894 <div class="mb-3">
2895 <label class="form-check-label">AI Settings :</label>
2896 <div class="form-check">
2897 <br>
2898 <input type="checkbox" id="aigenerated_image" name="aigenerated_image" value="1" class="form-check-input">
2899 <label for="aigenerated_image" class="form-check-label">Generated thumbnail with AI (SEO Friendly)</label>
2900 </div>
2901 </div>
2902
2903 <div class="mb-3">
2904 <label for="image_generating_status" class="form-label"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label>
2905 <select name="image_generating_status" class="form-select">
2906 <option value="0"><?php esc_html_e('Stable Diffusion', 'autowp'); ?></option>
2907 <option value="1"><?php esc_html_e('DALL-E', 'autowp'); ?></option>
2908 <option value="2"><?php esc_html_e('DuckDuckGo Images', 'autowp'); ?></option>
2909 </select>
2910 <p class="form-text"><?php esc_html_e('By default stable diffusion is selected.', 'autowp'); ?></p>
2911 </div>
2912 </div>
2913
2914 <div class="col-md-6">
2915 <div class="mb-3">
2916 <label for="content_prompt">Prompt for Content:</label>
2917 <br>
2918 <textarea id="content_prompt" name="content_prompt" rows="6" cols="80"></textarea>
2919 </div>
2920
2921 <div class="mb-3">
2922 <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#promptModal">Prompt Generator</button>
2923 </div>
2924 </div>
2925
2926
2927
2928
2929
2930 <p>It is highly recommended to use <span class="bold-text">"prompt generator"</span> for better results.</p>
2931
2932
2933 <div class="mb-3">
2934 <div class="modal fade" id="promptModal" tabindex="-1" aria-labelledby="promptModalLabel" aria-hidden="true">
2935 <div class="modal-dialog modal-lg">
2936 <div class="modal-content">
2937 <div class="modal-header">
2938 <h5 class="modal-title" id="promptModalLabel">Generate Prompt</h5>
2939 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
2940 </div>
2941 <div class="modal-body">
2942 <form>
2943
2944 <div class="mb-3">
2945 <label for="generationMethod" class="form-label">Topic Generation Method:</label>
2946 <select class="form-select" name="generationMethod" id="generationMethod">
2947 <option value="googleTrends">Google Trends</option>
2948 <option value="aiGenerated">AI-generated</option>
2949 </select>
2950 </div>
2951
2952 <div class="mb-3">
2953 <label for="keywordInput" class="form-label">Keyword:</label>
2954 <input type="text" class="form-control" id="keywordInput" placeholder="Enter keyword">
2955 </div>
2956
2957
2958
2959 <div class="mb-3">
2960 <label for="countrySelect" class="form-label">Google Trends Country:</label>
2961 <select class="form-select" id="countrySelect">
2962
2963 <option value="AF">Afghanistan</option>
2964 <option value="AX">�
2965 land Islands</option>
2966 <option value="AL">Albania</option>
2967 <option value="DZ">Algeria</option>
2968 <option value="AS">American Samoa</option>
2969 <option value="AD">Andorra</option>
2970 <option value="AO">Angola</option>
2971 <option value="AI">Anguilla</option>
2972 <option value="AQ">Antarctica</option>
2973 <option value="AG">Antigua and Barbuda</option>
2974 <option value="AR">Argentina</option>
2975 <option value="AM">Armenia</option>
2976 <option value="AW">Aruba</option>
2977 <option value="AU">Australia</option>
2978 <option value="AT">Austria</option>
2979 <option value="AZ">Azerbaijan</option>
2980 <option value="BS">Bahamas</option>
2981 <option value="BH">Bahrain</option>
2982 <option value="BD">Bangladesh</option>
2983 <option value="BB">Barbados</option>
2984 <option value="BY">Belarus</option>
2985 <option value="BE">Belgium</option>
2986 <option value="BZ">Belize</option>
2987 <option value="BJ">Benin</option>
2988 <option value="BM">Bermuda</option>
2989 <option value="BT">Bhutan</option>
2990 <option value="BO">Bolivia, Plurinational State of</option>
2991 <option value="BQ">Bonaire, Sint Eustatius and Saba</option>
2992 <option value="BA">Bosnia and Herzegovina</option>
2993 <option value="BW">Botswana</option>
2994 <option value="BV">Bouvet Island</option>
2995 <option value="BR">Brazil</option>
2996 <option value="IO">British Indian Ocean Territory</option>
2997 <option value="BN">Brunei Darussalam</option>
2998 <option value="BG">Bulgaria</option>
2999 <option value="BF">Burkina Faso</option>
3000 <option value="BI">Burundi</option>
3001 <option value="KH">Cambodia</option>
3002 <option value="CM">Cameroon</option>
3003 <option value="CA">Canada</option>
3004 <option value="CV">Cape Verde</option>
3005 <option value="KY">Cayman Islands</option>
3006 <option value="CF">Central African Republic</option>
3007 <option value="TD">Chad</option>
3008 <option value="CL">Chile</option>
3009 <option value="CN">China</option>
3010 <option value="CX">Christmas Island</option>
3011 <option value="CC">Cocos (Keeling) Islands</option>
3012 <option value="CO">Colombia</option>
3013 <option value="KM">Comoros</option>
3014 <option value="CG">Congo</option>
3015 <option value="CD">Congo, the Democratic Republic of the</option>
3016 <option value="CK">Cook Islands</option>
3017 <option value="CR">Costa Rica</option>
3018 <option value="CI">Côte d'Ivoire</option>
3019 <option value="HR">Croatia</option>
3020 <option value="CU">Cuba</option>
3021 <option value="CW">Curaçao</option>
3022 <option value="CY">Cyprus</option>
3023 <option value="CZ">Czech Republic</option>
3024 <option value="DK">Denmark</option>
3025 <option value="DJ">Djibouti</option>
3026 <option value="DM">Dominica</option>
3027 <option value="DO">Dominican Republic</option>
3028 <option value="EC">Ecuador</option>
3029 <option value="EG">Egypt</option>
3030 <option value="SV">El Salvador</option>
3031 <option value="GQ">Equatorial Guinea</option>
3032 <option value="ER">Eritrea</option>
3033 <option value="EE">Estonia</option>
3034 <option value="ET">Ethiopia</option>
3035 <option value="FK">Falkland Islands (Malvinas)</option>
3036 <option value="FO">Faroe Islands</option>
3037 <option value="FJ">Fiji</option>
3038 <option value="FI">Finland</option>
3039 <option value="FR">France</option>
3040 <option value="GF">French Guiana</option>
3041 <option value="PF">French Polynesia</option>
3042 <option value="TF">French Southern Territories</option>
3043 <option value="GA">Gabon</option>
3044 <option value="GM">Gambia</option>
3045 <option value="GE">Georgia</option>
3046 <option value="DE">Germany</option>
3047 <option value="GH">Ghana</option>
3048 <option value="GI">Gibraltar</option>
3049 <option value="GR">Greece</option>
3050 <option value="GL">Greenland</option>
3051 <option value="GD">Grenada</option>
3052 <option value="GP">Guadeloupe</option>
3053 <option value="GU">Guam</option>
3054 <option value="GT">Guatemala</option>
3055 <option value="GG">Guernsey</option>
3056 <option value="GN">Guinea</option>
3057 <option value="GW">Guinea-Bissau</option>
3058 <option value="GY">Guyana</option>
3059 <option value="HT">Haiti</option>
3060 <option value="HM">Heard Island and McDonald Islands</option>
3061 <option value="VA">Holy See (Vatican City State)</option>
3062 <option value="HN">Honduras</option>
3063 <option value="HK">Hong Kong</option>
3064 <option value="HU">Hungary</option>
3065 <option value="IS">Iceland</option>
3066 <option value="IN">India</option>
3067 <option value="ID">Indonesia</option>
3068 <option value="IR">Iran, Islamic Republic of</option>
3069 <option value="IQ">Iraq</option>
3070 <option value="IE">Ireland</option>
3071 <option value="IM">Isle of Man</option>
3072 <option value="IL">Israel</option>
3073 <option value="IT">Italy</option>
3074 <option value="JM">Jamaica</option>
3075 <option value="JP">Japan</option>
3076 <option value="JE">Jersey</option>
3077 <option value="JO">Jordan</option>
3078 <option value="KZ">Kazakhstan</option>
3079 <option value="KE">Kenya</option>
3080 <option value="KI">Kiribati</option>
3081 <option value="KP">Korea, Democratic People's Republic of</option>
3082 <option value="KR">Korea, Republic of</option>
3083 <option value="KW">Kuwait</option>
3084 <option value="KG">Kyrgyzstan</option>
3085 <option value="LA">Lao People's Democratic Republic</option>
3086 <option value="LV">Latvia</option>
3087 <option value="LB">Lebanon</option>
3088 <option value="LS">Lesotho</option>
3089 <option value="LR">Liberia</option>
3090 <option value="LY">Libya</option>
3091 <option value="LI">Liechtenstein</option>
3092 <option value="LT">Lithuania</option>
3093 <option value="LU">Luxembourg</option>
3094 <option value="MO">Macao</option>
3095 <option value="MK">Macedonia, the former Yugoslav Republic of</option>
3096 <option value="MG">Madagascar</option>
3097 <option value="MW">Malawi</option>
3098 <option value="MY">Malaysia</option>
3099 <option value="MV">Maldives</option>
3100 <option value="ML">Mali</option>
3101 <option value="MT">Malta</option>
3102 <option value="MH">Marshall Islands</option>
3103 <option value="MQ">Martinique</option>
3104 <option value="MR">Mauritania</option>
3105 <option value="MU">Mauritius</option>
3106 <option value="YT">Mayotte</option>
3107 <option value="MX">Mexico</option>
3108 <option value="FM">Micronesia, Federated States of</option>
3109 <option value="MD">Moldova, Republic of</option>
3110 <option value="MC">Monaco</option>
3111 <option value="MN">Mongolia</option>
3112 <option value="ME">Montenegro</option>
3113 <option value="MS">Montserrat</option>
3114 <option value="MA">Morocco</option>
3115 <option value="MZ">Mozambique</option>
3116 <option value="MM">Myanmar</option>
3117 <option value="NA">Namibia</option>
3118 <option value="NR">Nauru</option>
3119 <option value="NP">Nepal</option>
3120 <option value="NL">Netherlands</option>
3121 <option value="NC">New Caledonia</option>
3122 <option value="NZ">New Zealand</option>
3123 <option value="NI">Nicaragua</option>
3124 <option value="NE">Niger</option>
3125 <option value="NG">Nigeria</option>
3126 <option value="NU">Niue</option>
3127 <option value="NF">Norfolk Island</option>
3128 <option value="MP">Northern Mariana Islands</option>
3129 <option value="NO">Norway</option>
3130 <option value="OM">Oman</option>
3131 <option value="PK">Pakistan</option>
3132 <option value="PW">Palau</option>
3133 <option value="PS">Palestinian Territory, Occupied</option>
3134 <option value="PA">Panama</option>
3135 <option value="PG">Papua New Guinea</option>
3136 <option value="PY">Paraguay</option>
3137 <option value="PE">Peru</option>
3138 <option value="PH">Philippines</option>
3139 <option value="PN">Pitcairn</option>
3140 <option value="PL">Poland</option>
3141 <option value="PT">Portugal</option>
3142 <option value="PR">Puerto Rico</option>
3143 <option value="QA">Qatar</option>
3144 <option value="RE">Réunion</option>
3145 <option value="RO">Romania</option>
3146 <option value="RU">Russian Federation</option>
3147 <option value="RW">Rwanda</option>
3148 <option value="BL">Saint Barthélemy</option>
3149 <option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
3150 <option value="KN">Saint Kitts and Nevis</option>
3151 <option value="LC">Saint Lucia</option>
3152 <option value="MF">Saint Martin (French part)</option>
3153 <option value="PM">Saint Pierre and Miquelon</option>
3154 <option value="VC">Saint Vincent and the Grenadines</option>
3155 <option value="WS">Samoa</option>
3156 <option value="SM">San Marino</option>
3157 <option value="ST">Sao Tome and Principe</option>
3158 <option value="SA">Saudi Arabia</option>
3159 <option value="SN">Senegal</option>
3160 <option value="RS">Serbia</option>
3161 <option value="SC">Seychelles</option>
3162 <option value="SL">Sierra Leone</option>
3163 <option value="SG">Singapore</option>
3164 <option value="SX">Sint Maarten (Dutch part)</option>
3165 <option value="SK">Slovakia</option>
3166 <option value="SI">Slovenia</option>
3167 <option value="SB">Solomon Islands</option>
3168 <option value="SO">Somalia</option>
3169 <option value="ZA">South Africa</option>
3170 <option value="GS">South Georgia and the South Sandwich Islands</option>
3171 <option value="SS">South Sudan</option>
3172 <option value="ES">Spain</option>
3173 <option value="LK">Sri Lanka</option>
3174 <option value="SD">Sudan</option>
3175 <option value="SR">Suriname</option>
3176 <option value="SJ">Svalbard and Jan Mayen</option>
3177 <option value="SZ">Swaziland</option>
3178 <option value="SE">Sweden</option>
3179 <option value="CH">Switzerland</option>
3180 <option value="SY">Syrian Arab Republic</option>
3181 <option value="TW">Taiwan, Province of China</option>
3182 <option value="TJ">Tajikistan</option>
3183 <option value="TZ">Tanzania, United Republic of</option>
3184 <option value="TH">Thailand</option>
3185 <option value="TL">Timor-Leste</option>
3186 <option value="TG">Togo</option>
3187 <option value="TK">Tokelau</option>
3188 <option value="TO">Tonga</option>
3189 <option value="TT">Trinidad and Tobago</option>
3190 <option value="TN">Tunisia</option>
3191 <option value="TR">Turkey</option>
3192 <option value="TM">Turkmenistan</option>
3193 <option value="TC">Turks and Caicos Islands</option>
3194 <option value="TV">Tuvalu</option>
3195 <option value="UG">Uganda</option>
3196 <option value="UA">Ukraine</option>
3197 <option value="AE">United Arab Emirates</option>
3198 <option value="GB">United Kingdom</option>
3199 <option value="US">United States</option>
3200 <option value="UM">United States Minor Outlying Islands</option>
3201 <option value="UY">Uruguay</option>
3202 <option value="UZ">Uzbekistan</option>
3203 <option value="VU">Vanuatu</option>
3204 <option value="VE">Venezuela, Bolivarian Republic of</option>
3205 <option value="VN">Viet Nam</option>
3206 <option value="VG">Virgin Islands, British</option>
3207 <option value="VI">Virgin Islands, U.S.</option>
3208 <option value="WF">Wallis and Futuna</option>
3209 <option value="EH">Western Sahara</option>
3210 <option value="YE">Yemen</option>
3211 <option value="ZM">Zambia</option>
3212 <option value="ZW">Zimbabwe</option>
3213 <!-- Daha fazla ülke eklemeye devam edebilirsiniz -->
3214 </select>
3215 </div>
3216
3217
3218
3219 <div class="mb-3">
3220 <label for="languageSelect" class="form-label">Post Language:</label>
3221 <select class="form-select" id="languageSelect">
3222 <option value="Afrikaans">Afrikaans</option>
3223 <option value="Albanian">Albanian</option>
3224 <option value="Arabic">Arabic</option>
3225 <option value="Armenian">Armenian</option>
3226 <option value="Basque">Basque</option>
3227 <option value="Bengali">Bengali</option>
3228 <option value="Bulgarian">Bulgarian</option>
3229 <option value="Catalan">Catalan</option>
3230 <option value="Cambodian">Cambodian</option>
3231 <option value="Chinese (Mandarin)">Chinese (Mandarin)</option>
3232 <option value="Croatian">Croatian</option>
3233 <option value="Czech">Czech</option>
3234 <option value="Danish">Danish</option>
3235 <option value="Dutch">Dutch</option>
3236 <option value="English">English</option>
3237 <option value="Estonian">Estonian</option>
3238 <option value="Fiji">Fiji</option>
3239 <option value="Finnish">Finnish</option>
3240 <option value="French">French</option>
3241 <option value="Georgian">Georgian</option>
3242 <option value="German">German</option>
3243 <option value="Greek">Greek</option>
3244 <option value="Gujarati">Gujarati</option>
3245 <option value="Hebrew">Hebrew</option>
3246 <option value="Hindi">Hindi</option>
3247 <option value="Hungarian">Hungarian</option>
3248 <option value="Icelandic">Icelandic</option>
3249 <option value="Indonesian">Indonesian</option>
3250 <option value="Irish">Irish</option>
3251 <option value="Italian">Italian</option>
3252 <option value="Japanese">Japanese</option>
3253 <option value="Javanese">Javanese</option>
3254 <option value="Korean">Korean</option>
3255 <option value="Latin">Latin</option>
3256 <option value="Latvian">Latvian</option>
3257 <option value="Lithuanian">Lithuanian</option>
3258 <option value="Macedonian">Macedonian</option>
3259 <option value="Malay">Malay</option>
3260 <option value="Malayalam">Malayalam</option>
3261 <option value="Maltese">Maltese</option>
3262 <option value="Maori">Maori</option>
3263 <option value="Marathi">Marathi</option>
3264 <option value="Mongolian">Mongolian</option>
3265 <option value="Nepali">Nepali</option>
3266 <option value="Norwegian">Norwegian</option>
3267 <option value="Persian">Persian</option>
3268 <option value="Polish">Polish</option>
3269 <option value="Portuguese">Portuguese</option>
3270 <option value="Punjabi">Punjabi</option>
3271 <option value="Quechua">Quechua</option>
3272 <option value="Romanian">Romanian</option>
3273 <option value="Russian">Russian</option>
3274 <option value="Samoan">Samoan</option>
3275 <option value="Serbian">Serbian</option>
3276 <option value="Slovak">Slovak</option>
3277 <option value="Slovenian">Slovenian</option>
3278 <option value="Spanish">Spanish</option>
3279 <option value="Swahili">Swahili</option>
3280 <option value="Swedish ">Swedish </option>
3281 <option value="Tamil">Tamil</option>
3282 <option value="Tatar">Tatar</option>
3283 <option value="Telugu">Telugu</option>
3284 <option value="Thai">Thai</option>
3285 <option value="Tibetan">Tibetan</option>
3286 <option value="Tonga">Tonga</option>
3287 <option value="Turkish">Turkish</option>
3288 <option value="Ukrainian">Ukrainian</option>
3289 <option value="Urdu">Urdu</option>
3290 <option value="Uzbek">Uzbek</option>
3291 <option value="Vietnamese">Vietnamese</option>
3292 <option value="Welsh">Welsh</option>
3293 <option value="Xhosa">Xhosa</option>
3294 <!-- Daha fazla dil ekleyebilirsiniz -->
3295 </select>
3296 </div>
3297
3298 <div class="mb-3">
3299 <label for="subtitleSelect" class="form-label">Subtitle Count:</label>
3300 <select class="form-select" id="subtitleSelect">
3301 <option value="1">1</option>
3302 <option value="2">2</option>
3303 <option value="3">3</option>
3304 <option value="4">4</option>
3305 <option value="5">5</option>
3306 <option value="6">6</option>
3307 <option value="7">7</option>
3308 <option value="8">8</option>
3309 <option value="9">9</option>
3310 <option value="10">10</option>
3311 <!-- Add more subtitle options here -->
3312 </select>
3313 </div>
3314 <div class="mb-3">
3315 <label for="narrationSelect" class="form-label">Writing Style:</label>
3316 <select class="form-select" id="narrationSelect">
3317 <option value="Descriptive">Descriptive</option>
3318 <option value="Narrative">Narrative</option>
3319 <option value="Explanatory">Explanatory</option>
3320 <option value="Argumentative">Argumentative</option>
3321 <option value="Comparative">Comparative</option>
3322 <option value="ProcessAnalysis">Process Analysis</option>
3323 <option value="Allegorical">Allegorical</option>
3324 <option value="Chronological">Chronological</option>
3325 <option value="Ironic">Ironic</option>
3326 <option value="ConsistencyAndRepetition">Consistency and Repetition</option>
3327 <option value="LanguagePlayAndPoeticExpression">Language Play and Poetic Expression</option>
3328 <option value="InternalMonologue">Internal Monologue</option>
3329 <option value="Dialogical">Dialogical</option>
3330 <!-- Add more narration style options here -->
3331 </select>
3332 </div>
3333 <div class="mb-3">
3334 <label for="promptTextarea" class="form-label">Final Prompt:</label>
3335 <textarea class="form-control" id="promptTextarea" rows="4"></textarea>
3336 </div>
3337 </form>
3338 </div>
3339 <div class="modal-footer">
3340 <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
3341 <button type="button" class="btn btn-primary" id="generatePromptBtn">Generate Prompt</button>
3342 </div>
3343 </div>
3344 </div>
3345 </div>
3346
3347 <div class="col-md-12">
3348
3349 <div class="mb-3">
3350 <label for="title_prompt">Prompt for Title:</label>
3351 <br>
3352 <textarea id="title_prompt" name="title_prompt" rows="6" cols="80"></textarea>
3353 </div>
3354
3355 <div class="mb-3">
3356 <label for="tags_prompt">Prompt for Tags:</label>
3357 <br>
3358 <textarea id="tags_prompt" rows="6" name="tags_prompt" cols="80"></textarea>
3359 </div>
3360
3361 <div class="mb-3">
3362 <label for="image_prompt">Prompt for Thumbnail:</label>
3363 <br>
3364 <textarea id="image_prompt" rows="6" name="image_prompt" cols="80"></textarea>
3365 </div>
3366
3367 <div class="mb-3">
3368 <p class="message">For prompt examples, visit <a class="link" href="https://www.aiprm.com/prompts/">aiprm.com/prompts</a></p>
3369 </div>
3370
3371 <div class="mb-3">
3372 <p class="submit">
3373 <input type="submit" name="submit" id="submit" class="btn btn-primary" value="Generate Post">
3374 </p>
3375 </div>
3376 </div>
3377 </form>
3378 </form>
3379 </div>
3380 </div>
3381 </div>
3382 </div>
3383 <!-- Sidebar -->
3384 </div>
3385 </div>
3386 </div>
3387 </div>
3388 <?php
3389 }
3390
3391 function autowp_manual_post_selection_page_handler(){
3392 ?>
3393 <!-- Add this in the <head> section of your HTML -->
3394
3395 <div class="wrap">
3396 <h2><?php esc_html__('Manual Post', 'autowp')?></h2>
3397 <p><?php esc_html__('Please select the type of website you want manual posting:', 'autowp')?></p>
3398 <ul class="list-group">
3399 <li class="list-group-item">
3400 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=manual_post_wp_website_form')); ?>" class="d-flex justify-content-between align-items-center">
3401 <div class="d-flex align-items-center">
3402 <img src="<?php echo esc_url( plugins_url( 'assets/images/wordpress-icon.png', __FILE__ ) ); ?>" alt="<?php esc_attr_e('WordPress Website'); ?>" class="me-3" style="width: 80px; height: 80px;">
3403 <div>
3404 <h5><?php esc_html_e('AI-Rewrite From Wordpress Website', 'autowp')?></h5>
3405 <p><?php esc_html_e('Fetch posts from WordPress site and rewrite with artificial intelligence.', 'autowp')?></p>
3406 </div>
3407 </div>
3408 </a>
3409 </li>
3410 <li class="list-group-item">
3411 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=manual_post_rss_website_form')); ?>" class="d-flex justify-content-between align-items-center">
3412 <div class="d-flex align-items-center">
3413 <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;">
3414 <div>
3415 <h5><?php esc_html_e('AI-Rewrite From RSS Website', 'autowp')?></h5>
3416 <p><?php esc_html_e('Fetch content with RSS and rewrite with artificial intelligence.', 'autowp')?></p>
3417 </div>
3418 </div>
3419 </a>
3420 </li>
3421 <li class="list-group-item">
3422 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=manual_post_ai_website_form')); ?>" class="d-flex justify-content-between align-items-center">
3423 <div class="d-flex align-items-center">
3424 <img src="<?php echo esc_url(plugins_url( 'assets/images/robot-icon.png', __FILE__ )); ?>" alt="Artificial Intelligence" class="me-3" style="width: 80px; height: 80px;">
3425 <div>
3426 <h5><?php esc_html_e('Write AI-Generated from Scratch', 'autowp')?></h5>
3427 <p><?php esc_html_e('Create original content from scratch with artificial intelligence!', 'autowp')?></p>
3428 </div>
3429 </div>
3430 </a>
3431 </li>
3432
3433 <li class="list-group-item">
3434 <a href="<?php echo esc_url(get_admin_url(null, 'admin.php?page=manual_post_news_website_form')); ?>" class="d-flex justify-content-between align-items-center">
3435 <div class="d-flex align-items-center">
3436 <img src="<?php echo esc_url( plugins_url( 'assets/images/news.png', __FILE__ ) ); ?>" alt="<?php esc_attr_e('Rewrite With AI From News'); ?>" class="me-3" style="width: 80px; height: 80px;">
3437 <div>
3438 <h5><?php esc_html_e('Rewrite With AI From News', 'autowp')?></h5>
3439 <p><?php esc_html_e('Fetch content from News and rewrite with artificial intelligence.', 'autowp')?></p>
3440 </div>
3441 </div>
3442 </a>
3443 </li>
3444 </ul>
3445 </div>
3446 <?php
3447 }
3448
3449 function autowp_setAdminMenu(){
3450 add_menu_page(__('AutoWP', 'autowp'), __('AutoWP', 'autowp'), 'activate_plugins', 'autowp_menu', 'autowp_generalSettings',plugins_url( '/assets/images/autowp-icon25.png',__FILE__ ));
3451 add_submenu_page('autowp_menu', __('Automatic Post', 'autowp'), __('Automatic Post', 'autowp'), 'activate_plugins', 'autowp_automaticPost', 'autowp_wp_page_handler');
3452 add_submenu_page('autowp_menu', __('Add new', 'autowp'), __('Add new', 'autowp'), 'activate_plugins', 'autowp_add_new_website_form', 'autowp_website_selection_page_handler');
3453 add_submenu_page('autowp_menu', __("Manual Post","autowp"), __("Manual Post","autowp"), '2' ,'autowp_manualPost' ,'autowp_manual_post_selection_page_handler', '7');
3454
3455 //Automatic Post
3456 add_submenu_page('autowp_add_new_website_form', __('Add new WordPress Website', 'autowp'), __('Add new WordPress Website', 'autowp'), 'manage_options', 'add_new_wp_website_form', 'autowp_wp_website_form_page_handler');
3457 add_submenu_page('autowp_add_new_website_form',__('Add new RSS Website', 'autowp'), __('Add new RSS Website', 'autowp'), 'manage_options', 'add_new_rss_website_form', 'autowp_rss_website_form_page_handler');
3458 add_submenu_page('autowp_add_new_website_form', __('Add new AI-Generated Process', 'autowp'), __('Add new AI-Generated Process', 'autowp'), 'manage_options', 'add_new_ai_website_form', 'autowp_ai_website_form_page_handler');
3459 add_submenu_page('autowp_add_new_website_form', __('Add new News Website', 'autowp'), __('Add new News Website', 'autowp'), 'manage_options', 'add_new_news_website_form', 'autowp_news_website_form_page_handler');
3460
3461 //Manual Post
3462
3463 add_submenu_page('autowp_manualPost', __('Wordpress Website', 'autowp'), __('AI Post Writing', 'autowp'), 'manage_options', 'manual_post_ai_website_form', 'autowp_manual_post_ai_form_page_handler');
3464 add_submenu_page('autowp_manualPost', __('Wordpress Website', 'autowp'), __('AI Rewrite Post From RSS Website', 'autowp'), 'manage_options', 'manual_post_rss_website_form', 'autowp_manual_post_rss_form_page_handler');
3465 add_submenu_page('autowp_manualPost', __('Wordpress Website', 'autowp'), __('AI Rewrite Post From Wordpress Website', 'autowp'), 'manage_options', 'manual_post_wp_website_form', 'autowp_manual_post_wp_form_page_handler');
3466 add_submenu_page('autowp_manualPost', __('Wordpress Website', 'autowp'), __('Wordpress Website', 'autowp'), 'manage_options', 'manual_post_news_website_form', 'autowp_manual_post_news_form_page_handler');
3467
3468
3469
3470
3471 // Add a new submenu page for Settings
3472 add_submenu_page('autowp_menu', __('Settings', 'autowp'), __('Settings', 'autowp'), 'activate_plugins', 'autowp_settings', 'autowp_settings_page_handler');
3473
3474
3475 }
3476
3477 add_action('admin_menu','autowp_setAdminMenu');
3478
3479
3480 ?>