Plugin Directory

Changeset 3398057


Ignore:
Timestamp:
11/18/2025 12:31:49 PM (4 months ago)
Author:
socialpostflow
Message:

Update to version 1.1.2 from GitHub

Location:
social-post-flow
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • social-post-flow/tags/1.1.2/includes/class-social-post-flow-publish.php

    r3379825 r3398057  
    21292129    private function get_images_from_post_content( $post ) {
    21302130
    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        }
    21332152
    21342153        // If no images were found, return a blank array.
    2135         if ( ! $images ) {
     2154        if ( ! count( $image_urls ) ) {
    21362155            return array();
    21372156        }
     
    21392158        // Iterate through images, building array of image IDs.
    21402159        $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.
    21432169            $image_id = attachment_url_to_postid( esc_url( $image_url ) );
    21442170            if ( $image_id ) {
     
    21462172                continue;
    21472173            }
    2148 
    2149             // If here, no image ID by URL could be found. This is likely because
    2150             // the image URL is a specific size.
    21512174        }
    21522175
  • social-post-flow/tags/1.1.2/readme.txt

    r3396957 r3398057  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.1.1
     8Stable tag: 1.1.2
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    435435== Changelog ==
    436436
     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
    437441= 1.1.1 (2025-11-17) =
    438442* Fix: Logs: PHP Warning: Undefined array key `0`
  • social-post-flow/tags/1.1.2/social-post-flow.php

    r3396957 r3398057  
    99 * Plugin Name: Social Post Flow
    1010 * Plugin URI: http://www.socialpostflow.com/integrations/wordpress
    11  * Version: 1.1.1
     11 * Version: 1.1.2
    1212 * Author: Social Post Flow
    1313 * Author URI: http://www.socialpostflow.com
     
    2828
    2929// 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-17 12:00:00' );
     30define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1.2' );
     31define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-18 18:00:00' );
    3232
    3333// Define Plugin paths.
  • social-post-flow/trunk/includes/class-social-post-flow-publish.php

    r3379825 r3398057  
    21292129    private function get_images_from_post_content( $post ) {
    21302130
    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        }
    21332152
    21342153        // If no images were found, return a blank array.
    2135         if ( ! $images ) {
     2154        if ( ! count( $image_urls ) ) {
    21362155            return array();
    21372156        }
     
    21392158        // Iterate through images, building array of image IDs.
    21402159        $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.
    21432169            $image_id = attachment_url_to_postid( esc_url( $image_url ) );
    21442170            if ( $image_id ) {
     
    21462172                continue;
    21472173            }
    2148 
    2149             // If here, no image ID by URL could be found. This is likely because
    2150             // the image URL is a specific size.
    21512174        }
    21522175
  • social-post-flow/trunk/readme.txt

    r3396957 r3398057  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.1.1
     8Stable tag: 1.1.2
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    435435== Changelog ==
    436436
     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
    437441= 1.1.1 (2025-11-17) =
    438442* Fix: Logs: PHP Warning: Undefined array key `0`
  • social-post-flow/trunk/social-post-flow.php

    r3396957 r3398057  
    99 * Plugin Name: Social Post Flow
    1010 * Plugin URI: http://www.socialpostflow.com/integrations/wordpress
    11  * Version: 1.1.1
     11 * Version: 1.1.2
    1212 * Author: Social Post Flow
    1313 * Author URI: http://www.socialpostflow.com
     
    2828
    2929// 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-17 12:00:00' );
     30define( 'SOCIAL_POST_FLOW_PLUGIN_VERSION', '1.1.2' );
     31define( 'SOCIAL_POST_FLOW_PLUGIN_BUILD_DATE', '2025-11-18 18:00:00' );
    3232
    3333// Define Plugin paths.
Note: See TracChangeset for help on using the changeset viewer.