new-ai-website-form.php
1 month ago
new-gtrends-website-form.php
1 month ago
new-news-website-form.php
1 month ago
new-own-ai-agent-form.php
1 month ago
new-rss-website-form.php
1 month ago
new-wp-website-form.php
1 month ago
new-ai-website-form.php
838 lines
| 1 | <?php |
| 2 | |
| 3 | // Function to parse the prompt code and return an associative array of values |
| 4 | function autowp_parse_prompt_code($prompt_string) { |
| 5 | // Strip the surrounding tags to isolate the data |
| 6 | $start_tag = '[autowp-promptcode]'; |
| 7 | $end_tag = '[/autowp-promptcode]'; |
| 8 | $start_pos = strlen($start_tag); |
| 9 | $end_pos = strpos($prompt_string, $end_tag); |
| 10 | |
| 11 | $data_string = substr($prompt_string, $start_pos, $end_pos - $start_pos); |
| 12 | |
| 13 | // Split the string by commas to extract individual values |
| 14 | $values = explode(',', $data_string); |
| 15 | |
| 16 | // Assign each value to a variable, using array_pad to ensure there are exactly 6 elements |
| 17 | list($keyword, $generationMethod, $country, $language, $subtitle, $narration) = array_pad($values, 6, ''); |
| 18 | |
| 19 | // Return an associative array with each value labeled |
| 20 | return [ |
| 21 | 'keyword' => sanitize_text_field($keyword), |
| 22 | 'generationMethod' => sanitize_text_field($generationMethod), |
| 23 | 'country' => sanitize_text_field($country), |
| 24 | 'language' => sanitize_text_field($language), |
| 25 | 'subtitle' => sanitize_text_field($subtitle), |
| 26 | 'narration' => sanitize_text_field($narration) |
| 27 | ]; |
| 28 | } |
| 29 | |
| 30 | function autowp_parse_rewriting_prompt_code($prompt_string) { |
| 31 | // Strip the surrounding tags to isolate the data |
| 32 | $start_tag = '[autowp-rewriting-promptcode]'; |
| 33 | $end_tag = '[/autowp-rewriting-promptcode]'; |
| 34 | $start_pos = strlen($start_tag); |
| 35 | $end_pos = strpos($prompt_string, $end_tag); |
| 36 | |
| 37 | $data_string = substr($prompt_string, $start_pos, $end_pos - $start_pos); |
| 38 | |
| 39 | // Split the string by commas to extract individual values |
| 40 | $values = explode(',', $data_string); |
| 41 | |
| 42 | // Assign each value to a variable, using array_pad to ensure there are exactly 6 elements |
| 43 | list($language, $subtitle, $narration) = array_pad($values, 6, ''); |
| 44 | |
| 45 | // Return an associative array with each value labeled |
| 46 | return [ |
| 47 | |
| 48 | 'language' => sanitize_text_field($language), |
| 49 | 'subtitle' => sanitize_text_field($subtitle), |
| 50 | 'narration' => sanitize_text_field($narration) |
| 51 | ]; |
| 52 | } |
| 53 | |
| 54 | |
| 55 | function autowp_ai_website_form_page_handler(){ |
| 56 | // AI website form content and handling |
| 57 | global $wpdb; |
| 58 | $table_name = $wpdb->prefix . 'autowp_wordpress_websites'; |
| 59 | |
| 60 | $message = ''; |
| 61 | $notice = ''; |
| 62 | |
| 63 | |
| 64 | $default = array( |
| 65 | 'id' => 0, |
| 66 | 'website_name' => '', |
| 67 | 'website_type' => '', |
| 68 | 'category_id' => '', |
| 69 | 'aigenerated_title' => '', |
| 70 | 'aigenerated_content' => '', |
| 71 | 'aigenerated_tags' => '', |
| 72 | 'aigenerated_image' => '', |
| 73 | 'title_prompt' => '', |
| 74 | 'content_prompt' => '', |
| 75 | 'tags_prompt' => '', |
| 76 | 'image_prompt' => '', |
| 77 | 'image_generating_status' => '', |
| 78 | 'author_selection' => '', |
| 79 | 'active' => '', |
| 80 | |
| 81 | |
| 82 | |
| 83 | ); |
| 84 | |
| 85 | |
| 86 | if ( isset($_REQUEST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])), basename(__FILE__))) { |
| 87 | |
| 88 | |
| 89 | // Only retrieve the specific values needed |
| 90 | $item = array( |
| 91 | 'id' => isset($_POST['id']) ? intval($_POST['id']) : 0, |
| 92 | 'website_name' => sanitize_text_field($_POST['website_name']), |
| 93 | 'category_id' => isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array(), |
| 94 | 'aigenerated_image' => '1', |
| 95 | 'title_prompt' => sanitize_textarea_field($_POST['title_prompt']), |
| 96 | 'content_prompt' => '[autowp-promptcode]' . |
| 97 | sanitize_text_field($_POST['keywordInput']) . ',' . |
| 98 | 'aiGenerated'. ',' . |
| 99 | sanitize_text_field($_POST['countrySelect']) . ',' . |
| 100 | sanitize_text_field($_POST['languageSelect']) . ',' . |
| 101 | sanitize_text_field($_POST['subtitleSelect']) . ',' . |
| 102 | sanitize_text_field($_POST['narrationSelect']) . |
| 103 | '[/autowp-promptcode]', |
| 104 | |
| 105 | 'tags_prompt' => sanitize_textarea_field($_POST['tags_prompt']), |
| 106 | 'image_prompt' => sanitize_textarea_field($_POST['image_prompt']), |
| 107 | 'website_type' => 'ai', |
| 108 | 'image_generating_status' => sanitize_text_field($_POST['image_generating_status']), |
| 109 | 'author_selection' => sanitize_text_field($_POST['author_selection']), |
| 110 | 'active' => sanitize_text_field(($_POST['active'])) |
| 111 | ); |
| 112 | |
| 113 | |
| 114 | |
| 115 | //Convert category_id array to text |
| 116 | $category_ids = implode(",", $item['category_id']); |
| 117 | $item['category_id'] = $category_ids; |
| 118 | |
| 119 | |
| 120 | $item['aigenerated_title'] = '1'; |
| 121 | $item['aigenerated_content'] = '1'; |
| 122 | $item['aigenerated_tags'] = '1'; |
| 123 | |
| 124 | if($item['aigenerated_image'] !== '1'){ |
| 125 | $item['aigenerated_image'] = '0'; |
| 126 | } |
| 127 | |
| 128 | |
| 129 | $item['website_type'] = 'ai'; |
| 130 | |
| 131 | // Set WP-CRON |
| 132 | |
| 133 | $settings = unserialize(get_option('autowp_settings')); |
| 134 | |
| 135 | $wpcron_status = $settings['wpcron_status']; |
| 136 | |
| 137 | if(!isset($wpcron_status)){ |
| 138 | autowp_update_wp_cron_status('1'); |
| 139 | } |
| 140 | |
| 141 | $time_value_type = $settings['selected_time_type']; |
| 142 | |
| 143 | $user_wpcron_time = autowp_get_wpcron_time($time_value_type); |
| 144 | |
| 145 | $next_two_minutes = time() + 2 * 60; |
| 146 | |
| 147 | // Schedule WP-Cron |
| 148 | if (!wp_next_scheduled('autowp_cron')) { |
| 149 | wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron'); |
| 150 | |
| 151 | } else { |
| 152 | wp_clear_scheduled_hook('autowp_cron'); |
| 153 | wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron'); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | $item_valid = autowp_validate_website($item); |
| 161 | if ($item_valid === true) { |
| 162 | if ($item['id'] == 0) { |
| 163 | $result = $wpdb->insert($table_name, $item); |
| 164 | $item['id'] = $wpdb->insert_id; |
| 165 | if ($result) { |
| 166 | $message = __('New process was successfully saved! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp'); |
| 167 | } else { |
| 168 | $notice = __('There was an error while saving item', 'autowp'); |
| 169 | } |
| 170 | } else { |
| 171 | $result = $wpdb->update($table_name, $item, array('id' => $item['id'])); |
| 172 | if ($result) { |
| 173 | $message = __('New process was successfully updated! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp'); |
| 174 | } else { |
| 175 | $notice = __('There was an error while updating item', 'autowp'); |
| 176 | } |
| 177 | } |
| 178 | } else { |
| 179 | |
| 180 | $notice = $item_valid; |
| 181 | } |
| 182 | } |
| 183 | else { |
| 184 | |
| 185 | $item = $default; |
| 186 | $sanitized_id = absint($_REQUEST['id']); |
| 187 | if (isset($_REQUEST['id'])) { |
| 188 | $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE id = %d", $sanitized_id), ARRAY_A); |
| 189 | if (!$item) { |
| 190 | $item = $default; |
| 191 | $notice = __('Item not found', 'autowp'); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | |
| 197 | add_meta_box('websites_form_meta_box', __('Form', 'autowp'), 'autowp_ai_websites_form_meta_box_handler', 'add_new_ai_website_form', 'normal', 'default'); |
| 198 | |
| 199 | ?> |
| 200 | <div class="wrap"> |
| 201 | <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> |
| 202 | <h2><?php esc_html_e('Add New', 'autowp'); ?> <a class="add-new-h2" |
| 203 | href="<?php echo esc_url(get_admin_url(get_current_blog_id(), 'admin.php?page=autowp_automaticPost')); ?>"><?php esc_html_e('Back to List', 'autowp'); ?></a> |
| 204 | </h2> |
| 205 | |
| 206 | |
| 207 | <?php if (!empty($notice)): ?> |
| 208 | <div id="notice" class="error"><p><?php echo esc_html($notice) ?></p></div> |
| 209 | <?php endif;?> |
| 210 | <?php if (!empty($message)): ?> |
| 211 | <div id="message" class="updated"><p><?php echo esc_html($message) ?></p></div> |
| 212 | <?php endif;?> |
| 213 | |
| 214 | <form id="form" method="POST"> |
| 215 | <input type="hidden" name="nonce" value="<?php echo esc_attr(wp_create_nonce(basename(__FILE__))); ?>"/> |
| 216 | |
| 217 | |
| 218 | <input type="hidden" name="id" value="<?php echo esc_html($item['id']) ?>"/> |
| 219 | |
| 220 | <div class="metabox-holder" id="poststuff"> |
| 221 | <div id="post-body"> |
| 222 | <div id="post-body-content"> |
| 223 | |
| 224 | <?php do_meta_boxes('add_new_ai_website_form', 'normal', $item); ?> |
| 225 | <input type="submit" value="<?php esc_attr_e('Save', 'autowp')?>" id="submit" class="button-primary" name="submit"> |
| 226 | </div> |
| 227 | </div> |
| 228 | </div> |
| 229 | </form> |
| 230 | </div> |
| 231 | <?php |
| 232 | } |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | function autowp_ai_websites_form_meta_box_handler($item){ |
| 238 | |
| 239 | // Parsing the example content_prompt |
| 240 | $parsed_values = autowp_parse_prompt_code($item['content_prompt']) ?? ''; |
| 241 | |
| 242 | // Accessing values |
| 243 | $promptcode_keyword = $parsed_values['keyword'] ?? ''; |
| 244 | $promptcode_generationMethod = $parsed_values['generationMethod'] ?? ''; |
| 245 | $promptcode_country = $parsed_values['country'] ?? ''; |
| 246 | $promptcode_language = $parsed_values['language'] ?? ''; |
| 247 | $promptcode_subtitle = $parsed_values['subtitle'] ?? ''; |
| 248 | $promptcode_narration = $parsed_values['narration'] ?? ''; |
| 249 | |
| 250 | |
| 251 | ?> |
| 252 | <tbody > |
| 253 | <form> |
| 254 | <div class="container"> |
| 255 | <form class="form2bc row"> |
| 256 | <div class="col-md-6"> |
| 257 | <h4 style="font-weight: bold;">General Settings</h4> |
| 258 | <div class="mb-3"> |
| 259 | <label for="website_name" class="form-label">Name:</label> |
| 260 | <?php |
| 261 | //Get admin domain name |
| 262 | $autowp_admin_email = autowp_get_admin_email(); |
| 263 | $autowp_domain_name = esc_url(get_site_url()); |
| 264 | |
| 265 | echo '<input type="hidden" id="autowp_admin_email" value="' . esc_attr($autowp_admin_email) . '">'; |
| 266 | echo '<input type="hidden" id="autowp_domain_name" value="' . esc_attr($autowp_domain_name) . '">'; |
| 267 | ?> |
| 268 | <input id="website_name" name="website_name" type="text" value="<?php echo esc_attr($item['website_name']) ?>" required class="form-control"> |
| 269 | </div> |
| 270 | |
| 271 | <div class="mb-3"> |
| 272 | <label for="category_id" class="form-label">Categories:</label> |
| 273 | <select id="category_id" name="category_id[]" required multiple class="form-select"> |
| 274 | <?php |
| 275 | // Get selected categories |
| 276 | $selected_categories = $item['category_id']; |
| 277 | // Turn categories to array list |
| 278 | $selected_categories = explode(',', $selected_categories); |
| 279 | |
| 280 | $categories = get_categories(array( |
| 281 | 'orderby' => 'name', |
| 282 | 'order' => 'ASC', |
| 283 | 'hide_empty' => false |
| 284 | )); |
| 285 | |
| 286 | foreach ($categories as $category) { |
| 287 | if (isset($selected_categories) && in_array($category->term_id, $selected_categories)) { |
| 288 | echo '<option value="' . esc_attr($category->term_id) . '" selected>' . esc_html($category->name) . '</option>'; |
| 289 | continue; |
| 290 | } |
| 291 | echo '<option value="' . esc_attr($category->term_id) . '">' . esc_html($category->name) . '</option>'; |
| 292 | } |
| 293 | ?> |
| 294 | </select> |
| 295 | </div> |
| 296 | </div> |
| 297 | |
| 298 | <div class="col-md-6"> |
| 299 | <div class="mb-3"> |
| 300 | <label for="author_selection" class="form-label"><?php esc_html_e('Author Selection', 'autowp'); ?></label> |
| 301 | <select name="author_selection" id="author_selection" class="form-select"> |
| 302 | <?php |
| 303 | $authors = get_users(); |
| 304 | |
| 305 | foreach ($authors as $author) { |
| 306 | $author_id = $author->ID; |
| 307 | $author_name = $author->display_name; |
| 308 | $author_description = get_the_author_meta('description', $author_id); |
| 309 | |
| 310 | if ($item['author_selection'] === strval($author_id)) { |
| 311 | echo '<option value="' . esc_attr($author_id) . '" selected>' . esc_html($author_name) . '</option>'; |
| 312 | continue; |
| 313 | } |
| 314 | |
| 315 | echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>'; |
| 316 | } |
| 317 | ?> |
| 318 | </select> |
| 319 | <p class="form-text"><?php esc_html_e('Select an author from the list.', 'autowp'); ?></p> |
| 320 | </div> |
| 321 | |
| 322 | |
| 323 | |
| 324 | <div class="col-md-6"> |
| 325 | <label class="form-label" for="image_generating_status"><?php esc_html_e('Image Generating Method', 'autowp'); ?></label> |
| 326 | <select name="image_generating_status" class="form-select"> |
| 327 | <option value="0" <?php if ($item['image_generating_status'] === '0') { |
| 328 | echo 'selected'; |
| 329 | } ?>><?php esc_html_e('FLUX Realism LoRA', 'autowp'); ?></option> |
| 330 | |
| 331 | <option value="1" <?php if ($item['image_generating_status'] === '1') { |
| 332 | echo 'selected'; |
| 333 | } ?>><?php esc_html_e('Stable Diffusion Ultra', 'autowp'); ?></option> |
| 334 | |
| 335 | |
| 336 | <option value="2" <?php if ($item['image_generating_status'] === '2') { |
| 337 | echo 'selected'; |
| 338 | } ?>><?php esc_html_e('Stable Diffusion Core', 'autowp'); ?></option> |
| 339 | |
| 340 | |
| 341 | <option value="3" <?php if ($item['image_generating_status'] === '3') { |
| 342 | echo 'selected'; |
| 343 | } ?>><?php esc_html_e('age 1 Mini', 'autowp'); ?></option> |
| 344 | |
| 345 | |
| 346 | <option value="4" <?php if ($item['image_generating_status'] === '4') { |
| 347 | echo 'selected'; |
| 348 | } ?>><?php esc_html_e('age 2', 'autowp'); ?></option> |
| 349 | |
| 350 | |
| 351 | <option value="5" <?php if ($item['image_generating_status'] === '5') { |
| 352 | echo 'selected'; |
| 353 | } ?>><?php esc_html_e('DuckDuckGo Search', 'autowp'); ?></option> |
| 354 | |
| 355 | <option value="6" <?php if ($item['image_generating_status'] === '6') { |
| 356 | echo 'selected'; |
| 357 | } ?>><?php esc_html_e('Default Image', 'autowp'); ?></option> |
| 358 | |
| 359 | <option value="7" <?php if ($item['image_generating_status'] === '7') { |
| 360 | echo 'selected'; |
| 361 | } ?>><?php esc_html_e('No Image', 'autowp'); ?></option> |
| 362 | |
| 363 | |
| 364 | </select> |
| 365 | <p class="form-text"><?php esc_html_e('By default No Image is selected. Use DuckDuckGo Search to find images in the internet.', 'autowp'); ?></p> |
| 366 | </div> |
| 367 | |
| 368 | |
| 369 | </div> |
| 370 | </form> |
| 371 | </div> |
| 372 | |
| 373 | |
| 374 | |
| 375 | <div class="container"> |
| 376 | <div class="form2bc"> |
| 377 | <div class="col-md-6"> |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | <h4 style="font-weight: bold;">Post Settings</h4> |
| 384 | <!-- Integration of your initial form inputs starts here --> |
| 385 | <div class="mb-3"> |
| 386 | <label for="keywordInput" class="form-label">Keyword:</label> |
| 387 | <input type="text" class="form-control" id="keywordInput" name="keywordInput" placeholder="Enter keyword" value="<?php echo esc_attr($promptcode_keyword); ?>" required class="form-control"> |
| 388 | |
| 389 | </div> |
| 390 | |
| 391 | <div class="mb-3"> |
| 392 | <label for="countrySelect" class="form-label">Country:</label> |
| 393 | <select class="form-select" id="countrySelect" name="countrySelect"> |
| 394 | <!-- Countries list --> |
| 395 | <?php |
| 396 | $countries = array |
| 397 | ( |
| 398 | 'AF' => 'Afghanistan', |
| 399 | 'AX' => 'Aland Islands', |
| 400 | 'AL' => 'Albania', |
| 401 | 'DZ' => 'Algeria', |
| 402 | 'AS' => 'American Samoa', |
| 403 | 'AD' => 'Andorra', |
| 404 | 'AO' => 'Angola', |
| 405 | 'AI' => 'Anguilla', |
| 406 | 'AQ' => 'Antarctica', |
| 407 | 'AG' => 'Antigua And Barbuda', |
| 408 | 'AR' => 'Argentina', |
| 409 | 'AM' => 'Armenia', |
| 410 | 'AW' => 'Aruba', |
| 411 | 'AU' => 'Australia', |
| 412 | 'AT' => 'Austria', |
| 413 | 'AZ' => 'Azerbaijan', |
| 414 | 'BS' => 'Bahamas', |
| 415 | 'BH' => 'Bahrain', |
| 416 | 'BD' => 'Bangladesh', |
| 417 | 'BB' => 'Barbados', |
| 418 | 'BY' => 'Belarus', |
| 419 | 'BE' => 'Belgium', |
| 420 | 'BZ' => 'Belize', |
| 421 | 'BJ' => 'Benin', |
| 422 | 'BM' => 'Bermuda', |
| 423 | 'BT' => 'Bhutan', |
| 424 | 'BO' => 'Bolivia', |
| 425 | 'BA' => 'Bosnia And Herzegovina', |
| 426 | 'BW' => 'Botswana', |
| 427 | 'BV' => 'Bouvet Island', |
| 428 | 'BR' => 'Brazil', |
| 429 | 'IO' => 'British Indian Ocean Territory', |
| 430 | 'BN' => 'Brunei Darussalam', |
| 431 | 'BG' => 'Bulgaria', |
| 432 | 'BF' => 'Burkina Faso', |
| 433 | 'BI' => 'Burundi', |
| 434 | 'KH' => 'Cambodia', |
| 435 | 'CM' => 'Cameroon', |
| 436 | 'CA' => 'Canada', |
| 437 | 'CV' => 'Cape Verde', |
| 438 | 'KY' => 'Cayman Islands', |
| 439 | 'CF' => 'Central African Republic', |
| 440 | 'TD' => 'Chad', |
| 441 | 'CL' => 'Chile', |
| 442 | 'CN' => 'China', |
| 443 | 'CX' => 'Christmas Island', |
| 444 | 'CC' => 'Cocos (Keeling) Islands', |
| 445 | 'CO' => 'Colombia', |
| 446 | 'KM' => 'Comoros', |
| 447 | 'CG' => 'Congo', |
| 448 | 'CD' => 'Congo, Democratic Republic', |
| 449 | 'CK' => 'Cook Islands', |
| 450 | 'CR' => 'Costa Rica', |
| 451 | 'CI' => 'Cote D\'Ivoire', |
| 452 | 'HR' => 'Croatia', |
| 453 | 'CU' => 'Cuba', |
| 454 | 'CY' => 'Cyprus', |
| 455 | 'CZ' => 'Czech Republic', |
| 456 | 'DK' => 'Denmark', |
| 457 | 'DJ' => 'Djibouti', |
| 458 | 'DM' => 'Dominica', |
| 459 | 'DO' => 'Dominican Republic', |
| 460 | 'EC' => 'Ecuador', |
| 461 | 'EG' => 'Egypt', |
| 462 | 'SV' => 'El Salvador', |
| 463 | 'GQ' => 'Equatorial Guinea', |
| 464 | 'ER' => 'Eritrea', |
| 465 | 'EE' => 'Estonia', |
| 466 | 'ET' => 'Ethiopia', |
| 467 | 'FK' => 'Falkland Islands (Malvinas)', |
| 468 | 'FO' => 'Faroe Islands', |
| 469 | 'FJ' => 'Fiji', |
| 470 | 'FI' => 'Finland', |
| 471 | 'FR' => 'France', |
| 472 | 'GF' => 'French Guiana', |
| 473 | 'PF' => 'French Polynesia', |
| 474 | 'TF' => 'French Southern Territories', |
| 475 | 'GA' => 'Gabon', |
| 476 | 'GM' => 'Gambia', |
| 477 | 'GE' => 'Georgia', |
| 478 | 'DE' => 'Germany', |
| 479 | 'GH' => 'Ghana', |
| 480 | 'GI' => 'Gibraltar', |
| 481 | 'GR' => 'Greece', |
| 482 | 'GL' => 'Greenland', |
| 483 | 'GD' => 'Grenada', |
| 484 | 'GP' => 'Guadeloupe', |
| 485 | 'GU' => 'Guam', |
| 486 | 'GT' => 'Guatemala', |
| 487 | 'GG' => 'Guernsey', |
| 488 | 'GN' => 'Guinea', |
| 489 | 'GW' => 'Guinea-Bissau', |
| 490 | 'GY' => 'Guyana', |
| 491 | 'HT' => 'Haiti', |
| 492 | 'HM' => 'Heard Island & Mcdonald Islands', |
| 493 | 'VA' => 'Holy See (Vatican City State)', |
| 494 | 'HN' => 'Honduras', |
| 495 | 'HK' => 'Hong Kong', |
| 496 | 'HU' => 'Hungary', |
| 497 | 'IS' => 'Iceland', |
| 498 | 'IN' => 'India', |
| 499 | 'ID' => 'Indonesia', |
| 500 | 'IR' => 'Iran, Islamic Republic Of', |
| 501 | 'IQ' => 'Iraq', |
| 502 | 'IE' => 'Ireland', |
| 503 | 'IM' => 'Isle Of Man', |
| 504 | 'IL' => 'Israel', |
| 505 | 'IT' => 'Italy', |
| 506 | 'JM' => 'Jamaica', |
| 507 | 'JP' => 'Japan', |
| 508 | 'JE' => 'Jersey', |
| 509 | 'JO' => 'Jordan', |
| 510 | 'KZ' => 'Kazakhstan', |
| 511 | 'KE' => 'Kenya', |
| 512 | 'KI' => 'Kiribati', |
| 513 | 'KR' => 'Korea', |
| 514 | 'KW' => 'Kuwait', |
| 515 | 'KG' => 'Kyrgyzstan', |
| 516 | 'LA' => 'Lao People\'s Democratic Republic', |
| 517 | 'LV' => 'Latvia', |
| 518 | 'LB' => 'Lebanon', |
| 519 | 'LS' => 'Lesotho', |
| 520 | 'LR' => 'Liberia', |
| 521 | 'LY' => 'Libyan Arab Jamahiriya', |
| 522 | 'LI' => 'Liechtenstein', |
| 523 | 'LT' => 'Lithuania', |
| 524 | 'LU' => 'Luxembourg', |
| 525 | 'MO' => 'Macao', |
| 526 | 'MK' => 'Macedonia', |
| 527 | 'MG' => 'Madagascar', |
| 528 | 'MW' => 'Malawi', |
| 529 | 'MY' => 'Malaysia', |
| 530 | 'MV' => 'Maldives', |
| 531 | 'ML' => 'Mali', |
| 532 | 'MT' => 'Malta', |
| 533 | 'MH' => 'Marshall Islands', |
| 534 | 'MQ' => 'Martinique', |
| 535 | 'MR' => 'Mauritania', |
| 536 | 'MU' => 'Mauritius', |
| 537 | 'YT' => 'Mayotte', |
| 538 | 'MX' => 'Mexico', |
| 539 | 'FM' => 'Micronesia, Federated States Of', |
| 540 | 'MD' => 'Moldova', |
| 541 | 'MC' => 'Monaco', |
| 542 | 'MN' => 'Mongolia', |
| 543 | 'ME' => 'Montenegro', |
| 544 | 'MS' => 'Montserrat', |
| 545 | 'MA' => 'Morocco', |
| 546 | 'MZ' => 'Mozambique', |
| 547 | 'MM' => 'Myanmar', |
| 548 | 'NA' => 'Namibia', |
| 549 | 'NR' => 'Nauru', |
| 550 | 'NP' => 'Nepal', |
| 551 | 'NL' => 'Netherlands', |
| 552 | 'AN' => 'Netherlands Antilles', |
| 553 | 'NC' => 'New Caledonia', |
| 554 | 'NZ' => 'New Zealand', |
| 555 | 'NI' => 'Nicaragua', |
| 556 | 'NE' => 'Niger', |
| 557 | 'NG' => 'Nigeria', |
| 558 | 'NU' => 'Niue', |
| 559 | 'NF' => 'Norfolk Island', |
| 560 | 'MP' => 'Northern Mariana Islands', |
| 561 | 'NO' => 'Norway', |
| 562 | 'OM' => 'Oman', |
| 563 | 'PK' => 'Pakistan', |
| 564 | 'PW' => 'Palau', |
| 565 | 'PS' => 'Palestinian Territory, Occupied', |
| 566 | 'PA' => 'Panama', |
| 567 | 'PG' => 'Papua New Guinea', |
| 568 | 'PY' => 'Paraguay', |
| 569 | 'PE' => 'Peru', |
| 570 | 'PH' => 'Philippines', |
| 571 | 'PN' => 'Pitcairn', |
| 572 | 'PL' => 'Poland', |
| 573 | 'PT' => 'Portugal', |
| 574 | 'PR' => 'Puerto Rico', |
| 575 | 'QA' => 'Qatar', |
| 576 | 'RE' => 'Reunion', |
| 577 | 'RO' => 'Romania', |
| 578 | 'RU' => 'Russian Federation', |
| 579 | 'RW' => 'Rwanda', |
| 580 | 'BL' => 'Saint Barthelemy', |
| 581 | 'SH' => 'Saint Helena', |
| 582 | 'KN' => 'Saint Kitts And Nevis', |
| 583 | 'LC' => 'Saint Lucia', |
| 584 | 'MF' => 'Saint Martin', |
| 585 | 'PM' => 'Saint Pierre And Miquelon', |
| 586 | 'VC' => 'Saint Vincent And Grenadines', |
| 587 | 'WS' => 'Samoa', |
| 588 | 'SM' => 'San Marino', |
| 589 | 'ST' => 'Sao Tome And Principe', |
| 590 | 'SA' => 'Saudi Arabia', |
| 591 | 'SN' => 'Senegal', |
| 592 | 'RS' => 'Serbia', |
| 593 | 'SC' => 'Seychelles', |
| 594 | 'SL' => 'Sierra Leone', |
| 595 | 'SG' => 'Singapore', |
| 596 | 'SK' => 'Slovakia', |
| 597 | 'SI' => 'Slovenia', |
| 598 | 'SB' => 'Solomon Islands', |
| 599 | 'SO' => 'Somalia', |
| 600 | 'ZA' => 'South Africa', |
| 601 | 'GS' => 'South Georgia And Sandwich Isl.', |
| 602 | 'ES' => 'Spain', |
| 603 | 'LK' => 'Sri Lanka', |
| 604 | 'SD' => 'Sudan', |
| 605 | 'SR' => 'Suriname', |
| 606 | 'SJ' => 'Svalbard And Jan Mayen', |
| 607 | 'SZ' => 'Swaziland', |
| 608 | 'SE' => 'Sweden', |
| 609 | 'CH' => 'Switzerland', |
| 610 | 'SY' => 'Syrian Arab Republic', |
| 611 | 'TW' => 'Taiwan', |
| 612 | 'TJ' => 'Tajikistan', |
| 613 | 'TZ' => 'Tanzania', |
| 614 | 'TH' => 'Thailand', |
| 615 | 'TL' => 'Timor-Leste', |
| 616 | 'TG' => 'Togo', |
| 617 | 'TK' => 'Tokelau', |
| 618 | 'TO' => 'Tonga', |
| 619 | 'TT' => 'Trinidad And Tobago', |
| 620 | 'TN' => 'Tunisia', |
| 621 | 'TR' => 'Turkey', |
| 622 | 'TM' => 'Turkmenistan', |
| 623 | 'TC' => 'Turks And Caicos Islands', |
| 624 | 'TV' => 'Tuvalu', |
| 625 | 'UG' => 'Uganda', |
| 626 | 'UA' => 'Ukraine', |
| 627 | 'AE' => 'United Arab Emirates', |
| 628 | 'GB' => 'United Kingdom', |
| 629 | 'US' => 'United States', |
| 630 | 'UM' => 'United States Outlying Islands', |
| 631 | 'UY' => 'Uruguay', |
| 632 | 'UZ' => 'Uzbekistan', |
| 633 | 'VU' => 'Vanuatu', |
| 634 | 'VE' => 'Venezuela', |
| 635 | 'VN' => 'Viet Nam', |
| 636 | 'VG' => 'Virgin Islands, British', |
| 637 | 'VI' => 'Virgin Islands, U.S.', |
| 638 | 'WF' => 'Wallis And Futuna', |
| 639 | 'EH' => 'Western Sahara', |
| 640 | 'YE' => 'Yemen', |
| 641 | 'ZM' => 'Zambia', |
| 642 | 'ZW' => 'Zimbabwe', |
| 643 | ); |
| 644 | |
| 645 | foreach ($countries as $code => $name) { |
| 646 | $selected = ($promptcode_country == $code) ? 'selected' : ''; |
| 647 | echo "<option value='" . esc_attr($code) . "' " . esc_attr($selected) . ">" . esc_html($name) . "</option>"; |
| 648 | |
| 649 | |
| 650 | } |
| 651 | |
| 652 | ?> |
| 653 | </select> |
| 654 | </div> |
| 655 | <?php |
| 656 | $languages = [ |
| 657 | "Afrikaans", |
| 658 | "Albanian", |
| 659 | "Arabic", |
| 660 | "Armenian", |
| 661 | "Basque", |
| 662 | "Bengali", |
| 663 | "Bulgarian", |
| 664 | "Catalan", |
| 665 | "Cambodian", |
| 666 | "Chinese (Mandarin)", |
| 667 | "Croatian", |
| 668 | "Czech", |
| 669 | "Danish", |
| 670 | "Dutch", |
| 671 | "English", |
| 672 | "Estonian", |
| 673 | "Fiji", |
| 674 | "Finnish", |
| 675 | "French", |
| 676 | "Georgian", |
| 677 | "German", |
| 678 | "Greek", |
| 679 | "Gujarati", |
| 680 | "Hebrew", |
| 681 | "Hindi", |
| 682 | "Hungarian", |
| 683 | "Icelandic", |
| 684 | "Indonesian", |
| 685 | "Irish", |
| 686 | "Italian", |
| 687 | "Japanese", |
| 688 | "Javanese", |
| 689 | "Korean", |
| 690 | "Latin", |
| 691 | "Latvian", |
| 692 | "Lithuanian", |
| 693 | "Macedonian", |
| 694 | "Malay", |
| 695 | "Malayalam", |
| 696 | "Maltese", |
| 697 | "Maori", |
| 698 | "Marathi", |
| 699 | "Mongolian", |
| 700 | "Nepali", |
| 701 | "Norwegian", |
| 702 | "Persian", |
| 703 | "Polish", |
| 704 | "Portuguese", |
| 705 | "Punjabi", |
| 706 | "Quechua", |
| 707 | "Romanian", |
| 708 | "Russian", |
| 709 | "Samoan", |
| 710 | "Serbian", |
| 711 | "Slovak", |
| 712 | "Slovenian", |
| 713 | "Spanish", |
| 714 | "Swahili", |
| 715 | "Swedish", |
| 716 | "Tamil", |
| 717 | "Tatar", |
| 718 | "Telugu", |
| 719 | "Thai", |
| 720 | "Tibetan", |
| 721 | "Tonga", |
| 722 | "Turkish", |
| 723 | "Ukrainian", |
| 724 | "Urdu", |
| 725 | "Uzbek", |
| 726 | "Vietnamese", |
| 727 | "Welsh", |
| 728 | "Xhosa" |
| 729 | ]; |
| 730 | ?> |
| 731 | |
| 732 | <div class="mb-3"> |
| 733 | <label for="languageSelect" class="form-label">Post Language:</label> |
| 734 | <select class="form-select" id="languageSelect" name="languageSelect"> |
| 735 | |
| 736 | |
| 737 | |
| 738 | <?php foreach ($languages as $language): ?> |
| 739 | <option value="<?php echo esc_attr($language); ?>" <?php echo ($language === $promptcode_language) ? 'selected' : ''; ?>> |
| 740 | <?php echo esc_html($language); ?> |
| 741 | </option> |
| 742 | <?php endforeach; ?> |
| 743 | |
| 744 | |
| 745 | </select> |
| 746 | </div> |
| 747 | |
| 748 | <div class="mb-3"> |
| 749 | <label for="subtitleSelect" class="form-label">Subheading Count:</label> |
| 750 | <select class="form-select" id="subtitleSelect" name="subtitleSelect"> |
| 751 | <?php |
| 752 | for ($i = 1; $i <= 10; $i++) { |
| 753 | $selected = ($promptcode_subtitle == strval($i)) ? 'selected' : ''; |
| 754 | echo "<option value='" . esc_attr($i) . "' " . esc_attr($selected) . ">" . esc_html($i) . "</option>"; |
| 755 | |
| 756 | } |
| 757 | ?> |
| 758 | </select> |
| 759 | </div> |
| 760 | |
| 761 | <div class="mb-3"> |
| 762 | <label for="narrationSelect" class="form-label">Writing Style:</label> |
| 763 | <select class="form-select" id="narrationSelect" name="narrationSelect"> |
| 764 | <?php |
| 765 | $is_inactive = (isset($item['active']) && $item['active'] === '0'); |
| 766 | |
| 767 | $styles = [ |
| 768 | "Descriptive" => "Descriptive", |
| 769 | "Narrative" => "Narrative", |
| 770 | "Explanatory" => "Explanatory", |
| 771 | "Argumentative" => "Argumentative", |
| 772 | "Comparative" => "Comparative", |
| 773 | "Process Analysis" => "Process Analysis", |
| 774 | "Allegorical" => "Allegorical", |
| 775 | "Chronological" => "Chronological", |
| 776 | "Ironic" => "Ironic", |
| 777 | "ConsistencyAndRepetition" => "Consistency and Repetition", |
| 778 | "LanguagePlayAndPoeticExpression" => "Language Play and Poetic Expression", |
| 779 | "InternalMonologue" => "Internal Monologue", |
| 780 | "Dialogical" => "Dialogical" |
| 781 | ]; |
| 782 | foreach ($styles as $value => $name) { |
| 783 | $selected = ($promptcode_narration == $value) ? 'selected' : ''; |
| 784 | echo "<option value='" . esc_attr($value) . "' " . esc_attr($selected) . ">" . esc_html($name) . "</option>"; |
| 785 | |
| 786 | |
| 787 | } |
| 788 | ?> |
| 789 | </select> |
| 790 | </div> |
| 791 | |
| 792 | |
| 793 | <h4 style="font-weight: bold;">Source Status</h4> |
| 794 | |
| 795 | |
| 796 | <!-- Status Field (Active/Inactive) --> |
| 797 | <div class="mb-3"> |
| 798 | <label for="active" class="form-label">Status:</label> |
| 799 | |
| 800 | |
| 801 | <select id="active" name="active" class="form-select"> |
| 802 | <option value="1" <?php echo (!$is_inactive) ? 'selected' : ''; ?>> |
| 803 | Active |
| 804 | </option> |
| 805 | <option value="0" <?php echo ($is_inactive) ? 'selected' : ''; ?>> |
| 806 | Inactive |
| 807 | </option> |
| 808 | </select> |
| 809 | |
| 810 | <p class="message"> |
| 811 | When the cron job is triggered, any task marked as "Active" will be executed. |
| 812 | If you select "Inactive," this task will be skipped, and the cron job will move |
| 813 | on to the remaining active tasks. This makes it easy to enable or disable tasks |
| 814 | without removing them entirely. |
| 815 | </p> |
| 816 | </div> |
| 817 | |
| 818 | |
| 819 | <!-- Integration of your initial form inputs ends here --> |
| 820 | |
| 821 | </div> |
| 822 | <div class="col-md-6"> |
| 823 | |
| 824 | |
| 825 | |
| 826 | <p class="message">For prompt examples, visit <a class="link" href="https://www.aiprm.com/prompts/">aiprm.com/prompts</a></p> |
| 827 | </div> |
| 828 | </div> |
| 829 | </form> |
| 830 | |
| 831 | |
| 832 | </tbody> |
| 833 | <?php |
| 834 | } |
| 835 | |
| 836 | |
| 837 | ?> |
| 838 |