fine tune of logs + fail in php < 5.2
This commit is contained in:
parent
cda95507ce
commit
d3fdd18810
2 changed files with 14 additions and 11 deletions
|
@ -19,7 +19,7 @@ It's strictly only using resized images to maintain compatibility in case access
|
|||
|
||||
== Installation ==
|
||||
|
||||
1. Upload contents of `wp-featured2rss` to the `/wp-content/plugins/` directory
|
||||
1. Upload contents of `wp-featured2rss.zip` to the `/wp-content/plugins/` directory
|
||||
2. Activate the plugin through the `Plugins` menu in WordPress
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
|
|
@ -32,10 +32,19 @@ class WP_FEATURED2RSS {
|
|||
const expire = 30;
|
||||
|
||||
public function __construct () {
|
||||
|
||||
register_activation_hook( __FILE__ , array( &$this, 'plugin_activate' ) );
|
||||
add_action( 'rss2_item', array(&$this,'insert_enclosure_image') );
|
||||
}
|
||||
|
||||
/**
|
||||
* activate hook
|
||||
*/
|
||||
public static function plugin_activate() {
|
||||
if ( version_compare( phpversion(), 5.3, '<' ) ) {
|
||||
die( 'The minimum PHP version required for this plugin is 5.3' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -43,7 +52,7 @@ class WP_FEATURED2RSS {
|
|||
|
||||
$post = static::fix_post();
|
||||
|
||||
static::debug('insterting featured image to rss');
|
||||
//static::debug('insterting featured image to rss');
|
||||
|
||||
if ($post === false )
|
||||
return false;
|
||||
|
@ -55,12 +64,6 @@ class WP_FEATURED2RSS {
|
|||
if ( $cached = wp_cache_get ( $thid, __CLASS__ . __FUNCTION__ ) )
|
||||
return $cached;
|
||||
|
||||
$sizes = array (
|
||||
0 => 'large',
|
||||
1 => 'medium',
|
||||
2 => 'thumbnail'
|
||||
);
|
||||
|
||||
$asize = false;
|
||||
$meta = wp_get_attachment_metadata($thid);
|
||||
|
||||
|
@ -76,10 +79,10 @@ class WP_FEATURED2RSS {
|
|||
arsort($candidates);
|
||||
|
||||
foreach ($candidates as $potential => $maxsize ) {
|
||||
static::debug('checking size ' . $potential . ': ' . $meta['sizes'][$potential]['file'] . ' vs ' .$meta['file'] );
|
||||
//static::debug('checking size ' . $potential . ': ' . $meta['sizes'][$potential]['file'] . ' vs ' .$meta['file'] );
|
||||
|
||||
if (isset($meta['sizes'][$potential]) && isset($meta['sizes'][$potential]['file']) && $meta['sizes'][$potential]['file'] != $meta['file']) {
|
||||
static::debug( $meta['sizes'][$potential]['file'] . ' look like a resized file, using it');
|
||||
//static::debug( $meta['sizes'][$potential]['file'] . ' look like a resized file, using it');
|
||||
$asize = $potential;
|
||||
$img = wp_get_attachment_image_src( $thid, $potential );
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue