Merge branch 'release/0.5.6'

This commit is contained in:
Jonny Barnes 2017-05-19 15:34:55 +01:00
commit 442063e62e
2 changed files with 28 additions and 13 deletions

View file

@ -97,8 +97,14 @@ class MicropubController extends Controller
} }
$data['syndicate'] = []; $data['syndicate'] = [];
$targets = array_pluck(config('syndication.targets'), 'uid', 'service.name'); $targets = array_pluck(config('syndication.targets'), 'uid', 'service.name');
if (is_string($request->input('mp-syndicate-to'))) { if ($request->has('mp-syndicate-to')) {
$service = array_search($request->input('mp-syndicate-to'), $targets); $mpSyndicateTo = $request->input('mp-syndicate-to');
}
if ($request->has('properties.mp-syndicate-to')) {
$mpSyndicateTo = $request->input('properties.mp-syndicate-to');
}
if (is_string($mpSyndicateTo)) {
$service = array_search($mpSyndicateTo, $targets);
if ($service == 'Twitter') { if ($service == 'Twitter') {
$data['syndicate'][] = 'twitter'; $data['syndicate'][] = 'twitter';
} }
@ -106,21 +112,27 @@ class MicropubController extends Controller
$data['syndicate'][] = 'facebook'; $data['syndicate'][] = 'facebook';
} }
} }
if (is_array($request->input('mp-syndicate-to'))) { if (is_array($mpSyndicateTo)) {
foreach ($targets as $service => $target) { foreach ($mpSyndicateTo as $uid) {
if (in_array($target, $request->input('mp-syndicate-to'))) { $service = array_search($uid, $targets);
if ($service == 'Twitter') { if ($service == 'Twitter') {
$data['syndicate'][] = 'twitter'; $data['syndicate'][] = 'twitter';
} }
if ($service == 'Facebook') { if ($service == 'Facebook') {
$data['syndicate'][] = 'facebook'; $data['syndicate'][] = 'facebook';
}
} }
} }
} }
$data['photo'] = []; $data['photo'] = [];
if (is_array($request->input('photo'))) { $photos = null;
foreach ($request->input('photo') as $photo) { if ($request->has('photo')) {
$photos = $request->input('photo');
}
if ($request->has('properties.photo')) {
$photos = $request->input('properties.photo');
}
if ($photos !== null) {
foreach ($photos as $photo) {
if (is_string($photo)) { if (is_string($photo)) {
//only supporting media URLs for now //only supporting media URLs for now
$data['photo'][] = $photo; $data['photo'][] = $photo;

View file

@ -1,5 +1,8 @@
# Changelog # Changelog
## Version 0.5.6 (2017-05-19)
- Update micropub code to support html-form and json syntax for mp-syndicate-to and photos
## Version 0.5.5 (2017-05-19) ## Version 0.5.5 (2017-05-19)
- improve test suite - improve test suite
- Syndication should now work - Syndication should now work