PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 3.11.1
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v3.11.1
4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 All 134 releases
optimole-wp / inc / image_properties / height.php

height.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 3.11.1, at inc/image_properties/height.php

61 lines 931 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Optml_Height
5 */
6 class Optml_Height extends Optml_Property_Type {
7
8 /**
9 * Height Property.
10 *
11 * @var mixed $height
12 */
13 private $height = 'auto';
14
15 /**
16 * Optml_Height constructor.
17 *
18 * @param mixed $value Default value.
19 */
20 public function __construct( $value ) {
21 $this->set( $value );
22 }
23
24 /**
25 * Set property value.
26 *
27 * @param mixed $value Value to set.
28 */
29 public function set( $value ) {
30 if ( $value === 'auto' ) {
31 $this->height = 'auto';
32 return;
33 }
34
35 if ( ! $this->is_valid_numeric( $value ) ) {
36 $this->height = 'auto';
37 return;
38 }
39
40 $this->height = $this->to_positive_integer( $value );
41 }
42
43 /**
44 * Return property value.
45 *
46 * @return mixed
47 */
48 public function get() {
49 return $this->height;
50 }
51
52 /**
53 * Return ImageProxy URL formatted string property.
54 *
55 * @return mixed
56 */
57 public function toString() {
58 return sprintf( 'h:%s', $this->height );
59 }
60 }
61