作 者: kinpoo
发 布: haohao036
发布时间: 2006/02/21
支持版本: For Discuz!4.x/2.x
增加一种格式,比如放连续据的连接最好。:
多地址插入格式如:
[wmv]
http://.../001.MP3
http://.../002.MP3|无尽的爱
[/wmv]
插入单集的方式照旧
- [mp]url[/mp]
- [mp=1]url[/mp]
- [rm]url[/rm]
- [rm=450,350,1]url[/rm]
- [wmv]url[/wmv]
- [wmv=450,350,1]url[/wmv]
复制代码
以下仅演示多集插入播放器标签有
- [标签]
- 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!::include/discuzcode.func.php
将原来的(在文件的末尾~)
- [code]/*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com---BEGIN*/
- ################################################config begin############################
- //...此处为省略的代码...
- /*------------------------------------------------PLAYER UBB CODE--BY KINPOO--HTTP://www.CNGUY.com-----END*/
复制代码
替换为
- /*------------------------------------------------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='#80cbf9'; //播放器颜色~
- $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*/
复制代码
下面的附件只适合全新安装
下面附件是最新4.10版 大家只要上传到自已的论坛就可以用了。
用utf版本的论坛程序,
打开config.inc.php(这个强制字符集)
找
替换
找
替换
[ 本帖最后由 haohao036 于 2006-4-20 12:37 编辑 ] |