+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
注:做了我认为最简单的、也是能力范围内的小修改,
所以方便上大不如从前,还是等高手再改吧!
这个插件集成了以下功能:
1. WMV和RM两在类别的音乐及影像文件播放;
2. 自定义播放器的大小,以及是否自动播放, 以及默认方式播放;
3. 含全屏按扭;
4. 支持了FLASH播放,并可自定义播放器的大小;
5. 加了所有功能的按扭;
6. 加入音乐文件的动态显示歌词功能;
7. 动态歌词中支持暂停滚动,快速向上和向下滚动;
8. 加入HIDE按扭;
9. 各个函数得到了部分优化;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
第一步:
include/discuzcode.func.php修改开始
查找:
- if(!$bbcodeoff) {
- if(empty($discuzcodes['searcharray']['imgcode'])) {
- $discuzcodes['searcharray']['imgcode'] = array(
- "/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/ies",
- "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
- "/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies"
- );
- $discuzcodes['replacearray']['imgcode'] = $allowimgcode ? array(
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle" alt="" /> <a href="%s" target="_blank">Flash: %s</a> ')",
- "bbcodeurl('\\1', '<img src="%s" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\\nCTRL+Mouse wheel to zoom in/out\';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=\'hand\'; this.alt=\'Click here to open new window\\nCTRL+Mouse wheel to zoom in/out\';}" onclick="if(!this.resized) {return true;} else {window.open(\'%s\');}" onmousewheel="return imgzoom(this);" alt="" />')",
- "bbcodeurl('\\3', '<img width="\\1" height="\\2" src="%s" border="0" alt="" />')"
- ) : array(
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle" alt="" /> <a href="%s" target="_blank">Flash: %s</a> ')",
- "bbcodeurl('\\1', '<a href="%s" target="_blank">%s</a>')",
- "bbcodeurl('\\3', '<a href="%s" target="_blank">%s</a>')"
- );
- }
- $message = preg_replace($discuzcodes['searcharray']['imgcode'], $discuzcodes['replacearray']['imgcode'], $message);
- }
复制代码
整段替换为:
- if(!$bbcodeoff && $allowimgcode) {
- if(empty($discuzcodes['searcharray']['imgcode'])) {
- $discuzcodes['searcharray']['imgcode'] = array(
- "/\[swf\]\s*([^\[]+?)\s*\[\/swf\]/ies",
- "/\[img\]\s*([^\[]+?)\s*\[\/img\]/ies",
- "/\[swf=(\d+?)[x|\,](\d+?)\]\s*(.+?)\s*\[\/swf\]/ies",
- "/\[wmv\]\s*(.+?)\s*\[\/wmv\]/ies",
- "/\[mp3\]\s*(.+?)\s*\[\/mp3\]/ies",
- "/\[ron\]\s*(.+?)\s*\[\/ron\]/ies",
- "/\[rm\]\s*(.+?)\s*\[\/rm\]/ies",
- "/\[wmv=(\d+?)[x|\,](\d+?)[x|\,](\d+?)\]\s*(.+?)\s*\[\/wmv\]/ies",
- "/\[rm=(\d+?)[x|\,](\d+?)[x|\,](\d+?)\]\s*(.+?)\s*\[\/rm\]/ies",
- "/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[]+?)\s*\[\/img\]/ies"
- );
- $discuzcodes['replacearray']['imgcode'] = array(
- "bbcodeurl('\\1', '<a href="%s" target="_blank"><u>※单击鼠标在新窗口中打开※</u></a><br><br><embed width="360" height="300" src="%s" type="application/x-shockwave-flash"></embed>')",
- "bbcodeurl('\\1', '<br><img src="%s" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'单击这里开新视窗查看\\n按住CTRL,并滚动鼠标滚轮缩放图片大小\';}" onmouseover="if(this.resized) this.style.cursor=\'hand\';" onclick="if(!this.resized) {return true;} else {window.open(\'%s\');}" onmousewheel="return imgzoom(this);">')",
- "bbcodeurl('\\3', '<a href="%s" target="_blank"><u>※单击鼠标在新窗口中打开※</u></a><br><br><embed width="\\1" height="\\2" src="%s" type="application/x-shockwave-flash"></embed>')",
- "bbcodeurl('\\1', '<br><input type="button" name="mplayer" onclick="document.MediaPlayer.DisplaySize=3" value="全屏播放"> [ 双击退出全屏播放状态 ] <br><br><object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="360" height="300" ><PARAM NAME="AutoStart" VALUE="0" ><param name="enableContextMenu" value="0"><param name="ShowStatusBar" value="-1"><param name="Filename" value="%s"><embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="%s" width="360" height="300"></embed></object>')",
- "bbcodeurl('\\1', '<object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="480" height="68" ><PARAM NAME="AutoStart" VALUE="-1" ><param name="enableContextMenu" value="0"><param name="ShowStatusBar" value="-1"><param name="Filename" value="%s"><embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="%s" width="480" height="68"></embed></object>')",
- "bbcodeurl('\\1', '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="Player" width="480" height="0" viewastext><param name="Autostart" value="-1"><param name="CONTROLS" value="ImageWindow"><param name="enableContextMenu" value="0"><param name="CONSOLE" value="_master"><param name="LOOP" value="-1"><param name="CENTER" value="0"></object><br><object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=64 id=Player width=480 VIEWASTEXT><param name="_ExtentX" value="18256"><param name="_ExtentY" value="794"><param name="Autostart" value="-1"><param name="LOOP" value="-1"><param name="CENTER" value="0"><param name="BACKGROUNDCOLOR" value="#000000"><param name="SRC" value="%s"></object>')",
- "bbcodeurl('\\1', '<br><input type="button" name="rmplayer" onclick="document.rmplayer.SetFullScreen()" value="全屏播放"> [ 按ESC退出全屏播放状态 ] <br><br><object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="rmplayer" width="360" height="300" viewastext><param name="Autostart" value="0"><param name="CONTROLS" value="ImageWindow"><param name="enableContextMenu" value="0"><param name="CONSOLE" value="_master"><param name="LOOP" value="-1"><param name="CENTER" value="0"></object><br><object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=64 id=Player width=360 VIEWASTEXT><param name="_ExtentX" value="18256"><param name="_ExtentY" value="794"><param name="Autostart" value="0"><param name="LOOP" value="0"><param name="CENTER" value="0"><param name="BACKGROUNDCOLOR" value="#000000"><param name="SRC" value="%s"></object>')",
- "bbcodeurl('\\4', '<br><input type="button" name="mplayer" onclick="document.MediaPlayer.DisplaySize=3" value="全屏播放"> [ 双击退出全屏播放状态 ] <br><br><object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="\\1" height="\\2" ><PARAM NAME="AutoStart" VALUE="\\3" ><param name="ShowStatusBar" value="-1"><param name="enableContextMenu" value="0"><param name="Filename" value="%s"><embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" width="\\1" height="\\2"></embed></object>')",
- "bbcodeurl('\\4', '<br><input type="button" name="rmplayer" onclick="document.rmplayer.SetFullScreen()" value="全屏播放"> [ 按ESC退出全屏播放状态 ] <br><br><object width="\\1" height="\\2" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="rmplayer" viewastext><param name="Autostart" value="\\3"><param name="CONTROLS" value="ImageWindow"><param name="enableContextMenu" value="0"><param name="CONSOLE" value="_master"><param name="LOOP" value="-1"><param name="CENTER" value="0"></object><br><object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=64 id=Player width="\\1" VIEWASTEXT><param name="_ExtentX" value="18256"><param name="_ExtentY" value="794"><param name="Autostart" value="\\3"><param name="LOOP" value="-1"><param name="CENTER" value="0"><param name="SRC" value="%s"></object>')",
- "bbcodeurl('\\3', '<img width="\\1" height="\\2" src="%s" border="0">')"
- );
- }
- $message = preg_replace($discuzcodes['searcharray']['imgcode'], $discuzcodes['replacearray']['imgcode'], $message);
- }
复制代码
查找:
- function karmaimg($rate, $ratetimes) {
复制代码
上面加:
- function gcxdisp($code) {
- global $discuzcodes;
- $discuzcodes['pcodecount']++;
- $code = htmlspecialchars(str_replace('\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)));
- $discuzcodes['codehtml'][$discuzcodes['pcodecount']] = "<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="480" bgcolor="#000000"><tr><td rowspan="2"><marquee id="scrolltext" onmouseover=this.stop() onmouseout=this.start() TrueSpeed scrollamount=1 scrolldelay=200 width="455" height="280" direction="up"><font style="font-size: 14pt" color=#FFFFFF><center>$code</center></FONT></marquee></td><td width="30" onmouseover="list3()" onmouseout="list4()" style="Cursor:hand"><font color=#FFFFFF><center>↑</center></font></td></tr><tr><td width="30" onmouseover="list1()" onmouseout="list2()" style="Cursor:hand"><font color=#FFFFFF><center>↓</center></font></td></tr></table>";
- $discuzcodes['codecount']++;
- return "[\tDISCUZ_CODE_$discuzcodes[pcodecount]\t]";
- }
复制代码
查找:
- $message = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "codedisp('\\1')", $message);
复制代码
下面加:
- $message = preg_replace("/\s*\[gcx\](.+?)\[\/gcx\]\s*/ies", "gcxdisp('\\1')", $message);
复制代码
include/discuzcode.func.php修改结束
注:安装过老O播放器的兄弟们,安装到这里,以前的多媒体文件已经可以正常播放了!
第二步:
从后台DISCUZ!代码里插入按钮!
wmv bb_wmv.gif
rm bb_rm.gif
gcx bb_wma.gif
例子:[wmv=480,360,1]http://www.abc.com/abc.wmv[/wmv]
解释:插入 WMV 类型影像文件,其类型包括:wmv,wma,mp3,mid,mp,swf……
例子:[rm=480,360,1]http://www.abc.com/abc.wmv[/rm]
解释:插入 RM 类型影像文件,其类型包括:rm,rmvb,ra,ram……
例子:[gcx]在这里插入滚动显示的歌词[/gcx]
解释:插入滚动显示的歌词
注:播放器和歌词秀按钮都做好了,不放心可以去我的小坛子上测试先。
有问题请多多指正!
差点忘了,还有几个小图标,
放到images/common/
[ 本帖最后由 epin 于 2006-9-10 10:41 编辑 ] |