Skip to content

Commit 043aaf4

Browse files
committed
feat: mastodonpost kirby tag
1 parent ec5d4a5 commit 043aaf4

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

plugin/kirbytags.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
2-
$originalTag = Kirby\Text\KirbyTag::$types['link'];
2+
3+
use Kirby\Http\Remote;
4+
use Kirby\Text\KirbyTag;
5+
6+
$originalTag = KirbyTag::$types['link'];
7+
38
return [
49
'like' => [
510
'attr' => $originalTag['attr'],
@@ -45,4 +50,23 @@
4550
return $markup;
4651
},
4752
],
53+
'mastodonpost' => [
54+
'html' => function ($tag) {
55+
$embedUrl = $tag->mastodonpost;
56+
57+
$hostname = parse_url($embedUrl, PHP_URL_HOST);
58+
59+
$oEmbedResult = Remote::get('https://' . $hostname . '/api/oembed?format=json&url=' . $embedUrl);
60+
if (isset($oEmbedResult)) {
61+
$oEmbedJson = $oEmbedResult->json();
62+
63+
if (isset($oEmbedJson['html'])) {
64+
return $oEmbedJson['html'];
65+
}
66+
}
67+
68+
return null;
69+
},
70+
],
71+
'mastodonpost'
4872
];

vendor/composer/installed.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php return array(
22
'root' => array(
33
'name' => 'mauricerenck/indieconnector',
4-
'pretty_version' => '2.9.2',
5-
'version' => '2.9.2.0',
4+
'pretty_version' => '2.11.0',
5+
'version' => '2.11.0.0',
66
'reference' => null,
77
'type' => 'kirby-plugin',
88
'install_path' => __DIR__ . '/../../',
@@ -38,8 +38,8 @@
3838
'dev_requirement' => false,
3939
),
4040
'mauricerenck/indieconnector' => array(
41-
'pretty_version' => '2.9.2',
42-
'version' => '2.9.2.0',
41+
'pretty_version' => '2.11.0',
42+
'version' => '2.11.0.0',
4343
'reference' => null,
4444
'type' => 'kirby-plugin',
4545
'install_path' => __DIR__ . '/../../',

vendor/composer/platform_check.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
2020
}
2121
}
22-
trigger_error(
23-
'Composer detected issues in your platform: ' . implode(' ', $issues),
24-
E_USER_ERROR
22+
throw new \RuntimeException(
23+
'Composer detected issues in your platform: ' . implode(' ', $issues)
2524
);
2625
}

0 commit comments

Comments
 (0)