注意安装一定要细心
再说一遍绝对可以使用.本人正在用
名称:Player's UBB Tags for Discuz! 4.0.0RC4
作者:Kinpoo (www.CNGUY.com,E-mail:kinpoo@gmail.com,QQ:116258233)
日期:2005.08.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使播放器更加人性化
多集插入播放器标签有
[标签]
url1|名称1//"|名称" 可省略
url2|名称2
url3|名称3
[/标签]
插入示例
[mp=1]
http://www.adamleisy.com/audio/Linkin%20Park%20-%20Numb.mp3|Numb
http://fjsm.net/exobud/music/LinkinPark-SomewhereIBelong.mp3|Somewhere I belong
http://www.mmyz.net/xnxy/upload/forum/2006114202438.mp3|Don't stay
[/mp]
适用版本:
Discuz! 4.x.x
修改程序列表:
./include/discuzcode.func.php
./memcp.php
./register.php
./include/bbcode.js
修改模版列表:
./templates/相应的模版目录/post_bbinsert.htm
./templates/相应的模版目录/templates.lang.php
功能演示地址:
http://bbs.cnguy.com/post.php?fid=180
(这是pw版的 功能是一样)
http://bbs.cnguy.com/read.php?tid=6934
test id: test
test password: 123456
作品内容:
上传图片文件 共一步
0.将bb_rm.gif,bb_wmv.gif,bb_mp.gif放到 "./images/相应的风格目录/" 里
修改程序文件 共六步
./include/discuzcode.func.php(三步)
./memcp.php(一步)
./register.php(一步)
./include/bbcode.js(一步)
1.修改./include/discuzcode.func.php
1.1找到
- for($i = 0; $i <= $discuzcodes['pcodecount']; $i++) {
复制代码
在上面加上
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- if(!$bbcodeoff && $allowplayercode && $GLOBALS['player_ubb_on']) {
- if(empty($discuzcodes['searcharray']['playercode'])) {
- $discuzcodes['searcharray']['playercode'] = array(
- "/\[mp\](.+?)\[\/mp\]/eis",
- "/(\[mp=)([0-1]{1,1})(\])(.+?)(\[\/mp\])/eis",
- "/\[wmv\](.+?)\[\/wmv\]/eis",
- "/(\[wmv=)([0-9]{1,3})(\,)([0-9]{1,3})(\,)([0-1]{1,1})(\])(.+?)(\[\/wmv\])/eis",
- "/\[rm\](.+?)\[\/rm\]/eis",
- "/(\[rm=)([0-9]{1,3})(\,)([0-9]{1,3})(\,)([0-1]{1,1})(\])(.+?)(\[\/rm\])/eis"
- );
- $discuzcodes['replacearray']['playercode'] = array(
- "mediaplayer('\\1','-01')",
- "mediaplayer('\\4','\\2','-01')",
- "mediaplayer('\\1','-00')",
- "mediaplayer('\\8','\\6','\\2','\\4')",
- "realplayer('\\1')",
- "realplayer('\\8','\\2','\\4','\\6')"
- );
- }
- $message = preg_replace($discuzcodes['searcharray']['playercode'], $discuzcodes['replacearray']['playercode'], $message);
- }
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
1.2找到(文件的最后)
在上面加上
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- ################################################config begin############################
- //"true" or "1" is on,"false" or "0" is off
- $player_file=true; //是否显示影片地址
- $player_color='#698CC3'; //播放器颜色~
- $player_ubb_on=true; //是否使用此UBBs for Discuz!
- #################################################config end#############################
- $player_num=0;
- $player_pre=mt_rand();
- function realplayer($url,$width=450,$height=350,$auto=0){
- global $player_pre,$player_num;
- $pid=$player_pre.'_'.$player_num;
- $fullscreen ="function Full_{$pid}(){if(!document.all.I_{$pid}.CanStop()){alert('影片未开始,无法全屏!');}else{alert('将进入全屏模式,按Esc键退出全屏!');document.all.I_{$pid}.SetFullScreen();}}";
- $player ="<OBJECT classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' id='I_{$pid}' width='$width' height='$height'>";
- $player.="<PARAM NAME='SRC' VALUE='#url#'>";
- $player.="<PARAM NAME='CONSOLE' VALUE='P_{$pid}'>";
- $player.="<PARAM NAME='CONTROLS' VALUE='Imagewindow'>";
- $player.="<PARAM NAME='AUTOSTART' VALUE='1'></OBJECT>";
- $player.="<br><OBJECT classid='CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' id='C_{$pid}' width='$width' height='32'>";
- $player.="<PARAM NAME='SRC' VALUE='#url#'>";
- $player.="<PARAM NAME='CONSOLE' VALUE='P_{$pid}'>";
- $player.="<PARAM NAME='CONTROLS' VALUE='controlpanel'>";
- $player.="<PARAM NAME='AUTOSTART' VALUE='1'></OBJECT>";
- $htmlcode=get_player_html($player,$pid,$fullscreen,$url,$auto);
- $player_num++;
- return $htmlcode;
- }
- function mediaplayer($url,$auto,$width=450,$height=350){
- global $player_num,$player_pre;
- $pid=$player_pre.'_'.$player_num;
- $fullscreen="function Full_{$pid}(){alert('将进入全屏模式!双击,退出全屏!\\n若影片未加载成功将无法进入全屏!');document.all.P_{$pid}.DisplaySize=3;}";
- if($auto=="-01" || $width=="-01"){
- $fullscreen="";
- $width=350;
- $height=69;
- }
- ($auto==="-00" || $auto=="-01") && $auto=0;
- $player ="<OBJECT align='middle' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' id='P_{$pid}' width='$width' height='$height'>";
- $player.="<param name='autostart' value='1'>";
- $player.="<param name='ShowStatusBar' value='-1'>";
- $player.="<param name='EnableContextMenu' value='0'>";
- $player.="<param name='Filename' value='#url#'></OBJECT>";
- $htmlcode=get_player_html($player,$pid,$fullscreen,$url,$auto);
-
- $player_num++;
- return $htmlcode;
- }
- function get_player_html($player,$pid,$full,$url,$auto){
- global $player_file,$player_color,$discuz_uid,$groupid;
-
- if($player_file){
- if(!defined('IN_DISCUZ') && $groupid=='guest'){
- $show_url="<a name='A_$pid'></a><a href='./login.php'><font color='#FFFFFF'><b>[ 下载-登陆 ]</b></font></a>";
- }elseif (defined('IN_DISCUZ') && !$discuz_uid){
- $show_url="<a name='A_$pid'></a><a href='./logging.php?action=login'><font color='#FFFFFF'><b>[ 下载-登陆 ]</b></font></a>";
- }else{
- $show_url="<a name='A_$pid' href='#url#' style='color=orangered'><font color='#FFFFFF'><b>[ 下载-媒体 ]</b></font></a>";
- }
- }else{
- $show_url="<a name='A_$pid'></a>";
- }
- if(!defined('IN_DISCUZ')) {
- $crlf="<br>";
- }else {
- $crlf="\r\n";
- }
- $url = trim($url);
- $url = explode($crlf,$url);
- $player_select = "<select name='SELECT_{$pid}' onChange="HTML_{$pid}(0);"><option value=''> === 选择播放 === </option>";
- foreach ($url as $key => $value) {
- if(!defined('IN_DISCUZ')) {
- global $wind_version;
- if ($wind_version<'4') {
- $value=preg_replace("/\[\twind_code_([0-9]+)\t\]/eis","PHPWind3_URL_Back('\\1')",$value);
- }
- }
- $value=str_replace('"','"',$value);
- $value=preg_replace("/<a href=["']{1}(.[^"']+)["']{1}(.+)<\/a>/i","\\1",$value);
- $url[$key]=explode('|',$value);
- $url[$key][0] = trim($url[$key][0]);
- if(!$url[$key][0]) continue;
- ++$count;
- $url[$key][1] = " $count ".trim($url[$key][1]);
- $player_select.="<option value="{$url[$key][0]}">{$url[$key][1]}</option>";
- }
- $player_select .= '</select>';
- $count = "<font color='$player_color'><b>共有 $count 集</b></font>";
- $show_url = str_replace("#url#",$url[0][0],$show_url);
-
- if ($full!='') $full_btn=""<input type='button' name='btn_{$pid}_B_1' onclick='javascript:Full_{$pid}()' value='全屏播放'" + btn_end";
- else $full_btn="""";
- $btn_end =" style='background-color: $player_color;color: #FFFFFF;cursor: hand;filter: Alpha(Opacity=100, FinishOpacity=0, Style=3, StartX=70, StartY=70, FinishX=100, FinishY=100);font-weight: bolder;width: 100px;height:18px;border: 0px;'";
- $btn_end.=" onmouseover=\\"this.style.filter='';this.style.color='#666666';this.style.background='#EEFFFF';\\"";
- $btn_end.=" onmouseout=\\"this.style.filter='Alpha(Opacity=100, FinishOpacity=0, Style=3, StartX=70, StartY=70, FinishX=100, FinishY=100)';this.style.color='#FFFFFF';this.style.background='$player_color';\\">";
- $code ="<script language='javascript'>var btn_end="$btn_end";";
- $code.="var HTM_{$pid}_A_0="<input type='button' name='btn_{$pid}_A_0' onclick='javascript:HTML_{$pid}(0)' value='观看媒体'" + btn_end;";
- $code.="var HTM_{$pid}_A_1="<input type='button' name='btn_{$pid}_A_1' onclick='javascript:HTML_{$pid}(1)' value='关闭媒体'" + btn_end;";
- $code.="var HTM_{$pid}_B_0="$count";";
- $code.="var HTM_{$pid}_B_1=$full_btn;";
- $code.="var HTM_{$pid}_C_0='';";
- $code.="var HTM_{$pid}_C_1="$player";";
- $code.="function ChangeUrl_{$pid}(url){";
- $code.="A_{$pid}.href=url;";
- $code.="document.all.TD_{$pid}_C.innerHTML=HTM_{$pid}_C_1.replace(/#url#/ig,url);";
- $code.="}";
- $code.="function HTML_{$pid}(close){";
- $code.="if(close){";
- $code.="document.all.TD_{$pid}_A.innerHTML=HTM_{$pid}_A_0;";
- $code.="document.all.TD_{$pid}_B.innerHTML=HTM_{$pid}_B_0;";
- $code.="document.all.TD_{$pid}_C.innerHTML=HTM_{$pid}_C_0;";
- $code.="}else{";
- $code.="document.all.TD_{$pid}_A.innerHTML=HTM_{$pid}_A_1;";
- $code.="document.all.TD_{$pid}_B.innerHTML=HTM_{$pid}_B_1;";
- $code.="var url=document.all.SELECT_{$pid}.options[document.all.SELECT_{$pid}.selectedIndex].value;";
- $code.="if(!url) {url=document.all.SELECT_{$pid}.options[1].value;}";
- $code.="ChangeUrl_{$pid}(url);";
- $code.="}} $full</script>";
- $code.="<table width='50%' style='border:4px double $player_color;background:#FFFFFF;' cellspacing='0' cellpadding='4'>";
- $code.="<tr bgcolor='$player_color'><td><font color='#FFFFFF'><b>[ 播放媒体文件 ]</b></font></td> <td align='right'>$show_url</td></tr>";
- $code.="<tr><td id='TD_{$pid}_A'></td> <td align='right' id='TD_{$pid}_B'></td></tr>";
- $code.="<tr><td colspan='2'>$player_select</td></tr>";
- $code.="<tr><td colspan='2' id='TD_{$pid}_C'></td></tr></table>";
- $code.="<script language='javascript'>HTML_{$pid}(".($auto?0:1).");</script>";
- if (!defined('IN_DISCUZ')) {
- global $code_num,$code_htm,$wind_version;
- if ($wind_version<'4') {
- $code_num++;
- $code_htm[2][$code_num]=$code;
- return "[\twind_code_$code_num\t]";
- }
- }
- return $code;
- }
- function PHPWind3_URL_Back($key) {
- global $code_htm;
- $temp = $code_htm[0][$key];
- unset($code_htm[0][$key]);
- return $temp;
- }
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
1.3找到
- function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0) {
复制代码
修改为
- function discuzcode($message, $smileyoff, $bbcodeoff, $htmlon = 0, $allowsmilies = 1, $allowbbcode = 1, $allowimgcode = 1, $allowhtml = 0, $jammer = 0, $allowplayercode=1) { //", $allowplayercode=1" added for player ubb,by kinpoo
复制代码
2.修改./memcp.php
找到
- $sightmlnew = addslashes(discuzcode(stripslashes($signaturenew), 1, 0, 0, 0, ($allowsigbbcode ? ($allowcusbbcode ? 2 : 1) : 0), $allowsigimgcode, 0));
复制代码
修改为
- $sightmlnew = addslashes(discuzcode(stripslashes($signaturenew), 1, 0, 0, 0, ($allowsigbbcode ? ($allowcusbbcode ? 2 : 1) : 0), $allowsigimgcode, 0, 0, 0)); //the last ", 0, 0" added for player ubb,by kinpoo
复制代码
3.修改./register.php
找到
- $sightml = addslashes(discuzcode(stripslashes($signature), 1, 0, 0, 0, ($groupinfo['allowsigbbcode'] ? ($groupinfo['allowcusbbcode'] ? 2 : 1) : 0), $groupinfo['allowsigimgcode'], 0));
复制代码
修改为
- $sightml = addslashes(discuzcode(stripslashes($signature), 1, 0, 0, 0, ($groupinfo['allowsigbbcode'] ? ($groupinfo['allowcusbbcode'] ? 2 : 1) : 0), $groupinfo['allowsigimgcode'], 0, 0, 0)); //the last ", 0, 0" added for player ubb,by kinpoo
复制代码
4.修改./include/bbcode.js
查找:
- function setfocus() {
- document.input.message.focus();
- }
复制代码
上面加上
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- function realplayer() {
- if (helpmode) {
- alert(realplayer_help);
- } else if (document.selection && document.selection.type == "Text") {
- var range = document.selection.createRange();
- range.text = "[rm]" + range.text + "[/rm]";
- } else if (advmode) {
- AddTxt="[rm] [/rm]";
- AddText(AddTxt);
- } else {
- txt2=prompt(realplayer_normal,"450,350,1");
- if (txt2!=null) {
- txt=prompt(realplayer_normal_input,"");
- if (txt!=null) {
- if (txt2=="") {
- AddTxt="[rm]"+txt;
- AddText(AddTxt);
- AddText("[/rm]");
- } else {
- AddTxt="[rm="+txt2+"]"+txt;
- AddText(AddTxt);
- AddText("[/rm]");
- }
- }
- }
- }
- }
- function wmvplayer() {
- if (helpmode) {
- alert(wmvplayer_help);
- } else if (document.selection && document.selection.type == "Text") {
- var range = document.selection.createRange();
- range.text = "[wmv]" + range.text + "[/wmv]";
- } else if (advmode) {
- AddTxt="[wmv] [/wmv]";
- AddText(AddTxt);
- } else {
- txt2=prompt(wmvplayer_normal,"450,350,1");
- if (txt2!=null) {
- txt=prompt(wmvplayer_normal_input,"");
- if (txt!=null) {
- if (txt2=="") {
- AddTxt="[wmv]"+txt;
- AddText(AddTxt);
- AddText("[/wmv]");
- } else {
- AddTxt="[wmv="+txt2+"]"+txt;
- AddText(AddTxt);
- AddText("[/wmv]");
- }
- }
- }
- }
- }
- function mp3player() {
- if (helpmode) {
- alert(mp3player_help);
- } else if (document.selection && document.selection.type == "Text") {
- var range = document.selection.createRange();
- range.text = "[mp]" + range.text + "[/mp]";
- } else if (advmode) {
- AddTxt="[mp] [/mp]";
- AddText(AddTxt);
- } else {
- txt2=prompt(mp3player_normal,"1");
- if (txt2!=null) {
- txt=prompt(mp3player_normal_input,"");
- if (txt!=null) {
- if (txt2=="") {
- AddTxt="[mp]"+txt;
- AddText(AddTxt);
- AddText("[/mp]");
- } else {
- AddTxt="[mp="+txt2+"]"+txt;
- AddText(AddTxt);
- AddText("[/mp]");
- }
- }
- }
- }
- }
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
修改模版文件 共三步
./templates/相应的模版目录/post_bbinsert.htm(两步)
./templates/相应的模版目录/templates.lang.php(一步)
5.修改post_bbinsert.htm
5.1找到
- var center_normal = "{lang post_discuzcode_center_normal}";
复制代码
在下面加上
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- var realplayer_help = "{lang post_discuzcode_realplayer}\n\n{lang post_discuzcode_realplayer_comment}";
- var realplayer_normal = "{lang post_discuzcode_realplayer_normal}";
- var realplayer_normal_input = "{lang post_discuzcode_realplayer_normal_input}";
- var wmvplayer_help= "{lang post_discuzcode_wmvplayer}\n\n{lang post_discuzcode_wmvplayer_comment}";
- var wmvplayer_normal = "{lang post_discuzcode_wmvplayer_normal}";
- var wmvplayer_normal_input = "{lang post_discuzcode_wmvplayer_normal_input}";
- var mp3player_help = "{lang post_discuzcode_mp3player}\n\n{lang post_discuzcode_mp3player_comment}";
- var mp3player_normal = "{lang post_discuzcode_mp3player_normal}";
- var mp3player_normal_input = "{lang post_discuzcode_mp3player_normal_input}";
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
5.2找到
- <a href="javascript:center()"><img src="{IMGDIR}/bb_center.gif" border="0" alt="{lang post_discuzcode_center}"></a>
复制代码
在下面加上
- <!--------------------------------------------------------------------------PLAYER--START-->
- <a href="javascript:realplayer()"><img src="{IMGDIR}/bb_rm.gif" border="0" alt="{lang post_discuzcode_realplayer}"></a>
- <a href="javascript:wmvplayer()"><img src="{IMGDIR}/bb_wmv.gif" border="0" alt="{lang post_discuzcode_wmvplayer}"></a>
- <a href="javascript:mp3player()"><img src="{IMGDIR}/bb_mp.gif" border="0" alt="{lang post_discuzcode_mp3player}"></a>
- <!--------------------------------------------------------------------------PLAYER--END-->
复制代码
6.修改templates.lang.php
找到
- 'post_discuzcode_center_normal' => '请输入要居中对齐的文字。',
复制代码
在下面加上
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- 'post_discuzcode_realplayer' => '插入一个Real播放器',
- '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]',
- 'post_discuzcode_realplayer_normal' => '播放器的[宽度,高度,自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
- 'post_discuzcode_realplayer_normal_input' => '请输入Real Player可以播放的媒体文件 URL。',
- 'post_discuzcode_wmvplayer' => '插入一个Media播放器',
- '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]',
- 'post_discuzcode_wmvplayer_normal' => '播放器的[宽度,高度,自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
- 'post_discuzcode_wmvplayer_normal_input' => '请输入Media Player可以播放的媒体文件 URL。',
- 'post_discuzcode_mp3player' => '插入一个MP3播放器',
- '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]',
- 'post_discuzcode_mp3player_normal' => '播放器的[自动播放与否(1代表自动播放 0为手动播放)]。\n如无特别需要,保留默认即可。',
- 'post_discuzcode_mp3player_normal_input' => '请输入Media Player可以播放的无图像媒体文件 URL。',
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
安装完毕
[ 本帖最后由 haohao036 于 2006-3-30 09:51 编辑 ] |