Skip to content

Commit

Permalink
Merge pull request #966 from cloudinary/uat
Browse files Browse the repository at this point in the history
Uat
  • Loading branch information
bruckercloud authored Jul 29, 2024
2 parents e4dc6b5 + 4453fa2 commit 20dc1ec
Show file tree
Hide file tree
Showing 30 changed files with 504 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.8
3.1.9
2 changes: 1 addition & 1 deletion css/cloudinary.css

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
44 changes: 0 additions & 44 deletions css/images/circle.svg

This file was deleted.

Binary file modified css/images/connection-string.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion js/cloudinary.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion php/class-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,8 @@ public function get_asset( $post_id, $type = 'object' ) {
global $wpdb;

$wpdb->cld_table = Utils::get_relationship_table();
$prepare = $wpdb->prepare( "SELECT * FROM $wpdb->cld_table WHERE post_id = %d;", (int) $post_id );
$media_context = Utils::get_media_context( $post_id );
$prepare = $wpdb->prepare( "SELECT * FROM $wpdb->cld_table WHERE post_id = %d AND media_context = %s;", (int) $post_id, $media_context );
$result = $wpdb->get_row( $prepare, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL.NotPrepared

return $this->build_item( $result );
Expand Down
18 changes: 10 additions & 8 deletions php/class-delivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
use Cloudinary\Connect\Api;
use Cloudinary\Media\Filter;
use Cloudinary\Media\Global_Transformations;
use Cloudinary\Sync;
use Cloudinary\String_Replace;
use Cloudinary\UI\Component\HTML;
use Cloudinary\Delivery\Bypass;
use Cloudinary\Relate\Relationship;
use WP_Post;
use Cloudinary\Utils;

/**
* Plugin Delivery class.
Expand Down Expand Up @@ -335,11 +331,12 @@ public function generate_signature( $attachment_id ) {
if ( $relationship instanceof Relationship ) {
$public_id = $relationship->public_id;
}

$sizes = $this->get_sized( $attachment_id );
$settings_signature = self::get_settings_signature();
$relation_signature = $this->media->get_post_meta( $attachment_id, Sync::META_KEYS['relationship'], true );

return wp_json_encode( $sizes ) . $public_id . $sql . $settings_signature . $relation_signature;
return wp_json_encode( $sizes ) . $public_id . $sql . $settings_signature . $relation_signature . Utils::get_media_context( $attachment_id );
}

/**
Expand Down Expand Up @@ -544,9 +541,10 @@ public static function update_size_relations_public_id( $attachment_id, $public_
$relationship = Relationship::get_relationship( $attachment_id );

if ( $relationship instanceof Relationship ) {
$relationship->public_id = $public_id;
$relationship->public_hash = md5( (string) $public_id );
$relationship->signature = self::get_settings_signature();
$relationship->public_id = $public_id;
$relationship->public_hash = md5( (string) $public_id );
$relationship->signature = self::get_settings_signature();
$relationship->media_context = Utils::get_media_context( $attachment_id );
$relationship->save();
}
}
Expand Down Expand Up @@ -624,6 +622,7 @@ public static function create_size_relation( $attachment_id, $sized_url, $size =
'post_id' => $attachment_id,
'parent_path' => $parent_path,
'sized_url' => $sized_url,
'media_context' => Utils::get_media_context( $attachment_id ),
'width' => $width_height[0] ? $width_height[0] : 0,
'height' => $width_height[1] ? $width_height[1] : 0,
'format' => Utils::pathinfo( $sized_url, PATHINFO_EXTENSION ),
Expand Down Expand Up @@ -1013,6 +1012,9 @@ public function convert_tags( $content, $context = 'view' ) {
$base = $type . ':' . $url;
$public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null;
$cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id );
if ( empty( $cloudinary_url ) ) {
continue;
}
if ( ! empty( $relation['slashed'] ) && $relation['slashed'] ) {
$aliases[ $base . '?' ] = addcslashes( $cloudinary_url . '&', '/' );
$aliases[ $base ] = addcslashes( $cloudinary_url, '/' );
Expand Down
27 changes: 3 additions & 24 deletions php/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Cloudinary\Delivery\Lazy_Load;
use Cloudinary\Delivery\Responsive_Breakpoints;
use Cloudinary\Assets as CLD_Assets;
use Cloudinary\Integrations\WPML;
use Cloudinary\Media\Gallery;
use Cloudinary\Sync\Storage;
use Cloudinary\UI\State;
Expand All @@ -30,7 +31,7 @@ final class Plugin {
*
* @since 0.1
*
* @var Admin|CLD_Assets|Connect|Dashboard|Deactivation|Delivery|Extensions|Gallery|Lazy_Load|Media|Meta_Box|Relate|Report|Responsive_Breakpoints|REST_API|State|Storage|SVG|Sync|URL|null
* @var Admin|CLD_Assets|Connect|Dashboard|Deactivation|Delivery|Extensions|Gallery|Lazy_Load|Media|Meta_Box|Relate|Report|Responsive_Breakpoints|REST_API|State|Storage|SVG|Sync|URL[]|WPML|null
*/
public $components;
/**
Expand Down Expand Up @@ -89,29 +90,6 @@ final class Plugin {
*/
public $plugin_file;

/**
* Directory in plugin containing autoloaded classes.
*
* @var string
*/
protected $autoload_class_dir = 'php';

/**
* Autoload matches cache.
*
* @var array
*/
protected $autoload_matches_cache = array();

/**
* Holds the list of hooks.
*
* @since 0.1
*
* @var array
*/
public $hooks;

/**
* Holds the list of keys.
*/
Expand Down Expand Up @@ -166,6 +144,7 @@ public function init() {
$this->components['relate'] = new Relate( $this );
$this->components['metabox'] = new Meta_Box( $this );
$this->components['url'] = new URL( $this );
$this->components['wpml'] = new WPML( $this );
}

/**
Expand Down
8 changes: 5 additions & 3 deletions php/class-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function get_attachment_data( $post_id = null ) {
unset( $meta[ Sync::META_KEYS['cloudinary'] ], $meta[ Sync::META_KEYS['process_log'] ], $meta['_wp_attachment_metadata'] );
array_walk(
$meta,
static function( &$row ) {
static function ( &$row ) {
$row = reset( $row );
}
);
Expand All @@ -226,9 +226,11 @@ static function( &$row ) {
}

$wpdb->cld_table = Utils::get_relationship_table();
$media_context = Utils::get_media_context( $post->ID );
$prepare = $wpdb->prepare(
"SELECT * FROM {$wpdb->cld_table} WHERE post_id = %d;",
$post->ID
"SELECT * FROM {$wpdb->cld_table} WHERE post_id = %d AND media_context = %s;",
$post->ID,
$media_context
);
$relationship = $wpdb->get_row( $prepare ); // phpcs:ignore WordPress.DB.PreparedSQL,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching

Expand Down
Loading

0 comments on commit 20dc1ec

Please sign in to comment.