Changeset 3325924
- Timestamp:
- 07/10/2025 08:58:28 PM (9 months ago)
- Location:
- featured-image-from-url/trunk
- Files:
-
- 17 edited
-
admin/api.php (modified) (7 diffs)
-
admin/column.php (modified) (1 diff)
-
admin/dimensions.php (modified) (1 diff)
-
admin/html/js/meta-box.js (modified) (2 diffs)
-
admin/html/meta-box.html (modified) (3 diffs)
-
admin/html/troubleshooting.html (modified) (3 diffs)
-
admin/languages.php (modified) (1 diff)
-
admin/menu.php (modified) (2 diffs)
-
admin/meta-box.php (modified) (3 diffs)
-
admin/widgets.php (modified) (6 diffs)
-
featured-image-from-url.php (modified) (2 diffs)
-
gravity-forms/includes/class-fifu-image-gf-field.php (modified) (1 diff)
-
includes/jetpack.php (modified) (1 diff)
-
includes/speedup.php (modified) (1 diff)
-
includes/thumbnail.php (modified) (8 diffs)
-
includes/util.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
featured-image-from-url/trunk/admin/api.php
r3248885 r3325924 192 192 function fifu_get_ip() { 193 193 foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { 194 if ( array_key_exists($key, $_SERVER) === true) {194 if (isset($_SERVER[$key]) === true) { 195 195 foreach (explode(',', $_SERVER[$key]) as $ip) { 196 196 $ip = trim($ip); … … 200 200 } 201 201 } 202 return $_SERVER['REMOTE_ADDR'];202 return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; 203 203 } 204 204 … … 207 207 return json_decode(FIFU_NO_CREDENTIALS); 208 208 209 $images = $request['selected'];209 $images = isset($request['selected']) ? $request['selected'] : []; 210 210 211 211 return fifu_create_thumbnails_list($images, false); … … 231 231 if (!$cron) { 232 232 // manual 233 $post_id = $image[0];234 $url = $image[1];235 $meta_key = $image[2];236 $meta_id = $image[3];237 $is_category = $image[4] == 1;238 $video_url = $image[5];233 $post_id = isset($image[0]) ? $image[0] : null; 234 $url = isset($image[1]) ? $image[1] : null; 235 $meta_key = isset($image[2]) ? $image[2] : null; 236 $meta_id = isset($image[3]) ? $image[3] : null; 237 $is_category = isset($image[4]) ? ($image[4] == 1) : false; 238 $video_url = isset($image[5]) ? $image[5] : null; 239 239 } else { 240 240 // upload auto … … 445 445 446 446 $rows = array(); 447 $images = $request['selected'];447 $images = isset($request['selected']) ? $request['selected'] : []; 448 448 $total = count($images); 449 449 $url_sign = ''; 450 450 foreach ($images as $image) { 451 $storage_id = $image['storage_id'];451 $storage_id = isset($image['storage_id']) ? $image['storage_id'] : null; 452 452 if (!$storage_id) 453 453 continue; … … 843 843 844 844 function fifu_api_list_all_fifu(WP_REST_Request $request) { 845 $page = (int) $request['page'];846 $type = $request['type'];847 $keyword = $request['keyword'];845 $page = (int) (isset($request['page']) ? $request['page'] : 0); 846 $type = isset($request['type']) ? $request['type'] : null; 847 $keyword = isset($request['keyword']) ? $request['keyword'] : null; 848 848 $urls = fifu_db_get_all_urls($page, $type, $keyword); 849 849 return $urls; … … 854 854 return null; 855 855 856 $page = (int) $request['page'];857 $type = $request['type'];858 $keyword = $request['keyword'];856 $page = (int) (isset($request['page']) ? $request['page'] : 0); 857 $type = isset($request['type']) ? $request['type'] : null; 858 $keyword = isset($request['keyword']) ? $request['keyword'] : null; 859 859 return fifu_db_get_posts_with_internal_featured_image($page, $type, $keyword); 860 860 } -
featured-image-from-url/trunk/admin/column.php
r3294304 r3325924 256 256 function fifu_optimized_column_image($url, $att_id) { 257 257 if (fifu_is_from_speedup($url)) { 258 $url = explode('?', $url)[0]; 258 $aux = explode('?', $url); 259 $url = isset($aux[0]) ? $aux[0] : $url; 259 260 return fifu_speedup_get_signed_url($url, 128, 128, null, null, false); 260 261 } -
featured-image-from-url/trunk/admin/dimensions.php
r3322839 r3325924 25 25 "https://img.youtube.com", 26 26 "https://cdn.diariodeavisos.com", 27 "https://i.guim.co.uk", 27 28 ]); 28 29 -
featured-image-from-url/trunk/admin/html/js/meta-box.js
r3115860 r3325924 112 112 var image = new Image(); 113 113 jQuery(image).attr('onload', 'fifu_store_sizes(this);'); 114 image.onerror = function () { 115 // Set the background to the fallback error image 116 jQuery("#fifu_image").css('background-image', "url('https://storage.googleapis.com/featuredimagefromurl/image-not-found.jpg')"); 117 }; 114 118 jQuery(image).attr('src', url); 115 119 } … … 123 127 jQuery("#fifu_image").on('click', function (evt) { 124 128 evt.stopImmediatePropagation(); 129 130 // Do not open lightbox if the error image is set as background 131 const errorImg = "https://storage.googleapis.com/featuredimagefromurl/image-not-found.jpg"; 132 const bg = jQuery("#fifu_image").css('background-image'); 133 if (bg && bg.includes(errorImg)) { 134 return; 135 } 136 125 137 let url = fifu_convert(jQuery("#fifu_input_url").val()); 126 138 let adjustedUrl = fifu_cdn_adjust(url); -
featured-image-from-url/trunk/admin/html/meta-box.html
r3294304 r3325924 10 10 name="fifu_input_alt" 11 11 placeholder="<?php $fifu['common']['alt']() ?>" 12 value="<?php echo $alt; ?>"12 value="<?php echo esc_attr($alt); ?>" 13 13 style="<?php echo $width ?>;font-size:13px;margin:0px 0px 0px 2px" /> 14 14 </td> … … 25 25 <div id="fifu_image" 26 26 style="<?php echo $height, $show_image ?> 27 background:url('<?php echo $url; ?>') no-repeat center center;27 background:url('<?php echo esc_url($url); ?>') no-repeat center center; 28 28 background-size:cover; 29 29 cursor:zoom-in; … … 39 39 name="fifu_input_url" 40 40 placeholder="<?php $fifu['image']['keywords']() ?>" 41 value="<?php echo $url; ?>"41 value="<?php echo esc_url($url); ?>" 42 42 style="<?php echo $width ?>;font-size:13px;" /> 43 43 </td> -
featured-image-from-url/trunk/admin/html/troubleshooting.html
r3307677 r3325924 70 70 <div class="greybox" style="position: relative; top: -10px;"> 71 71 WP RSS Aggregator feed items have no featured image:<br> 72 1) Enable 'FIFU → Settings → Automatic → Auto set featured media from post content → auto set featured media from post content' before fetching the feed source.<br>72 1) Enable 'FIFU → Settings → Automatic → Auto set featured media from post content → Auto set → auto set featured media from post content' before fetching the feed source.<br> 73 73 </div> 74 74 </div> … … 879 879 Using a video from post content as featured video:<br> 880 880 1) enable "FIFU Settings → Video → Featured Video"<br> 881 2) enable "FIFU Settings → Automatic → Auto set featured media from post content → use the found image/video as featured image/video"<br>882 3) enable "FIFU Settings → Automatic → Auto set featured media from post content → hide the image/video from content"<br>881 2) enable "FIFU Settings → Automatic → Auto set featured media from post content → Auto set → auto set featured media from post content"<br> 882 3) select "FIFU Settings → Automatic → Auto set featured media from post content → Media type filter → Video"<br> 883 883 4) access the campaign and uncheck all options in "Images" box<br> 884 884 5) click on "Run campaign" button<br> … … 1236 1236 <div class="greybox" style="position: relative; top: -10px"> 1237 1237 Setting featured video automatically:<br> 1238 1) access"FIFU Settings → Automatic → Auto set featured media from post content";<br>1239 2) enable " use the found image/video as featured image";<br>1240 3) enable "hide the image/video from content";<br>1241 4) access"Zapier → Make a Zap", select YouTube as the first app and configure as you want;<br>1238 1) go to "FIFU Settings → Automatic → Auto set featured media from post content";<br> 1239 2) enable "Auto set → auto set featured media from post content";<br> 1240 3) select "Media type filter → Video";<br> 1241 4) go to "Zapier → Make a Zap", select YouTube as the first app and configure as you want;<br> 1242 1242 5) select WordPress as the second app;<br> 1243 1243 6) click on "Choose Action Event", select "Create Post" and "Continue";<br> -
featured-image-from-url/trunk/admin/languages.php
r3217355 r3325924 267 267 // Dynamically handle locales not in the mapping 268 268 $parts = explode('_', $locale); 269 return $parts[0]; // Return the first part of the locale (e.g., "es" from "es_ES")269 return !empty($parts) ? $parts[0] : $locale; // Return the first part of the locale (e.g., "es" from "es_ES") 270 270 } -
featured-image-from-url/trunk/admin/menu.php
r3315511 r3325924 12 12 $fifu = fifu_get_strings_settings(); 13 13 14 if ( strpos($_SERVER['REQUEST_URI'], 'featured-image-from-url') !== false || strpos($_SERVER['REQUEST_URI'], 'fifu') !== false) {14 if (isset($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], 'featured-image-from-url') !== false || strpos($_SERVER['REQUEST_URI'], 'fifu') !== false)) { 15 15 wp_enqueue_script('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/js/all.min.js'); 16 16 wp_enqueue_style('jquery-ui-style1', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css'); … … 276 276 $arrDefaultType = array('fifu_default_cpt'); 277 277 $arrOn = array('fifu_wc_zoom', 'fifu_wc_lbox'); 278 $arrOnNo = array('fifu_fake' , 'fifu_photon');278 $arrOnNo = array('fifu_fake'); 279 279 $arrOffNo = array('fifu_data_clean', 'fifu_run_delete_all', 'fifu_reset'); 280 280 -
featured-image-from-url/trunk/admin/meta-box.php
r3294304 r3325924 96 96 $align = 'text-align:left;'; 97 97 98 $url = get_post_meta($post->ID, 'fifu_image_url', true);99 $alt = get_post_meta($post->ID, 'fifu_image_alt', true);98 $url = esc_url(get_post_meta($post->ID, 'fifu_image_url', true)); 99 $alt = esc_attr(get_post_meta($post->ID, 'fifu_image_alt', true)); 100 100 101 101 if ($url) { … … 387 387 function fifu_dokan_product_edit_after_product_tags($post, $post_id) { 388 388 $fifu = fifu_get_strings_dokan(); 389 $url = get_post_meta($post_id, 'fifu_image_url', true);389 $url = esc_url(get_post_meta($post_id, 'fifu_image_url', true)); 390 390 ?> 391 391 … … 419 419 function fifu_mvx_product_manager_right_panel_after($post_id) { 420 420 $fifu = fifu_get_strings_dokan(); 421 $url = get_post_meta($post_id, 'fifu_image_url', true);421 $url = esc_url(get_post_meta($post_id, 'fifu_image_url', true)); 422 422 ?> 423 423 -
featured-image-from-url/trunk/admin/widgets.php
r3048639 r3325924 13 13 14 14 public function widget($args, $instance) { 15 echo $args['before_widget']; 16 echo $args['after_widget']; 15 if (isset($args['before_widget'])) { 16 echo $args['before_widget']; 17 } 18 if (isset($args['after_widget'])) { 19 echo $args['after_widget']; 20 } 17 21 } 18 22 … … 26 30 return $instance; 27 31 } 28 29 32 } 30 33 … … 42 45 public function widget($args, $instance) { 43 46 extract($args); 44 echo $args['before_widget']; 45 echo $args['after_widget']; 47 if (isset($args['before_widget'])) { 48 echo $args['before_widget']; 49 } 50 if (isset($args['after_widget'])) { 51 echo $args['after_widget']; 52 } 46 53 } 47 54 … … 57 64 return $instance; 58 65 } 59 60 66 } 61 67 … … 72 78 73 79 public function widget($args, $instance) { 74 echo $args['before_widget']; 75 echo $args['after_widget']; 80 if (isset($args['before_widget'])) { 81 echo $args['before_widget']; 82 } 83 if (isset($args['after_widget'])) { 84 echo $args['after_widget']; 85 } 76 86 } 77 87 … … 86 96 return $instance; 87 97 } 88 89 98 } 90 99 -
featured-image-from-url/trunk/featured-image-from-url.php
r3322839 r3325924 5 5 * Plugin URI: https://fifu.app/ 6 6 * Description: Use a remote image or video as featured image of a post or WooCommerce product. 7 * Version: 5. 1.97 * Version: 5.2.0 8 8 * Author: fifu.app 9 9 * Author URI: https://fifu.app/ … … 132 132 133 133 function fifu_uninstall() { 134 // buddyboss app135 if ( isset($_REQUEST['page']) && strpos($_REQUEST['page'], 'bbapp') !== false)134 global $pagenow; 135 if ($pagenow !== 'plugins.php') 136 136 return; 137 137 -
featured-image-from-url/trunk/gravity-forms/includes/class-fifu-image-gf-field.php
r2926179 r3325924 133 133 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead) { 134 134 if ($this->phoneFormat == 'standard' && preg_match('/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/', $value, $matches)) { 135 $value = sprintf('(%s) %s-%s', $matches[1], $matches[2], $matches[3]);135 $value = sprintf('(%s) %s-%s', isset($matches[1]) ? $matches[1] : '', isset($matches[2]) ? $matches[2] : '', isset($matches[3]) ? $matches[3] : ''); 136 136 } 137 137 -
featured-image-from-url/trunk/includes/jetpack.php
r3307677 r3325924 93 93 return true; 94 94 95 $blocklist = array('localhost', 'amazon-adsystem.com', 'sapo.io', 'i .guim.co.uk', 'image.influenster.com', 'api.screenshotmachine.com', 'img.brownsfashion.com', 'fbcdn.net', 'nitrocdn.com', 'brightspotcdn.com', 'realtysouth.com', 'tiktokcdn.com', 'fdcdn.akamaized.net', 'blockchainstock.azureedge.net', 'aa.com.tr', 'cdn.discordapp.com', 'download.schneider-electric.com', 'images.twojjs.com', 'preview.redd.it', 'external-preview.redd.it', 'i.redd.it', 'cdn.fbsbx.com', 'canva.com', 'cdn.fifu.app', 'cloud.fifu.app', 'images.placeholders.dev');95 $blocklist = array('localhost', 'amazon-adsystem.com', 'sapo.io', 'image.influenster.com', 'api.screenshotmachine.com', 'img.brownsfashion.com', 'fbcdn.net', 'nitrocdn.com', 'brightspotcdn.com', 'realtysouth.com', 'tiktokcdn.com', 'fdcdn.akamaized.net', 'blockchainstock.azureedge.net', 'aa.com.tr', 'cdn.discordapp.com', 'download.schneider-electric.com', 'images.twojjs.com', 'preview.redd.it', 'external-preview.redd.it', 'i.redd.it', 'cdn.fbsbx.com', 'canva.com', 'cdn.fifu.app', 'cloud.fifu.app', 'images.placeholders.dev'); 96 96 foreach ($blocklist as $domain) { 97 97 if (strpos($url, $domain) !== false) -
featured-image-from-url/trunk/includes/speedup.php
r3311133 r3325924 151 151 152 152 $aux = explode('-', $url); 153 $width = (int) $aux[1];154 $height = (int) $aux[2];153 $width = isset($aux[1]) ? (int) $aux[1] : 0; 154 $height = isset($aux[2]) ? (int) $aux[2] : 0; 155 155 156 156 if (isset($parameters['resize'])) { -
featured-image-from-url/trunk/includes/thumbnail.php
r3315511 r3325924 9 9 10 10 global $pagenow; 11 if (!i n_array($pagenow, array('post.php', 'post-new.php', 'admin-ajax.php', 'wp-cron.php'))) {11 if (!isset($pagenow) || !in_array($pagenow, array('post.php', 'post-new.php', 'admin-ajax.php', 'wp-cron.php'))) { 12 12 if (is_plugin_active('wordpress-seo/wp-seo.php')) { 13 13 add_action('wpseo_opengraph_image', 'fifu_add_social_tag_yoast'); … … 117 117 if (!empty($url)) { 118 118 $buffer_contents = ob_get_contents(); 119 if ( strpos($buffer_contents, '<meta property="og:image"') === false) {119 if ($buffer_contents !== false && strpos($buffer_contents, '<meta property="og:image"') === false) { 120 120 $url = esc_url($url); 121 121 include 'html/social-home.html'; … … 147 147 148 148 // "all products" page 149 if (function_exists('get_current_screen') && isset(get_current_screen()->parent_file) && get_current_screen()->parent_file == 'edit.php?post_type=product') {149 if (function_exists('get_current_screen') && get_current_screen() && isset(get_current_screen()->parent_file) && get_current_screen()->parent_file == 'edit.php?post_type=product') { 150 150 $attr['src'] = fifu_optimized_column_image($url, $attachment->ID); 151 151 return $attr; … … 185 185 186 186 $src = fifu_get_attribute('src', $html); 187 if (isset($FIFU_SESSION [$src])) {187 if (isset($FIFU_SESSION) && isset($FIFU_SESSION[$src])) { 188 188 $data = $FIFU_SESSION[$src]; 189 189 if (strpos($html, 'fifu-replaced') !== false) … … 259 259 260 260 global $post; 261 if (!isset($post) || !isset($post->ID)) 262 return $content; 263 261 264 $post_id = $post->ID; 262 265 $att_id = get_post_thumbnail_id($post_id); … … 325 328 326 329 $del = substr($src[0], - 1); 327 $url = fifu_normalize(explode($del, $src[0])[1]); 330 $url_parts = explode($del, $src[0]); 331 $url = isset($url_parts[1]) ? fifu_normalize($url_parts[1]) : ''; 328 332 329 333 if (!$url || fifu_jetpack_blocked($url) || strpos($url, 'data:image') === 0) … … 443 447 function fifu_add_rss() { 444 448 global $post; 449 if (!isset($post) || !isset($post->ID)) 450 return; 451 445 452 if (has_post_thumbnail($post->ID)) { 446 453 $thumbnail = fifu_main_image_url($post->ID, true); // external (no CDN) … … 465 472 // for ajax pagination 466 473 function fifu_posts_results($posts, $query) { 467 if (!is_admin() && $query->is_main_query() && is_paged() ) {474 if (!is_admin() && $query->is_main_query() && is_paged() && !empty($posts)) { 468 475 foreach ($posts as $post) { 469 fifu_add_parameters_single_post($post->ID); 476 if (isset($post->ID)) { 477 fifu_add_parameters_single_post($post->ID); 478 } 470 479 } 471 480 } -
featured-image-from-url/trunk/includes/util.php
r3307677 r3325924 7 7 8 8 $aux = explode($attribute, $html); 9 if ( $aux)9 if (isset($aux[1])) 10 10 $aux = $aux[1]; 11 else 12 return null; 13 14 if (empty($aux)) 15 return null; 11 16 12 17 $quote = $aux[0]; -
featured-image-from-url/trunk/readme.txt
r3322839 r3325924 5 5 Requires at least: 5.6 6 6 Tested up to: 6.8.1 7 Stable tag: 5. 1.97 Stable tag: 5.2.0 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 246 246 == Changelog == 247 247 248 = 5.2.0 = 249 * Enhancement: Image Not Found message displayed in the post editor when the image URL is invalid; Fix: vulnerability reported by Wordfence (improved validation of values added in FIFU fields via post editor for better security); Fix: potential undefined index notices. 250 248 251 = 5.1.9 = 249 252 * Notice: the plugin collects the theme name anonymously (the goal is to identify the most common themes and ensure FIFU works correctly with all of them). … … 252 255 * Fix: Optimized Images (performance issue when serving full image size and possible conflicts with images from Cloudinary); Fix: images in the WooCommerce product gallery (not displayed when Optimized Images was disabled). 253 256 254 = 5.1.7 =255 * Enhancement: REST API (JSON examples with highlighted syntax).256 257 257 = others = 258 258 * [more](https://fifu.app/changelog) … … 261 261 == Upgrade Notice == 262 262 263 = 5. 1.9=264 * Notice: the plugin collects the theme name anonymously (the goal is to identify the most common themes and ensure FIFU works correctly with all of them).263 = 5.2.0 = 264 * Enhancement: Image Not Found message displayed in the post editor when the image URL is invalid; Fix: vulnerability reported by Wordfence (improved validation of values added in FIFU fields via post editor for better security); Fix: potential undefined index notices.
Note: See TracChangeset
for help on using the changeset viewer.