placeholder images for hidden/secure files
This commit is contained in:
parent
c7fd3e85a6
commit
6bb5ec424e
|
@ -132,7 +132,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|||
<div class="file_path_field">
|
||||
<label><?php _e( 'File paths:', 'woocommerce' ); ?> <a class="tips" data-tip="<?php _e( 'Enter one or more File Paths, one per line, to make this variation a downloadable product, or leave blank.', 'woocommerce' ); ?>" href="#">[?]</a></label>
|
||||
<textarea style="float:left;" class="short file_paths" cols="20" rows="2" placeholder="<?php _e( 'File paths/URLs, one per line', 'woocommerce' ); ?>" name="variable_file_paths[<?php echo $loop; ?>]" wrap="off"><?php if ( isset( $_file_paths ) ) echo esc_textarea( $_file_paths ); ?></textarea>
|
||||
<input type="button" class="upload_file_button button" value="<?php _e( 'Upload a file', 'woocommerce' ); ?>" title="<?php _e( 'Upload', 'woocommerce' ); ?>" data-choose="<?php _e( 'Choose a file', 'woocommerce' ); ?>" data-update="<?php _e( 'Insert file URL', 'woocommerce' ); ?>" value="<?php _e( 'Choose a file', 'woocommerce' ); ?>" />
|
||||
<input type="button" class="upload_file_button button" value="<?php _e( 'Choose a file', 'woocommerce' ); ?>" title="<?php _e( 'Upload', 'woocommerce' ); ?>" data-choose="<?php _e( 'Choose a file', 'woocommerce' ); ?>" data-update="<?php _e( 'Insert file URL', 'woocommerce' ); ?>" value="<?php _e( 'Choose a file', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -36,6 +36,39 @@ function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
|
|||
return str_replace( array( ' ', '_' ), '-', strtolower( $taxonomy ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* woocommerce_get_attachment_image_attributes function.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $attr
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_get_attachment_image_attributes( $attr ) {
|
||||
if ( strstr( $attr['src'], 'woocommerce_uploads/' ) )
|
||||
$attr['src'] = woocommerce_placeholder_img_src();
|
||||
|
||||
return $attr;
|
||||
}
|
||||
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'woocommerce_get_attachment_image_attributes' );
|
||||
|
||||
|
||||
function woocommerce_prepare_attachment_for_js( $response ) {
|
||||
|
||||
if ( isset( $response['url'] ) && strstr( $response['url'], 'woocommerce_uploads/' ) ) {
|
||||
$response['full']['url'] = woocommerce_placeholder_img_src();
|
||||
if ( $response['sizes'] ) {
|
||||
foreach( $response['sizes'] as $size => $value ) {
|
||||
$response['sizes'][ $size ]['url'] = woocommerce_placeholder_img_src();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
add_filter( 'wp_prepare_attachment_for_js', 'woocommerce_prepare_attachment_for_js' );
|
||||
|
||||
/**
|
||||
* woocommerce_get_dimension function.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue