1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addon/noembed/noembed.php

27 lines
747 B
PHP
Raw Normal View History

2016-03-20 08:06:33 +01:00
<?php
/**
* Name: Noembed
* Description: Use noembed.com as an addition to Hubzilla's native oembed functionality
* Version: 1.0
* Author: Jeroen van Riet Paap <jeroenpraat@hubzilla.nl>, Mike Macgirvin <mike@zothub.com>
* Maintainer: Jeroen van Riet Paap <jeroenpraat@hubzilla.nl>
*
*/
function noembed_load() {
register_hook('oembed_probe','addon/noembed/noembed.php','noembed_oembed_probe');
}
function noembed_unload() {
unregister_hook('oembed_probe','addon/noembed/noembed.php','noembed_oembed_probe');
}
function noembed_oembed_probe(&$a,&$b) {
// try noembed service
$ourl = 'https://noembed.com/embed?url=' . urlencode($b['url']);
$result = z_fetch_url($ourl);
if($result['success'])
$b['embed'] = $result['body'];
}