GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( eea301...fe82dd )
by Brad
06:04 queued 02:50
created

FooGallery_Thumbnails::resize()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 39
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 13
nc 3
nop 3
dl 0
loc 39
rs 8.8571
c 2
b 0
f 0
1
<?php
2
/*
3
 * FooGallery Thumbnail Resizing class
4
 */
5
6
if ( !class_exists( 'FooGallery_Thumbnails' ) ) {
7
8
	class FooGallery_Thumbnails {
9
10
		function __construct() {
11
			//generate thumbs using WPThumb
12
			add_filter( 'foogallery_attachment_resize_thumbnail', array( $this, 'resize' ), 10, 3 );
13
		}
14
15
		function resize( $original_image_src, $args, $thumbnail_object ) {
16
17
			$arg_defaults = array(
18
				'width'                   => 0,
19
				'height'                  => 0,
20
				'crop'                    => true,
21
				'jpeg_quality'            => foogallery_thumbnail_jpeg_quality(),
22
				'thumb_resize_animations' => foogallery_get_setting( 'thumb_resize_animations' )
23
			);
24
25
			$args = wp_parse_args( $args, $arg_defaults );
26
27
//			$width  = (int)$args['width'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
//			$height = (int)$args['height'];
29
//			$crop   = (bool)$args['crop'];
30
//
31
//			//check if we are trying to get back the default thumbnail that we already have
32
//			if ( $thumbnail_object->ID > 0 && $width == get_option( 'thumbnail_size_w' ) && $height == get_option( 'thumbnail_size_h' ) && $crop == get_option( 'thumbnail_crop' ) ) {
33
//				$thumbnail_attributes = wp_get_attachment_image_src( $thumbnail_object->ID );
34
//
35
//				return $thumbnail_attributes[0];
36
//			}
37
//
38
//			//we need either a width or a height. If nothing is given then default to the thumb width setting in Settings->Media
39
//			if ( 0 == $width && 0 == $height ) {
40
//				$args['width'] = (int)get_option( 'thumbnail_size_w' );
41
//			}
42
43
			if ( $thumbnail_object->ID > 0 ) {
44
				$crop_from_position = get_post_meta( $thumbnail_object->ID, 'wpthumb_crop_pos', true );
45
46
				if ( !empty( $crop_from_position ) ) {
47
					$args['crop_from_position'] = $crop_from_position;
48
				}
49
			}
50
51
52
			return wpthumb( $original_image_src, $args );
53
		}
54
	}
55
}
56