]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/customize/class-wp-customize-cropped-image-control.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / customize / class-wp-customize-cropped-image-control.php
1 <?php
2 /**
3  * Customize API: WP_Customize_Cropped_Image_Control class
4  *
5  * @package WordPress
6  * @subpackage Customize
7  * @since 4.4.0
8  */
9
10 /**
11  * Customize Cropped Image Control class.
12  *
13  * @since 4.3.0
14  *
15  * @see WP_Customize_Image_Control
16  */
17 class WP_Customize_Cropped_Image_Control extends WP_Customize_Image_Control {
18
19         /**
20          * Control type.
21          *
22          * @since 4.3.0
23          * @access public
24          * @var string
25          */
26         public $type = 'cropped_image';
27
28         /**
29          * Suggested width for cropped image.
30          *
31          * @since 4.3.0
32          * @access public
33          * @var int
34          */
35         public $width = 150;
36
37         /**
38          * Suggested height for cropped image.
39          *
40          * @since 4.3.0
41          * @access public
42          * @var int
43          */
44         public $height = 150;
45
46         /**
47          * Whether the width is flexible.
48          *
49          * @since 4.3.0
50          * @access public
51          * @var bool
52          */
53         public $flex_width = false;
54
55         /**
56          * Whether the height is flexible.
57          *
58          * @since 4.3.0
59          * @access public
60          * @var bool
61          */
62         public $flex_height = false;
63
64         /**
65          * Enqueue control related scripts/styles.
66          *
67          * @since 4.3.0
68          * @access public
69          */
70         public function enqueue() {
71                 wp_enqueue_script( 'customize-views' );
72
73                 parent::enqueue();
74         }
75
76         /**
77          * Refresh the parameters passed to the JavaScript via JSON.
78          *
79          * @since 4.3.0
80          * @access public
81          *
82          * @see WP_Customize_Control::to_json()
83          */
84         public function to_json() {
85                 parent::to_json();
86
87                 $this->json['width']       = absint( $this->width );
88                 $this->json['height']      = absint( $this->height );
89                 $this->json['flex_width']  = absint( $this->flex_width );
90                 $this->json['flex_height'] = absint( $this->flex_height );
91         }
92
93 }