Ejemplo n.º 1
0
function embedYouTube($input, $argv, $parser)
{
    $ytid = '';
    $width = $width_max = 425;
    $height = $height_max = 355;
    if (!empty($argv['ytid'])) {
        $ytid = embedYouTube_url2ytid($argv['ytid']);
    } elseif (!empty($input)) {
        $ytid = embedYouTube_url2ytid($input);
    }
    if (!empty($argv['width']) && settype($argv['width'], 'integer') && $width_max >= $argv['width']) {
        $width = $argv['width'];
    }
    if (!empty($argv['height']) && settype($argv['height'], 'integer') && $height_max >= $argv['height']) {
        $height = $argv['height'];
    }
    if (!empty($ytid)) {
        $url = "http://www.youtube.com/v/{$ytid}";
        return "<object type=\"application/x-shockwave-flash\" data=\"{$url}\" width=\"{$width}\" height=\"{$height}\"><param name=\"movie\" value=\"{$url}\"/><param name=\"wmode\" value=\"transparent\"/></object>";
    }
}
Ejemplo n.º 2
0
function embedYouTube($input, $argv, $parser)
{
    //$parser->disableCache();
    $ytid = '';
    $width_max = 640;
    $height_max = 385;
    $width = 425;
    $height = 355;
    if (!empty($argv['ytid'])) {
        $ytid = embedYouTube_url2ytid($argv['ytid']);
    } elseif (!empty($input)) {
        $ytid = embedYouTube_url2ytid($input);
    }
    if (!empty($argv['width']) && settype($argv['width'], 'integer') && $width_max >= $argv['width']) {
        $width = $argv['width'];
    }
    if (!empty($argv['height']) && settype($argv['height'], 'integer') && $height_max >= $argv['height']) {
        $height = $argv['height'];
    }
    if (!empty($ytid)) {
        $url = "http://www.youtube.com/v/{$ytid}&enablejsapi=1&version=2&playerapiid={$ytid}";
        // it's not mistake, there should be &, not ?
        return "<object type=\"application/x-shockwave-flash\" data=\"{$url}\" width=\"{$width}\" height=\"{$height}\" id=\"YT_{$ytid}\"><param name=\"movie\" value=\"{$url}\"/><param name=\"wmode\" value=\"transparent\"/><param name=\"allowScriptAccess\" value=\"always\"/></object>";
    }
}
Ejemplo n.º 3
0
function embedYouTube($input, $argv, $parser)
{
    // $parser->disableCache();
    $ytid = '';
    $width_max = 640;
    $height_max = 385;
    $width = 425;
    $height = 355;
    if (!empty($argv['ytid'])) {
        $ytid = embedYouTube_url2ytid($argv['ytid']);
    } elseif (!empty($input)) {
        $ytid = embedYouTube_url2ytid($input);
    }
    if (!empty($argv['width']) && settype($argv['width'], 'integer') && $width_max >= $argv['width']) {
        $width = $argv['width'];
    }
    if (!empty($argv['height']) && settype($argv['height'], 'integer') && $height_max >= $argv['height']) {
        $height = $argv['height'];
    }
    // If $wgAllVideosAdminOnly is set and is above the allowed audio only height
    // then don't convert this.  Without this, a non-admin could add a full sized youtube
    // tag that would not get upgraded to a file page on save, but remain a <youtube> tag.
    // The non-admin would continue to see this, but the admin would see the
    // youtube video player.
    global $wgAllVideosAdminOnly;
    if ($height > AUDIO_ONLY_HEIGHT && $wgAllVideosAdminOnly) {
        return $input;
    }
    if (!empty($ytid)) {
        $url = "http://www.youtube.com/v/{$ytid}&enablejsapi=1&version=2&playerapiid={$ytid}";
        // it's not mistake, there should be &, not ?
        return "<object type=\"application/x-shockwave-flash\" data=\"{$url}\" width=\"{$width}\" height=\"{$height}\" id=\"YT_{$ytid}\"><param name=\"movie\" value=\"{$url}\"/><param name=\"wmode\" value=\"transparent\"/><param name=\"allowScriptAccess\" value=\"always\"/></object>";
    }
}