Plugin Directory

Changeset 517438


Ignore:
Timestamp:
03/11/2012 07:11:46 AM (14 years ago)
Author:
ihacklog
Message:
  • improved: the method to check whether a link resource is a picture
  • fixed: the compatibility with Hacklog Remote Attachment plugin (resolved the dumplicated filename bug)
Location:
hacklog-remote-image-autosave/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hacklog-remote-image-autosave/trunk/readme.txt

    r517231 r517438  
    55Requires at least: 3.2.1
    66Tested up to: 3.3.1
    7 Stable tag: 2.0.4
     7Stable tag: 2.0.5
    88
    99save remote images in the posts to local server and add it as an attachment to the post.
     
    4444== Changelog ==
    4545
     46= 2.0.5 =
     47* improved: the method to check whether a link resource is a picture
     48* fixed: the compatibility with Hacklog Remote Attachment plugin (resolved the dumplicated filename bug)
     49
    4650= 2.0.4 =
    4751* fixed: corrected the logic to check if a url is remote or not.
  • hacklog-remote-image-autosave/trunk/util.class.php

    r517434 r517438  
    8585    /**
    8686     *
    87      * @todo : add extra to check wether a link resource is a picture
     87     * @todo : add extra to check whether a link resource is a picture
    8888     */
    8989    public static function link_img_tag_callback($matches) {
     
    9292        $replaced_content = $index;
    9393        $src = $matches [5];
     94        $href = $matches[2];
    9495        // if the link is not a picture
    95         $href = strpos ( basename ( $matches [2] ), '.' ) !== FALSE ? $matches [2] : $src;
     96        $url_path = parse_url($href,PHP_URL_PATH);
     97        $ext_no_dot = pathinfo(basename($url_path), PATHINFO_EXTENSION);
     98        $href = in_array($ext_no_dot, array_values(self::$mime_to_ext) ) ? $href : $src;
    9699        if (self::is_remote_file ( $href )) {
    97100            self::$code_block [$index] = array (
Note: See TracChangeset for help on using the changeset viewer.