Upgarded to 4.17.4
This commit is contained in:
@ -67,14 +67,24 @@ class ET_Builder_Plugin_Compat_WP_Offload_S3 extends ET_Builder_Plugin_Compat_Ba
|
||||
global $as3cf;
|
||||
|
||||
$as3cf_s3_to_local = new AS3CF_S3_To_Local( $as3cf );
|
||||
$attachment_id = $attachment_id_pre;
|
||||
|
||||
$attachment_id = $as3cf_s3_to_local->get_attachment_id_from_url( $url );
|
||||
// In WP Offload Media 2.6 the get_attachment_id_from_url() method was renamed to get_item_source_from_url().
|
||||
// Now the method also returns bool or array. If it's an array we need to process it.
|
||||
if ( method_exists( $as3cf_s3_to_local, 'get_item_source_from_url' ) ) {
|
||||
$item_source = $as3cf_s3_to_local->get_item_source_from_url( $url );
|
||||
|
||||
if ( $attachment_id ) {
|
||||
return $attachment_id;
|
||||
if ( is_array( $item_source ) && array_key_exists( 'id', $item_source ) ) {
|
||||
$attachment_id = $item_source['id'];
|
||||
}
|
||||
}
|
||||
|
||||
return $attachment_id_pre;
|
||||
// Pre 2.6. get_attachment_id_from_url() will return the attachment ID.
|
||||
if ( method_exists( $as3cf_s3_to_local, 'get_attachment_id_from_url' ) ) {
|
||||
$attachment_id = $as3cf_s3_to_local->get_attachment_id_from_url( $url );
|
||||
}
|
||||
|
||||
return $attachment_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user