git-svn-id: https://develop.svn.wordpress.org/trunk@22505 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c4b070dd07
commit
1d6fa49ae2
@ -172,7 +172,7 @@ class Custom_Image_Header {
|
|||||||
|
|
||||||
if ( ( 1 == $step || 3 == $step ) ) {
|
if ( ( 1 == $step || 3 == $step ) ) {
|
||||||
add_thickbox();
|
add_thickbox();
|
||||||
wp_enqueue_script( 'media-upload' );
|
wp_enqueue_media();
|
||||||
wp_enqueue_script( 'custom-header' );
|
wp_enqueue_script( 'custom-header' );
|
||||||
if ( current_theme_supports( 'custom-header', 'header-text' ) )
|
if ( current_theme_supports( 'custom-header', 'header-text' ) )
|
||||||
wp_enqueue_script( 'wp-color-picker' );
|
wp_enqueue_script( 'wp-color-picker' );
|
||||||
@ -534,13 +534,18 @@ class Custom_Image_Header {
|
|||||||
<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
|
<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
$image_library_url = get_upload_iframe_src( 'image', null, 'library' );
|
$modal_update_href = esc_url( add_query_arg( array(
|
||||||
$image_library_url = remove_query_arg( 'TB_iframe', $image_library_url );
|
'page' => 'custom-header',
|
||||||
$image_library_url = add_query_arg( array( 'context' => 'custom-header', 'TB_iframe' => 1 ), $image_library_url );
|
'step' => 2,
|
||||||
|
'_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
|
||||||
|
), admin_url('themes.php') ) );
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
|
<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
|
||||||
<a id="choose-from-library-link" class="button thickbox" href="<?php echo esc_url( $image_library_url ); ?>"><?php _e( 'Choose Image' ); ?></a>
|
<a id="choose-from-library-link" class="button"
|
||||||
|
data-update-link="<?php echo esc_attr( $modal_update_href ); ?>"
|
||||||
|
data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
|
||||||
|
data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></a>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
@ -746,7 +751,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
|
|||||||
<p class="submit">
|
<p class="submit">
|
||||||
<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
|
<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
|
if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
|
||||||
submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
|
submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
@ -800,7 +805,7 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
|
|||||||
|
|
||||||
if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
|
if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
|
||||||
wp_die( __( 'Cheatin’ uh?' ) );
|
wp_die( __( 'Cheatin’ uh?' ) );
|
||||||
|
|
||||||
if ( $_POST['oitar'] > 1 ) {
|
if ( $_POST['oitar'] > 1 ) {
|
||||||
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
|
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
|
||||||
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
|
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
// Fetch available headers and apply jQuery.masonry
|
var frame;
|
||||||
// once the images have loaded.
|
|
||||||
$( function() {
|
$( function() {
|
||||||
|
// Fetch available headers and apply jQuery.masonry
|
||||||
|
// once the images have loaded.
|
||||||
var $headers = $('.available-headers');
|
var $headers = $('.available-headers');
|
||||||
|
|
||||||
$headers.imagesLoaded( function() {
|
$headers.imagesLoaded( function() {
|
||||||
@ -9,5 +11,36 @@
|
|||||||
itemSelector: '.default-header'
|
itemSelector: '.default-header'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Build the choose from library frame.
|
||||||
|
$('#choose-from-library-link').click( function( event ) {
|
||||||
|
var $el = $(this);
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
frame = wp.media({
|
||||||
|
title: $el.data('choose'),
|
||||||
|
library: {
|
||||||
|
type: 'image'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
frame.toolbar.on( 'activate:select', function() {
|
||||||
|
frame.toolbar.view().add({
|
||||||
|
select: {
|
||||||
|
style: 'primary',
|
||||||
|
text: $el.data('update'),
|
||||||
|
|
||||||
|
click: function() {
|
||||||
|
var attachment = frame.state().get('selection').first(),
|
||||||
|
link = $el.data('updateLink');
|
||||||
|
|
||||||
|
window.location = link + '&file=' + attachment.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
frame.state('library');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user