Skip to content

Commit 0c4f085

Browse files
author
Marco Pereirinha
committed
Merge branch 'hotfix/3.2.2-build-1' into fix/post-save-v3
2 parents eac63a4 + 328fc05 commit 0c4f085

6 files changed

Lines changed: 53 additions & 23 deletions

File tree

php/class-utils.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,11 @@ public static function looks_like_json( $thing ) {
546546
}
547547

548548
$thing = trim( $thing );
549-
549+
550550
if ( empty( $thing ) ) {
551551
return false;
552552
}
553-
553+
554554
if ( ! in_array( $thing[0], array( '{', '[' ), true ) ) {
555555
return false;
556556
}
@@ -1267,4 +1267,38 @@ public static function rest_url( $path = '', $scheme = null ) {
12671267
*/
12681268
return apply_filters( 'cloudinary_rest_url', $rest_url, $path, $scheme );
12691269
}
1270+
1271+
/**
1272+
* Get the transformations title.
1273+
*
1274+
* @param string $context The context.
1275+
*
1276+
* @return string
1277+
*/
1278+
public static function get_transformations_title( $context ) {
1279+
$transformations_title = __( 'Cloudinary global transformations', 'cloudinary' );
1280+
$taxonomy_slug = static::get_sanitized_text( 'taxonomy' );
1281+
1282+
if ( $taxonomy_slug ) {
1283+
$taxonomy = get_taxonomy( $taxonomy_slug );
1284+
$transformations_title = sprintf(
1285+
// translators: %1$s is the taxonomy label and the %2$s is the context of the use.
1286+
__( '%1$s %2$s transformations', 'cloudinary' ),
1287+
$taxonomy->labels->singular_name,
1288+
$context
1289+
);
1290+
1291+
$taxonomy_id = static::get_sanitized_text( 'tag_ID' );
1292+
1293+
if ( $taxonomy_id ) {
1294+
$transformations_title = sprintf(
1295+
// translators: %s is the term name.
1296+
__( '%s transformations', 'cloudinary' ),
1297+
get_term( $taxonomy_id )->name
1298+
);
1299+
}
1300+
}
1301+
1302+
return $transformations_title;
1303+
}
12701304
}

php/templates/taxonomy-transformation-fields.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,21 @@
2222
<h2>
2323
<?php
2424
// translators: The taxonomy label.
25-
echo esc_html( sprintf( __( 'Cloudinary %s transformations', 'cloudinary' ), strtolower( $tax_labels->singular_name ) ) );
25+
echo esc_html( sprintf( __( 'Cloudinary %s transformations', 'cloudinary' ), $tax_labels->singular_name ) );
2626
?>
2727
</h2>
2828
<button type="button"><i class="dashicons dashicons-arrow-down-alt2"></i></button>
2929
</div>
3030
<div class="cloudinary-collapsible__content" style="display:none;">
3131
<div class="cld-more-details">
3232
<?php
33-
echo esc_html(
34-
sprintf(
35-
// translators: The taxonomy label.
36-
__( 'Additional transformations for this %s that will be appended to the globally defined Cloudinary transformations.', 'cloudinary' ),
37-
$tax_labels->singular_name
38-
)
33+
printf(
34+
// 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.
35+
esc_html__( 'Add these %1$s-specific transformations to the global Cloudinary transformations in the plugin\'s %2$simage%3$s and %4$svideo%3$s settings.', 'cloudinary' ),
36+
esc_html( $tax_labels->singular_name ),
37+
'<a href="' . esc_url( admin_url( 'admin.php?page=cloudinary_image_settings#text-image-settings.image-freeform' ) ) . '">',
38+
'</a>',
39+
'<a href="' . esc_url( admin_url( 'admin.php?page=cloudinary_video_settings#text-video-settings.video-freeform' ) ) . '">'
3940
)
4041
?>
4142
</div>

php/ui/component/class-notice.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Cloudinary\REST_API;
1111
use Cloudinary\UI\Component;
12+
use Cloudinary\Utils;
1213

1314
/**
1415
* Frame Component to render components only.

php/ui/component/class-text.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ protected function wrap( $struct ) {
4444
'cld-input-' . $this->type,
4545
);
4646

47+
if ( $this->setting->has_param( 'anchor' ) ) {
48+
$struct['attributes']['id'] = 'text-' . str_replace( '_', '-', $this->setting->get_slug() );
49+
}
50+
4751
return $struct;
4852
}
4953

ui-definitions/settings-image.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
use Cloudinary\Utils;
99
use function Cloudinary\get_plugin_instance;
1010

11-
$transformations_title = __( 'Cloudinary global transformations', 'cloudinary' );
12-
13-
$taxonomy_slug = Utils::get_sanitized_text( 'taxonomy' );
14-
15-
if ( $taxonomy_slug ) {
16-
$transformations_title = __( 'Term transformations', 'cloudinary' );
17-
}
11+
$transformations_title = Utils::get_transformations_title( esc_html__( 'Image', 'cloudinary' ) );
1812

1913
$settings = array(
2014
array(
@@ -161,6 +155,7 @@
161155
'slug' => 'image_freeform',
162156
'title' => $transformations_title,
163157
'default' => '',
158+
'anchor' => true,
164159
'tooltip_text' => sprintf(
165160
// translators: The link to transformation reference.
166161
__(

ui-definitions/settings-video.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
use Cloudinary\Utils;
99
use function Cloudinary\get_plugin_instance;
1010

11-
$transformations_title = __( 'Cloudinary global transformations', 'cloudinary' );
12-
13-
$taxonomy_slug = Utils::get_sanitized_text( 'taxonomy' );
14-
15-
if ( $taxonomy_slug ) {
16-
$transformations_title = __( 'Term transformations', 'cloudinary' );
17-
}
11+
$transformations_title = Utils::get_transformations_title( esc_html__( 'Video', 'cloudinary' ) );
1812

1913
$settings = array(
2014
array(
@@ -247,6 +241,7 @@
247241
'slug' => 'video_freeform',
248242
'title' => $transformations_title,
249243
'default' => '',
244+
'anchor' => true,
250245
'tooltip_text' => sprintf(
251246
// translators: The link to transformation reference.
252247
__(

0 commit comments

Comments
 (0)