diff options
-rw-r--r-- | lib/helpers.php | 8 | ||||
-rw-r--r-- | views/new-post.php | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/helpers.php b/lib/helpers.php index 6afa55c..6bbe327 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -100,6 +100,7 @@ function micropub_post($endpoint, $params, $access_token) { $post = http_build_query(array_merge(array( 'h' => 'entry' ), $params)); + $post = preg_replace('/%5B[0-9]+%5D/', '%5B%5D', $post); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); @@ -145,6 +146,7 @@ function get_syndication_targets(&$user) { if(is_array($r['data']['syndicate-to'])) { $targetURLs = $r['data']['syndicate-to']; } elseif(is_string($r['data']['syndicate-to'])) { + // support comma separated as a fallback $targetURLs = preg_split('/, ?/', $r['data']['syndicate-to']); } else { $targetURLs = array(); @@ -153,10 +155,12 @@ function get_syndication_targets(&$user) { foreach($targetURLs as $t) { // If the syndication target doesn't have a scheme, add http if(!preg_match('/^http/', $t)) - $t = 'http://' . $t; + $t2 = 'http://' . $t; + else + $t2 = $t; // Parse the target expecting it to be a URL - $url = parse_url($t); + $url = parse_url($t2); // If there's a host, and the host contains a . then we can assume there's a favicon // parse_url will parse strings like http://twitter into an array with a host of twitter, which is not resolvable diff --git a/views/new-post.php b/views/new-post.php index 12c01f9..a03259c 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -126,7 +126,7 @@ $(function(){ location: $("#note_location").val(), category: $("#note_category").val(), slug: $("#note_slug").val(), - 'syndicate-to': syndications.join(',') + 'syndicate-to': syndications }, function(data){ var response = JSON.parse(data); |