summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-02-28 19:33:55 -0800
committerAaron Parecki <aaron@parecki.com>2017-02-28 19:33:55 -0800
commitce5712435938cae8868c7dbeea01085a350a04d2 (patch)
tree14df32ccc316cab16a543b345494a4f366ec7782
parent1151a6d17d1bf4a2227f0656321c589c5b7ca73d (diff)
also support finding the repost URL from an h-cite
-rw-r--r--controllers/controllers.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/controllers/controllers.php b/controllers/controllers.php
index c780490..782a318 100644
--- a/controllers/controllers.php
+++ b/controllers/controllers.php
@@ -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;