这个插件集成了以下功能:
1. WMV和RM两在类别的音乐及影像文件播放;
2. 自定义播放器的大小,以及是否自动播放, 以及默认方式播放;
3. 含全屏按扭;
4. 支持了FLASH播放,并可自定义播放器的大小;
5. 加了所有功能的按扭;
6. 加入音乐文件的动态显示歌词功能;
7. 动态歌词中支持暂停滚动,快速向上和向下滚动;
8. 加入HIDE按扭, 并根据后台设定的权限决定是否显示此按扭;
9. 各个函数得到了部分优化;
可参考附件图片演示.
include/discuzcode.func.php修改开始
查找:
- if(!$bbcodeoff && $allowimgcode) {
- if(empty($discuzcodes['searcharray']['imgcode'])) {
- $discuzcodes['searcharray']['imgcode'] = array(
- "/\[swf\]\s*([^\[]+?)\s*\[\/swf\]/ies",
- "/\[img\]\s*([^\[]+?)\s*\[\/img\]/ies",
- "/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[]+?)\s*\[\/img\]/ies"
- );
- $discuzcodes['replacearray']['imgcode'] = array(
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle"> <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.resized) this.style.cursor=\'hand\';" onclick="if(!this.resized) {return true;} else {window.open(\'%s\');}" onmousewheel="return imgzoom(this);">')",
- "bbcodeurl('\\3', '<img width="\\1" height="\\2" src="%s" border="0">')"
- );
- }
- $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修改结束
include/bbcode.js修改开始
文章最后加上:
ps.先查看这个文件内是否已有以下某函数,若有,请删除后再加.
- function wmv() {
- if (helpmode){
- alert(wmv_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[wmv=360,300,1]" + range.text + "[/wmv]";
- } else if (advmode) {
- AddTxt="[wmv=360,300,1]http://[/wmv]";
- AddText(AddTxt);
- } else {
- txt=prompt(wmv_normal,"http://");
- if (txt!=null){
- txt2=prompt(media_input1,"360");
- txt3=prompt(media_input2,"300");
- txt4=prompt(media_input3,"1");
- txt2=txt2==null?'360':txt2;
- txt3=txt3==null?'300':txt3;
- txt4=txt4==null?'0':txt4;
- if (txt2!="" && txt3!="" && txt4!=""){
- AddTxt="[wmv="+txt2+","+txt3+","+txt4+"]"+txt;
- AddText(AddTxt);
- AddText("[/wmv]");
- }else{
- AddTxt="[wmv=360,300,1]"+txt;
- AddText(AddTxt);
- AddText("[/wmv]");
- }
- }
- }
- }
- function rm() {
- if (helpmode){
- alert(rm_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[rm=360,300,1]" + range.text + "[/rm]";
- } else if (advmode) {
- AddTxt="[rm=360,300,1]http://[/rm]";
- AddText(AddTxt);
- } else {
- txt=prompt(wmv_normal,"http://");
- if (txt!=null){
- txt2=prompt(media_input1,"360");
- txt3=prompt(media_input2,"300");
- txt4=prompt(media_input3,"1");
- txt2=txt2==null?'360':txt2;
- txt3=txt3==null?'300':txt3;
- txt4=txt4==null?'0':txt4;
- if (txt2!="" && txt3!="" && txt4!=""){
- AddTxt="[rm="+txt2+","+txt3+","+txt4+"]"+txt;
- AddText(AddTxt);
- AddText("[/rm]");
- }else{
- AddTxt="[rm=360,300,1]"+txt;
- AddText(AddTxt);
- AddText("[/rm]");
- }
- }
- }
- }
- function gcx_mp3() {
- if (helpmode) {
- alert(gcx_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[gcx]" + range.text + "[/gcx][mp3]http://[/mp3]";
- } else if (advmode) {
- AddTxt="\r[gcx]"+gcx_help+"[/gcx][mp3]http://[/mp3]";
- AddText(AddTxt);
- } else {
- txt=prompt(wmv_normal,"http://");
- if (txt!=null) {
- AddTxt="\r[gcx]"+gcx_help;
- AddText(AddTxt);
- AddText("[/gcx][mp3]"+txt+"[/mp3]");
- }
- }
- }
- function gcx_ron() {
- if (helpmode) {
- alert(gcx_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[gcx]" + range.text + "[/gcx][ron]http://[/ron]";
- } else if (advmode) {
- AddTxt="\r[gcx]"+gcx_help+"[/gcx][ron]http://[/ron]";
- AddText(AddTxt);
- } else {
- txt=prompt(wmv_normal,"http://");
- if (txt!=null) {
- AddTxt="\r[gcx]"+gcx_help;
- AddText(AddTxt);
- AddText("[/gcx][ron]"+txt+"[/ron]");
- }
- }
- }
- function hide() {
- if (helpmode) {
- alert(hide_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[hide]" + range.text + "[/hide]";
- } else if (advmode) {
- AddTxt="[hide]"+hide_normal+"[/hide]";
- AddText(AddTxt);
- } else {
- txt1=prompt(hide_credit,0);
- txt=prompt(hide_help,hide_normal);
- txt1=txt1==0 || !txt1?'':"="+txt1;
- if (txt!=null) {
- AddTxt="[hide"+txt1+"]"+txt;
- AddText(AddTxt);
- AddText("[/hide]");
- }
- }
- }
复制代码
include/bbcode.js修改结束
templates\default\templates.lang.php修改开始
查找:
- 'post_discuzcode_image_normal' => '请输入图像的 URL。',
复制代码
下面加:
- 'post_discuzcode_wmv' => '插入 WMV 类型影像文件',
- 'post_discuzcode_wmv_comment' => '在文本中插入一个 WMV 类型影像文件。\n其类型包括:wmv,wma,mp3,mid,mp,swf……',
- 'post_discuzcode_rm' => '插入 RM 类型影像文件',
- 'post_discuzcode_rm_comment' => '在文本中插入一个 RM 类型影像文件。\n其类型包括:rm,rmvb,ra,ram……',
- 'post_discuzcode_mp3' => '为一个 MP3 类型的音乐加入动态歌词功能',
- 'post_discuzcode_ron' => '为一个 RM 类型的音乐加入动态歌词功能',
- 'post_discuzcode_gcx' => '\r在这里插入滚动显示的歌词\r',
- 'post_discuzcode_hide' => '插入 HIDE 代码!',
- 'post_discuzcode_hide_credit' => '输入你要限制的积分值: (0=回复查看贴)',
- 'post_discuzcode_hide_normal' => '插入您要用 HIDE 代码隐藏的信息!',
- 'post_discuzcode_wmv_normal' => '请输入影像文件的 URL。',
- 'post_discuzcode_media_input1' => '插入影像文件的宽度,推荐360-480',
- 'post_discuzcode_media_input2' => '插入影像文件的高度,推荐300-360',
- 'post_discuzcode_media_input3' => '是否让插入的影像文件自动播放,1=自动播放、0=手动播放',
复制代码
templates\default\templates.lang.php修改结束
templates\default\post_bbinsert.htm修改开始
查找:
- var image_normal = "{lang post_discuzcode_image_normal}";
复制代码
下面加:
- var wmv_help = "{lang post_discuzcode_wmv}\n\n{lang post_discuzcode_wmv_comment}";
- var rm_help = "{lang post_discuzcode_rm}\n\n{lang post_discuzcode_rm_comment}";
- var mp3_help = "{lang post_discuzcode_mp3}";
- var ron_help = "{lang post_discuzcode_ron}";
- var gcx_help = "{lang post_discuzcode_gcx}";
- var hide_help = "{lang post_discuzcode_hide}";
- var hide_normal = "{lang post_discuzcode_hide_normal}";
- var hide_credit = "{lang post_discuzcode_hide_credit}";
- var wmv_normal = "{lang post_discuzcode_wmv_normal}";
- var media_input1 = "{lang post_discuzcode_media_input1}";
- var media_input2 = "{lang post_discuzcode_media_input2}";
- var media_input3 = "{lang post_discuzcode_media_input3}";
复制代码
查找:
- <a href="javascript:flash()"><img src="{IMGDIR}/bb_flash.gif" border="0" alt="{lang post_discuzcode_flash}"></a>
复制代码
下面加:
- <a href="javascript:wmv()"><img src="{IMGDIR}/bb_vod.gif" border="0" alt="{lang post_discuzcode_wmv}"></a>
- <a href="javascript:rm()"><img src="{IMGDIR}/bb_rm.gif" border="0" alt="{lang post_discuzcode_rm}"></a>
- <a href="javascript:gcx_mp3()"><img src="{IMGDIR}/bb_mp3.gif" border="0" alt="{lang post_discuzcode_mp3}"></a>
- <a href="javascript:gcx_ron()"><img src="{IMGDIR}/bb_ron.gif" border="0" alt="{lang post_discuzcode_ron}"></a>
- <!--{if $allowhidecode}-->
- <a href="javascript:hide()"><img src="{IMGDIR}/bb_hide.gif" border="0" alt="{lang post_discuzcode_hide}"></a>
- <!--{/if}-->
复制代码
templates\default\post_bbinsert.htm修改结束
include/common.js修改开始
文章最后加入:
- function list1(){
- scrolltext.scrollDelay=50;
- scrolltext.scrollAmount=2;
- scrolltext.direction="up";
- }
- function list2(){
- scrolltext.scrollDelay=220;
- scrolltext.scrollAmount=1;
- scrolltext.direction="up";
- }
- function list3(){
- scrolltext.scrollDelay=50;
- scrolltext.scrollAmount=2;
- scrolltext.direction="down";
- }
- function list4(){
- scrolltext.scrollDelay=220;
- scrolltext.scrollAmount=1;
- scrolltext.direction="up";
- }
复制代码
include/common.js修改结束
附件内所有图片文件放到[IMAGES/模板名]目录中 |