Skip to content

Commit 0a6193f

Browse files
authored
Merge pull request #908 from cloudinary/uat
Version 3.1.5
2 parents 3130a24 + 6590f62 commit 0a6193f

File tree

12 files changed

+185
-53
lines changed

12 files changed

+185
-53
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.4
1+
3.1.5

js/inline-loader.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array(), 'version' => '25ccbb8ce37353267420');
1+
<?php return array('dependencies' => array(), 'version' => '980f7ffe080efd9cda16');

js/inline-loader.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

languages/cloudinary.pot

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: Cloudinary STABLETAG\n"
66
"Report-Msgid-Bugs-To: https://github.com/cloudinary/cloudinary_wordpress\n"
7-
"POT-Creation-Date: 2023-08-22 09:32:35+00:00\n"
7+
"POT-Creation-Date: 2023-10-10 10:18:43+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
@@ -776,16 +776,16 @@ msgstr ""
776776
msgid "Full Size"
777777
msgstr ""
778778

779-
#: php/connect/class-api.php:360
779+
#: php/connect/class-api.php:373
780780
msgid "No direct access to file system."
781781
msgstr ""
782782

783-
#: php/connect/class-api.php:455
783+
#: php/connect/class-api.php:468
784784
#. translators: variable is thread name and queue size.
785785
msgid "Uploading remote url: %1$s."
786786
msgstr ""
787787

788-
#: php/connect/class-api.php:586
788+
#: php/connect/class-api.php:599
789789
msgid "Could not get VIP file content"
790790
msgstr ""
791791

@@ -905,29 +905,29 @@ msgstr ""
905905
msgid "Attachment Display Settings"
906906
msgstr ""
907907

908-
#: php/media/class-gallery.php:343 php/media/class-gallery.php:344
908+
#: php/media/class-gallery.php:350 php/media/class-gallery.php:351
909909
msgid "Gallery settings"
910910
msgstr ""
911911

912-
#: php/media/class-gallery.php:352
912+
#: php/media/class-gallery.php:359
913913
msgid "Gallery Settings"
914914
msgstr ""
915915

916-
#: php/media/class-gallery.php:362
916+
#: php/media/class-gallery.php:369
917917
msgid "Replace WooCommerce Gallery"
918918
msgstr ""
919919

920-
#: php/media/class-gallery.php:363
920+
#: php/media/class-gallery.php:370
921921
msgid ""
922922
"Replace the default WooCommerce gallery with the Cloudinary Gallery on "
923923
"product pages."
924924
msgstr ""
925925

926-
#: php/media/class-gallery.php:371
926+
#: php/media/class-gallery.php:378
927927
msgid "Cloudinary Gallery block defaults"
928928
msgstr ""
929929

930-
#: php/media/class-gallery.php:374
930+
#: php/media/class-gallery.php:381
931931
msgid ""
932932
"The Cloudinary Gallery is available as a new block type which can be "
933933
"inserted to any post or page. Note, this is not available when using the "

package-lock.json

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"minimist": "^1.2.6",
126126
"npm-run-all": "^4.1.5",
127127
"null-loader": "^4.0.1",
128-
"postcss": "^8.1.6",
128+
"postcss": "^8.4.31",
129129
"postcss-color-function": "^4.1.0",
130130
"postcss-import": "^13.0.0",
131131
"postcss-loader": "^4.0.4",

php/class-delivery.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,10 @@ public function convert_tags( $content, $context = 'view' ) {
10321032
$replacements = array_merge( $replacements, $aliases );
10331033
}
10341034

1035+
// Sort by length, so we replace the longest first and prevent early replacements.
1036+
$keys = array_map( 'strlen', array_keys( $replacements ) );
1037+
array_multisort( $keys, SORT_DESC, $replacements );
1038+
10351039
// Update the post meta cache.
10361040
if ( is_singular() ) {
10371041
$has_cache = array();
@@ -1140,7 +1144,7 @@ protected function standardize_tag( $tag_element ) {
11401144
$local_size = filesize( get_attached_file( $tag_element['id'] ) );
11411145
}
11421146
$remote_size = get_post_meta( $tag_element['id'], Sync::META_KEYS['remote_size'], true );
1143-
$tag_element['atts']['data-filesize'] = size_format( $local_size );
1147+
$tag_element['atts']['data-filesize'] = size_format( $local_size );
11441148
$tag_element['atts']['data-optsize'] = size_format( $remote_size );
11451149
$tag_element['atts']['data-optformat'] = get_post_meta( $tag_element['id'], Sync::META_KEYS['remote_format'], true );
11461150
if ( ! empty( $local_size ) && ! empty( $remote_size ) ) {
@@ -1154,6 +1158,29 @@ protected function standardize_tag( $tag_element ) {
11541158

11551159
$tag_element['atts']['data-version'] = $this->media->get_cloudinary_version( $tag_element['id'] );
11561160

1161+
/**
1162+
* Bypass Cloudinary's SEO URLs.
1163+
*
1164+
* @hook cloudinary_bypass_seo_url
1165+
* @since 3.1.5
1166+
*
1167+
* @param $bypass_seo_url {bool} Whether to bypass SEO URLs.
1168+
*
1169+
* @return {bool}
1170+
*/
1171+
$bypass_seo_url = apply_filters( 'cloudinary_bypass_seo_url', false );
1172+
1173+
$tag_element['atts']['data-seo'] = ! $bypass_seo_url;
1174+
1175+
$resource_type = in_array( $tag_element['type'], array( 'image', 'video' ), true ) ? $tag_element['type'] : 'raw';
1176+
1177+
$args = array(
1178+
'delivery' => $this->media->get_media_delivery( $tag_element['id'] ),
1179+
'resource_type' => $resource_type,
1180+
);
1181+
1182+
$tag_element['atts']['data-public-id'] = $this->plugin->get_component( 'connect' )->api->get_public_id( $tag_element['id'], $args );
1183+
11571184
return $tag_element;
11581185
}
11591186

@@ -1182,9 +1209,10 @@ public function rebuild_tag( $tag_element ) {
11821209
if ( apply_filters( 'cloudinary_apply_breakpoints', true ) ) {
11831210
$meta = wp_get_attachment_metadata( $tag_element['id'] );
11841211
if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
1212+
$relationship = Relationship::get_relationship( $tag_element['id'] );
11851213
// Check overwrite.
11861214
$meta['overwrite_transformations'] = $tag_element['overwrite_transformations'];
1187-
$meta['cloudinary_id'] = $tag_element['atts']['data-public-id'];
1215+
$meta['cloudinary_id'] = $relationship->public_id;
11881216
$meta['transformations'] = $tag_element['transformations'];
11891217
// Add new srcset.
11901218
$element = wp_image_add_srcset_and_sizes( $tag_element['original'], $meta, $tag_element['id'] );
@@ -1318,7 +1346,7 @@ public function parse_element( $element ) {
13181346
$tag_element['height'] = ! empty( $attributes['height'] ) ? $attributes['height'] : $item['height'];
13191347
$attributes['data-public-id'] = $public_id;
13201348
$tag_element['format'] = $item['format'];
1321-
1349+
13221350
if ( 'img' === $tag_element['tag'] ) {
13231351
// Check if this is a crop or a scale.
13241352
$has_size = $this->media->get_size_from_url( $this->sanitize_url( $raw_url ) );

0 commit comments

Comments
 (0)