@@ -942,6 +942,10 @@ function tumblr_get_npf_data(DOMNode $node): array
942
942
943
943
function tumblr_get_attributes ($ node ): array
944
944
{
945
+ if (empty ($ node ->attributes )) {
946
+ return [];
947
+ }
948
+
945
949
$ attributes = [];
946
950
foreach ($ node ->attributes as $ key => $ attribute ) {
947
951
$ attributes [$ key ] = trim ($ attribute ->value );
@@ -1040,7 +1044,7 @@ function tumblr_insert_contact(stdClass $blog, int $uid)
1040
1044
'name ' => $ blog ->title ,
1041
1045
'nick ' => $ blog ->name ,
1042
1046
'addr ' => $ blog ->name . '@tumblr.com ' ,
1043
- 'about ' => $ blog ->description ,
1047
+ 'about ' => HTML :: toBBCode ( $ blog ->description ) ,
1044
1048
'updated ' => date (DateTimeFormat::MYSQL , $ blog ->updated )
1045
1049
];
1046
1050
return Contact::insert ($ fields );
@@ -1090,7 +1094,7 @@ function tumblr_update_contact(stdClass $blog, int $uid, int $cid, int $pcid)
1090
1094
'name ' => $ info ->response ->blog ->title ,
1091
1095
'nick ' => $ info ->response ->blog ->name ,
1092
1096
'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 ),
1094
1098
'updated ' => date (DateTimeFormat::MYSQL , $ info ->response ->blog ->updated ),
1095
1099
'header ' => $ info ->response ->blog ->theme ->header_image_focused ,
1096
1100
'rel ' => $ rel ,
@@ -1173,7 +1177,11 @@ function tumblr_get_contact_by_url(string $url): array
1173
1177
}
1174
1178
1175
1179
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
+ }
1177
1185
$ html = $ curlResult ->getBody ();
1178
1186
if (empty ($ html )) {
1179
1187
return [];
@@ -1219,7 +1227,7 @@ function tumblr_get_contact_by_url(string $url): array
1219
1227
'pubkey ' => '' ,
1220
1228
'priority ' => 0 ,
1221
1229
'guid ' => $ data ->response ->blog ->uuid ,
1222
- 'about ' => $ data ->response ->blog ->description ,
1230
+ 'about ' => HTML :: toBBCode ( $ data ->response ->blog ->description ) ,
1223
1231
'photo ' => $ data ->response ->blog ->avatar [0 ]->url ,
1224
1232
'header ' => $ data ->response ->blog ->theme ->header_image_focused ,
1225
1233
];
0 commit comments