]> git.mxchange.org Git - friendica.git/blob - mod/oembed.php
Merge pull request #2314 from rabuzarus/0302_datetime_cleanup
[friendica.git] / mod / oembed.php
1 <?php
2 require_once("include/oembed.php");
3
4 if(! function_exists('oembed_content')) {
5 function oembed_content(&$a) {
6         // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
7
8         if ($a->argv[1]=='b2h'){
9                 $url = array( "", trim(hex2bin($_REQUEST['url'])));
10                 echo oembed_replacecb($url);
11                 killme();
12         }
13
14         if ($a->argv[1]=='h2b'){
15                 $text = trim(hex2bin($_REQUEST['text']));
16                 echo oembed_html2bbcode($text);
17                 killme();
18         }
19
20         if ($a->argc == 2){
21                 echo "<html><body>";
22                 $url = base64url_decode($a->argv[1]);
23                 $j = oembed_fetch_url($url);
24
25                 // workaround for media.ccc.de (and any other endpoint that return size 0)
26                 if (substr($j->html, 0, 7) == "<iframe" && strstr($j->html, 'width="0"')) {
27                         $j->html = '<style>html,body{margin:0;padding:0;} iframe{width:100%;height:100%;}</style>'. $j->html;
28                         $j->html = str_replace('width="0"', '', $j->html);
29                         $j->html = str_replace('height="0"', '', $j->html);
30                 }
31                 echo $j->html;
32 //              logger('mod-oembed ' . $j->html, LOGGER_ALL);
33                 echo "</body></html>";
34         }
35         killme();
36 }
37 }