Skip to content

Commit d97c2a2

Browse files
authored
Merge pull request #862 from cloudinary/improvements/vip-feedback
Improvements vip feedback
2 parents 1e1d7ad + 334aa65 commit d97c2a2

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

php/cache/class-cache-point.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,14 @@ public function delete_meta( $check, $object_id, $meta_key, $meta_value ) {
198198
public function get_meta( $check, $object_id, $meta_key ) {
199199

200200
if ( self::POST_TYPE_SLUG === get_post_type( $object_id ) ) {
201-
$meta = $this->get_meta_cache( $object_id );
201+
$meta = $this->get_meta_cache( $object_id );
202+
$value = '';
203+
202204
if ( empty( $meta_key ) ) {
203205
$value = $meta;
204206
} elseif ( isset( $meta[ $meta_key ] ) ) {
207+
$value = array();
205208
$value[] = $meta[ $meta_key ];
206-
} else {
207-
$value = '';
208209
}
209210

210211
return $value;
@@ -431,11 +432,12 @@ protected function load_cache_point( $url ) {
431432
$url = trailingslashit( $url );
432433
$cache_point = null;
433434
$params = array(
434-
'name' => $key,
435-
'post_type' => self::POST_TYPE_SLUG,
436-
'posts_per_page' => 1,
435+
'name' => $key,
436+
'post_type' => self::POST_TYPE_SLUG,
437+
'posts_per_page' => 1,
438+
'suppress_filters' => false,
437439
);
438-
$found = get_posts( $params );
440+
$found = get_posts( $params ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts
439441
if ( ! empty( $found ) ) {
440442
$cache_point = array_shift( $found );
441443
$this->registered_cache_points[ $url ] = $cache_point;

php/cache/class-file-system.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function get_file_src_root( $file_url ) {
182182
*/
183183
public function get_location( $path ) {
184184
$location_path = trailingslashit( dirname( $path ) );
185-
$type = array_search( $location_path, $this->paths );
185+
$type = array_search( $location_path, $this->paths, true );
186186

187187
return $type ? $type : 'root';
188188
}
@@ -346,7 +346,7 @@ function ( $file ) use ( $files ) {
346346
$offset = strlen( $file ) - strlen( $ext );
347347
$min_file = substr( $file, 0, $offset ) . 'min.' . $ext;
348348

349-
return ! in_array( $min_file, $files );
349+
return ! in_array( $min_file, $files, true );
350350
}
351351
);
352352

php/class-admin.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function render() {
308308
// If the section has a defined template, use that instead eg. wizard.
309309
$file = $this->plugin->dir_path . 'ui-definitions/components/' . $template . '.php';
310310
}
311-
include $file;
311+
include $file; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
312312
}
313313

314314
/**
@@ -414,7 +414,6 @@ public function init_setting_save() {
414414
$saving = filter_input_array( INPUT_POST, $args, false );
415415
if ( ! empty( $saving ) && ! empty( $saving[ $submission ] ) && wp_verify_nonce( $saving['_cld_nonce'], 'cloudinary-settings' ) ) {
416416
$referer = $saving['_wp_http_referer'];
417-
wp_parse_str( wp_parse_url( $referer, PHP_URL_QUERY ), $query );
418417

419418
$data = $saving[ $submission ];
420419
$this->save_settings( $submission, $data );

php/class-cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function frontend_rewrite( $template ) {
138138
return $template;
139139
}
140140
ob_start( array( $this, 'html_rewrite' ) );
141-
include $template;
141+
include $template; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
142142

143143
return CLDN_PATH . 'php/cache/template.php';
144144
}

php/class-connect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ public static function test_rest_api_connectivity() {
10561056
*/
10571057
protected function get_connection_string_content() {
10581058
ob_start();
1059-
include $this->plugin->dir_path . 'php/templates/connection-string.php';
1059+
include $this->plugin->dir_path . 'php/templates/connection-string.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
10601060

10611061
return ob_get_clean();
10621062
}

php/class-delivery.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ protected function standardize_tag( $tag_element ) {
10551055
$tag_element['atts']['data-format'] = $tag_element['format'];
10561056
}
10571057
// Add wp-{media-type}-{id} class name.
1058-
if ( empty( $tag_element['atts']['class'] ) || ! in_array( 'wp-' . $tag_element['type'] . '-' . $tag_element['id'], $tag_element['atts']['class'] ) ) {
1058+
if ( empty( $tag_element['atts']['class'] ) || ! in_array( 'wp-' . $tag_element['type'] . '-' . $tag_element['id'], $tag_element['atts']['class'], true ) ) {
10591059
$tag_element['atts']['class'][] = 'wp-' . $tag_element['type'] . '-' . $tag_element['id'];
10601060
}
10611061

@@ -1541,11 +1541,12 @@ protected function set_usability( $item, $auto_sync = null ) {
15411541
*/
15421542
$item = apply_filters( 'cloudinary_set_usable_asset', $item );
15431543

1544+
$found = array();
15441545
$found[ $item['public_id'] ] = $item;
1545-
$scaled = self::make_scaled_url( $item['sized_url'] );
1546-
$descaled = self::descaled_url( $item['sized_url'] );
1547-
$scaled_slashed = addcslashes( $scaled, '/' );
1548-
$descaled_slashed = addcslashes( $descaled, '/' );
1546+
$scaled = self::make_scaled_url( $item['sized_url'] );
1547+
$descaled = self::descaled_url( $item['sized_url'] );
1548+
$scaled_slashed = addcslashes( $scaled, '/' );
1549+
$descaled_slashed = addcslashes( $descaled, '/' );
15491550
$found[ $scaled ] = $item;
15501551
$found[ $descaled ] = $item;
15511552
$found[ $scaled_slashed ] = array_merge( $item, array( 'slashed' => true ) );

0 commit comments

Comments
 (0)