Dimensions.php
950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace AC\Column\Media;
use AC\Settings;
/**
* @since 2.0
*/
class Dimensions extends Meta {
public function __construct() {
parent::__construct();
$this->set_type( 'column-dimensions' )
->set_group( 'media-image' )
->set_label( __( 'Dimensions', 'codepress-admin-columns' ) );
}
public function get_value( $id ) {
$meta = $this->get_raw_value( $id );
if ( empty( $meta['width'] ) || empty( $meta['height'] ) ) {
return $this->get_empty_char();
}
$value = $meta['width'] . ' × ' . $meta['height'];
$tooltip = sprintf( __( 'Width : %s px', 'codepress-admin-columns' ), $meta['width'] ) . "<br/>\n" . sprintf( __( 'Height : %s px', 'codepress-admin-columns' ), $meta['height'] );
return ac_helper()->html->tooltip( $this->get_formatted_value( $value ), $tooltip );
}
public function register_settings() {
$this->add_setting( new Settings\Column\BeforeAfter( $this ) );
}
}