Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions php/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ public function default_image_freeform_transformations( $default ) {
* @return string The converted URL.
*/
public function cloudinary_url( $attachment_id, $size = array(), $transformations = array(), $cloudinary_id = null, $overwrite_transformations = false ) {
if ( ! ( $cloudinary_id ) ) {
if ( ! $cloudinary_id ) {
$cloudinary_id = $this->cloudinary_id( $attachment_id );
if ( ! $cloudinary_id ) {
return null;
Expand Down Expand Up @@ -1159,7 +1159,7 @@ public function get_cloudinary_id( $attachment_id ) {
*
* @param int $attachment_id The ID to get Cloudinary id for.
*
* @return string|false the ID or null if not existing.
* @return string|false the ID or false if not existing.
*/
public function cloudinary_id( $attachment_id ) {
static $cloudinary_ids = array();
Expand All @@ -1170,8 +1170,8 @@ public function cloudinary_id( $attachment_id ) {
}

if ( ! $this->is_media( $attachment_id ) ) {
$cloudinary_ids[ $attachment_id ] = null;
return null;
$cloudinary_ids[ $attachment_id ] = false;
return false;
}

if ( ! $this->sync->is_synced( $attachment_id ) && ! defined( 'REST_REQUEST' ) ) {
Expand Down Expand Up @@ -1857,7 +1857,7 @@ public function get_post_meta( $post_id, $key = '', $single = false ) {
}
}
if ( '' !== $key ) {
$meta = isset( $meta[ $key ] ) ? $meta[ $key ] : '';
$meta = isset( $meta[ $key ] ) ? $meta[ $key ] : null;
}

return $single ? $meta : (array) $meta;
Expand Down
3 changes: 2 additions & 1 deletion php/class-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public function image_meta_viewer() {
*/
public function render( $post ) {
if ( 'attachment' === $post->post_type ) {
$meta = wp_get_attachment_metadata( $post->ID );
$sync = $this->plugin->get_component( 'sync' );
$meta = get_post_meta( $post->ID, $sync::META_KEYS['cloudinary'], true );

$args = array(
'type' => 'tag',
Expand Down
2 changes: 1 addition & 1 deletion php/class-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public function setup_sync_base_struct() {
'priority' => 25,
'sync' => array( $this->managers['upload'], 'explicit_update' ),
'validate' => function ( $attachment_id ) {
$delivery = $this->managers['media']->get_post_meta( $attachment_id, self::META_KEYS['delivery'] );
$delivery = $this->managers['media']->get_post_meta( $attachment_id, self::META_KEYS['delivery'], true );

return empty( $delivery ) || 'upload' === $delivery;
},
Expand Down
4 changes: 2 additions & 2 deletions php/connect/class-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,13 @@ function_exists( 'wp_get_original_image_url' ) &&
} else {
$file_url = wp_get_attachment_url( $attachment_id );
}
if ( ! is_local_attachment( $attachment_id ) ) {
$media = get_plugin_instance()->get_component( 'media' );
if ( ! $media->is_local_media( $attachment_id ) ) {
$disable_https_fetch = false; // Remote can upload via url.
// translators: variable is thread name and queue size.
$action_message = sprintf( __( 'Uploading remote url: %1$s.', 'cloudinary' ), $file_url );
do_action( '_cloudinary_queue_action', $action_message );
}
$media = get_plugin_instance()->get_component( 'media' );
$tempfile = false;
if ( $media && $media->is_cloudinary_url( $file_url ) ) {
// If this is a Cloudinary URL, then we can use it to fetch from that location.
Expand Down