Skip to content

Commit 81c7c16

Browse files
Merge pull request #1094 from cloudinary/develop
3.2.13 (2)
2 parents ca4e61d + 2f05abd commit 81c7c16

File tree

5 files changed

+79
-35
lines changed

5 files changed

+79
-35
lines changed

languages/cloudinary.pot

Lines changed: 31 additions & 31 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: 2025-09-02 13:12:16+00:00\n"
7+
"POT-Creation-Date: 2025-09-12 09:34: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"
@@ -63,11 +63,11 @@ msgstr[1] ""
6363
msgid "No items found."
6464
msgstr ""
6565

66-
#: php/cache/class-cache-point.php:961 php/class-assets.php:1239
66+
#: php/cache/class-cache-point.php:961 php/class-assets.php:1262
6767
msgid "Cloudinary Asset"
6868
msgstr ""
6969

70-
#: php/cache/class-cache-point.php:962 php/class-assets.php:1240
70+
#: php/cache/class-cache-point.php:962 php/class-assets.php:1263
7171
msgid "Post type to represent a non-media library asset."
7272
msgstr ""
7373

@@ -87,114 +87,114 @@ msgstr ""
8787
msgid "Enable Cloudinary status"
8888
msgstr ""
8989

90-
#: php/class-assets.php:794
90+
#: php/class-assets.php:817
9191
msgid "Caching"
9292
msgstr ""
9393

94-
#: php/class-assets.php:805
94+
#: php/class-assets.php:828
9595
msgid "Creating shadow assets"
9696
msgstr ""
9797

98-
#: php/class-assets.php:816
98+
#: php/class-assets.php:839
9999
msgid "Updating asset storage"
100100
msgstr ""
101101

102-
#: php/class-assets.php:1283
102+
#: php/class-assets.php:1306
103103
msgid "Additional Asset Sync Settings"
104104
msgstr ""
105105

106-
#: php/class-assets.php:1303
106+
#: php/class-assets.php:1326
107107
msgid "Additional asset sync settings"
108108
msgstr ""
109109

110-
#: php/class-assets.php:1304
110+
#: php/class-assets.php:1327
111111
msgid ""
112112
"Enabling additional asset syncing will sync the toggled assets with "
113113
"Cloudinary to make use of advanced optimization and CDN delivery "
114114
"functionality."
115115
msgstr ""
116116

117-
#: php/class-assets.php:1305
117+
#: php/class-assets.php:1328
118118
msgid "Enable additional asset syncing"
119119
msgstr ""
120120

121-
#: php/class-assets.php:1344
121+
#: php/class-assets.php:1367
122122
msgid "External Asset Sync Settings"
123123
msgstr ""
124124

125-
#: php/class-assets.php:1393 php/class-cache.php:615
125+
#: php/class-assets.php:1416 php/class-cache.php:615
126126
msgid "Plugin"
127127
msgstr ""
128128

129-
#: php/class-assets.php:1429 php/class-cache.php:791
129+
#: php/class-assets.php:1452 php/class-cache.php:791
130130
msgid "Plugins"
131131
msgstr ""
132132

133-
#: php/class-assets.php:1447 php/class-cache.php:808
133+
#: php/class-assets.php:1470 php/class-cache.php:808
134134
msgid "Deliver assets from all plugin folders"
135135
msgstr ""
136136

137-
#: php/class-assets.php:1479 php/class-cache.php:651
137+
#: php/class-assets.php:1502 php/class-cache.php:651
138138
msgid "Theme"
139139
msgstr ""
140140

141-
#: php/class-assets.php:1511 php/class-cache.php:842
141+
#: php/class-assets.php:1534 php/class-cache.php:842
142142
msgid "Themes"
143143
msgstr ""
144144

145-
#: php/class-assets.php:1529 php/class-cache.php:859
145+
#: php/class-assets.php:1552 php/class-cache.php:859
146146
msgid "Deliver all assets from active theme."
147147
msgstr ""
148148

149-
#: php/class-assets.php:1554 php/class-assets.php:1589 php/class-cache.php:683
149+
#: php/class-assets.php:1577 php/class-assets.php:1612 php/class-cache.php:683
150150
#: php/class-cache.php:894
151151
msgid "WordPress"
152152
msgstr ""
153153

154-
#: php/class-assets.php:1563 php/class-cache.php:667
154+
#: php/class-assets.php:1586 php/class-cache.php:667
155155
msgid "WordPress Admin"
156156
msgstr ""
157157

158-
#: php/class-assets.php:1570 php/class-cache.php:674
158+
#: php/class-assets.php:1593 php/class-cache.php:674
159159
msgid "WordPress Includes"
160160
msgstr ""
161161

162-
#: php/class-assets.php:1607 php/class-cache.php:911
162+
#: php/class-assets.php:1630 php/class-cache.php:911
163163
msgid "Deliver all assets from WordPress core."
164164
msgstr ""
165165

166-
#: php/class-assets.php:1633 php/class-assets.php:1659 php/class-cache.php:707
166+
#: php/class-assets.php:1656 php/class-assets.php:1682 php/class-cache.php:707
167167
#: php/class-cache.php:946
168168
msgid "Content"
169169
msgstr ""
170170

171-
#: php/class-assets.php:1640 php/class-cache.php:698
171+
#: php/class-assets.php:1663 php/class-cache.php:698
172172
msgid "Uploads"
173173
msgstr ""
174174

