class-rio-attachment-extra-data.php
6 months ago
class-rio-base-active-record.php
6 months ago
class-rio-base-extra-data.php
6 months ago
class-rio-base-helper.php
6 months ago
class-rio-base-object.php
6 months ago
class-rio-process-queue-table.php
4 months ago
class-rio-server-smushit-extra-data.php
6 months ago
class.webp-extra-data.php
6 months ago
class.webp-extra-data.php
169 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class RIOP_WebP_Extra_Data. |
| 5 | * |
| 6 | * @property string $source_src |
| 7 | */ |
| 8 | class RIOP_WebP_Extra_Data extends RIO_Attachment_Extra_Data { |
| 9 | /** |
| 10 | * @var null|string E.g. attachment, nextgen, etc |
| 11 | */ |
| 12 | protected $convert_from = null; |
| 13 | |
| 14 | /** |
| 15 | * @var null|string|int |
| 16 | */ |
| 17 | protected $converted_from_size = null; |
| 18 | |
| 19 | /** |
| 20 | * @var string|null Image source src. |
| 21 | */ |
| 22 | protected $source_src = null; |
| 23 | |
| 24 | /** |
| 25 | * @var string|null Image absolute path. |
| 26 | */ |
| 27 | protected $source_path = null; |
| 28 | |
| 29 | /** |
| 30 | * @var string|null Converted WebP image src. |
| 31 | */ |
| 32 | protected $converted_src = null; |
| 33 | |
| 34 | /** |
| 35 | * @var string|null Converted WebP absolute path. |
| 36 | */ |
| 37 | protected $converted_path = null; |
| 38 | |
| 39 | /** |
| 40 | * @var int|null Post ID. |
| 41 | */ |
| 42 | protected $post_id = null; |
| 43 | |
| 44 | /** |
| 45 | * @var int|null thumbnails count. |
| 46 | */ |
| 47 | protected $thumbnails_count = null; |
| 48 | |
| 49 | /** |
| 50 | * @param string $source_src |
| 51 | */ |
| 52 | public function set_source_src( $source_src ) { |
| 53 | $this->source_src = trim( $source_src ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Get source property. |
| 58 | * |
| 59 | * @param bool $decoded Whether to decode src or not. |
| 60 | * |
| 61 | * @return string |
| 62 | */ |
| 63 | public function get_source_src( $decoded = true ) { |
| 64 | $src = $this->source_src; |
| 65 | |
| 66 | if ( $decoded ) { |
| 67 | return urldecode( $src ); |
| 68 | } |
| 69 | |
| 70 | return $src; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @return null|string |
| 75 | */ |
| 76 | public function get_source_path() { |
| 77 | return $this->source_path; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @param null|string $source_path |
| 82 | */ |
| 83 | public function set_source_path( $source_path ) { |
| 84 | $this->source_path = $source_path; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @return null|string |
| 89 | */ |
| 90 | public function get_convert_from() { |
| 91 | return $this->convert_from; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @param null|string $convert_from |
| 96 | */ |
| 97 | public function set_convert_from( $convert_from ) { |
| 98 | $this->convert_from = $convert_from; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @return int|null|string |
| 103 | */ |
| 104 | public function get_converted_from_size() { |
| 105 | return $this->converted_from_size; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * @param int|null|string $converted_from_size |
| 110 | */ |
| 111 | public function set_converted_from_size( $converted_from_size ) { |
| 112 | $this->converted_from_size = $converted_from_size; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return string |
| 117 | */ |
| 118 | public function get_converted_path() { |
| 119 | return $this->converted_path; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * @param string $converted_path |
| 124 | */ |
| 125 | public function set_converted_path( $converted_path ) { |
| 126 | $this->converted_path = $converted_path; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * @return string |
| 131 | */ |
| 132 | public function get_converted_src() { |
| 133 | return $this->converted_src; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * @param string $converted_src |
| 138 | */ |
| 139 | public function set_converted_src( $converted_src ) { |
| 140 | $this->converted_src = $converted_src; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * @return int |
| 145 | */ |
| 146 | public function get_post_id() { |
| 147 | return $this->post_id; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * @param int $post_id |
| 152 | * |
| 153 | * @return RIOP_WebP_Extra_Data |
| 154 | */ |
| 155 | public function set_post_id( $post_id ) { |
| 156 | $this->post_id = $post_id; |
| 157 | |
| 158 | return $this; |
| 159 | } |
| 160 | |
| 161 | public function get_original_main_size() { |
| 162 | return ''; |
| 163 | } |
| 164 | |
| 165 | public function get_thumbnails_count() { |
| 166 | return $this->thumbnails_count; |
| 167 | } |
| 168 | } |
| 169 |