Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

Player's UBB Tags for Discuz! 论坛用播放器UBB标签

[复制链接]
freddy 发表于 2005-9-6 13:46:52 | 显示全部楼层 |阅读模式
作品: Player's UBB Tags for Discuz!
作者: Kinpoo (www.CNGUY.com)
日期: 2005.07.23


功能简介:


        1.增加下列播放器标签(注:自动=1,手动=0)
                [mp]http://www.xxx.com/1.mp3[/mp]
                //用于播放mp3等无图像的media player可播放的文件

                [mp=1]http://www.xxx.com/1.mp3[/mp]
                //用于播放mp3等无图像的media player可播放的文件 带可控的[自动或手动]参数

                [wmv]http://www.xxx.com/1.wmv[/wmv]
                //用于播放media player可播放的文件

                [wmv=450,350,1]http://www.xxx.com/1.wmv[/wmv]
                //用于播放media player可播放的文件 带可控的[宽度,高度,自动或手动]参数

                [rm]http://www.xxx.com/1.rm[/rm]
                //用于播放real player可播放的文件

                [rm=450,350,1]http://www.xxx.com/1.rm[/rm]
                //用于播放real player可播放的文件 带可控的[宽度,高度,自动或手动]参数

        2.有图像的可以全屏观看
        3.支持一页内插入多个播放器(至多有一个播放器设置为自动播放,其他设置为手动)
        4.支持带有空格的url
        5.带有可控开关
        6.提供媒体文件url使播放器更加人性化



适用版本:
        Discuz! 2.5F
        其他版本未验证

修改程序列表:
        ./include/discuzcode.php
        ./viewpro.php
        ./viewthread.php
        ./include/bbcode.js

修改模版列表:
        ./templates/相应的模版目录/post_bbinsert.htm
        ./templates/相应的模版目录/templates.lang.php


功能演示地址:
                 一:http://haohao036.meibu.com/bbs/p ... ;fid=51&typeid=
                 (感谢haohao036提供演示)
                 test id: test
                 test password: test

                 二:http://bbs.cnguy.com/post.php?fid=180
                 (这是pw版的 功能是一样)
                 http://bbs.cnguy.com/read.php?tid=6934
                 test id: test
                 test password: 123456


作品内容:
/*
BEGIN||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||BEGIN
*/

建议按照附件中的文本进行修改

====================================================================================
上传图片文件

------------------------------------------------------------------------------------

0.将bb_rm.gif,bb_wmv.gif,bb_mp.gif放到 "./images/相应的风格目录/" 里
bb_rm.gif
bb_wmv.gif
bb_mp.gif
没有找到好的图标 自己又不会做 见谅~

====================================================================================

====================================================================================
修改程序文件 共六步
------------------------------------------------------------------------------------
./include/discuzcode.php(三步)
./viewpro.php(一步)
./viewthread.php(一步)
./include/bbcode.js(一步)
====================================================================================

