| 1 |
<?php |
| 2 |
/** |
| 3 |
* Stock Photo (Image Banks) Provider Settings |
| 4 |
* |
| 5 |
* Renders configuration for free stock image banks: |
| 6 |
* Pixabay, Pexels, Unsplash, Openverse. |
| 7 |
* |
| 8 |
* @package BotWriter |
| 9 |
*/ |
| 10 |
|
| 11 |
if (!defined('ABSPATH')) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Render Stock Photo settings |
| 17 |
* Called when 'stockphoto' is selected as image_provider |
| 18 |
*/ |
| 19 |
function botwriter_render_stockphoto_settings($settings, $is_active) { |
| 20 |
$preferred = get_option('botwriter_stockphoto_preferred', 'random'); |
| 21 |
$selection = get_option('botwriter_stockphoto_selection', 'random_top10'); |
| 22 |
$attribution = get_option('botwriter_stockphoto_attribution', 'caption'); |
| 23 |
?> |
| 24 |
<div class="provider-config-section stockphoto-provider-section"> |
| 25 |
|
| 26 |
<!-- Info banner --> |
| 27 |
<div class="notice notice-success inline bw-notice-info-inline" style="margin-bottom: 20px;"> |
| 28 |
<p> |
| 29 |
<span class="dashicons dashicons-camera bw-icon-info"></span> |
| 30 |
<strong><?php esc_html_e('Free Stock Images', 'botwriter'); ?></strong> |
| 31 |
</p> |
| 32 |
<p> |
| 33 |
<?php esc_html_e('Uses free image banks instead of AI generation. No API keys needed — images are sourced from Pixabay, Pexels, Unsplash, and Openverse with automatic fallback.', 'botwriter'); ?> |
| 34 |
</p> |
| 35 |
</div> |
| 36 |
|
| 37 |
<div class="settings-grid-2col"> |
| 38 |
<!-- Preferred Bank --> |
| 39 |
<div class="setting-card"> |
| 40 |
<div class="form-row"> |
| 41 |
<label><span class="dashicons dashicons-images-alt2"></span> <?php esc_html_e('Preferred Image Bank:', 'botwriter'); ?></label> |
| 42 |
<select name="botwriter_stockphoto_preferred" class="form-select botwriter-autosave" id="stockphoto_preferred"> |
| 43 |
<option value="random" <?php selected($preferred, 'random'); ?>>🎲 <?php esc_html_e('Random (auto rotate)', 'botwriter'); ?></option> |
| 44 |
<option value="pixabay" <?php selected($preferred, 'pixabay'); ?>>📷 Pixabay</option> |
| 45 |
<option value="pexels" <?php selected($preferred, 'pexels'); ?>>📸 Pexels</option> |
| 46 |
<option value="unsplash" <?php selected($preferred, 'unsplash'); ?>>🏞️ Unsplash</option> |
| 47 |
<option value="openverse" <?php selected($preferred, 'openverse'); ?>>🌐 Openverse (Creative Commons)</option> |
| 48 |
</select> |
| 49 |
</div> |
| 50 |
<p class="description"> |
| 51 |
<?php esc_html_e('The system will search this bank first. If no results are found, it automatically tries the other banks.', 'botwriter'); ?> |
| 52 |
</p> |
| 53 |
<div class="bank-details" style="margin-top: 12px;"> |
| 54 |
<table class="specs-table"> |
| 55 |
<tr><td><strong>Random</strong></td><td><?php esc_html_e('Randomizes bank order on each search across all providers', 'botwriter'); ?></td></tr> |
| 56 |
<tr><td><strong>Pixabay</strong></td><td><?php esc_html_e('Large library, no attribution required', 'botwriter'); ?></td></tr> |
| 57 |
<tr><td><strong>Pexels</strong></td><td><?php esc_html_e('High quality photos, no attribution required', 'botwriter'); ?></td></tr> |
| 58 |
<tr><td><strong>Unsplash</strong></td><td><?php esc_html_e('Professional photos, no attribution required', 'botwriter'); ?></td></tr> |
| 59 |
<tr><td><strong>Openverse</strong></td><td><?php esc_html_e('CC licensed, attribution may be required', 'botwriter'); ?></td></tr> |
| 60 |
</table> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
|
| 64 |
<!-- Selection Mode --> |
| 65 |
<div class="setting-card"> |
| 66 |
<div class="form-row"> |
| 67 |
<label><span class="dashicons dashicons-randomize"></span> <?php esc_html_e('Image Selection:', 'botwriter'); ?></label> |
| 68 |
<select name="botwriter_stockphoto_selection" class="form-select botwriter-autosave" id="stockphoto_selection"> |
| 69 |
<option value="first" <?php selected($selection, 'first'); ?>>🎯 <?php esc_html_e('Most Relevant (first result)', 'botwriter'); ?></option> |
| 70 |
<option value="random_top5" <?php selected($selection, 'random_top5'); ?>>🎲 <?php esc_html_e('Random from Top 5', 'botwriter'); ?></option> |
| 71 |
<option value="random_top10" <?php selected($selection, 'random_top10'); ?>>🎲 <?php esc_html_e('Random from Top 10 (recommended)', 'botwriter'); ?></option> |
| 72 |
</select> |
| 73 |
</div> |
| 74 |
<p class="description"> |
| 75 |
<?php esc_html_e('How to pick an image from the search results. Random selection adds variety across posts with similar topics.', 'botwriter'); ?> |
| 76 |
</p> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
|
| 80 |
<!-- Attribution Settings --> |
| 81 |
<div class="settings-grid-2col" style="margin-top: 20px;"> |
| 82 |
<div class="setting-card"> |
| 83 |
<div class="form-row"> |
| 84 |
<label><span class="dashicons dashicons-editor-quote"></span> <?php esc_html_e('Image Attribution:', 'botwriter'); ?></label> |
| 85 |
<select name="botwriter_stockphoto_attribution" class="form-select botwriter-autosave" id="stockphoto_attribution"> |
| 86 |
<option value="caption" <?php selected($attribution, 'caption'); ?>>📝 <?php esc_html_e('Image Caption (recommended)', 'botwriter'); ?></option> |
| 87 |
<option value="content_footer" <?php selected($attribution, 'content_footer'); ?>>📄 <?php esc_html_e('Post Content Footer', 'botwriter'); ?></option> |
| 88 |
<option value="disabled" <?php selected($attribution, 'disabled'); ?>>🚫 <?php esc_html_e('Disabled (no attribution)', 'botwriter'); ?></option> |
| 89 |
</select> |
| 90 |
</div> |
| 91 |
<p class="description"> |
| 92 |
<?php esc_html_e('Where to display photographer credit. Caption stores it in the image metadata. Footer appends it to the post content.', 'botwriter'); ?> |
| 93 |
</p> |
| 94 |
</div> |
| 95 |
|
| 96 |
<div class="setting-card"> |
| 97 |
<div class="notice notice-warning inline bw-notice-info-inline" style="margin: 0;"> |
| 98 |
<p> |
| 99 |
<span class="dashicons dashicons-warning"></span> |
| 100 |
<strong><?php esc_html_e('Attribution Notice', 'botwriter'); ?></strong> |
| 101 |
</p> |
| 102 |
<p> |
| 103 |
<?php esc_html_e('Pixabay, Pexels, and Unsplash do NOT require attribution. However, Openverse images may use CC-BY/CC-BY-SA licenses that legally require credit. Disabling attribution may carry legal risk for Openverse images.', 'botwriter'); ?> |
| 104 |
</p> |
| 105 |
</div> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
|
| 109 |
<!-- How it works --> |
| 110 |
<div class="info-tip highlight-tip" style="margin-top: 20px;"> |
| 111 |
<span class="dashicons dashicons-lightbulb"></span> |
| 112 |
<div> |
| 113 |
<p><strong><?php esc_html_e('💡 How it works:', 'botwriter'); ?></strong></p> |
| 114 |
<p><?php esc_html_e('The AI generates a short English keyword phrase describing the article\'s ideal image (e.g., "sunset beach tropical palm trees"). This phrase is used to search the image bank. The system automatically falls back to other banks if no results are found.', 'botwriter'); ?></p> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
|
| 118 |
<!-- Cost comparison --> |
| 119 |
<div class="cost-comparison" style="margin-top: 20px;"> |
| 120 |
<h5><span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Cost per Image', 'botwriter'); ?></h5> |
| 121 |
<div class="cost-cards"> |
| 122 |
<div class="cost-card cheapest"> |
| 123 |
<span class="provider">Pixabay</span> |
| 124 |
<span class="cost">$0.00</span> |
| 125 |
<span class="badge"><?php esc_html_e('FREE', 'botwriter'); ?></span> |
| 126 |
</div> |
| 127 |
<div class="cost-card cheapest"> |
| 128 |
<span class="provider">Pexels</span> |
| 129 |
<span class="cost">$0.00</span> |
| 130 |
<span class="badge"><?php esc_html_e('FREE', 'botwriter'); ?></span> |
| 131 |
</div> |
| 132 |
<div class="cost-card cheapest"> |
| 133 |
<span class="provider">Unsplash</span> |
| 134 |
<span class="cost">$0.00</span> |
| 135 |
<span class="badge"><?php esc_html_e('FREE', 'botwriter'); ?></span> |
| 136 |
</div> |
| 137 |
<div class="cost-card cheapest"> |
| 138 |
<span class="provider">Openverse</span> |
| 139 |
<span class="cost">$0.00</span> |
| 140 |
<span class="badge"><?php esc_html_e('FREE', 'botwriter'); ?></span> |
| 141 |
</div> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
|
| 145 |
</div> |
| 146 |
<?php |
| 147 |
} |
| 148 |
|