PageRenderTime 69ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-includes/class-wp-customize-control.php

https://github.com/markjaquith/WordPress
PHP | 802 lines | 328 code | 78 blank | 396 comment | 40 complexity | 29ce71d568c8bbed7eea01b8f7bc7a8e MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * WordPress Customize Control classes
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 3.4.0
  8. */
  9. /**
  10. * Customize Control class.
  11. *
  12. * @since 3.4.0
  13. */
  14. class WP_Customize_Control {
  15. /**
  16. * Incremented with each new class instantiation, then stored in $instance_number.
  17. *
  18. * Used when sorting two instances whose priorities are equal.
  19. *
  20. * @since 4.1.0
  21. * @var int
  22. */
  23. protected static $instance_count = 0;
  24. /**
  25. * Order in which this instance was created in relation to other instances.
  26. *
  27. * @since 4.1.0
  28. * @var int
  29. */
  30. public $instance_number;
  31. /**
  32. * Customizer manager.
  33. *
  34. * @since 3.4.0
  35. * @var WP_Customize_Manager
  36. */
  37. public $manager;
  38. /**
  39. * Control ID.
  40. *
  41. * @since 3.4.0
  42. * @var string
  43. */
  44. public $id;
  45. /**
  46. * All settings tied to the control.
  47. *
  48. * @since 3.4.0
  49. * @var array
  50. */
  51. public $settings;
  52. /**
  53. * The primary setting for the control (if there is one).
  54. *
  55. * @since 3.4.0
  56. * @var string|WP_Customize_Setting|null
  57. */
  58. public $setting = 'default';
  59. /**
  60. * Capability required to use this control.
  61. *
  62. * Normally this is empty and the capability is derived from the capabilities
  63. * of the associated `$settings`.
  64. *
  65. * @since 4.5.0
  66. * @var string
  67. */
  68. public $capability;
  69. /**
  70. * Order priority to load the control in Customizer.
  71. *
  72. * @since 3.4.0
  73. * @var int
  74. */
  75. public $priority = 10;
  76. /**
  77. * Section the control belongs to.
  78. *
  79. * @since 3.4.0
  80. * @var string
  81. */
  82. public $section = '';
  83. /**
  84. * Label for the control.
  85. *
  86. * @since 3.4.0
  87. * @var string
  88. */
  89. public $label = '';
  90. /**
  91. * Description for the control.
  92. *
  93. * @since 4.0.0
  94. * @var string
  95. */
  96. public $description = '';
  97. /**
  98. * List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values.
  99. *
  100. * @since 3.4.0
  101. * @var array
  102. */
  103. public $choices = array();
  104. /**
  105. * List of custom input attributes for control output, where attribute names are the keys and values are the values.
  106. *
  107. * Not used for 'checkbox', 'radio', 'select', 'textarea', or 'dropdown-pages' control types.
  108. *
  109. * @since 4.0.0
  110. * @var array
  111. */
  112. public $input_attrs = array();
  113. /**
  114. * Show UI for adding new content, currently only used for the dropdown-pages control.
  115. *
  116. * @since 4.7.0
  117. * @var bool
  118. */
  119. public $allow_addition = false;
  120. /**
  121. * @deprecated It is better to just call the json() method
  122. * @since 3.4.0
  123. * @var array
  124. */
  125. public $json = array();
  126. /**
  127. * Control's Type.
  128. *
  129. * @since 3.4.0
  130. * @var string
  131. */
  132. public $type = 'text';
  133. /**
  134. * Callback.
  135. *
  136. * @since 4.0.0
  137. *
  138. * @see WP_Customize_Control::active()
  139. *
  140. * @var callable Callback is called with one argument, the instance of
  141. * WP_Customize_Control, and returns bool to indicate whether
  142. * the control is active (such as it relates to the URL
  143. * currently being previewed).
  144. */
  145. public $active_callback = '';
  146. /**
  147. * Constructor.
  148. *
  149. * Supplied `$args` override class property defaults.
  150. *
  151. * If `$args['settings']` is not defined, use the $id as the setting ID.
  152. *
  153. * @since 3.4.0
  154. *
  155. * @param WP_Customize_Manager $manager Customizer bootstrap instance.
  156. * @param string $id Control ID.
  157. * @param array $args {
  158. * Optional. Array of properties for the new Control object. Default empty array.
  159. *
  160. * @type int $instance_number Order in which this instance was created in relation
  161. * to other instances.
  162. * @type WP_Customize_Manager $manager Customizer bootstrap instance.
  163. * @type string $id Control ID.
  164. * @type array $settings All settings tied to the control. If undefined, `$id` will
  165. * be used.
  166. * @type string $setting The primary setting for the control (if there is one).
  167. * Default 'default'.
  168. * @type string $capability Capability required to use this control. Normally this is empty
  169. * and the capability is derived from `$settings`.
  170. * @type int $priority Order priority to load the control. Default 10.
  171. * @type string $section Section the control belongs to. Default empty.
  172. * @type string $label Label for the control. Default empty.
  173. * @type string $description Description for the control. Default empty.
  174. * @type array $choices List of choices for 'radio' or 'select' type controls, where
  175. * values are the keys, and labels are the values.
  176. * Default empty array.
  177. * @type array $input_attrs List of custom input attributes for control output, where
  178. * attribute names are the keys and values are the values. Not
  179. * used for 'checkbox', 'radio', 'select', 'textarea', or
  180. * 'dropdown-pages' control types. Default empty array.
  181. * @type bool $allow_addition Show UI for adding new content, currently only used for the
  182. * dropdown-pages control. Default false.
  183. * @type array $json Deprecated. Use WP_Customize_Control::json() instead.
  184. * @type string $type Control type. Core controls include 'text', 'checkbox',
  185. * 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional
  186. * input types such as 'email', 'url', 'number', 'hidden', and
  187. * 'date' are supported implicitly. Default 'text'.
  188. * @type callable $active_callback Active callback.
  189. * }
  190. */
  191. public function __construct( $manager, $id, $args = array() ) {
  192. $keys = array_keys( get_object_vars( $this ) );
  193. foreach ( $keys as $key ) {
  194. if ( isset( $args[ $key ] ) ) {
  195. $this->$key = $args[ $key ];
  196. }
  197. }
  198. $this->manager = $manager;
  199. $this->id = $id;
  200. if ( empty( $this->active_callback ) ) {
  201. $this->active_callback = array( $this, 'active_callback' );
  202. }
  203. self::$instance_count += 1;
  204. $this->instance_number = self::$instance_count;
  205. // Process settings.
  206. if ( ! isset( $this->settings ) ) {
  207. $this->settings = $id;
  208. }
  209. $settings = array();
  210. if ( is_array( $this->settings ) ) {
  211. foreach ( $this->settings as $key => $setting ) {
  212. $settings[ $key ] = $this->manager->get_setting( $setting );
  213. }
  214. } elseif ( is_string( $this->settings ) ) {
  215. $this->setting = $this->manager->get_setting( $this->settings );
  216. $settings['default'] = $this->setting;
  217. }
  218. $this->settings = $settings;
  219. }
  220. /**
  221. * Enqueue control related scripts/styles.
  222. *
  223. * @since 3.4.0
  224. */
  225. public function enqueue() {}
  226. /**
  227. * Check whether control is active to current Customizer preview.
  228. *
  229. * @since 4.0.0
  230. *
  231. * @return bool Whether the control is active to the current preview.
  232. */
  233. final public function active() {
  234. $control = $this;
  235. $active = call_user_func( $this->active_callback, $this );
  236. /**
  237. * Filters response of WP_Customize_Control::active().
  238. *
  239. * @since 4.0.0
  240. *
  241. * @param bool $active Whether the Customizer control is active.
  242. * @param WP_Customize_Control $control WP_Customize_Control instance.
  243. */
  244. $active = apply_filters( 'customize_control_active', $active, $control );
  245. return $active;
  246. }
  247. /**
  248. * Default callback used when invoking WP_Customize_Control::active().
  249. *
  250. * Subclasses can override this with their specific logic, or they may
  251. * provide an 'active_callback' argument to the constructor.
  252. *
  253. * @since 4.0.0
  254. *
  255. * @return true Always true.
  256. */
  257. public function active_callback() {
  258. return true;
  259. }
  260. /**
  261. * Fetch a setting's value.
  262. * Grabs the main setting by default.
  263. *
  264. * @since 3.4.0
  265. *
  266. * @param string $setting_key
  267. * @return mixed The requested setting's value, if the setting exists.
  268. */
  269. final public function value( $setting_key = 'default' ) {
  270. if ( isset( $this->settings[ $setting_key ] ) ) {
  271. return $this->settings[ $setting_key ]->value();
  272. }
  273. }
  274. /**
  275. * Refresh the parameters passed to the JavaScript via JSON.
  276. *
  277. * @since 3.4.0
  278. */
  279. public function to_json() {
  280. $this->json['settings'] = array();
  281. foreach ( $this->settings as $key => $setting ) {
  282. $this->json['settings'][ $key ] = $setting->id;
  283. }
  284. $this->json['type'] = $this->type;
  285. $this->json['priority'] = $this->priority;
  286. $this->json['active'] = $this->active();
  287. $this->json['section'] = $this->section;
  288. $this->json['content'] = $this->get_content();
  289. $this->json['label'] = $this->label;
  290. $this->json['description'] = $this->description;
  291. $this->json['instanceNumber'] = $this->instance_number;
  292. if ( 'dropdown-pages' === $this->type ) {
  293. $this->json['allow_addition'] = $this->allow_addition;
  294. }
  295. }
  296. /**
  297. * Get the data to export to the client via JSON.
  298. *
  299. * @since 4.1.0
  300. *
  301. * @return array Array of parameters passed to the JavaScript.
  302. */
  303. public function json() {
  304. $this->to_json();
  305. return $this->json;
  306. }
  307. /**
  308. * Checks if the user can use this control.
  309. *
  310. * Returns false if the user cannot manipulate one of the associated settings,
  311. * or if one of the associated settings does not exist. Also returns false if
  312. * the associated section does not exist or if its capability check returns
  313. * false.
  314. *
  315. * @since 3.4.0
  316. *
  317. * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true.
  318. */
  319. final public function check_capabilities() {
  320. if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) {
  321. return false;
  322. }
  323. foreach ( $this->settings as $setting ) {
  324. if ( ! $setting || ! $setting->check_capabilities() ) {
  325. return false;
  326. }
  327. }
  328. $section = $this->manager->get_section( $this->section );
  329. if ( isset( $section ) && ! $section->check_capabilities() ) {
  330. return false;
  331. }
  332. return true;
  333. }
  334. /**
  335. * Get the control's content for insertion into the Customizer pane.
  336. *
  337. * @since 4.1.0
  338. *
  339. * @return string Contents of the control.
  340. */
  341. final public function get_content() {
  342. ob_start();
  343. $this->maybe_render();
  344. return trim( ob_get_clean() );
  345. }
  346. /**
  347. * Check capabilities and render the control.
  348. *
  349. * @since 3.4.0
  350. * @uses WP_Customize_Control::render()
  351. */
  352. final public function maybe_render() {
  353. if ( ! $this->check_capabilities() ) {
  354. return;
  355. }
  356. /**
  357. * Fires just before the current Customizer control is rendered.
  358. *
  359. * @since 3.4.0
  360. *
  361. * @param WP_Customize_Control $control WP_Customize_Control instance.
  362. */
  363. do_action( 'customize_render_control', $this );
  364. /**
  365. * Fires just before a specific Customizer control is rendered.
  366. *
  367. * The dynamic portion of the hook name, `$this->id`, refers to
  368. * the control ID.
  369. *
  370. * @since 3.4.0
  371. *
  372. * @param WP_Customize_Control $control WP_Customize_Control instance.
  373. */
  374. do_action( "customize_render_control_{$this->id}", $this );
  375. $this->render();
  376. }
  377. /**
  378. * Renders the control wrapper and calls $this->render_content() for the internals.
  379. *
  380. * @since 3.4.0
  381. */
  382. protected function render() {
  383. $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
  384. $class = 'customize-control customize-control-' . $this->type;
  385. printf( '<li id="%s" class="%s">', esc_attr( $id ), esc_attr( $class ) );
  386. $this->render_content();
  387. echo '</li>';
  388. }
  389. /**
  390. * Get the data link attribute for a setting.
  391. *
  392. * @since 3.4.0
  393. * @since 4.9.0 Return a `data-customize-setting-key-link` attribute if a setting is not registered for the supplied setting key.
  394. *
  395. * @param string $setting_key
  396. * @return string Data link parameter, a `data-customize-setting-link` attribute if the `$setting_key` refers to a pre-registered setting,
  397. * and a `data-customize-setting-key-link` attribute if the setting is not yet registered.
  398. */
  399. public function get_link( $setting_key = 'default' ) {
  400. if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof WP_Customize_Setting ) {
  401. return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
  402. } else {
  403. return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"';
  404. }
  405. }
  406. /**
  407. * Render the data link attribute for the control's input element.
  408. *
  409. * @since 3.4.0
  410. * @uses WP_Customize_Control::get_link()
  411. *
  412. * @param string $setting_key
  413. */
  414. public function link( $setting_key = 'default' ) {
  415. echo $this->get_link( $setting_key );
  416. }
  417. /**
  418. * Render the custom attributes for the control's input element.
  419. *
  420. * @since 4.0.0
  421. */
  422. public function input_attrs() {
  423. foreach ( $this->input_attrs as $attr => $value ) {
  424. echo $attr . '="' . esc_attr( $value ) . '" ';
  425. }
  426. }
  427. /**
  428. * Render the control's content.
  429. *
  430. * Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`.
  431. *
  432. * Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`.
  433. * Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly.
  434. *
  435. * Control content can alternately be rendered in JS. See WP_Customize_Control::print_template().
  436. *
  437. * @since 3.4.0
  438. */
  439. protected function render_content() {
  440. $input_id = '_customize-input-' . $this->id;
  441. $description_id = '_customize-description-' . $this->id;
  442. $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : '';
  443. switch ( $this->type ) {
  444. case 'checkbox':
  445. ?>
  446. <span class="customize-inside-control-row">
  447. <input
  448. id="<?php echo esc_attr( $input_id ); ?>"
  449. <?php echo $describedby_attr; ?>
  450. type="checkbox"
  451. value="<?php echo esc_attr( $this->value() ); ?>"
  452. <?php $this->link(); ?>
  453. <?php checked( $this->value() ); ?>
  454. />
  455. <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $this->label ); ?></label>
  456. <?php if ( ! empty( $this->description ) ) : ?>
  457. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  458. <?php endif; ?>
  459. </span>
  460. <?php
  461. break;
  462. case 'radio':
  463. if ( empty( $this->choices ) ) {
  464. return;
  465. }
  466. $name = '_customize-radio-' . $this->id;
  467. ?>
  468. <?php if ( ! empty( $this->label ) ) : ?>
  469. <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
  470. <?php endif; ?>
  471. <?php if ( ! empty( $this->description ) ) : ?>
  472. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  473. <?php endif; ?>
  474. <?php foreach ( $this->choices as $value => $label ) : ?>
  475. <span class="customize-inside-control-row">
  476. <input
  477. id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"
  478. type="radio"
  479. <?php echo $describedby_attr; ?>
  480. value="<?php echo esc_attr( $value ); ?>"
  481. name="<?php echo esc_attr( $name ); ?>"
  482. <?php $this->link(); ?>
  483. <?php checked( $this->value(), $value ); ?>
  484. />
  485. <label for="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>"><?php echo esc_html( $label ); ?></label>
  486. </span>
  487. <?php endforeach; ?>
  488. <?php
  489. break;
  490. case 'select':
  491. if ( empty( $this->choices ) ) {
  492. return;
  493. }
  494. ?>
  495. <?php if ( ! empty( $this->label ) ) : ?>
  496. <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
  497. <?php endif; ?>
  498. <?php if ( ! empty( $this->description ) ) : ?>
  499. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  500. <?php endif; ?>
  501. <select id="<?php echo esc_attr( $input_id ); ?>" <?php echo $describedby_attr; ?> <?php $this->link(); ?>>
  502. <?php
  503. foreach ( $this->choices as $value => $label ) {
  504. echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
  505. }
  506. ?>
  507. </select>
  508. <?php
  509. break;
  510. case 'textarea':
  511. ?>
  512. <?php if ( ! empty( $this->label ) ) : ?>
  513. <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
  514. <?php endif; ?>
  515. <?php if ( ! empty( $this->description ) ) : ?>
  516. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  517. <?php endif; ?>
  518. <textarea
  519. id="<?php echo esc_attr( $input_id ); ?>"
  520. rows="5"
  521. <?php echo $describedby_attr; ?>
  522. <?php $this->input_attrs(); ?>
  523. <?php $this->link(); ?>
  524. ><?php echo esc_textarea( $this->value() ); ?></textarea>
  525. <?php
  526. break;
  527. case 'dropdown-pages':
  528. ?>
  529. <?php if ( ! empty( $this->label ) ) : ?>
  530. <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
  531. <?php endif; ?>
  532. <?php if ( ! empty( $this->description ) ) : ?>
  533. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  534. <?php endif; ?>
  535. <?php
  536. $dropdown_name = '_customize-dropdown-pages-' . $this->id;
  537. $show_option_none = __( '&mdash; Select &mdash;' );
  538. $option_none_value = '0';
  539. $dropdown = wp_dropdown_pages(
  540. array(
  541. 'name' => $dropdown_name,
  542. 'echo' => 0,
  543. 'show_option_none' => $show_option_none,
  544. 'option_none_value' => $option_none_value,
  545. 'selected' => $this->value(),
  546. )
  547. );
  548. if ( empty( $dropdown ) ) {
  549. $dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) );
  550. $dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) );
  551. $dropdown .= '</select>';
  552. }
  553. // Hackily add in the data link parameter.
  554. $dropdown = str_replace( '<select', '<select ' . $this->get_link() . ' id="' . esc_attr( $input_id ) . '" ' . $describedby_attr, $dropdown );
  555. // Even more hacikly add auto-draft page stubs.
  556. // @todo Eventually this should be removed in favor of the pages being injected into the underlying get_pages() call. See <https://github.com/xwp/wp-customize-posts/pull/250>.
  557. $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' );
  558. if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) {
  559. $auto_draft_page_options = '';
  560. foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) {
  561. $post = get_post( $auto_draft_page_id );
  562. if ( $post && 'page' === $post->post_type ) {
  563. $auto_draft_page_options .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $post->ID ), esc_html( $post->post_title ) );
  564. }
  565. }
  566. if ( $auto_draft_page_options ) {
  567. $dropdown = str_replace( '</select>', $auto_draft_page_options . '</select>', $dropdown );
  568. }
  569. }
  570. echo $dropdown;
  571. ?>
  572. <?php if ( $this->allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : // Currently tied to menus functionality. ?>
  573. <button type="button" class="button-link add-new-toggle">
  574. <?php
  575. /* translators: %s: Add New Page label. */
  576. printf( __( '+ %s' ), get_post_type_object( 'page' )->labels->add_new_item );
  577. ?>
  578. </button>
  579. <div class="new-content-item">
  580. <label for="create-input-<?php echo esc_attr( $this->id ); ?>"><span class="screen-reader-text"><?php _e( 'New page title' ); ?></span></label>
  581. <input type="text" id="create-input-<?php echo esc_attr( $this->id ); ?>" class="create-item-input" placeholder="<?php esc_attr_e( 'New page title&hellip;' ); ?>">
  582. <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button>
  583. </div>
  584. <?php endif; ?>
  585. <?php
  586. break;
  587. default:
  588. ?>
  589. <?php if ( ! empty( $this->label ) ) : ?>
  590. <label for="<?php echo esc_attr( $input_id ); ?>" class="customize-control-title"><?php echo esc_html( $this->label ); ?></label>
  591. <?php endif; ?>
  592. <?php if ( ! empty( $this->description ) ) : ?>
  593. <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>
  594. <?php endif; ?>
  595. <input
  596. id="<?php echo esc_attr( $input_id ); ?>"
  597. type="<?php echo esc_attr( $this->type ); ?>"
  598. <?php echo $describedby_attr; ?>
  599. <?php $this->input_attrs(); ?>
  600. <?php if ( ! isset( $this->input_attrs['value'] ) ) : ?>
  601. value="<?php echo esc_attr( $this->value() ); ?>"
  602. <?php endif; ?>
  603. <?php $this->link(); ?>
  604. />
  605. <?php
  606. break;
  607. }
  608. }
  609. /**
  610. * Render the control's JS template.
  611. *
  612. * This function is only run for control types that have been registered with
  613. * WP_Customize_Manager::register_control_type().
  614. *
  615. * In the future, this will also print the template for the control's container
  616. * element and be override-able.
  617. *
  618. * @since 4.1.0
  619. */
  620. final public function print_template() {
  621. ?>
  622. <script type="text/html" id="tmpl-customize-control-<?php echo esc_attr( $this->type ); ?>-content">
  623. <?php $this->content_template(); ?>
  624. </script>
  625. <?php
  626. }
  627. /**
  628. * An Underscore (JS) template for this control's content (but not its container).
  629. *
  630. * Class variables for this control class are available in the `data` JS object;
  631. * export custom variables by overriding WP_Customize_Control::to_json().
  632. *
  633. * @see WP_Customize_Control::print_template()
  634. *
  635. * @since 4.1.0
  636. */
  637. protected function content_template() {}
  638. }
  639. /**
  640. * WP_Customize_Color_Control class.
  641. */
  642. require_once ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php';
  643. /**
  644. * WP_Customize_Media_Control class.
  645. */
  646. require_once ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php';
  647. /**
  648. * WP_Customize_Upload_Control class.
  649. */
  650. require_once ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php';
  651. /**
  652. * WP_Customize_Image_Control class.
  653. */
  654. require_once ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php';
  655. /**
  656. * WP_Customize_Background_Image_Control class.
  657. */
  658. require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php';
  659. /**
  660. * WP_Customize_Background_Position_Control class.
  661. */
  662. require_once ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php';
  663. /**
  664. * WP_Customize_Cropped_Image_Control class.
  665. */
  666. require_once ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php';
  667. /**
  668. * WP_Customize_Site_Icon_Control class.
  669. */
  670. require_once ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php';
  671. /**
  672. * WP_Customize_Header_Image_Control class.
  673. */
  674. require_once ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php';
  675. /**
  676. * WP_Customize_Theme_Control class.
  677. */
  678. require_once ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php';
  679. /**
  680. * WP_Widget_Area_Customize_Control class.
  681. */
  682. require_once ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php';
  683. /**
  684. * WP_Widget_Form_Customize_Control class.
  685. */
  686. require_once ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php';
  687. /**
  688. * WP_Customize_Nav_Menu_Control class.
  689. */
  690. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php';
  691. /**
  692. * WP_Customize_Nav_Menu_Item_Control class.
  693. */
  694. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php';
  695. /**
  696. * WP_Customize_Nav_Menu_Location_Control class.
  697. */
  698. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php';
  699. /**
  700. * WP_Customize_Nav_Menu_Name_Control class.
  701. *
  702. * As this file is deprecated, it will trigger a deprecation notice if instantiated. In a subsequent
  703. * release, the require_once here will be removed and _deprecated_file() will be called if file is
  704. * required at all.
  705. *
  706. * @deprecated 4.9.0 This file is no longer used due to new menu creation UX.
  707. */
  708. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php';
  709. /**
  710. * WP_Customize_Nav_Menu_Locations_Control class.
  711. */
  712. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-locations-control.php';
  713. /**
  714. * WP_Customize_Nav_Menu_Auto_Add_Control class.
  715. */
  716. require_once ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php';
  717. /**
  718. * WP_Customize_Date_Time_Control class.
  719. */
  720. require_once ABSPATH . WPINC . '/customize/class-wp-customize-date-time-control.php';
  721. /**
  722. * WP_Sidebar_Block_Editor_Control class.
  723. */
  724. require_once ABSPATH . WPINC . '/customize/class-wp-sidebar-block-editor-control.php';