| 4349 | $attachment_data = wp_prepare_attachment_for_js( $post->ID ); |
| 4350 | if ( $attachment_data ) { |
| 4351 | $data_to_extract = array( |
| 4352 | 'filename' => __( 'File name' ), |
| 4353 | 'mime' => __( 'File type' ), |
| 4354 | 'dateFormatted' => __( 'Uploaded on' ), |
| 4355 | 'filesizeHumanReadable' => __( 'File size' ), |
| 4356 | 'dimensions' => __( 'Dimensions' ), |
| 4357 | 'alt' => __( 'Alt text' ), |
| 4358 | 'title' => __( 'Title' ), |
| 4359 | 'caption' => __( 'Caption' ), |
| 4360 | 'description' => __( 'Description' ), |
| 4361 | ); |
| 4362 | |
| 4363 | foreach ( $data_to_extract as $extract_key => $label ) { |
| 4364 | if ( 'dimensions' === $extract_key ) { |
| 4365 | if ( 'image' === $attachment_data[ 'type' ] && ( $attachment_data['width'] && $attachment_data['height'] ) ) { |
| 4366 | $post_data_to_export[] = array( |
| 4367 | 'name' => 'Dimensions', |
| 4368 | 'value' => sprintf( esc_html__( '%1$s by %2$s pixels' ), $attachment_data['width'], $attachment_data['height'] ), |
| 4369 | ); |
| 4370 | } |
| 4371 | } |
| 4372 | elseif ( ! empty( $attachment_data[ $extract_key ] ) ) { |
| 4373 | $post_data_to_export[] = array( |
| 4374 | 'name' => $label, |
| 4375 | 'value' => esc_html( $attachment_data[ $extract_key ] ), |
| 4376 | ); |
| 4377 | } |
| 4378 | } |
| 4379 | } |
| 4380 | |