Code Duplication    Length = 34-34 lines in 2 locations

class.json-api-endpoints.php 1 location

@@ 1208-1241 (lines=34) @@
1205
			$response['exif']   = $metadata;
1206
		}
1207
1208
		if ( in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) ) {
1209
			$metadata = wp_get_attachment_metadata( $media_item->ID );
1210
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
1211
				$response['height'] = $metadata['height'];
1212
				$response['width']  = $metadata['width'];
1213
			}
1214
1215
			if ( isset( $metadata['length'] ) ) {
1216
				$response['length'] = $metadata['length'];
1217
			}
1218
1219
			// add VideoPress info
1220
			if ( function_exists( 'video_get_info_by_blogpostid' ) ) {
1221
				$info = video_get_info_by_blogpostid( $this->api->get_blog_id_for_output(), $media_id );
1222
1223
				// Thumbnails
1224
				if ( function_exists( 'video_format_done' ) && function_exists( 'video_image_url_by_guid' ) ) {
1225
					$response['thumbnails'] = array( 'fmt_hd' => '', 'fmt_dvd' => '', 'fmt_std' => '' );
1226
					foreach ( $response['thumbnails'] as $size => $thumbnail_url ) {
1227
						if ( video_format_done( $info, $size ) ) {
1228
							$response['thumbnails'][ $size ] = video_image_url_by_guid( $info->guid, $size );
1229
						} else {
1230
							unset( $response['thumbnails'][ $size ] );
1231
						}
1232
					}
1233
				}
1234
1235
				$response['videopress_guid'] = $info->guid;
1236
				$response['videopress_processing_done'] = true;
1237
				if ( '0000-00-00 00:00:00' == $info->finish_date_gmt ) {
1238
					$response['videopress_processing_done'] = false;
1239
				}
1240
			}
1241
		}
1242
1243
		$response['thumbnails'] = (object) $response['thumbnails'];
1244

sal/class.json-api-post-base.php 1 location

@@ 593-626 (lines=34) @@
590
			$response['exif']   = $metadata;
591
		}
592
593
		if ( in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) ) {
594
			$metadata = wp_get_attachment_metadata( $media_item->ID );
595
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
596
				$response['height'] = $metadata['height'];
597
				$response['width']  = $metadata['width'];
598
			}
599
600
			if ( isset( $metadata['length'] ) ) {
601
				$response['length'] = $metadata['length'];
602
			}
603
604
			// add VideoPress info
605
			if ( function_exists( 'video_get_info_by_blogpostid' ) ) {
606
				$info = video_get_info_by_blogpostid( $this->site->blog_id, $media_id );
607
608
				// Thumbnails
609
				if ( function_exists( 'video_format_done' ) && function_exists( 'video_image_url_by_guid' ) ) {
610
					$response['thumbnails'] = array( 'fmt_hd' => '', 'fmt_dvd' => '', 'fmt_std' => '' );
611
					foreach ( $response['thumbnails'] as $size => $thumbnail_url ) {
612
						if ( video_format_done( $info, $size ) ) {
613
							$response['thumbnails'][ $size ] = video_image_url_by_guid( $info->guid, $size );
614
						} else {
615
							unset( $response['thumbnails'][ $size ] );
616
						}
617
					}
618
				}
619
620
				$response['videopress_guid'] = $info->guid;
621
				$response['videopress_processing_done'] = true;
622
				if ( '0000-00-00 00:00:00' == $info->finish_date_gmt ) {
623
					$response['videopress_processing_done'] = false;
624
				}
625
			}
626
		}
627
628
		$response['thumbnails'] = (object) $response['thumbnails'];
629