|
@ -19,13 +19,21 @@ $app->post('/editor/publish', function() use($app) { |
|
|
|
|
|
|
|
|
if($user->micropub_optin_html_content) { |
|
|
if($user->micropub_optin_html_content) { |
|
|
$content = ['html' => $content]; |
|
|
$content = ['html' => $content]; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$micropub_request = array( |
|
|
|
|
|
'name' => [$params['name']], |
|
|
|
|
|
'content' => [$content] |
|
|
|
|
|
); |
|
|
|
|
|
$json = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
$json = false; |
|
|
|
|
|
|
|
|
$micropub_request = array( |
|
|
$micropub_request = array( |
|
|
'h' => 'entry', |
|
|
'h' => 'entry', |
|
|
'name' => $params['name'], |
|
|
|
|
|
'content' => $content |
|
|
|
|
|
|
|
|
'name' => [$params['name']], |
|
|
|
|
|
'content' => [$content] |
|
|
); |
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(array_key_exists('category', $params) && $params['category']) |
|
|
if(array_key_exists('category', $params) && $params['category']) |
|
|
$micropub_request['category'] = $params['category']; |
|
|
$micropub_request['category'] = $params['category']; |
|
@ -42,7 +50,14 @@ $app->post('/editor/publish', function() use($app) { |
|
|
$micropub_request['published'] = $params['publish']; |
|
|
$micropub_request['published'] = $params['publish']; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$r = micropub_post_for_user($user, $micropub_request); |
|
|
|
|
|
|
|
|
if($json) { |
|
|
|
|
|
$micropub_request = [ |
|
|
|
|
|
'type' => ['h-entry'], |
|
|
|
|
|
'properties' => $micropub_request |
|
|
|
|
|
]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$r = micropub_post_for_user($user, $micropub_request, null, $json); |
|
|
|
|
|
|
|
|
$app->response()['Content-type'] = 'application/json'; |
|
|
$app->response()['Content-type'] = 'application/json'; |
|
|
$app->response()->body(json_encode([ |
|
|
$app->response()->body(json_encode([ |
|
|