add Threads & Bluesky support #3

Merged
n merged 3 commits from bsky into main 2024-01-27 17:06:31 +01:00
3 changed files with 17 additions and 6 deletions
Showing only changes of commit 7c1b7bdd2c - Show all commits

View file

@ -1,9 +1,12 @@
# ClickAt # ClickAt
[Shaarli](https://github.com/shaarli/Shaarli/) plugin to make 𝕏 and Fediverse addresses clickable. [Shaarli](https://github.com/shaarli/Shaarli/) plugin to make microblogging
social networks (Twitter/𝕏 and Fediverse) addresses clickable.
## Manual ## Manual
1. Clone repository in plugin directory. 1. Clone repository in plugin directory.
2. Activate plugin. 2. Activate plugin.
3. Quote users from Twitter/𝕏 with their `@nic`, and users from the Fediverse with `@nic@server`. 3. Quote users from:
- Twitter/𝕏 with their `@nic`,
- Fediverse with `@nic@instance`.

View file

@ -1 +1 @@
description="Make Twitter and Fediverse addresses clickable." description="Make microblogging social networks (Twitter/𝕏 and Fediverse) addresses clickable."

View file

@ -2,7 +2,7 @@
/** /**
* ClickAt * ClickAt
* *
* This plugin makes Twitter and Fediverse addresses clickable. * This plugin makes microblogging social networks (Twitter/𝕏 and Fediverse) addresses clickable.
*/ */
use Shaarli\Config\ConfigManager; use Shaarli\Config\ConfigManager;
@ -13,8 +13,16 @@ function hook_clickat_render_linklist($data)
{ {
foreach ($data['links'] as &$value) { foreach ($data['links'] as &$value) {
$value['description'] = preg_replace('/\ @([\w\d]+)@([\w\d_\-\.]+)/',' <a href="https://\2/@\1">&commat;\1</a>',$value['description']); $value['description'] = preg_replace(
$value['description'] = preg_replace('/\ @([\w\d]+)/',' <a href="https://twitter.com/\1">&commat;\1</a>',$value['description']); '/\ @([\w\d]+)@([\w\d_\-\.]+)/',
' <a href="https://\2/@\1">&commat;\1</a>',
$value['description']
);
$value['description'] = preg_replace(
'/\ @([\w\d]+)/',
' <a href="https://twitter.com/\1">&commat;\1</a>',
$value['description']
);
} }
return $data; return $data;
} }