Changeset 3478117
- Timestamp:
- 03/09/2026 12:47:16 PM (3 weeks ago)
- Location:
- draftseo-ai
- Files:
-
- 26 added
- 6 edited
-
tags/1.1.0 (added)
-
tags/1.1.0/LICENSE.txt (added)
-
tags/1.1.0/README.md (added)
-
tags/1.1.0/admin (added)
-
tags/1.1.0/admin/css (added)
-
tags/1.1.0/admin/css/admin-styles.css (added)
-
tags/1.1.0/admin/css/index.php (added)
-
tags/1.1.0/admin/index.php (added)
-
tags/1.1.0/admin/js (added)
-
tags/1.1.0/admin/js/admin-scripts.js (added)
-
tags/1.1.0/admin/js/index.php (added)
-
tags/1.1.0/admin/settings-page.php (added)
-
tags/1.1.0/draftseo-ai.php (added)
-
tags/1.1.0/includes (added)
-
tags/1.1.0/includes/class-api-client.php (added)
-
tags/1.1.0/includes/class-content-processor.php (added)
-
tags/1.1.0/includes/class-image-handler.php (added)
-
tags/1.1.0/includes/class-rest-api.php (added)
-
tags/1.1.0/includes/class-seo-handler.php (added)
-
tags/1.1.0/includes/class-settings.php (added)
-
tags/1.1.0/includes/index.php (added)
-
tags/1.1.0/index.php (added)
-
tags/1.1.0/languages (added)
-
tags/1.1.0/languages/index.php (added)
-
tags/1.1.0/readme.txt (added)
-
tags/1.1.0/uninstall.php (added)
-
trunk/README.md (modified) (14 diffs)
-
trunk/admin/js/admin-scripts.js (modified) (2 diffs)
-
trunk/admin/settings-page.php (modified) (1 diff)
-
trunk/includes/class-image-handler.php (modified) (4 diffs)
-
trunk/includes/class-rest-api.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
draftseo-ai/trunk/README.md
r3461555 r3478117 1 # DraftSEO. AI- WordPress Plugin2 3 Publish AI-generated blogs from DraftSEO. AIplatform directly to WordPress with automatic image import and SEO optimization.1 # DraftSEO.ai - WordPress Plugin 2 3 Publish AI-generated blogs from DraftSEO.ai platform directly to WordPress with automatic image import and SEO optimization. 4 4 5 5 ## Installation … … 8 8 9 9 1. Go to WordPress Admin → Plugins → Add New 10 2. Search for "DraftSEO. AI"10 2. Search for "DraftSEO.ai" 11 11 3. Click "Install Now" and then "Activate" 12 12 … … 23 23 2. Copy the `draftseo-ai` directory to `wp-content/plugins/` 24 24 3. Go to WordPress Admin → Plugins 25 4. Find "DraftSEO. AI" and click "Activate"25 4. Find "DraftSEO.ai" and click "Activate" 26 26 27 27 ## Configuration 28 28 29 29 1. Navigate to WordPress Admin → DraftSEO → Settings 30 2. Click "Connect with DraftSEO. AI" button31 - You'll be automatically redirected to DraftSEO. AI30 2. Click "Connect with DraftSEO.ai" button 31 - You'll be automatically redirected to DraftSEO.ai 32 32 - Sign in if you're not already logged in 33 33 - Connection completes automatically (OAuth-based, no API key needed) … … 36 36 37 37 ### Core Features 38 - ✅ One-click publishing from DraftSEO. AIto WordPress39 - ✅ Automatic image import from DraftSEO. AIto WordPress Media Library38 - ✅ One-click publishing from DraftSEO.ai to WordPress 39 - ✅ Automatic image import from DraftSEO.ai to WordPress Media Library 40 40 - ✅ SEO metadata preservation (keywords, meta descriptions) 41 41 - ✅ WordPress category sync … … 52 52 - Remaining images processed in background via WordPress Cron 53 53 54 All images are downloaded directly from DraftSEO. AIto your WordPress Media Library.54 All images are downloaded directly from DraftSEO.ai to your WordPress Media Library. 55 55 56 56 … … 59 59 ### Publishing a Blog 60 60 61 1. **Generate Blog on DraftSEO. AI**62 - Create your blog using DraftSEO. AIplatform61 1. **Generate Blog on DraftSEO.ai** 62 - Create your blog using DraftSEO.ai platform 63 63 - Configure SEO settings, categories, and tags 64 64 … … 72 72 ### API Endpoints 73 73 74 The plugin provides REST API endpoints for DraftSEO. AIintegration:74 The plugin provides REST API endpoints for DraftSEO.ai integration: 75 75 76 76 - `GET /wp-json/draftseo/v1/users` - Get WordPress users … … 80 80 - `POST /wp-json/draftseo/v1/update` - Update/republish existing post 81 81 - `GET|POST /wp-json/draftseo/v1/test-connection` - Test API connection 82 - `POST /wp-json/draftseo/v1/remote-disconnect` - Clear connection (called by DraftSEO. AI)82 - `POST /wp-json/draftseo/v1/remote-disconnect` - Clear connection (called by DraftSEO.ai) 83 83 84 84 All endpoints require Bearer token authentication using your API key. … … 90 90 - **MySQL**: 5.6 or higher 91 91 - **WordPress Cron**: Enabled (for background image processing) 92 - **DraftSEO. AIAccount**: Active subscription92 - **DraftSEO.ai Account**: Active subscription 93 93 94 94 ## File Structure … … 103 103 │ └── settings-page.php # Settings page template 104 104 ├── includes/ # Core plugin classes 105 │ ├── class-api-client.php # DraftSEO. AIAPI communication105 │ ├── class-api-client.php # DraftSEO.ai API communication 106 106 │ ├── class-content-processor.php # HTML cleanup and formatting 107 107 │ ├── class-image-handler.php # Image import strategies … … 169 169 ## Credits 170 170 171 Developed by [DraftSEO. AI](https://draftseo.ai)171 Developed by [DraftSEO.ai](https://draftseo.ai) 172 172 173 173 ## Changelog 174 175 ### 1.1.0 176 177 - **Image Replacement** — When a new image is generated and republished from DraftSEO.ai, replace the image inside the blog automatically. 178 - **Assets Cleanup** — The old now-unused image is auto-deleted from the Media folder in Wordpress. Saves storage space, cleans up unused media assets. 174 179 175 180 ### 1.0.5 … … 232 237 - **`rest_ensure_response()`** — All success responses now use `rest_ensure_response()` per WordPress REST API Handbook, allowing WordPress filters to process responses through the standard pipeline 233 238 - **Input validation arguments** — `/publish` and `/update` routes now define `args` with `validate_callback` and `sanitize_callback` for server-side input validation before the handler runs 234 - **Remote disconnect endpoint** — `/remote-disconnect` properly clears stored API key and connection settings when triggered from DraftSEO. AIplatform235 - **Bidirectional disconnect sync** — When a user disconnects from DraftSEO. AI, the platform now calls the plugin's `/remote-disconnect` endpoint before local deletion, keeping both sides in sync239 - **Remote disconnect endpoint** — `/remote-disconnect` properly clears stored API key and connection settings when triggered from DraftSEO.ai platform 240 - **Bidirectional disconnect sync** — When a user disconnects from DraftSEO.ai, the platform now calls the plugin's `/remote-disconnect` endpoint before local deletion, keeping both sides in sync 236 241 237 242 #### Stability & Error Handling (6 improvements) … … 268 273 269 274 #### Image Handling 270 - Direct download from DraftSEO. AIto WordPress Media Library275 - Direct download from DraftSEO.ai to WordPress Media Library 271 276 - Alt text and heading text metadata preserved 272 277 - Featured image setting with URL replacement in post content (Nebius URLs → local WordPress URLs) … … 274 279 275 280 ### 0.2.0 (Initial Beta) 276 - One-click blog publishing from DraftSEO. AI277 - Automatic image import from DraftSEO. AI281 - One-click blog publishing from DraftSEO.ai 282 - Automatic image import from DraftSEO.ai 278 283 - SEO metadata transfer 279 284 - WordPress category sync -
draftseo-ai/trunk/admin/js/admin-scripts.js
r3423447 r3478117 1 1 /** 2 * Admin JavaScript for DraftSEO. AI2 * Admin JavaScript for DraftSEO.ai 3 3 * 4 4 * @package DraftSEO_Publisher … … 12 12 13 13 /** 14 * Disconnect from DraftSEO. AI14 * Disconnect from DraftSEO.ai 15 15 */ 16 16 $('#disconnect-draftseo').on('click', function(e) { 17 17 e.preventDefault(); 18 18 19 if (!confirm('Are you sure you want to disconnect from DraftSEO. AI? You will need to reconnect to publish blogs.')) {19 if (!confirm('Are you sure you want to disconnect from DraftSEO.ai? You will need to reconnect to publish blogs.')) { 20 20 return; 21 21 } -
draftseo-ai/trunk/admin/settings-page.php
r3423447 r3478117 152 152 <ol style="margin: 0; padding-left: 20px; color: #856404; font-size: 13px; line-height: 1.6;"> 153 153 <li><?php esc_html_e('Log in to your DraftSEO.AI account in another browser tab first', 'draftseo-ai'); ?></li> 154 <li><?php esc_html_e('Make sure the admin email of this WordPress site matches your DraftSEO.AI account email', 'draftseo-ai'); ?></li>155 154 <li><?php esc_html_e('Then click the "Connect with DraftSEO.AI" button below', 'draftseo-ai'); ?></li> 156 155 </ol> -
draftseo-ai/trunk/includes/class-image-handler.php
r3423447 r3478117 99 99 } 100 100 101 // Store URL hash for future lookup (enables deletion on republish) 102 self::store_image_hash($attachment_id, $image['url']); 103 101 104 // Store URL mapping for replacement 102 105 $wp_url = wp_get_attachment_url($attachment_id); … … 156 159 update_post_meta($featured_id, 'draftseo_heading_text', sanitize_text_field($featured_image['headingText'])); 157 160 } 161 162 // Store URL hash for future lookup (enables deletion on republish) 163 self::store_image_hash($featured_id, $featured_image['url']); 158 164 159 165 // Store URL mapping … … 235 241 update_post_meta($attachment_id, 'draftseo_heading_text', sanitize_text_field($image['headingText'])); 236 242 } 243 244 // Store URL hash for future lookup (enables deletion on republish) 245 self::store_image_hash($attachment_id, $image['url']); 237 246 238 247 // Store URL mapping … … 308 317 309 318 /** 319 * Delete WordPress media attachments by their original CDN source URLs 320 * 321 * Finds attachments tagged with draftseo_original_url and permanently deletes them. 322 * Called during republish to clean up old images replaced by regeneration. 323 * 324 * @param array $urls Array of CDN URLs to look up and delete 325 */ 326 public static function delete_images_by_urls($urls) { 327 if (empty($urls) || !is_array($urls)) { 328 return; 329 } 330 331 global $wpdb; 332 333 foreach ($urls as $url) { 334 if (empty($url)) { 335 continue; 336 } 337 338 $url = esc_url_raw($url); 339 340 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching 341 $attachment_id = $wpdb->get_var( 342 $wpdb->prepare( 343 "SELECT post_id FROM {$wpdb->postmeta} 344 WHERE meta_key = 'draftseo_original_url' 345 AND meta_value = %s 346 LIMIT 1", 347 $url 348 ) 349 ); 350 351 if ($attachment_id) { 352 // Delete attachment and its files from disk 353 wp_delete_attachment(intval($attachment_id), true); 354 355 // Clear the URL hash cache entry 356 $cache_key = 'draftseo_img_' . md5($url); 357 wp_cache_delete($cache_key, 'draftseo_images'); 358 } 359 } 360 } 361 362 /** 310 363 * Store image URL hash for duplicate detection 311 364 * -
draftseo-ai/trunk/includes/class-rest-api.php
r3461526 r3478117 498 498 } 499 499 500 // Delete replaced images from media library before importing new ones 501 if (isset($params['images_to_delete']) && is_array($params['images_to_delete']) && !empty($params['images_to_delete'])) { 502 DraftSEO_Image_Handler::delete_images_by_urls($params['images_to_delete']); 503 } 504 500 505 // Handle images if provided 501 506 $images_imported = 0; -
draftseo-ai/trunk/readme.txt
r3461555 r3478117 106 106 107 107 == Changelog == 108 109 = 1.1.0 = 110 111 When a new image is generated and republished from DraftSEO.ai, the old now-unused image is auto-deleted from the Media folder in Wordpress. Saves storage space, cleans up unused media assets. 108 112 109 113 = 1.0.5 = … … 227 231 == Upgrade Notice == 228 232 233 = 1.1.0 = 234 When a new image is generated and republished from DraftSEO.ai, the old now-unused image is auto-deleted from the Media folder in Wordpress. Saves storage space, cleans up unused media assets. 235 236 = 1.0.5 = 237 Youtube Player styles for blogs. 238 229 239 = 1.0.4 = 230 240 Fixes YouTube videos not rendering on WordPress by correcting pipeline order and preserving Gutenberg block markers. Also fixes headings appearing as raw markdown after images.
Note: See TracChangeset
for help on using the changeset viewer.