angelovcom.net

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-wp-customize-upload-control.php (1197B)


      1 <?php
      2 /**
      3  * Customize API: WP_Customize_Upload_Control class
      4  *
      5  * @package WordPress
      6  * @subpackage Customize
      7  * @since 4.4.0
      8  */
      9 
     10 /**
     11  * Customize Upload Control Class.
     12  *
     13  * @since 3.4.0
     14  *
     15  * @see WP_Customize_Media_Control
     16  */
     17 class WP_Customize_Upload_Control extends WP_Customize_Media_Control {
     18 	/**
     19 	 * Control type.
     20 	 *
     21 	 * @since 3.4.0
     22 	 * @var string
     23 	 */
     24 	public $type = 'upload';
     25 
     26 	/**
     27 	 * Media control mime type.
     28 	 *
     29 	 * @since 4.1.0
     30 	 * @var string
     31 	 */
     32 	public $mime_type = '';
     33 
     34 	/**
     35 	 * Button labels.
     36 	 *
     37 	 * @since 4.1.0
     38 	 * @var array
     39 	 */
     40 	public $button_labels = array();
     41 
     42 	public $removed = '';         // Unused.
     43 	public $context;              // Unused.
     44 	public $extensions = array(); // Unused.
     45 
     46 	/**
     47 	 * Refresh the parameters passed to the JavaScript via JSON.
     48 	 *
     49 	 * @since 3.4.0
     50 	 *
     51 	 * @uses WP_Customize_Media_Control::to_json()
     52 	 */
     53 	public function to_json() {
     54 		parent::to_json();
     55 
     56 		$value = $this->value();
     57 		if ( $value ) {
     58 			// Get the attachment model for the existing file.
     59 			$attachment_id = attachment_url_to_postid( $value );
     60 			if ( $attachment_id ) {
     61 				$this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id );
     62 			}
     63 		}
     64 	}
     65 }