PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 3.0.5
Admin Columns v3.0.5
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Settings / Column / Width.php
codepress-admin-columns / classes / Settings / Column Last commit date
BeforeAfter 8 years ago ActionIcons.php 8 years ago AttachmentDisplay.php 8 years ago BeforeAfter.php 8 years ago CharacterLimit.php 8 years ago CommentCount.php 8 years ago CustomField.php 8 years ago CustomFieldType.php 8 years ago Date.php 8 years ago ExifData.php 8 years ago Image.php 8 years ago Images.php 8 years ago Label.php 8 years ago LinkLabel.php 8 years ago LinkToMenu.php 8 years ago Message.php 8 years ago Meta.php 8 years ago MissingImageSize.php 8 years ago NumberOfItems.php 8 years ago Password.php 8 years ago PathScope.php 8 years ago Post.php 8 years ago PostFormatIcon.php 8 years ago PostLink.php 8 years ago PostType.php 8 years ago Separator.php 8 years ago StatusIcon.php 8 years ago StringLimit.php 8 years ago Taxonomy.php 8 years ago Term.php 8 years ago Toggle.php 8 years ago Type.php 8 years ago User.php 8 years ago Width.php 8 years ago WordLimit.php 8 years ago WordsPerMinute.php 8 years ago
Width.php
134 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class AC_Settings_Column_Width extends AC_Settings_Column
8 implements AC_Settings_HeaderInterface {
9
10 /**
11 * @var integer
12 */
13 private $width;
14
15 /**
16 * @var string
17 */
18 private $width_unit;
19
20 protected function define_options() {
21 return array(
22 'width',
23 'width_unit' => '%',
24 );
25 }
26
27 private function get_valid_width_units() {
28 return array(
29 '%' => '%',
30 'px' => 'px',
31 );
32 }
33
34 private function is_valid_width_unit( $width_unit ) {
35 return array_key_exists( $width_unit, $this->get_valid_width_units() );
36 }
37
38 public function create_view() {
39 $width = $this->create_element( 'text' )
40 ->set_attribute( 'placeholder', __( 'Auto', 'codepress-admin-columns' ) );
41
42 $unit = $this->create_element( 'radio', 'width_unit' )
43 ->set_options( $this->get_valid_width_units() );
44
45 $section = new AC_View( array(
46 'width' => $width,
47 'unit' => $unit,
48 ) );
49 $section->set_template( 'settings/setting-width' );
50
51 $view = new AC_View( array(
52 'label' => __( 'Width', 'codepress-admin-columns' ),
53 'sections' => array( $section ),
54 ) );
55
56 return $view;
57 }
58
59 public function create_header_view() {
60
61 $view = new AC_View( array(
62 'title' => __( 'width', 'codepress-admin-columns' ),
63 'content' => $this->get_display_width(),
64 ) );
65
66 return $view;
67 }
68
69 /**
70 * @return int
71 */
72 public function get_width() {
73 return $this->width;
74 }
75
76 /**
77 * @param int $width
78 *
79 * @return bool
80 */
81 public function set_width( $value ) {
82
83 // Backwards compatible for AC 2.9
84 if ( '' === $value ) {
85 $this->width = $value;
86
87 return true;
88 }
89
90 $value = absint( $value );
91
92 if ( $value > 0 ) {
93 $this->width = $value;
94
95 return true;
96 }
97
98 return false;
99 }
100
101 /**
102 * @return string
103 */
104 public function get_width_unit() {
105 return $this->width_unit;
106 }
107
108 /**
109 * @param string $width_unit
110 *
111 * @return bool
112 */
113 public function set_width_unit( $width_unit ) {
114 if ( ! $this->is_valid_width_unit( $width_unit ) ) {
115 return false;
116 }
117
118 $this->width_unit = $width_unit;
119
120 return true;
121 }
122
123 public function get_display_width() {
124 $value = false;
125
126 if ( $width = $this->get_width() ) {
127 $value = $width . $this->get_width_unit();
128 }
129
130 return $value;
131 }
132
133 }
134