@@ -942,6 +942,10 @@ function tumblr_get_npf_data(DOMNode $node): array
942942
943943function tumblr_get_attributes ($ node ): array
944944{
945+ if (empty ($ node ->attributes )) {
946+ return [];
947+ }
948+
945949 $ attributes = [];
946950 foreach ($ node ->attributes as $ key => $ attribute ) {
947951 $ attributes [$ key ] = trim ($ attribute ->value );
@@ -1040,7 +1044,7 @@ function tumblr_insert_contact(stdClass $blog, int $uid)
10401044 'name ' => $ blog ->title ,
10411045 'nick ' => $ blog ->name ,
10421046 'addr ' => $ blog ->name . '@tumblr.com ' ,
1043- 'about ' => $ blog ->description ,
1047+ 'about ' => HTML :: toBBCode ( $ blog ->description ) ,
10441048 'updated ' => date (DateTimeFormat::MYSQL , $ blog ->updated )
10451049 ];
10461050 return Contact::insert ($ fields );
@@ -1090,7 +1094,7 @@ function tumblr_update_contact(stdClass $blog, int $uid, int $cid, int $pcid)
10901094 'name ' => $ info ->response ->blog ->title ,
10911095 'nick ' => $ info ->response ->blog ->name ,
10921096 'addr ' => $ info ->response ->blog ->name . '@tumblr.com ' ,
1093- 'about ' => BBCode:: convertForUriId ( $ uri_id , $ info ->response ->blog ->description , BBCode:: CONNECTORS ),
1097+ 'about ' => HTML :: toBBCode ( $ info ->response ->blog ->description ),
10941098 'updated ' => date (DateTimeFormat::MYSQL , $ info ->response ->blog ->updated ),
10951099 'header ' => $ info ->response ->blog ->theme ->header_image_focused ,
10961100 'rel ' => $ rel ,
@@ -1173,7 +1177,11 @@ function tumblr_get_contact_by_url(string $url): array
11731177 }
11741178
11751179 if (!preg_match ('#^https?://tumblr.com/(.+)# ' , $ url , $ matches ) && !preg_match ('#^https?://www\.tumblr.com/(.+)# ' , $ url , $ matches ) && !preg_match ('#^https?://(.+)\.tumblr.com# ' , $ url , $ matches )) {
1176- $ curlResult = DI ::httpClient ()->get ($ url );
1180+ try {
1181+ $ curlResult = DI ::httpClient ()->get ($ url );
1182+ } catch (\Exception $ e ) {
1183+ return [];
1184+ }
11771185 $ html = $ curlResult ->getBody ();
11781186 if (empty ($ html )) {
11791187 return [];
@@ -1219,7 +1227,7 @@ function tumblr_get_contact_by_url(string $url): array
12191227 'pubkey ' => '' ,
12201228 'priority ' => 0 ,
12211229 'guid ' => $ data ->response ->blog ->uuid ,
1222- 'about ' => $ data ->response ->blog ->description ,
1230+ 'about ' => HTML :: toBBCode ( $ data ->response ->blog ->description ) ,
12231231 'photo ' => $ data ->response ->blog ->avatar [0 ]->url ,
12241232 'header ' => $ data ->response ->blog ->theme ->header_image_focused ,
12251233 ];
0 commit comments