@@ -1745,6 +1745,7 @@ function ( $attr, $key ) {
1745
1745
$ image_source_url = '' ;
1746
1746
$ img_success = true ;
1747
1747
$ new_post_id = 0 ;
1748
+ $ img_title = $ item ['item_title ' ];
1748
1749
$ feed_img_tag = ! empty ( $ import_featured_img ) && is_string ( $ import_featured_img ) ? $ import_featured_img : '' ;
1749
1750
1750
1751
// image tag
@@ -1768,10 +1769,11 @@ function ( $attr, $key ) {
1768
1769
}
1769
1770
} else {
1770
1771
$ image_source_url = $ feed_img_tag ;
1772
+ $ img_title = pathinfo ( basename ( $ image_source_url ), PATHINFO_FILENAME );
1771
1773
}
1772
1774
1773
1775
if ( ! empty ( $ image_source_url ) ) {
1774
- $ img_success = $ this ->try_save_featured_image ( $ image_source_url , 0 , $ item [ ' item_title ' ] , $ import_errors , $ import_info , $ new_post );
1776
+ $ img_success = $ this ->try_save_featured_image ( $ image_source_url , 0 , $ img_title , $ import_errors , $ import_info , $ new_post );
1775
1777
$ new_post_id = $ img_success ;
1776
1778
}
1777
1779
@@ -1853,8 +1855,9 @@ function( $term ) {
1853
1855
do_action ( 'feedzy_import_extra ' , $ job , $ item_obj , $ new_post_id , $ import_errors , $ import_info );
1854
1856
1855
1857
if ( ! empty ( $ import_featured_img ) && 'attachment ' !== $ import_post_type ) {
1856
- $ image_source_url = '' ;
1857
- $ img_success = true ;
1858
+ $ image_source_url = '' ;
1859
+ $ img_success = true ;
1860
+ $ img_title = $ item ['item_title ' ];
1858
1861
1859
1862
$ feed_img_tag = false === strpos ( $ import_featured_img , '[[{"value": ' ) ? $ import_featured_img : '[#item_image] ' ; // Use feed default image when we are using chained actions.
1860
1863
@@ -1875,6 +1878,9 @@ function( $term ) {
1875
1878
} else {
1876
1879
$ img_success = false ;
1877
1880
}
1881
+ } elseif ( wp_http_validate_url ( $ import_featured_img ) ) {
1882
+ $ image_source_url = $ import_featured_img ;
1883
+ $ img_title = pathinfo ( basename ( $ image_source_url ), PATHINFO_FILENAME );
1878
1884
}
1879
1885
1880
1886
// Fetch image from graby.
@@ -1921,7 +1927,7 @@ function( $term ) {
1921
1927
}
1922
1928
}
1923
1929
1924
- if ( 'yes ' === $ import_item_img_url || ! $ this ->tryReuseExistingFeaturedImage ( $ img_success , $ item [ ' item_title ' ] , $ new_post_id ) ) {
1930
+ if ( 'yes ' === $ import_item_img_url || ! $ this ->tryReuseExistingFeaturedImage ( $ img_success , $ img_title , $ new_post_id ) ) {
1925
1931
// Run chained actions.
1926
1932
$ import_featured_img = rawurldecode ( $ import_featured_img );
1927
1933
$ import_featured_img = trim ( $ import_featured_img );
@@ -1935,7 +1941,7 @@ function( $term ) {
1935
1941
update_post_meta ( $ new_post_id , 'feedzy_item_external_url ' , $ image_source_url );
1936
1942
} else {
1937
1943
// if import_featured_img is a tag.
1938
- $ img_success = $ this ->try_save_featured_image ( $ image_source_url , $ new_post_id , $ item [ ' item_title ' ] , $ import_errors , $ import_info );
1944
+ $ img_success = $ this ->try_save_featured_image ( $ image_source_url , $ new_post_id , $ img_title , $ import_errors , $ import_info );
1939
1945
}
1940
1946
}
1941
1947
}
0 commit comments