1.修改./include/discuzcode.php
1.1找到


  1. for($i = 0; $i <= $post_codecount; $i++) {
复制代码




在上面加上


  1. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
  2.         if(!$bbcodeoff && $allowplayercode && $GLOBALS['player_ubb_on']) {
  3.                 if(empty($searcharray['playercode']) || empty($replacearray['playercode'])) {
  4.                         $searcharray['playercode'] = array(
  5.                                 "/\[mp\](.+?)\[\/mp\]/eis",
  6.                                 "/(\[mp=)([0-1]{1,1})(\])(.+?)(\[\/mp\])/eis",
  7.                                 "/\[wmv\](.+?)\[\/wmv\]/eis",
  8.                                 "/(\[wmv=)([0-9]{1,3})(\,)([0-9]{1,3})(\,)([0-1]{1,1})(\])(.+?)(\[\/wmv\])/eis",
  9.                                 "/\[rm\](.+?)\[\/rm\]/eis",
  10.                                 "/(\[rm=)([0-9]{1,3})(\,)([0-9]{1,3})(\,)([0-1]{1,1})(\])(.+?)(\[\/rm\])/eis"               
  11.                         );
  12.                         $replacearray['playercode'] = array(
  13.                                 "mediaplayer('\\1','-01')",
  14.                                 "mediaplayer('\\4','\\2','-01')",
  15.                                 "mediaplayer('\\1','-00')",
  16.                                 "mediaplayer('\\8','\\6','\\2','\\4')",
  17.                                 "realplayer('\\1')",
  18.                                 "realplayer('\\8','\\2','\\4','\\6')"
  19.                         );
  20.                 }
  21.                 $message = preg_replace($searcharray['playercode'], $replacearray['playercode'], $message);
  22.         }
  23. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码




1.2找到


  1. ?>
复制代码




在上面加上

  1. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
  2. ################################################config begin############################
  3. //"true" or "1" is on,"false" or "0" is off
  4. $download_media=true;        //show media file url or not
  5. $player_ubb_on=true;        //use player ubb or not
  6. #################################################config end#############################
  7. function realplayer($realmediaurl,$realwidth=450,$realheight=350,$realautostart=1){
  8.         global $discuz_uid,$download_media,$realplayernum;
  9.         !$realplayernum && $realplayernum = 0;
  10.         if($download_media){
  11.                 if($discuz_uid){
  12.                         $realpalyerifuser="<a href='$realmediaurl' style='color=orangered'>Download Media File</a>";
  13.                 }else{
  14.                         $realpalyerifuser="<a href='./logging.php?action=login' style='color=orangered'>Download Media File-Please Login</a>";
  15.                 }
  16.         }else{
  17.                 $realpalyerifuser='';
  18.         }
  19.         $realplayerhtml="<br><OBJECT classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' id='RAOCX$realplayernum' width='$realwidth' height='$realheight'><PARAM NAME='SRC' VALUE='$realmediaurl'><PARAM NAME='CONSOLE' VALUE='realplayer$realplayernum'><PARAM NAME='CONTROLS' VALUE='Imagewindow'><PARAM NAME='AUTOSTART' VALUE='$realautostart'></OBJECT><br><OBJECT classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' height='32' id='video$realplayernum' width='$realwidth'><PARAM NAME='SRC' VALUE='$realmediaurl'><PARAM NAME='AUTOSTART' VALUE='$realautostart'><PARAM NAME='CONTROLS' VALUE='controlpanel'><PARAM NAME='CONSOLE' VALUE='realplayer$realplayernum'></OBJECT><br><script language=javascript>function real_full$realplayernum(){if(!document.RAOCX$realplayernum.CanStop()){alert('影片未开始,无法全屏!');}else{alert('将进入全屏模式,按Esc键退出全屏!');document.RAOCX$realplayernum.SetFullScreen();}}</script><input type='button' name='rmplayer$realplayernum' onclick='javascript:real_full$realplayernum()' value='全屏播放'>&nbsp;$realpalyerifuser<br>";
  20.         $realplayernum++;
  21.         return $realplayerhtml;
  22. }
  23. function mediaplayer($wmmediaurl,$mediaauto,$mediawidth=450,$mediaheight=350){
  24.         global $discuz_uid,$download_media,$mediaplayernum;
  25.         !$mediaplayernum && $mediaplayernum = 0;
  26.         $mediaallscreen="<script language=javascript>function media_full$mediaplayernum(){alert('将进入全屏模式,按Esc键退出全屏!\\n若影片未加载成功将无法进入全屏!');document.MediaPlayer$mediaplayernum.DisplaySize=3;}</script><input type='button' name='mplayer$mediaplayernum' onclick='javascript:media_full$mediaplayernum()' value='全屏播放'>&nbsp;";
  27.         if($download_media){
  28.                 if($discuz_uid){
  29.                         $mediapalyerifuser="<a href='$wmmediaurl' style='color:orangered;'>Download Media File</a>";
  30.                 }else{
  31.                         $mediapalyerifuser="<a href='./logging.php?action=login' style='color:orangered;'>Download Media File-Please Login</a>";
  32.                 }
  33.         }else{
  34.                 $mediapalyerifuser='';
  35.         }
  36.         if($mediaauto==="-00"){
  37.                 $mediaauto=1;
  38.         }elseif($mediaauto=="-01"){
  39.                 $mediaauto=1;
  40.                 $mediaallscreen="";
  41.                 $mediawidth=280;
  42.                 $mediaheight=69;
  43.         }
  44.         if($mediawidth=="-01"){
  45.                 $mediaallscreen="";
  46.                 $mediawidth=280;
  47.                 $mediaheight=69;
  48.         }
  49.         $mediaplayerhtml="<br><OBJECT align='middle' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' id='MediaPlayer$mediaplayernum' width='$mediawidth' height='$mediaheight'><param name='autostart' value='$mediaauto'><param name='ShowStatusBar' value='-1'><param name='Filename' value='$wmmediaurl'></OBJECT><br>$mediaallscreen$mediapalyerifuser<br>";
  50.         $mediaplayernum++;
  51.         return $mediaplayerhtml;
  52. }
  53. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码



1.3找到


  1. function postify($message, $smileyoff, $bbcodeoff, $allowsmilies = 1, $allowhtml = 0, $allowbbcode = 1, $allowimgcode = 1) {
复制代码




修改为


  1. function postify($message, $smileyoff, $bbcodeoff, $allowsmilies = 1, $allowhtml = 0, $allowbbcode = 1, $allowimgcode = 1, $allowplayercode=1) {        //", $allowplayercode=1" added for player ubb,by kinpoo
复制代码



2.修改./viewpro.php
找到


  1. $member['signature'] = postify($member['signature'], 1, 0, 0, 0, $member['allowsigbbcode'], $member['allowsigimgcode']);
复制代码



修改为


  1. $member['signature'] = postify($member['signature'], 1, 0, 0, 0, $member['allowsigbbcode'], $member['allowsigimgcode'], 0);        //the last ", 0" added for player ubb,by kinpoo
复制代码




3.修改./viewthread.php
找到


  1. $post['signature'] = $post['usesig'] && $post['signature'] ? postify($post['signature'], 1, 0, 0, 0, $_DCACHE['usergroups'][$post['groupid']]['allowsigbbcode'], $_DCACHE['usergroups'][$post['groupid']]['allowsigimgcode']) : NULL;
复制代码




修改为

  1. $post['signature'] = $post['usesig'] && $post['signature'] ? postify($post['signature'], 1, 0, 0, 0, $_DCACHE['usergroups'][$post['groupid']]['allowsigbbcode'], $_DCACHE['usergroups'][$post['groupid']]['allowsigimgcode'], 0) : NULL;        //the last ", 0" added for player ubb,by kinpoo
复制代码




4.修改./include/bbcode.js
在文件的末尾加上

  1. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
  2. function realplayer() {
  3.         if (helpmode) {
  4.                 alert(realplayer_help);
  5.         } else if (getSelectedText()) {
  6.                 var        range =        document.selection.createRange();
  7.                 range.text = "[rm]" + range.text +        "[/rm]";
  8.         } else if (advmode)        {
  9.                 AddTxt="[rm] [/rm]";
  10.                 AddText(AddTxt);
  11.         } else {
  12.                 txt2=prompt(realplayer_normal,"450,350,1");
  13.                 if (txt2!=null)        {
  14.                         txt=prompt(realplayer_normal_input,"");         
  15.                         if (txt!=null) {
  16.                                 if (txt2=="") {
  17.                                         AddTxt="[rm]"+txt;
  18.                                         AddText(AddTxt);
  19.                                         AddText("[/rm]");
  20.                                 } else {
  21.                                         AddTxt="[rm="+txt2+"]"+txt;
  22.                                         AddText(AddTxt);
  23.                                         AddText("[/rm]");
  24.                                 }                  
  25.                         }
  26.                 }
  27.         }
  28. }
  29. function wmvplayer() {
  30.         if (helpmode) {
  31.                 alert(wmvplayer_help);
  32.         } else if (getSelectedText()) {
  33.                 var        range =        document.selection.createRange();
  34.                 range.text = "[wmv]" + range.text +        "[/wmv]";
  35.         } else if (advmode)        {
  36.                 AddTxt="[wmv] [/wmv]";
  37.                 AddText(AddTxt);
  38.         } else {
  39.                 txt2=prompt(wmvplayer_normal,"450,350,1");
  40.                 if (txt2!=null)        {
  41.                         txt=prompt(wmvplayer_normal_input,"");         
  42.                         if (txt!=null) {
  43.                                 if (txt2=="") {
  44.                                         AddTxt="[wmv]"+txt;
  45.                                         AddText(AddTxt);
  46.                                         AddText("[/wmv]");
  47.                                 } else {
  48.                                         AddTxt="[wmv="+txt2+"]"+txt;
  49.                                         AddText(AddTxt);
  50.                                         AddText("[/wmv]");
  51.                                 }                  
  52.                         }
  53.                 }
  54.         }
  55. }
  56. function mp3player() {
  57.         if (helpmode) {
  58.                 alert(mp3player_help);
  59.         } else if (getSelectedText()) {
  60.                 var        range =        document.selection.createRange();
  61.                 range.text = "[mp]" + range.text +        "[/mp]";
  62.         } else if (advmode)        {
  63.                 AddTxt="[mp] [/mp]";
  64.                 AddText(AddTxt);
  65.         } else {
  66.                 txt2=prompt(mp3player_normal,"1");
  67.                 if (txt2!=null)        {
  68.                         txt=prompt(mp3player_normal_input,"");         
  69.                         if (txt!=null) {
  70.                                 if (txt2=="") {
  71.                                         AddTxt="[mp]"+txt;
  72.                                         AddText(AddTxt);
  73.                                         AddText("[/mp]");
  74.                                 } else {
  75.                                         AddTxt="[mp="+txt2+"]"+txt;
  76.                                         AddText(AddTxt);
  77.                                         AddText("[/mp]");
  78.                                 }                  
  79.                         }
  80.                 }
  81.         }
  82. }
  83. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码


====================================================================================
修改模版文件 共三步
------------------------------------------------------------------------------------
./templates/相应的模版目录/post_bbinsert.htm(两步)
./templates/相应的模版目录/templates.lang.php(一步)
====================================================================================
5.修改post_bbinsert.htm
5.1找到

  1. var center_normal = "{lang post_discuzcode_center_normal}";
复制代码




在下面加上


  1. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
  2.         var realplayer_help = "{lang post_discuzcode_realplayer}\n\n{lang post_discuzcode_realplayer_comment}";
  3.         var realplayer_normal = "{lang post_discuzcode_realplayer_normal}";
  4.         var realplayer_normal_input = "{lang post_discuzcode_realplayer_normal_input}";
  5.         var realplayer_help = "{lang post_discuzcode_wmvplayer}\n\n{lang post_discuzcode_wmvplayer_comment}";
  6.         var wmvplayer_normal = "{lang post_discuzcode_wmvplayer_normal}";
  7.         var wmvplayer_normal_input = "{lang post_discuzcode_wmvplayer_normal_input}";
  8.         var mp3player_help = "{lang post_discuzcode_mp3player}\n\n{lang post_discuzcode_mp3player_comment}";
  9.         var mp3player_normal = "{lang post_discuzcode_mp3player_normal}";
  10.         var mp3player_normal_input = "{lang post_discuzcode_mp3player_normal_input}";
  11. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码



5.2找到


  1. <a href="javascript:center()"><img src="{IMGDIR}/bb_center.gif" border="0" alt="{lang post_discuzcode_center}"></a>
复制代码




在下面加上


  1.         <!--------------------------------------------------------------------------PLAYER--START-->
  2.         <a href="javascript:realplayer()"><img src="{IMGDIR}/bb_rm.gif" border="0" alt="{lang post_discuzcode_realplayer}"></a>
  3.         <a href="javascript:wmvplayer()"><img src="{IMGDIR}/bb_wmv.gif" border="0" alt="{lang post_discuzcode_wmvplayer}"></a>
  4.         <a href="javascript:mp3player()"><img src="{IMGDIR}/bb_mp.gif" border="0" alt="{lang post_discuzcode_mp3player}"></a>
  5.         <!--------------------------------------------------------------------------PLAYER--END-->
复制代码




6.修改templates.lang.php
找到


  1. 'post_discuzcode_center_normal' => '请输入要居中对齐的文字。',
复制代码




在下面加上


  1. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
  2.         'post_discuzcode_realplayer' => '插入一个Real播放器',
  3.         'post_discuzcode_realplayer_comment' => '插入一个Real播放器。\n例如:\n[rm]http://www.cnguy.com/1.rm[/rm]\n[rm=450,350,1]http://www.cnguy.com/1.rm[/rm]',
  4.         'post_discuzcode_realplayer_normal' => '播放器的[宽度,高度,自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
  5.         'post_discuzcode_realplayer_normal_input' => '请输入Real Player可以播放的媒体文件 URL。',
  6.         'post_discuzcode_wmvplayer' => '插入一个Media播放器',
  7.         'post_discuzcode_wmvplayer_comment' => '插入一个Media播放器。\n例如:\n[wmv]http://www.cnguy.com/1.wmv[/wmv]\n[wmv=450,350,1]http://www.cnguy.com/1.wmv[/wmv]',
  8.         'post_discuzcode_wmvplayer_normal' => '播放器的[宽度,高度,自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
  9.         'post_discuzcode_wmvplayer_normal_input' => '请输入Media Player可以播放的媒体文件 URL。',
  10.         'post_discuzcode_mp3player' => '插入一个MP3播放器',
  11.         'post_discuzcode_mp3player_comment' => '插入一个无图像Media播放器。\n例如:\n[mp]http://www.cnguy.com/1.mp3[/mp]\n[mp=1]http://www.cnguy.com/1.mp3[/mp]',
  12.         'post_discuzcode_mp3player_normal' => '播放器的[自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
  13.         'post_discuzcode_mp3player_normal_input' => '请输入Media Player可以播放的无图像媒体文件 URL。',
  14. /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码



/*
END||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||END
*/

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
lu5266 发表于 2005-9-6 13:49:43 | 显示全部楼层
我也抢沙发
回复

使用道具 举报

 楼主| freddy 发表于 2005-9-6 13:51:38 | 显示全部楼层
哈哈!支持兄弟
回复

使用道具 举报

lu5266 发表于 2005-9-6 13:53:39 | 显示全部楼层
哈哈
我是来支持你的
你右支持我的沙发啊

呵呵
回复

使用道具 举报

 楼主| freddy 发表于 2005-9-6 13:57:44 | 显示全部楼层
哈哈!无所谓哈!兄弟最近在忙什么呢?
回复

使用道具 举报

lu5266 发表于 2005-9-6 14:03:26 | 显示全部楼层
上课啊
等下
还要呢

现在只是等人家睡觉的时候
来上一会
回复

使用道具 举报

xjbl 发表于 2005-9-6 14:15:07 | 显示全部楼层
这个不错,偶安装了..很好用..
回复

使用道具 举报

 楼主| freddy 发表于 2005-9-6 14:58:58 | 显示全部楼层
原帖由 xjbl 于 2005-9-6 14:15 发表
这个不错,偶安装了..很好用..


论坛地址给我看看!
回复

使用道具 举报

xjbl 发表于 2005-9-6 15:04:02 | 显示全部楼层
原帖由 freddy 于 2005-9-6 14:58 发表


论坛地址给我看看!

地址偶忘了...
回复

使用道具 举报

sdywd 发表于 2005-9-6 15:04:27 | 显示全部楼层
郁闷,我第10楼了,谢谢楼主

我原来安装了ubb的,不过只是针对图片,可以直接添加这个吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-4 01:35 , Processed in 0.113921 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表