PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
← All changes | includes/filters/content.php +14 -5 1.3.101.4.1 View file →
@@ -405,8 +405,12 @@
405 405 ) {
406 406 return false;
407 407 }
408 408
409 + if ( ! apply_filters( 'wpmcs_push_to_url_pairs', true, $item_source['id'], $item_source['source_type'] ) ) {
410 + return false;
411 + }
412 +
409 413 $base = trailingslashit($upload_dir['baseurl']);
410 414 $backward_replacement = apply_filters('wpmcs_enable_backward_url_replacement', false);
411 415
412 416 $source_server_file = Utils::remove_scheme($base.$item['source_path']);
@@ -626,18 +630,23 @@
626 630 }
627 631
628 632 if ( ! empty( $wpmcsItems ) ) {
629 633 foreach ( $wpmcsItems as $item ) {
630 - // Each returned item may have matched on either the source_path or original_source_path.
634 + // Each returned item may have matched on either the source_path or original_source_path
635 + // (or, in backward-compatibility mode, key or original_key — $paths above is keyed by
636 + // whichever field type get_attachment_source_path() was asked for, so the lookup below
637 + // must compare against that same field, not always source_path).
631 638 // Because the base image file name of a thumbnail might match the primary rather scaled or rotated full image
632 639 // it's possible that both source paths are used by separate URLs.
633 640 $source_id = (int)$item['source_id'];
634 641 $source_type = $item['source_type'];
635 - $source_paths = [ $item['source_path'] ];
642 + $path_field = $reverse_compatibility ? 'key' : 'source_path';
643 + $original_field = $reverse_compatibility ? 'original_key' : 'original_source_path';
644 + $source_paths = [ $item[ $path_field ] ];
636 645
637 - // If original_source_path is set, add it to source_paths.
638 - if(isset($item['original_source_path']) && !Utils::is_empty($item['original_source_path'])) {
639 - $source_paths[] = $item['original_source_path'];
646 + // If the original path/key is set, add it to source_paths.
647 + if(isset($item[ $original_field ]) && !Utils::is_empty($item[ $original_field ])) {
648 + $source_paths[] = $item[ $original_field ];
640 649 }
641 650
642 651 foreach ( $source_paths as $source_path ) {
643 652 if ( ! empty( $paths[ $source_path ] ) ) {