26 lines
647 B
PHP
26 lines
647 B
PHP
<?php
|
|
/**
|
|
* ClickAt
|
|
*
|
|
* This plugin makes Twitter and Fediverse addresses clickable.
|
|
*/
|
|
|
|
use Shaarli\Config\ConfigManager;
|
|
use Shaarli\Plugin\PluginManager;
|
|
use Shaarli\Render\TemplatePage;
|
|
|
|
function clickat_init($conf)
|
|
{
|
|
return $errors;
|
|
}
|
|
|
|
function hook_clickat_render_linklist($data)
|
|
{
|
|
|
|
foreach ($data['links'] as &$value) {
|
|
$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']);
|
|
}
|
|
return $data;
|
|
}
|
|
|