Sanitize image metadata
This commit is contained in:
parent
4ed8d46867
commit
2b6cbc7629
|
@ -1876,10 +1876,10 @@ class WC_API_Products extends WC_API_Resource {
|
|||
|
||||
if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
$title = wc_clean( $image_meta['title'] );
|
||||
}
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$content = $image_meta['caption'];
|
||||
$content = wc_clean( $image_meta['caption'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2457,10 +2457,10 @@ class WC_API_Products extends WC_API_Resource {
|
|||
|
||||
if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
$title = wc_clean( $image_meta['title'] );
|
||||
}
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$content = $image_meta['caption'];
|
||||
$content = wc_clean( $image_meta['caption'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2073,10 +2073,10 @@ class WC_CLI_Product extends WC_CLI_Command {
|
|||
|
||||
if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
$title = wc_clean( $image_meta['title'] );
|
||||
}
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$content = $image_meta['caption'];
|
||||
$content = wc_clean( $image_meta['caption'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,10 +124,10 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) {
|
|||
|
||||
if ( $image_meta = wp_read_image_metadata( $upload['file'] ) ) {
|
||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||
$title = $image_meta['title'];
|
||||
$title = wc_clean( $image_meta['title'] );
|
||||
}
|
||||
if ( trim( $image_meta['caption'] ) ) {
|
||||
$content = $image_meta['caption'];
|
||||
$content = wc_clean( $image_meta['caption'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue