better debugging

This commit is contained in:
Peter Molnar 2016-03-08 13:37:52 +00:00
parent dcdc0ef297
commit 71fa8a766b
2 changed files with 13 additions and 8 deletions

View file

@ -3,8 +3,8 @@ Contributors: cadeyrn
Donate link: https://paypal.me/petermolnar/3 Donate link: https://paypal.me/petermolnar/3
Tags: RSS, feed, featured image, attachment Tags: RSS, feed, featured image, attachment
Requires at least: 3.0 Requires at least: 3.0
Tested up to: 4.4 Tested up to: 4.4.2
Stable tag: 0.1 Stable tag: 0.1.1
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
Required minimum PHP version: 5.3 Required minimum PHP version: 5.3
@ -32,6 +32,11 @@ Version numbering logic:
* every .B version indicates new features. * every .B version indicates new features.
* every ..C indicates bugfixes for A.B version. * every ..C indicates bugfixes for A.B version.
= 0.1.1 =
*2016-03-08*
* better debugging
= 0.1 = = 0.1 =
*2015-12-14* *2015-12-14*

View file

@ -3,7 +3,7 @@
Plugin Name: wp-featured2rss Plugin Name: wp-featured2rss
Plugin URI: https://github.com/petermolnar/wp-featured2rss Plugin URI: https://github.com/petermolnar/wp-featured2rss
Description: WordPress plugin to add featured image to RSS feed as attachment (which WordPress doesn't do by default) Description: WordPress plugin to add featured image to RSS feed as attachment (which WordPress doesn't do by default)
Version: 0.1 Version: 0.1.1
Author: Peter Molnar <hello@petermolnar.eu> Author: Peter Molnar <hello@petermolnar.eu>
Author URI: http://petermolnar.eu/ Author URI: http://petermolnar.eu/
License: GPLv3 License: GPLv3
@ -52,7 +52,7 @@ class WP_FEATURED2RSS {
$post = static::fix_post(); $post = static::fix_post();
//static::debug('insterting featured image to rss'); static::debug('insterting featured image to rss',7);
if ($post === false ) if ($post === false )
return false; return false;
@ -79,10 +79,10 @@ class WP_FEATURED2RSS {
arsort($candidates); arsort($candidates);
foreach ($candidates as $potential => $maxsize ) { 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'], 7 );
if (isset($meta['sizes'][$potential]) && isset($meta['sizes'][$potential]['file']) && $meta['sizes'][$potential]['file'] != $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', 7);
$asize = $potential; $asize = $potential;
$img = wp_get_attachment_image_src( $thid, $potential ); $img = wp_get_attachment_image_src( $thid, $potential );
break; break;
@ -172,7 +172,7 @@ class WP_FEATURED2RSS {
// in case WordPress debug log has a minimum level // in case WordPress debug log has a minimum level
if ( defined ( 'WP_DEBUG_LEVEL' ) ) { if ( defined ( 'WP_DEBUG_LEVEL' ) ) {
$wp_level = $levels [ WP_DEBUG_LEVEL ]; $wp_level = $levels [ WP_DEBUG_LEVEL ];
if ( $level_ < $wp_level ) { if ( $level_ > $wp_level ) {
return false; return false;
} }
} }
@ -213,4 +213,4 @@ class WP_FEATURED2RSS {
$WP_FEATURED2RSS = new WP_FEATURED2RSS(); $WP_FEATURED2RSS = new WP_FEATURED2RSS();
endif; endif;