mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 15:15:13 +00:00
35 lines
951 B
PHP
35 lines
951 B
PHP
<?php
|
|
|
|
namespace Code\Module;
|
|
|
|
use App;
|
|
use Code\Web\Controller;
|
|
use Code\Lib as Zlib;
|
|
|
|
class Oembed extends Controller
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
// logger('mod_oembed ' . App::$query_string, LOGGER_ALL);
|
|
|
|
if (argc() > 1) {
|
|
if (argv(1) == 'b2h') {
|
|
$url = ["", trim(hex2bin($_REQUEST['url']))];
|
|
echo Zlib\Oembed::replacecb($url);
|
|
killme();
|
|
} elseif (argv(1) == 'h2b') {
|
|
$text = trim(hex2bin($_REQUEST['text']));
|
|
echo Zlib\Oembed::html2bbcode($text);
|
|
killme();
|
|
} else {
|
|
echo "<html><head><base target=\"_blank\" rel=\"nofollow noopener\" /></head><body>";
|
|
$src = base64url_decode(argv(1));
|
|
$j = Zlib\Oembed::fetch_url($src);
|
|
echo $j['html'];
|
|
echo "</body></html>";
|
|
}
|
|
}
|
|
killme();
|
|
}
|
|
}
|