Browse Source

also support finding the repost URL from an h-cite

pull/82/head
Aaron Parecki 4 years ago
parent
commit
ce57124359
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      controllers/controllers.php

+ 15
- 1
controllers/controllers.php View File

@ -226,7 +226,21 @@ $app->get('/repost', function() use($app) {
$edit_data = get_micropub_source($user, $params['edit'], 'repost-of');
$url = $params['edit'];
if(isset($edit_data['repost-of'])) {
$repost_of = $edit_data['repost-of'][0];
$repost = $edit_data['repost-of'][0];
print_r($edit_data);
if(is_string($edit_data['repost-of'][0])) {
$repost_of = $repost;
} elseif(is_array($repost)) {
if(array_key_exists('type', $repost) && in_array('h-cite', $repost)) {
if(array_key_exists('url', $repost['properties'])) {
$repost_of = $repost['properties']['url'][0];
}
} else {
// Error
}
} else {
// Error: don't know what type of post this is
}
}
} else {
$edit_data = false;

Loading…
Cancel
Save