Code Duplication    Length = 9-9 lines in 2 locations

_inc/lib/tonesque.php 2 locations

@@ 50-58 (lines=9) @@
47
			$_image_url  = set_url_scheme( $image_url );
48
			if ( wp_startswith( $_image_url, $content_url ) ) {
49
				$_image_path = str_replace( $content_url, ABSPATH . 'wp-content', $_image_url );
50
				if ( file_exists( $_image_path ) ) {
51
					$filetype = wp_check_filetype( $_image_path );
52
					$ext = $filetype['ext'];
53
					$type = $filetype['type'];
54
55
					if ( wp_startswith( $type, 'image/' ) ) {
56
						$data = file_get_contents( $_image_path );
57
					}
58
				}
59
			}
60
61
			if ( empty( $data ) ) {
@@ 71-79 (lines=9) @@
68
		}
69
70
		// If it's a local path in our WordPress install:
71
		if ( file_exists( $image_url ) ) {
72
			$filetype = wp_check_filetype( $image_url );
73
			$ext = $filetype['ext'];
74
			$type = $filetype['type'];
75
76
			if ( wp_startswith( $type, 'image/' ) ) {
77
				$data = file_get_contents( $image_url );
78
			}
79
		}
80
81
		// Now turn it into an image and return it.
82
		return imagecreatefromstring( $data );