Album.php
5 years ago
AlternateText.php
5 years ago
Artist.php
5 years ago
Author.php
5 years ago
AuthorName.php
5 years ago
AvailableSizes.php
5 years ago
Caption.php
5 years ago
Comments.php
5 years ago
Date.php
5 years ago
Description.php
5 years ago
Dimensions.php
5 years ago
Download.php
5 years ago
ExifData.php
5 years ago
FileName.php
5 years ago
FileSize.php
5 years ago
FullPath.php
5 years ago
Height.php
5 years ago
ID.php
5 years ago
MediaParent.php
5 years ago
Menu.php
5 years ago
Meta.php
5 years ago
MetaValue.php
5 years ago
MimeType.php
5 years ago
Taxonomy.php
5 years ago
Title.php
5 years ago
Width.php
5 years ago
Dimensions.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Column\Media; |
| 4 | |
| 5 | use AC\Settings; |
| 6 | |
| 7 | /** |
| 8 | * @since 2.0 |
| 9 | */ |
| 10 | class Dimensions extends Meta { |
| 11 | |
| 12 | public function __construct() { |
| 13 | parent::__construct(); |
| 14 | |
| 15 | $this->set_type( 'column-dimensions' ); |
| 16 | $this->set_label( __( 'Dimensions', 'codepress-admin-columns' ) ); |
| 17 | } |
| 18 | |
| 19 | public function get_value( $id ) { |
| 20 | $meta = $this->get_raw_value( $id ); |
| 21 | |
| 22 | if ( empty( $meta['width'] ) || empty( $meta['height'] ) ) { |
| 23 | return $this->get_empty_char(); |
| 24 | } |
| 25 | |
| 26 | $value = $meta['width'] . ' × ' . $meta['height']; |
| 27 | |
| 28 | $tooltip = sprintf( __( 'Width : %s px', 'codepress-admin-columns' ), $meta['width'] ) . "<br/>\n" . sprintf( __( 'Height : %s px', 'codepress-admin-columns' ), $meta['height'] ); |
| 29 | |
| 30 | return ac_helper()->html->tooltip( $this->get_formatted_value( $value ), $tooltip ); |
| 31 | } |
| 32 | |
| 33 | public function register_settings() { |
| 34 | $this->add_setting( new Settings\Column\BeforeAfter( $this ) ); |
| 35 | } |
| 36 | |
| 37 | } |