mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 16:45:31 +01:00
0860bb2771
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs. See #41452. Built from https://develop.svn.wordpress.org/trunk@41162 git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
99 lines
3.2 KiB
PHP
99 lines
3.2 KiB
PHP
<?php
|
|
/**
|
|
* Customize API: WP_Customize_Site_Icon_Control class
|
|
*
|
|
* @package WordPress
|
|
* @subpackage Customize
|
|
* @since 4.4.0
|
|
*/
|
|
|
|
/**
|
|
* Customize Site Icon control class.
|
|
*
|
|
* Used only for custom functionality in JavaScript.
|
|
*
|
|
* @since 4.3.0
|
|
*
|
|
* @see WP_Customize_Cropped_Image_Control
|
|
*/
|
|
class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control {
|
|
|
|
/**
|
|
* Control type.
|
|
*
|
|
* @since 4.3.0
|
|
* @var string
|
|
*/
|
|
public $type = 'site_icon';
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @since 4.3.0
|
|
*
|
|
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
|
* @param string $id Control ID.
|
|
* @param array $args Optional. Arguments to override class property defaults.
|
|
*/
|
|
public function __construct( $manager, $id, $args = array() ) {
|
|
parent::__construct( $manager, $id, $args );
|
|
add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 );
|
|
}
|
|
|
|
/**
|
|
* Renders a JS template for the content of the site icon control.
|
|
*
|
|
* @since 4.5.0
|
|
*/
|
|
public function content_template() {
|
|
?>
|
|
<label for="{{ data.settings['default'] }}-button">
|
|
<# if ( data.label ) { #>
|
|
<span class="customize-control-title">{{ data.label }}</span>
|
|
<# } #>
|
|
<# if ( data.description ) { #>
|
|
<span class="description customize-control-description">{{{ data.description }}}</span>
|
|
<# } #>
|
|
</label>
|
|
|
|
<# if ( data.attachment && data.attachment.id ) { #>
|
|
<div class="attachment-media-view">
|
|
<# if ( data.attachment.sizes ) { #>
|
|
<div class="site-icon-preview wp-clearfix">
|
|
<div class="favicon-preview">
|
|
<img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="" />
|
|
|
|
<div class="favicon">
|
|
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
|
|
</div>
|
|
<span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
|
|
</div>
|
|
<img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
|
|
</div>
|
|
<# } #>
|
|
<div class="actions">
|
|
<# if ( data.canUpload ) { #>
|
|
<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
|
|
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
|
|
<# } #>
|
|
</div>
|
|
</div>
|
|
<# } else { #>
|
|
<div class="attachment-media-view">
|
|
<div class="placeholder">
|
|
<?php echo $this->button_labels['placeholder']; ?>
|
|
</div>
|
|
<div class="actions">
|
|
<# if ( data.defaultAttachment ) { #>
|
|
<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
|
|
<# } #>
|
|
<# if ( data.canUpload ) { #>
|
|
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
|
|
<# } #>
|
|
</div>
|
|
</div>
|
|
<# } #>
|
|
<?php
|
|
}
|
|
}
|