blob: abd27797970158b9ae30eeb982a54a55b8d589b8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
/**
* Name: UnshortURL
* Description: Expand shortened URLs into their proper URLs
* Version: 0.1.0
* Author: Harald Eilertsen <https://hub.volse.no/channel/harald>
* Maintainer: Harald Eilertsen <https://hub.volse.no/channel/harald>
*
* SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Zotlabs\Lib\Apps;
use Zotlabs\Extend\Hook;
function unshorturl_install() {
Hook::register('perpare_body', 'addon/unshorturl/unshorturl.php', 'unshorturl_prepare_body', 1);
}
function unshorturl_uninstall() {
Hook::deregister('prepare_body', 'addon/unshorturl/unshorturl.php', 'unshorturl_prepare_body');
}
function unshorturl_prepare_body(&$body) {
if (!local_channel() || !Apps::addon_app_installed(local_channel(), 'unshorturl')) {
return;
}
preg_replace('/https?:\/\/bit.ly\/[^\s]+/g', '[hidden bitly link]');
}
|