175-
#: php/class-assets.php:1677 php/class-cache.php:963
175+
#: php/class-assets.php:1700 php/class-cache.php:963
176176
msgid "Deliver all content assets from WordPress Media Library."
177177
msgstr ""
178178

179-
#: php/class-assets.php:1701
179+
#: php/class-assets.php:1724
180180
msgid "Enable external assets"
181181
msgstr ""
182182

183-
#: php/class-assets.php:1702
183+
#: php/class-assets.php:1725
184184
msgid ""
185185
"Enabling external assets allows you to sync assets from specific external "
186186
"sources with Cloudinary."
187187
msgstr ""
188188

189-
#: php/class-assets.php:1712
189+
#: php/class-assets.php:1735
190190
msgid "Domains for each external source."
191191
msgstr ""
192192

193-
#: php/class-assets.php:1715
193+
#: php/class-assets.php:1738
194194
msgid "Enter a domain"
195195
msgstr ""
196196

197-
#: php/class-assets.php:1716
197+
#: php/class-assets.php:1739
198198
msgid "Press ENTER or SPACE or type comma or tab to continue."
199199
msgstr ""
200200

@@ -1290,12 +1290,12 @@ msgstr ""
12901290
msgid "Cloudinary %1$s %2$s Transformations"
12911291
msgstr ""
12921292

1293-
#: php/templates/taxonomy-transformation-fields.php:25
1293+
#: php/templates/taxonomy-transformation-fields.php:41
12941294
#. translators: The taxonomy label.
12951295
msgid "Cloudinary %s transformations"
12961296
msgstr ""
12971297

1298-
#: php/templates/taxonomy-transformation-fields.php:35
1298+
#: php/templates/taxonomy-transformation-fields.php:51
12991299
#. translators: %1$s is the taxonomy label, %2$s is the image settings link,
13001300
#. %4$s is the video settings link. The %3$s is the closing tags for the links.
13011301
msgid ""

php/assets/class-rest-assets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ public function rest_handle_state( $request ) {
258258
$state = $request['state'];
259259
foreach ( $ids as $id ) {
260260
$where = array(
261-
'post_id' => $id,
262-
'post_state' => 'asset',
261+
'post_id' => $id,
262+
'sync_type' => 'asset',
263263
);
264264
if ( 'delete' === $state ) {
265265
$data = array(

php/class-assets.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,32 @@ public function can_sync( $can, $asset_id ) {
273273
$can = false;
274274
}
275275

276+
// If the asset is set to a 'disable' state, we do not allow syncing.
277+
if ( $can && self::is_asset_type( $asset_id ) && $this->is_disable_state( $asset_id ) ) {
278+
$can = false;
279+
}
280+
276281
return $can;
277282
}
278283

284+
/**
285+
* Verify if the asset is set to a 'disable' state.
286+
*
287+
* @param int $asset_id The asset ID to check.
288+
*
289+
* @return bool
290+
*/
291+
protected function is_disable_state( $asset_id ) {
292+
global $wpdb;
293+
294+
$wpdb->cld_table = Utils::get_relationship_table();
295+
$media_context = Utils::get_media_context( $asset_id );
296+
$prepare = $wpdb->prepare( "SELECT `post_state` FROM $wpdb->cld_table WHERE post_id = %d AND media_context = %s;", (int) $asset_id, $media_context ); // phpcs:ignore WordPress.DB.PreparedSQL
297+
$state = $wpdb->get_var( $prepare ); // phpcs:ignore WordPress.DB
298+
299+
return 'disable' === $state;
300+
}
301+
279302
/**
280303
* Check if the post is a asset post type.
281304
*

php/class-delivery.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,11 @@ public function convert_tags( $content, $context = 'view' ) {
10691069
if ( empty( $relation['public_id'] || $url === $relation['public_id'] ) ) {
10701070
continue; // We don't need the public_id relation item.
10711071
}
1072+
1073+
if ( 'disable' === $relation['post_state'] ) {
1074+
continue; // We should not deliver disabled items.
1075+
}
1076+
10721077
$base = $type . ':' . $url;
10731078
$public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null;
10741079
$cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id );

php/templates/taxonomy-transformation-fields.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@
1313

1414
wp_add_inline_script( 'cloudinary', 'var CLD_GLOBAL_TRANSFORMATIONS = CLD_GLOBAL_TRANSFORMATIONS ? CLD_GLOBAL_TRANSFORMATIONS : {};', 'before' );
1515

16-
$tax_slug = Utils::get_sanitized_text( 'taxonomy' );
17-
$tax_labels = get_taxonomy_labels( get_taxonomy( $tax_slug ) );
16+
$tax_slug = Utils::get_sanitized_text( 'taxonomy' );
17+
18+
if ( empty( $tax_slug ) ) {
19+
return;
20+
}
21+
22+
$current_taxonomy = get_taxonomy( $tax_slug );
23+
24+
if ( ! $current_taxonomy instanceof WP_Taxonomy ) {
25+
return;
26+
}
27+
28+
$tax_labels = get_taxonomy_labels( $current_taxonomy );
29+
30+
if ( empty( $tax_labels ) ) {
31+
return;
32+
}
33+
1834
$cloudinary = get_plugin_instance();
1935
?>
2036
<div class="cloudinary-collapsible">

0 commit comments

Comments
 (0)