mirror of
https://github.com/YunoHost-Apps/hubzilla_ynh.git
synced 2024-09-03 19:26:21 +02:00
27 lines
747 B
PHP
27 lines
747 B
PHP
|
<?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'];
|
||
|
}
|