Allow disabling of custom header uploads via remove_theme_support. props jorbin, fixes #14837.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-10-17 07:12:34 +00:00
parent ddae2a0b15
commit d91842f870
2 changed files with 13 additions and 1 deletions

View File

@ -456,7 +456,7 @@ class Custom_Image_Header {
<?php } ?>
</td>
</tr>
<?php if ( current_theme_supports( 'custom-header-uploads' ) ) : ?>
<tr valign="top">
<th scope="row"><?php _e( 'Upload Image' ); ?></th>
<td>
@ -473,6 +473,7 @@ class Custom_Image_Header {
</form>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
@ -483,7 +484,11 @@ class Custom_Image_Header {
<tr valign="top">
<th scope="row"><?php _e( 'Default Images' ); ?></th>
<td>
<?php if ( current_theme_supports( 'custom-header-uploads' ) ) : ?>
<p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers.' ) ?></p>
<?php else: ?>
<p><?php _e( 'You can use one of these cool headers.' ) ?>
<?php endif; ?>
<?php
$this->show_default_header_selector();
?>
@ -570,6 +575,9 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
*/
function step_2() {
check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');
if ( ! current_theme_supports( 'custom-header-uploads' ) )
wp_die( 'Cheatin&#8217; uh?' );
$overrides = array('test_form' => false);
$file = wp_handle_upload($_FILES['import'], $overrides);
@ -650,6 +658,9 @@ wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
*/
function step_3() {
check_admin_referer('custom-header-crop-image');
if ( ! current_theme_supports( 'custom-header-uploads' ) )
wp_die( 'Cheatin&#8217; uh?' );
if ( $_POST['oitar'] > 1 ) {
$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];

View File

@ -1467,6 +1467,7 @@ function add_custom_image_header($header_callback, $admin_header_callback, $admi
add_action('wp_head', $header_callback);
add_theme_support( 'custom-header' );
add_theme_support( 'custom-header-uploads' );
if ( ! is_admin() )
return;