Plugin Directory

Changeset 192313


Ignore:
Timestamp:
01/10/2010 06:43:29 PM (16 years ago)
Author:
fairweb
Message:
 
Location:
fw-post-image
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • fw-post-image/trunk/fw-post-image.class.php

    r184668 r192313  
    33 * @package fw-post-image
    44 * @author Myriam Faulkner
    5  * @version 1.1
     5 * @version 1.2
    66 */
    77class fw_post_image {
     
    6161}
    6262
     63public function remote_file_exists($image) {
     64    if ( @file($image)) {
     65        return true;
     66    }
     67    return false;
     68}
     69
    6370public function get_image_in_content () {
    6471
     
    6774    preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $my_post->post_content, $matches );
    6875
    69     if ( isset( $matches ) ) $image = $matches[1][0];
     76    if ( isset( $matches ) ) {
     77            $image = $matches[1][0];
    7078
    71     if ( $matches[1][0] ) {
     79    if ( $matches[1][0] && $this->remote_file_exists($image) ) {
    7280
    7381            // determine alt attribute
     
    98106                return $this->html;
    99107        }
    100     else {
     108
     109        } else {
    101110        return NULL;
    102111        }
  • fw-post-image/trunk/fw-post-image.php

    r184672 r192313  
    22 * @package fw-post-image
    33 * @author Myriam Faulkner
    4  * @version 1.1
     4 * @version 1.2
    55 */
    66/*
    77Plugin Name: fw-post-image
    8 Plugin URI: http://www.fairweb.fr/plugins-wordpress/fw-post-image
     8Plugin URI: http://www.fairweb.fr/en/plugins-wordpress/fw-post-image/
    99Description: If no post image is defined, get first image belonging to post or first image found post content. WP 2.9 > only.
    1010Author: Myriam Faulkner
    11 Version: 1.1
     11Version: 1.2
    1212Author URI: http://www.fairweb.fr/
    1313*/
     
    2626 */
    2727require_once(WP_PLUGIN_DIR .'/fw-post-image/fw-post-image.class.php');
    28 
    2928    $fw_pimg = new fw_post_image();
    3029    add_filter( 'post_thumbnail_html', array(&$fw_pimg, 'get_post_image'),1,5 );
    31 
    3230?>
  • fw-post-image/trunk/readme.txt

    r184668 r192313  
    44Tags: post image, image, photo, thumbnail
    55Requires at least: 2.9
    6 Tested up to: 2.9
     6Tested up to: 2.9.1
    77Stable tag: '/trunk'
    88
     
    3737
    3838== Changelog ==
     39= 1.2 =
     40* Prevent error on getimagesize (line 92) when scanning post content for an image and finding an image which does not exist.
    3941= 1.1 =
    4042* Changed filter name for post_thumbnail_html (previously post_image_html)
Note: See TracChangeset for help on using the changeset viewer.