Changeset 3448007
- Timestamp:
- 01/27/2026 03:44:04 PM (2 months ago)
- Location:
- outrank
- Files:
-
- 19 added
- 4 edited
-
tags/1.0.4 (added)
-
tags/1.0.4/css (added)
-
tags/1.0.4/css/article.css (added)
-
tags/1.0.4/css/home.css (added)
-
tags/1.0.4/css/manage.css (added)
-
tags/1.0.4/images (added)
-
tags/1.0.4/images/icon.svg (added)
-
tags/1.0.4/includes (added)
-
tags/1.0.4/includes/image-functions.php (added)
-
tags/1.0.4/index.php (added)
-
tags/1.0.4/libs (added)
-
tags/1.0.4/libs/api.php (added)
-
tags/1.0.4/outrank.php (added)
-
tags/1.0.4/pages (added)
-
tags/1.0.4/pages/home.php (added)
-
tags/1.0.4/pages/manage.php (added)
-
tags/1.0.4/readme.txt (added)
-
tags/1.0.4/script (added)
-
tags/1.0.4/script/manage.js (added)
-
trunk/includes/image-functions.php (modified) (2 diffs)
-
trunk/libs/api.php (modified) (2 diffs)
-
trunk/outrank.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
outrank/trunk/includes/image-functions.php
r3337904 r3448007 5 5 if (empty($image_url)) return false; 6 6 7 $filename = basename($image_url); 8 $image_data = file_get_contents($image_url); 7 $filename = basename(wp_parse_url($image_url, PHP_URL_PATH)); 8 if (empty($filename)) { 9 $filename = 'image-' . time() . '.jpg'; 10 } 11 12 // Try file_get_contents first 13 $image_data = @file_get_contents($image_url); 14 15 // Fallback to wp_remote_get if file_get_contents fails 16 if (!$image_data) { 17 $response = wp_remote_get($image_url, [ 18 'timeout' => 30, 19 'sslverify' => false, 20 ]); 21 22 if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) { 23 $image_data = wp_remote_retrieve_body($response); 24 } 25 } 26 9 27 if (!$image_data) return false; 10 28 11 29 $upload_dir = wp_upload_dir(); 30 $filename = wp_unique_filename($upload_dir['path'], $filename); 12 31 $filepath = $upload_dir['path'] . '/' . $filename; 13 file_put_contents($filepath, $image_data); 32 33 if (!file_put_contents($filepath, $image_data)) return false; 14 34 15 35 $filetype = wp_check_filetype($filename, null); 36 $mime_type = $filetype['type'] ?: 'image/jpeg'; 16 37 17 38 $attachment = [ 18 'post_mime_type' => $ filetype['type'],19 'post_title' => sanitize_file_name( $filename),39 'post_mime_type' => $mime_type, 40 'post_title' => sanitize_file_name(pathinfo($filename, PATHINFO_FILENAME)), 20 41 'post_content' => '', 21 42 'post_status' => 'inherit', … … 23 44 24 45 $attach_id = wp_insert_attachment($attachment, $filepath, $post_id); 46 if (is_wp_error($attach_id) || !$attach_id) return false; 47 25 48 require_once ABSPATH . 'wp-admin/includes/image.php'; 26 49 $attach_data = wp_generate_attachment_metadata($attach_id, $filepath); -
outrank/trunk/libs/api.php
r3397401 r3448007 201 201 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery 202 202 $inserted = $wpdb->insert($table_name, [ 203 'image' => $imageId ,204 'slug' => $final_slug, // Use unique slug203 'image' => $imageId ? (string) $imageId : '', 204 'slug' => $final_slug, 205 205 'title' => $title, 206 206 'meta_description' => sanitize_text_field($params['meta_description'] ?? ''), … … 210 210 211 211 if (!$inserted) { 212 // If custom table insert fails, we should probably delete the post to maintain consistency 212 // If custom table insert fails, delete the post to maintain consistency 213 $db_error = $wpdb->last_error; 213 214 wp_delete_post($post_id, true); 214 return new WP_REST_Response(['error' => 'Failed to insert into tracking table'], 500); 215 return new WP_REST_Response([ 216 'error' => 'Failed to insert into tracking table' . ( $db_error ? ': ' . $db_error : '' ) 217 ], 500); 215 218 } 216 219 -
outrank/trunk/outrank.php
r3397401 r3448007 6 6 * Plugin URI: https://outrank.so 7 7 * Description: Get traffic and outrank competitors with automatic SEO-optimized content generation published to your WordPress site. 8 * Version: 1.0. 38 * Version: 1.0.4 9 9 * Author: Outrank 10 10 * License: GPLv2 or later -
outrank/trunk/readme.txt
r3397401 r3448007 5 5 Tested up to: 6.8 6 6 Requires PHP: 8.0 7 Stable tag: 1.0. 37 Stable tag: 1.0.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 74 74 == Changelog == 75 75 76 = 1.0.4 = 77 * Improved image downloading reliability across different server configurations 78 * Fixed compatibility issues with strict database settings 79 * Better error messages when troubleshooting sync issues 80 * Improved handling of image filenames and file types 81 76 82 = 1.0.3 = 77 83 * Add custom duplicate slugs handling
Note: See TracChangeset
for help on using the changeset viewer.