Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

class-wp-customize-cropped-image-control.php 1.6 KiB

pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. * Customize Cropped Image Control class.
  11. *
  12. * @since 4.3.0
  13. *
  14. * @see WP_Customize_Image_Control
  15. */
  16. class WP_Customize_Cropped_Image_Control extends WP_Customize_Image_Control {
  17. /**
  18. * Control type.
  19. *
  20. * @since 4.3.0
  21. * @access public
  22. * @var string
  23. */
  24. public $type = 'cropped_image';
  25. /**
  26. * Suggested width for cropped image.
  27. *
  28. * @since 4.3.0
  29. * @access public
  30. * @var int
  31. */
  32. public $width = 150;
  33. /**
  34. * Suggested height for cropped image.
  35. *
  36. * @since 4.3.0
  37. * @access public
  38. * @var int
  39. */
  40. public $height = 150;
  41. /**
  42. * Whether the width is flexible.
  43. *
  44. * @since 4.3.0
  45. * @access public
  46. * @var bool
  47. */
  48. public $flex_width = false;
  49. /**
  50. * Whether the height is flexible.
  51. *
  52. * @since 4.3.0
  53. * @access public
  54. * @var bool
  55. */
  56. public $flex_height = false;
  57. /**
  58. * Enqueue control related scripts/styles.
  59. *
  60. * @since 4.3.0
  61. * @access public
  62. */
  63. public function enqueue() {
  64. wp_enqueue_script( 'customize-views' );
  65. parent::enqueue();
  66. }
  67. /**
  68. * Refresh the parameters passed to the JavaScript via JSON.
  69. *
  70. * @since 4.3.0
  71. * @access public
  72. *
  73. * @see WP_Customize_Control::to_json()
  74. */
  75. public function to_json() {
  76. parent::to_json();
  77. $this->json['width'] = absint( $this->width );
  78. $this->json['height'] = absint( $this->height );
  79. $this->json['flex_width'] = absint( $this->flex_width );
  80. $this->json['flex_height'] = absint( $this->flex_height );
  81. }
  82. }