diff --git a/languages/cloudinary.pot b/languages/cloudinary.pot index 3b5dcf4a9..76eed4e58 100644 --- a/languages/cloudinary.pot +++ b/languages/cloudinary.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Cloudinary STABLETAG\n" "Report-Msgid-Bugs-To: https://github.com/cloudinary/cloudinary_wordpress\n" -"POT-Creation-Date: 2025-09-02 13:12:16+00:00\n" +"POT-Creation-Date: 2025-09-12 09:34:43+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -63,11 +63,11 @@ msgstr[1] "" msgid "No items found." msgstr "" -#: php/cache/class-cache-point.php:961 php/class-assets.php:1239 +#: php/cache/class-cache-point.php:961 php/class-assets.php:1262 msgid "Cloudinary Asset" msgstr "" -#: php/cache/class-cache-point.php:962 php/class-assets.php:1240 +#: php/cache/class-cache-point.php:962 php/class-assets.php:1263 msgid "Post type to represent a non-media library asset." msgstr "" @@ -87,114 +87,114 @@ msgstr "" msgid "Enable Cloudinary status" msgstr "" -#: php/class-assets.php:794 +#: php/class-assets.php:817 msgid "Caching" msgstr "" -#: php/class-assets.php:805 +#: php/class-assets.php:828 msgid "Creating shadow assets" msgstr "" -#: php/class-assets.php:816 +#: php/class-assets.php:839 msgid "Updating asset storage" msgstr "" -#: php/class-assets.php:1283 +#: php/class-assets.php:1306 msgid "Additional Asset Sync Settings" msgstr "" -#: php/class-assets.php:1303 +#: php/class-assets.php:1326 msgid "Additional asset sync settings" msgstr "" -#: php/class-assets.php:1304 +#: php/class-assets.php:1327 msgid "" "Enabling additional asset syncing will sync the toggled assets with " "Cloudinary to make use of advanced optimization and CDN delivery " "functionality." msgstr "" -#: php/class-assets.php:1305 +#: php/class-assets.php:1328 msgid "Enable additional asset syncing" msgstr "" -#: php/class-assets.php:1344 +#: php/class-assets.php:1367 msgid "External Asset Sync Settings" msgstr "" -#: php/class-assets.php:1393 php/class-cache.php:615 +#: php/class-assets.php:1416 php/class-cache.php:615 msgid "Plugin" msgstr "" -#: php/class-assets.php:1429 php/class-cache.php:791 +#: php/class-assets.php:1452 php/class-cache.php:791 msgid "Plugins" msgstr "" -#: php/class-assets.php:1447 php/class-cache.php:808 +#: php/class-assets.php:1470 php/class-cache.php:808 msgid "Deliver assets from all plugin folders" msgstr "" -#: php/class-assets.php:1479 php/class-cache.php:651 +#: php/class-assets.php:1502 php/class-cache.php:651 msgid "Theme" msgstr "" -#: php/class-assets.php:1511 php/class-cache.php:842 +#: php/class-assets.php:1534 php/class-cache.php:842 msgid "Themes" msgstr "" -#: php/class-assets.php:1529 php/class-cache.php:859 +#: php/class-assets.php:1552 php/class-cache.php:859 msgid "Deliver all assets from active theme." msgstr "" -#: php/class-assets.php:1554 php/class-assets.php:1589 php/class-cache.php:683 +#: php/class-assets.php:1577 php/class-assets.php:1612 php/class-cache.php:683 #: php/class-cache.php:894 msgid "WordPress" msgstr "" -#: php/class-assets.php:1563 php/class-cache.php:667 +#: php/class-assets.php:1586 php/class-cache.php:667 msgid "WordPress Admin" msgstr "" -#: php/class-assets.php:1570 php/class-cache.php:674 +#: php/class-assets.php:1593 php/class-cache.php:674 msgid "WordPress Includes" msgstr "" -#: php/class-assets.php:1607 php/class-cache.php:911 +#: php/class-assets.php:1630 php/class-cache.php:911 msgid "Deliver all assets from WordPress core." msgstr "" -#: php/class-assets.php:1633 php/class-assets.php:1659 php/class-cache.php:707 +#: php/class-assets.php:1656 php/class-assets.php:1682 php/class-cache.php:707 #: php/class-cache.php:946 msgid "Content" msgstr "" -#: php/class-assets.php:1640 php/class-cache.php:698 +#: php/class-assets.php:1663 php/class-cache.php:698 msgid "Uploads" msgstr "" -#: php/class-assets.php:1677 php/class-cache.php:963 +#: php/class-assets.php:1700 php/class-cache.php:963 msgid "Deliver all content assets from WordPress Media Library." msgstr "" -#: php/class-assets.php:1701 +#: php/class-assets.php:1724 msgid "Enable external assets" msgstr "" -#: php/class-assets.php:1702 +#: php/class-assets.php:1725 msgid "" "Enabling external assets allows you to sync assets from specific external " "sources with Cloudinary." msgstr "" -#: php/class-assets.php:1712 +#: php/class-assets.php:1735 msgid "Domains for each external source." msgstr "" -#: php/class-assets.php:1715 +#: php/class-assets.php:1738 msgid "Enter a domain" msgstr "" -#: php/class-assets.php:1716 +#: php/class-assets.php:1739 msgid "Press ENTER or SPACE or type comma or tab to continue." msgstr "" @@ -1290,12 +1290,12 @@ msgstr "" msgid "Cloudinary %1$s %2$s Transformations" msgstr "" -#: php/templates/taxonomy-transformation-fields.php:25 +#: php/templates/taxonomy-transformation-fields.php:41 #. translators: The taxonomy label. msgid "Cloudinary %s transformations" msgstr "" -#: php/templates/taxonomy-transformation-fields.php:35 +#: php/templates/taxonomy-transformation-fields.php:51 #. translators: %1$s is the taxonomy label, %2$s is the image settings link, #. %4$s is the video settings link. The %3$s is the closing tags for the links. msgid "" diff --git a/php/assets/class-rest-assets.php b/php/assets/class-rest-assets.php index 15d4e1fef..a7502de63 100644 --- a/php/assets/class-rest-assets.php +++ b/php/assets/class-rest-assets.php @@ -258,8 +258,8 @@ public function rest_handle_state( $request ) { $state = $request['state']; foreach ( $ids as $id ) { $where = array( - 'post_id' => $id, - 'post_state' => 'asset', + 'post_id' => $id, + 'sync_type' => 'asset', ); if ( 'delete' === $state ) { $data = array( diff --git a/php/class-assets.php b/php/class-assets.php index 34349c5df..a83b70b5e 100644 --- a/php/class-assets.php +++ b/php/class-assets.php @@ -273,9 +273,32 @@ public function can_sync( $can, $asset_id ) { $can = false; } + // If the asset is set to a 'disable' state, we do not allow syncing. + if ( $can && self::is_asset_type( $asset_id ) && $this->is_disable_state( $asset_id ) ) { + $can = false; + } + return $can; } + /** + * Verify if the asset is set to a 'disable' state. + * + * @param int $asset_id The asset ID to check. + * + * @return bool + */ + protected function is_disable_state( $asset_id ) { + global $wpdb; + + $wpdb->cld_table = Utils::get_relationship_table(); + $media_context = Utils::get_media_context( $asset_id ); + $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 + $state = $wpdb->get_var( $prepare ); // phpcs:ignore WordPress.DB + + return 'disable' === $state; + } + /** * Check if the post is a asset post type. * diff --git a/php/class-delivery.php b/php/class-delivery.php index 3b415685a..e4e58a1ab 100644 --- a/php/class-delivery.php +++ b/php/class-delivery.php @@ -1069,6 +1069,11 @@ public function convert_tags( $content, $context = 'view' ) { if ( empty( $relation['public_id'] || $url === $relation['public_id'] ) ) { continue; // We don't need the public_id relation item. } + + if ( 'disable' === $relation['post_state'] ) { + continue; // We should not deliver disabled items. + } + $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 ); diff --git a/php/templates/taxonomy-transformation-fields.php b/php/templates/taxonomy-transformation-fields.php index 90b04794b..63146ff4b 100644 --- a/php/templates/taxonomy-transformation-fields.php +++ b/php/templates/taxonomy-transformation-fields.php @@ -13,8 +13,24 @@ wp_add_inline_script( 'cloudinary', 'var CLD_GLOBAL_TRANSFORMATIONS = CLD_GLOBAL_TRANSFORMATIONS ? CLD_GLOBAL_TRANSFORMATIONS : {};', 'before' ); -$tax_slug = Utils::get_sanitized_text( 'taxonomy' ); -$tax_labels = get_taxonomy_labels( get_taxonomy( $tax_slug ) ); +$tax_slug = Utils::get_sanitized_text( 'taxonomy' ); + +if ( empty( $tax_slug ) ) { + return; +} + +$current_taxonomy = get_taxonomy( $tax_slug ); + +if ( ! $current_taxonomy instanceof WP_Taxonomy ) { + return; +} + +$tax_labels = get_taxonomy_labels( $current_taxonomy ); + +if ( empty( $tax_labels ) ) { + return; +} + $cloudinary = get_plugin_instance(); ?>