Jump to content

Extension talk:YouTubeTag

Add topic
From mediawiki.org
Latest comment: 12 years ago by 24.190.93.182 in topic Error

Missing argument 3

[edit]

Hi -

I get a Warning: Missing argument 3 for renderYouTubeTag(), called in /usr/local/www/apache22/data/wiki/includes/Parser.php on line 427"

error when i try and implement this. Any ideas?

What version of MediaWiki are you using? --Jimbojw 02:31, 10 May 2007 (UTC)Reply
I am using MediaWiki 1.5.6 ... I guess it is time for an upgrade?--Pkyle 06:52, 10 May 2007 (UTC)Reply
Yeah, if possible. It's best to upgrade all the way to the latest release (at the time of this writing, that's 1.10.0). However, if your host doesn't support PHP5, you should at least upgrade to 1.6.x if you can. I plan to support any versions listed as 'current' or 'legacy' on the Download page. --Jimbojw 15:06, 10 May 2007 (UTC)Reply


YouTube allows parameters to control certain aspects of the embedded video, such as &rel=0 to disable the display of related videos, and an option &autoplay=1 to autoplay. Current the extension does not recognise these parameters. --84.9.191.165 15:46, 25 August 2007 (UTC)Reply

New parameters: $width & $height

[edit]

Hi, i am alex borras, I tested this and it is interesting to add it to the extension:

<?php
function renderYouTubeTag( $input, $params, &$parser ) {

    # Check for 'v' parameter and ensure it has a valid value
    $v = htmlspecialchars($params['v']);
    $width  = htmlspecialchars($params['width']);
    $height = htmlspecialchars($params['height']);
    $v = htmlspecialchars($params['v']);
    if ($v==null || preg_match('%[^A-Za-z0-9_\\-]%',$v)) {
        return '<div class="errorbox">'.wfMsgForContent('youtubetag-bad-id', $v).'</div>';
    }
    if ($width==null) {
        $width = 425;
    }
    if ($height==null) {
        $height = 350;
    }
    # Build URL and output embedded flash object
    $url = "http://www.youtube.com/v/$v";
    return
        '<object width="'.$width.'" height="'.$height.'">'.
        '<param name="movie" value="'.$url.'"></param>'.
        '<param name="wmode" value="transparent"></param>'.
        '<embed src="'.$url.'" type="application/x-shockwave-flash" '.
        'wmode="transparent" width="'.$width.'" height="'.$height.'">'.
        '</embed></object>';
}
?>

and call with: <youtube v="tAWUkjZAamk" height="340" width="560" />


and you get <youtube v="tAWUkjZAamk" height="<script>alert('passive xss')</script>"/>. Safety variant :

<?php
function renderYouTubeTag( $input, $params, &$parser ) {

    # Check for 'v' parameter and ensure it has a valid value
    $v = htmlspecialchars($params['v']);
    $width =(INT) $params['width'] ? $params['width'] : 425;
    $height =(INT) $params['height'] ? $params['height'] : 350;
    if ($v==null || preg_match('%[^A-Za-z0-9_\\-]%',$v)) {
        return '<div class="errorbox">'.wfMsgForContent('youtubetag-bad-id', $v).'</div>';
    }

    # Build URL and output embedded flash object
    $url = "http://www.youtube.com/v/$v";
    return
        '<object width="'.$width.'" height="'.$height.'">'.
        '<param name="movie" value="'.$url.'"></param>'.
        '<param name="wmode" value="transparent"></param>'.
        '<embed src="'.$url.'" type="application/x-shockwave-flash" '.
        'wmode="transparent" width="'.$width.'" height="'.$height.'">'.
        '</embed></object>';
} ?>

~~Fedcomp

Problem

[edit]

On our wiki, we have a strange problem that that the video won't show up, but the I know it's there because the space expands on where I put the tags. Mr. Berty 18:46, 2 January 2011 (UTC)Reply


I have some problem. Mike

Works with 1.18

[edit]

Hi, since my MW update to 1.18, this Extension will not work. I get the Errormessage:

Fatal error: Call to a member function addMessage() on a non-object in ........./extensions/YouTubeTag.php on line 67

I affraid this extension makes troube, because it's did use a i18n Messagefile. Other extension makes the same problems http://www.gossamer-threads.com/lists/wiki/mediawiki/261958

--Starwhooper 21:26, 11 January 2012 (UTC)Reply

Error

[edit]

Fatal error: Call to a member function addMessage() on a non-object in C:\wamp\www\wiki\extensions\YouTubeTag.php on line 67 24.190.93.182 00:16, 30 August 2012 (UTC)Reply