Pristine upstream, unpacked from the official wordpress.org tarball. https://wordpress.org/wordpress-7.1.1.tar.gz sha1 2a9d68474e8703aa3a66f80427b325e0941b6a1e (published by wordpress.org) sha256 3996fee13448ef12e07e9f0c77db2f655ffa1b7cde71c80a4965d3bf1fb956b3 This branch carries nothing but upstream releases, one commit each, and is never edited. It is the other side of the git-subtree merge that brings security releases into SiriusPress/wordpress/ — see SiriusPress/docs/upstream-merges.md.
65 lines
1.2 KiB
PHP
65 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Customize API: WP_Customize_Upload_Control class
|
|
*
|
|
* @package WordPress
|
|
* @subpackage Customize
|
|
* @since 4.4.0
|
|
*/
|
|
|
|
/**
|
|
* Customize Upload Control Class.
|
|
*
|
|
* @since 3.4.0
|
|
*
|
|
* @see WP_Customize_Media_Control
|
|
*/
|
|
class WP_Customize_Upload_Control extends WP_Customize_Media_Control {
|
|
/**
|
|
* Control type.
|
|
*
|
|
* @since 3.4.0
|
|
* @var string
|
|
*/
|
|
public $type = 'upload';
|
|
|
|
/**
|
|
* Media control mime type.
|
|
*
|
|
* @since 4.1.0
|
|
* @var string
|
|
*/
|
|
public $mime_type = '';
|
|
|
|
/**
|
|
* Button labels.
|
|
*
|
|
* @since 4.1.0
|
|
* @var array
|
|
*/
|
|
public $button_labels = array();
|
|
|
|
public $removed = ''; // Unused.
|
|
public $context; // Unused.
|
|
public $extensions = array(); // Unused.
|
|
|
|
/**
|
|
* Refresh the parameters passed to the JavaScript via JSON.
|
|
*
|
|
* @since 3.4.0
|
|
*
|
|
* @uses WP_Customize_Media_Control::to_json()
|
|
*/
|
|
public function to_json() {
|
|
parent::to_json();
|
|
|
|
$value = $this->value();
|
|
if ( $value ) {
|
|
// Get the attachment model for the existing file.
|
|
$attachment_id = attachment_url_to_postid( $value );
|
|
if ( $attachment_id ) {
|
|
$this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id );
|
|
}
|
|
}
|
|
}
|
|
}
|