Je bent niet ingelogd.

  • |

#1 27-Dec-2011 02:23:01

warp
Administrator

Embedded video in punBB

Maak in de extensie map een nieuwe map:

mkdir video_url_punbb

Maak in deze map het bestand manifest.xml met de volgende inhoud:

<?xml version="1.0" encoding="UTF-8"?>
<extension engine="1.0">
    <id>video_url_punbb</id>
    <title>PunBB Video Url BBCodes</title>
    <version>1.1.0</version>
    <description>Adds BBCodes to allow Youtube, Dailymotion, Veoh, Sevenload ... videos embeding with direct (permanent) link for PunBB forum</description>
    <author>Soleil (mattroitixiu@gmail.com)</author>
    <minversion>PunBB 1.4</minversion>
    <maxtestedon>PunBB 1.4</maxtestedon>
    <hooks>
        <hook id="ps_preparse_tags_start"><![CDATA[
            $tags[] = 'video';
            $tags_opened[] = 'video';
            $tags_closed[] = 'video';
        ]]></hook>
        <hook id="ps_do_bbcode_replace"><![CDATA[
            $pattern[] = '#\[video\](.*?)\[/video\]#';
            if(preg_match('#http://.*youtube\.com/watch\?v=(.*)#', $text, $matches)){
                $urlExplode = explode('=',$text);
                $lastPart = $urlExplode[1];
                $lastPartExplode = explode('[',$lastPart);
                $partID = $lastPartExplode[0];
                $replace[] = '<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/'.$partID.'&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$partID.'&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>';
                }
            elseif(preg_match('#http://.*dailymotion\.com/video/(\w+)#s', $text, $matches)){
                $replace[] = '<object width="480" height="291"><param name="movie" value="http://www.dailymotion.com/swf/'.$matches[1].'&related=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/'.$matches[1].'&related=1" type="application/x-shockwave-flash" width="480" height="291" allowFullScreen="true" allowScriptAccess="always"></embed></object>';
                }
            elseif(preg_match('#http://.*megavideo\.com/\?v=(\w+)#s', $text, $matches)){
                $replace[] = '<object width="640" height="480"><param name="movie" value="http://www.megavideo.com/v/'.$matches[1].'a19bd6f443be4c02307efa26f3c3faaf"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/'.$matches[1].'a19bd6f443be4c02307efa26f3c3faaf" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480"></embed></object>';
                }
            elseif(preg_match('#http://.*vimeo\.com/(\d+)#', $text, $matches)){
                $replace[] = '<object width="500" height="320"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='.$matches[1].'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id='.$matches[1].'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
                }
            elseif(preg_match('#http://.*video\.yahoo\.com/watch/(\d+)/(\d+)#', $text, $matches)){
                $replace[] = '<object width="512" height="322"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" /><param name="allowFullScreen" value="true" /><param name="AllowScriptAccess" VALUE="always" /><param name="bgcolor" value="#000000" /><param name="flashVars" value="id='.$matches[2].'&vid='.$matches[1].'&lang=en-us&intl=us&embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" type="application/x-shockwave-flash" width="512" height="322" allowFullScreen="true" AllowScriptAccess="always" bgcolor="#000000" flashVars="id='.$matches[2].'&vid='.$matches[1].'&lang=en-us&intl=us&embed=1" ></embed></object>';
                }
            elseif(preg_match('#http://.*metacafe\.com/watch/(\d+)/(\w+)/#', $text, $matches)){
                $replace[] = '<embed src="http://www.metacafe.com/fplayer/'.$matches[1].'/'.$matches[2].'.swf" width="400" height="345" wmode="transparent" allowFullScreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';
                }
            elseif(preg_match('#http://vids\.myspace\.com(.*)(video|Video)(ID|id)=(\d+)#', $text, $matches)){
                $replace[] = '<object width="425px" height="360px"><param name="allowFullScreen" value="true"/><param name="wmode" value="transparent"/><param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m='.$matches[4].',t=1,mt=video,searchID=,primarycolor=,secondarycolor="/><embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m='.$matches[4].',t=1,mt=video,searchID=,primarycolor=,secondarycolor=" width="425" height="360" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"/></object>';
                }
            elseif(preg_match('#http://.*videovat\.com/videos/(\d+)/(.*)#', $text, $matches)){
                $replace[] = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="424" height="373" id="videovatPlayer" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="http://www.videovat.com/videoPlayer.swf" /><param name="quality" value="high" /><param name="flashvars" value="videoId='.$matches[1].'" /><param name="allowFullscreen" value="true" /><param name="wmode" value="transparent" /><embed src="http://www.videovat.com/videoPlayer.swf" quality="high" wmode="transparent" flashvars="videoId='.$matches[1].'" width="424" height="373" name="videovatPlayer" align="middle" allowScriptAccess="always" allowFullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed></object>';
                }
            elseif(preg_match('#http://tinypic\.com/player\.php\?v=(.*)&amp;s=(\d)#', $text, $matches)){
                $replace[] = '<embed width="440" height="420" type="application/x-shockwave-flash" src="http://v'.$matches[2].'.tinypic.com/player.swf?file='.$matches[1].'&s='.$matches[2].'"></embed>';
                }
            elseif(preg_match('#http://.*myvideo\.de/watch/(\d+)/(\w+)#', $text, $matches)){
                $replace[] = '<object style="width:470px;height:406px;" width="470" height="406" type="application/x-shockwave-flash" data="http://www.myvideo.de/movie/'.$matches[1].'"><param name="movie" value="http://www.myvideo.de/movie/'.$matches[1].'"></param><param name="AllowFullscreen" value="true"></param><param name="AllowScriptAccess" value="always"></param><embed src="http://www.myvideo.de/movie/'.$matches.'" width="470" height="406"></embed></object>';
                }
            elseif(preg_match('#http://.*mixpod\.com/playlist/(\d+)#', $text, $matches)){
                $replace[] = '<embed src="http://assets.myflashfetish.com/swf/mp3/mixpod.swf?myid='.$matches[1].'&path=" quality="high" wmode="window" bgcolor="222222" flashvars="mycolor=222222&mycolor2=77ADD1&mycolor3=FFFFFF&autoplay=false&rand=0&f=4&vol=100&pat=4&grad=true" width="410" height="311" name="myflashfetish" salign="TL" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" border="0" style="visibility:visible;width:410px;height:311px;" /></embed>';
                }
            elseif(preg_match('#http://.*sevenload\.com/#', $text, $matches)){
                $urlExplode = explode('/',$text);
                $partCount = count($urlExplode);
                $lastPartPosition = $partCount-2;
                $lastPart = $urlExplode[$lastPartPosition];
                $lastPartExplode = explode('-',$lastPart);
                $partID = $lastPartExplode[0];
                $replace[] = '<script type="text/javascript" src="'.$matches[0].'pl/'.$partID.'/500x408"></script>';
                }
            elseif(preg_match('#http://.*veoh\.com/#', $text, $matches)){
                $urlExplode = explode('/',$text);
                $partCount = count($urlExplode);
                $lastPartPosition = $partCount-2;
                $lastPart = $urlExplode[$lastPartPosition];
                $lastPartExplode = explode('[',$lastPart);
                $partID = $lastPartExplode[0];
                $replace[] = '<object width="410" height="341" id="veohFlashPlayer" name="veohFlashPlayer"><param name="movie" value="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.6.1001&permalinkId='.$partID.'&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.4.2.6.1001&permalinkId='.$partID.'&player=videodetailsembedded&videoAutoPlay=0&id=anonymous" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="410" height="341" id="veohFlashPlayerEmbed" name="veohFlashPlayerEmbed"></embed></object>';
                }
            elseif(preg_match('#http://.*vidiac\.com/(.*?)(\.\w+)#', $text, $matches)){
                $urlExplode = explode('/',$text);
                $partCount = count($urlExplode);
                $lastPartPosition = $partCount-2;
                $lastPart = $urlExplode[$lastPartPosition];
                $lastPartExplode = explode('.',$lastPart);
                $partID = $lastPartExplode[0];
                $replace[] = '<embed src="http://www.vidiac.com/vidiac.swf" FlashVars="video='.$partID.'" quality="high" bgcolor="#ffffff" width="428" height="352" name="ePlayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
                }
            else{
                $replace[] = '<strong>You\'ve posted a wrong link or your video is not supported by this extension.<br>Please check your link.</strong>';
                }
        ]]></hook>
        <hook id="he_new_bbcode_link"><![CDATA[
        // add lang file
        if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php')) {
        require($ext_info['path'].'/lang/'.$forum_user['language'].'.php');
        } else {
            require($ext_info['path'].'/lang/English.php');
        }
        $lang_help = array_merge($lang_help, $lang_help_flash);
        ?>
        <div class="entry-content">
            <code>[video]<?php echo $lang_help['videourl_uri'] ?>[/video]</code> <span><?php echo $lang_help['produces'] ?></span>
            <?php echo $lang_help['videourl_display'] ?>
        </div><?php
        ]]></hook>
    </hooks>
</extension>

maak indezelfde map een (sub-)map :

mkdir img

in deze imagemap kun je een "video" icoontje van 16x16px opslaan als "video.png, dat als alle goed gaat in de BBcode editor balk komt te staan.

Embed video syntax:

[video]http://sitenaam/videonaam[/video]


Bron: http://punbb.informer.com/forums/post/134667/#p134667

Offline

#2 15-May-2012 01:20:00

warp
Administrator

Embedded video in punBB

Een makkelijke en eenvoudiger manier:

De aanduiding "[youtube]"kan in de BBCode generator aangepast/vervangen worden door kortere term als bv. [ytube] o.i.d.

[video=480,320][url]http://youtu.be/LhTIQZv4OZA[/url][/video]

Offline

Bulletin Board voettekst