Code Duplication    Length = 34-34 lines in 2 locations

class.json-api-endpoints.php 1 location

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

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

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