PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 2.31.2
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v2.31.2
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Models / Media.php
Media.php
51 lines 815 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Models;
4
5 /**
6 * Price model
7 */
8 class Media extends Model {
9 use Traits\HasImageSizes;
10
11 /**
12 * Rest API endpoint
13 *
14 * @var string
15 */
16 protected $endpoint = 'medias';
17
18 /**
19 * Object name
20 *
21 * @var string
22 */
23 protected $object_name = 'media';
24
25 /**
26 * Image srcset.
27 *
28 * @return string
29 */
30 public function getSrcsetAttribute() {
31 if ( empty( $this->attributes['url'] ) ) {
32 return '';
33 }
34 return $this->imageSrcSet( $this->attributes['url'] );
35 }
36
37 /**
38 * Get the image url for a specific size.
39 *
40 * @param integer $size The size.
41 *
42 * @return string
43 */
44 public function getUrl( $size = 0 ) {
45 if ( empty( $this->attributes['url'] ) ) {
46 return '';
47 }
48 return $size ? $this->imageUrl( $this->attributes['url'], $size ) : $this->attributes['url'];
49 }
50 }
51