2020-10-14 00:12:16 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-10-14 12:47:42 +02:00
|
|
|
* ClickAt
|
2020-10-14 00:12:16 +02:00
|
|
|
*
|
2020-10-14 12:47:42 +02:00
|
|
|
* This plugin makes Twitter and Fediverse addresses clickable.
|
2020-10-14 00:12:16 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
use Shaarli\Config\ConfigManager;
|
|
|
|
use Shaarli\Plugin\PluginManager;
|
|
|
|
use Shaarli\Render\TemplatePage;
|
|
|
|
|
|
|
|
function hook_clickat_render_linklist($data)
|
|
|
|
{
|
|
|
|
|
2020-10-14 12:47:42 +02:00
|
|
|
foreach ($data['links'] as &$value) {
|
2021-07-29 18:56:46 +02:00
|
|
|
$value['description'] = preg_replace('/\ @([\w\d]+)@([\w\d_\.]+)/',' <a href="https://\2/users/\1">@\1</a>',$value['description']);
|
|
|
|
$value['description'] = preg_replace('/\ @([\w\d]+)/',' <a href="https://twitter.com/\1">@\1</a>',$value['description']);
|
2020-10-14 12:47:42 +02:00
|
|
|
}
|
2020-10-14 00:12:16 +02:00
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|