summaryrefslogtreecommitdiff
path: root/lib/helpers.php
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2020-03-30 10:26:46 -0700
committerAaron Parecki <aaron@parecki.com>2020-03-30 10:26:46 -0700
commit8dec126e7dd19ebb068b1a4f42804f8c0205af9d (patch)
tree03b978cc4772db3e1819e27aa76cccd742a89488 /lib/helpers.php
parent3759383e91344a6e10d23d4dbd90b9eda513d79c (diff)
add channel selection to event interface
Diffstat (limited to 'lib/helpers.php')
-rw-r--r--lib/helpers.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/helpers.php b/lib/helpers.php
index 695ca27..48ada12 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -269,6 +269,7 @@ function parse_headers($headers) {
function get_micropub_config(&$user, $query=[]) {
$targets = [];
+ $channels = [];
$r = micropub_get($user->micropub_endpoint, $query, $user->micropub_access_token);
if($r['data'] && is_array($r['data']) && array_key_exists('syndicate-to', $r['data'])) {
@@ -295,8 +296,13 @@ function get_micropub_config(&$user, $query=[]) {
}
}
+ if($r['data'] && is_array($r['data']) && array_key_exists('channels', $r['data']) && is_array($r['data']['channels'])) {
+ $channels = $r['data']['channels'];
+ }
+
// Reset the values so they can be overwritten
$user->syndication_targets = '';
+ $user->channels = '';
$user->supported_post_types = '';
$user->supported_visibility = '';
$user->micropub_media_endpoint = '';
@@ -304,6 +310,9 @@ function get_micropub_config(&$user, $query=[]) {
if(count($targets))
$user->syndication_targets = json_encode($targets);
+ if(count($channels))
+ $user->channels = json_encode($channels);
+
$media_endpoint = false;
$supported_post_types = false;
if($r['data'] && is_array($r['data'])) {
@@ -325,6 +334,7 @@ function get_micropub_config(&$user, $query=[]) {
return [
'targets' => $targets,
+ 'channels' => $channels,
'response' => $r
];
}