示例#1
0
文件: oembed.php 项目: redmatrix/red
/** @file */
function oembed_replacecb($matches)
{
    $embedurl = $matches[1];
    $j = oembed_fetch_url($embedurl);
    $s = oembed_format_object($j);
    return $s;
}
示例#2
0
/** @file */
function oembed_replacecb($matches)
{
    $embedurl = $matches[1];
    // implements a personal embed white/black list for logged in members
    if (local_channel()) {
        if ($x = get_pconfig(local_channel(), 'system', 'embed_deny')) {
            $l = explode("\n", $x);
            if ($l) {
                foreach ($l as $ll) {
                    if (trim($ll) && strpos($embedurl, trim($ll)) !== false) {
                        return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
                    }
                }
            }
        }
        if ($x = get_pconfig(local_channel(), 'system', 'embed_allow')) {
            $found = false;
            $l = explode("\n", $x);
            if ($l) {
                foreach ($l as $ll) {
                    if (trim($ll) && strpos($embedurl, trim($ll)) !== false) {
                        $found = true;
                        break;
                    }
                }
            }
            if (!$found) {
                return '<a href="' . $embedurl . '">' . $embedurl . '</a>';
            }
        }
    }
    $j = oembed_fetch_url($embedurl);
    $s = oembed_format_object($j);
    return $s;
}
示例#3
0
function oembed_replacecb($matches)
{
    //	logger('oembedcb');
    $embedurl = $matches[1];
    $j = oembed_fetch_url($embedurl);
    $s = oembed_format_object($j);
    return $s;
    //oembed_iframe($s,$j->width,$j->height);
}
示例#4
0
function tryoembed($match)
{
    $url = count($match) == 2 ? $match[1] : $match[2];
    $o = oembed_fetch_url($url);
    if ($o->type == 'error') {
        return $match[0];
    }
    $html = oembed_format_object($o);
    return $html;
}
示例#5
0
function oembed_replacecb($matches)
{
    $embedurl = $matches[1];
    $result = oembed_action($embedurl);
    if ($result['action'] === 'block') {
        return '<a href="' . $result['url'] . '">' . $result['url'] . '</a>';
    }
    $j = oembed_fetch_url($result['url']);
    $s = oembed_format_object($j);
    return $s;
}
示例#6
0
function tryoembed($match)
{
    $url = count($match) == 2 ? $match[1] : $match[2];
    $o = oembed_fetch_url($url);
    //echo "<pre>"; var_dump($match, $url, $o); killme();
    if ($o->type == "error") {
        return $match[0];
    }
    $html = oembed_format_object($o);
    return $html;
    //oembed_iframe($html,$o->width,$o->height);
}
示例#7
0
function tryoembed($match)
{
    //$url = ((count($match)==2)?$match[1]:$match[2]);
    $url = $match[1];
    // Always embed the SSL version
    $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
    //logger("tryoembed: $url");
    $o = oembed_fetch_url($url);
    if (isset($match[2])) {
        $o->title = $match[2];
    }
    if ($o->type == "error") {
        return $match[0];
    }
    $html = oembed_format_object($o);
    return $html;
    //oembed_iframe($html,$o->width,$o->height);
}