Changeset 3398057
- Timestamp:
- 11/18/2025 12:31:49 PM (4 months ago)
- Location:
- social-post-flow
- Files:
-
- 6 edited
- 1 copied
-
tags/1.1.2 (copied) (copied from social-post-flow/trunk)
-
tags/1.1.2/includes/class-social-post-flow-publish.php (modified) (3 diffs)
-
tags/1.1.2/readme.txt (modified) (2 diffs)
-
tags/1.1.2/social-post-flow.php (modified) (2 diffs)
-
trunk/includes/class-social-post-flow-publish.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/social-post-flow.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
social-post-flow/tags/1.1.2/includes/class-social-post-flow-publish.php
r3379825 r3398057 2129 2129 private function get_images_from_post_content( $post ) { 2130 2130 2131 // Extract all <img> tags from the Post's content. 2132 $images = preg_match_all( '/<img.+?src=[\'"]([^\'"]+)[\'"].*?>/i', apply_filters( 'the_content', $post->post_content ), $matches ); 2131 // Wrap content in <html>, <head> and <body> tags with an UTF-8 Content-Type meta tag. 2132 // Forcibly tell DOMDocument that this HTML uses the UTF-8 charset. 2133 // <meta charset="utf-8"> isn't enough, as DOMDocument still interprets the HTML as ISO-8859, which breaks character encoding 2134 // Use of mb_convert_encoding() with HTML-ENTITIES is deprecated in PHP 8.2, so we have to use this method. 2135 // If we don't, special characters render incorrectly. 2136 $text = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>' . apply_filters( 'the_content', $post->post_content ) . '</body></html>'; 2137 2138 // Load the HTML into a DOMDocument. 2139 libxml_use_internal_errors( true ); 2140 $html = new DOMDocument(); 2141 $html->loadHTML( $text ); 2142 2143 // Load DOMDocument into XPath. 2144 $xpath = new DOMXPath( $html ); 2145 2146 // Extract images from the Post's content. 2147 $images = $xpath->query( '//img[@src]' ); 2148 $image_urls = array(); 2149 foreach ( $images as $image ) { 2150 $image_urls[] = $image->getAttribute( 'src' ); 2151 } 2133 2152 2134 2153 // If no images were found, return a blank array. 2135 if ( ! $images) {2154 if ( ! count( $image_urls ) ) { 2136 2155 return array(); 2137 2156 } … … 2139 2158 // Iterate through images, building array of image IDs. 2140 2159 $image_ids = array(); 2141 foreach ( $matches[1] as $image_url ) { 2142 // Attempt to get the image ID by the image URL. 2160 foreach ( $image_urls as $image_url ) { 2161 // Remove query parameters from the image URL. 2162 $image_url = strtok( $image_url, '?' ); 2163 2164 // Remove any size suffix from the image URL. 2165 $image_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif|webp|avif))/i', '', $image_url ); 2166 2167 // Attempt to get the image ID by the image URL, as this allows us to build a detailed image object 2168 // including width, height and other attributes that some networks may require. 2143 2169 $image_id = attachment_url_to_postid( esc_url( $image_url ) ); 2144 2170 if ( $image_id ) { … … 2146 2172 continue; 2147 2173 } 2148 2149 // If here, no image ID by URL could be found. This is likely because2150 // the image URL is a specific size.2151 2174 } 2152 2175 -
social-post-flow/tags/1.1.2/readme.txt
r3396957 r3398057 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.1. 18 Stable tag: 1.1.2 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 435 435 == Changelog == 436 436 437 = 1.1.2 (2025-11-18) = 438 * Fix: Status: Image: Additional Images: Display "Auto populate from Post content", not "Auto populate from Featured image content" 439 * Fix: Status: Images: Additional Images: Auto populate from Post content: improve detection of images in content 440 437 441 = 1.1.1 (2025-11-17) = 438 442 * Fix: Logs: PHP Warning: Undefined array key `0` -
social-post-flow/tags/1.1.2/social-post-flow.php
r3396957 r3398057 9 9 * Plugin Name: Social Post Flow 10 10 * Plugin URI: http://www.socialpostflow.com/integrations/wordpress 11 * Version: 1.1. 111 * Version: 1.1.2 12 12 * Author: Social Post Flow 13 13 * Author URI: http://www.socialpostflow.com … … 28 28 29 29 // Define Plugin version and build date. 30 define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1. 1' );31 define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-1 7 12:00:00' );30 define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1.2' ); 31 define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-18 18:00:00' ); 32 32 33 33 // Define Plugin paths. -
social-post-flow/trunk/includes/class-social-post-flow-publish.php
r3379825 r3398057 2129 2129 private function get_images_from_post_content( $post ) { 2130 2130 2131 // Extract all <img> tags from the Post's content. 2132 $images = preg_match_all( '/<img.+?src=[\'"]([^\'"]+)[\'"].*?>/i', apply_filters( 'the_content', $post->post_content ), $matches ); 2131 // Wrap content in <html>, <head> and <body> tags with an UTF-8 Content-Type meta tag. 2132 // Forcibly tell DOMDocument that this HTML uses the UTF-8 charset. 2133 // <meta charset="utf-8"> isn't enough, as DOMDocument still interprets the HTML as ISO-8859, which breaks character encoding 2134 // Use of mb_convert_encoding() with HTML-ENTITIES is deprecated in PHP 8.2, so we have to use this method. 2135 // If we don't, special characters render incorrectly. 2136 $text = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>' . apply_filters( 'the_content', $post->post_content ) . '</body></html>'; 2137 2138 // Load the HTML into a DOMDocument. 2139 libxml_use_internal_errors( true ); 2140 $html = new DOMDocument(); 2141 $html->loadHTML( $text ); 2142 2143 // Load DOMDocument into XPath. 2144 $xpath = new DOMXPath( $html ); 2145 2146 // Extract images from the Post's content. 2147 $images = $xpath->query( '//img[@src]' ); 2148 $image_urls = array(); 2149 foreach ( $images as $image ) { 2150 $image_urls[] = $image->getAttribute( 'src' ); 2151 } 2133 2152 2134 2153 // If no images were found, return a blank array. 2135 if ( ! $images) {2154 if ( ! count( $image_urls ) ) { 2136 2155 return array(); 2137 2156 } … … 2139 2158 // Iterate through images, building array of image IDs. 2140 2159 $image_ids = array(); 2141 foreach ( $matches[1] as $image_url ) { 2142 // Attempt to get the image ID by the image URL. 2160 foreach ( $image_urls as $image_url ) { 2161 // Remove query parameters from the image URL. 2162 $image_url = strtok( $image_url, '?' ); 2163 2164 // Remove any size suffix from the image URL. 2165 $image_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif|webp|avif))/i', '', $image_url ); 2166 2167 // Attempt to get the image ID by the image URL, as this allows us to build a detailed image object 2168 // including width, height and other attributes that some networks may require. 2143 2169 $image_id = attachment_url_to_postid( esc_url( $image_url ) ); 2144 2170 if ( $image_id ) { … … 2146 2172 continue; 2147 2173 } 2148 2149 // If here, no image ID by URL could be found. This is likely because2150 // the image URL is a specific size.2151 2174 } 2152 2175 -
social-post-flow/trunk/readme.txt
r3396957 r3398057 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.1. 18 Stable tag: 1.1.2 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 435 435 == Changelog == 436 436 437 = 1.1.2 (2025-11-18) = 438 * Fix: Status: Image: Additional Images: Display "Auto populate from Post content", not "Auto populate from Featured image content" 439 * Fix: Status: Images: Additional Images: Auto populate from Post content: improve detection of images in content 440 437 441 = 1.1.1 (2025-11-17) = 438 442 * Fix: Logs: PHP Warning: Undefined array key `0` -
social-post-flow/trunk/social-post-flow.php
r3396957 r3398057 9 9 * Plugin Name: Social Post Flow 10 10 * Plugin URI: http://www.socialpostflow.com/integrations/wordpress 11 * Version: 1.1. 111 * Version: 1.1.2 12 12 * Author: Social Post Flow 13 13 * Author URI: http://www.socialpostflow.com … … 28 28 29 29 // Define Plugin version and build date. 30 define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1. 1' );31 define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-1 7 12:00:00' );30 define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1.2' ); 31 define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-18 18:00:00' ); 32 32 33 33 // Define Plugin paths.
Note: See TracChangeset
for help on using the changeset viewer.