本插件由版主sakurakawaii于07年5月2日23:19分
在Windows XP Discuz!5.5.0标准模版 IE6 Mysql4.1下测试安装无错
本测试仅代表此插件安装无错,不包括今后长期使用中可能出现的问题
[演示]: http://bbs.bizhs.com/forumdisplay.php?fid=15
特此说明一下:
以前有很多凌凌乱乱的关于支持多媒体的插件,多了反而乱了...
所以我感觉,如果你要用到这个功能,
最好还是规范一下.
建议在安装这个插件之后把后台的多媒体代码关闭或删除!
这个插件集成了以下功能:
原创: oytktk(靖飒)
1. WMV和RM两在类别的音乐及影像文件播放;
2. 自定义播放器的大小,以及是否自动播放, 以及默认方式播放;
3. 含全屏按扭;
4. 支持了FLASH播放,并可自定义播放器的大小;
5. 加了所有功能的按扭;
6. 加入音乐文件的动态显示歌词功能;
7. 动态歌词中支持暂停滚动,快速向上和向下滚动;
8. 加入HIDE按扭, 并根据后台设定的权限决定是否显示此按扭;
9. 各个函数得到了部分优化;
include/discuzcode.func.php
查找:
if(!$bbcodeoff) {复制代码
改为:
//======================
if(!$bbcodeoff) {复制代码
查找:
for($i = 0; $i <= $discuzcodes['pcodecount']; $i++) {复制代码
改为:
//=======================
for($i = 0; $i <= $discuzcodes['pcodecount']; $i++)
{复制代码
然后将两个
//====================复制代码
中间的内容改为:
if(!$bbcodeoff) {
$message = preg_replace(array(
($parsetype != 1 ? "/\[swf\]\s*([^\[\<\r\n]+?)\s*\[\/swf\]/ies" : "//"),
"/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
"/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies",
"/\[swf=(\d+?)[x|\,](\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"
), $allowimgcode ? array(
($parsetype != 1 ? "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=\"\" />')",
"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=\"0\" ><param name=\"enableContextMenu\" value=\"0\"><param name=\"ShowStatusBar\" value=\"\\3\"><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=\"\\1\" height=\"\\2\"></embed></object>')",
"bbcodeurl('\\1', '<object align=\"middle\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" class=\"OBJECT\" id=\"MediaPlayer\" width=\"360\" 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=\"360\" height=\"68\"></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>')"
) : array(
($parsetype != 1 ? "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>')",
"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">%s</a>')",
"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">%s</a>')",
"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', '<a href=\"%s\" target=\"_blank\">%s</a>')",
"bbcodeurl('\\4', '<a href=\"%s\" target=\"_blank\">%s</a>')",
"bbcodeurl('\\4', '<a href=\"%s\" target=\"_blank\">%s</a>')"
), $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\" width=\"480\" bgcolor=\"#000000\"><tr><td rowspan=\"2\" width=\"460\"><marquee id=\"scrolltext\" onmouseover=this.stop() onmouseout=this.start() TrueSpeed scrollamount=1 scrolldelay=200 width=\"100%\" height=\"280\" direction=\"up\"><font style=\"font-size: 14pt\" color=#FFFFFF><center>$code</center></FONT></marquee></td><td width=\"20\" onmouseover=\"list3()\" onmouseout=\"list4()\" style=\"Cursor:hand\"><font color=#FFFFFF><center>↑</center></font></td></tr><tr><td width=\"20\" 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);复制代码
2. 文件 include/javascript/editor.js
查找:
} else if(!wysiwyg && cmd == 'outdent') {复制代码
在上面加:
}else if(cmd == 'hkvod'){
var hkvod_t = prompt(lang['enter_hk_meida_url'], 'http://')
var hkvod_1 = prompt(lang['enter_hk_media_input1'], '360')
var hkvod_2 = prompt(lang['enter_hk_media_input2'], '300')
var hkvod_3 = prompt(lang['enter_hk_media_input3'], '0')
var opentag = '[wmv=' + hkvod_1 + ',' + hkvod_2 + ',' + hkvod_3 + ']' + hkvod_t;
var closetag = '[/wmv]';
insertText(opentag + closetag, opentag.length, closetag.length);
}else if(cmd == 'hkrmv'){
var hkrmv_t = prompt(lang['enter_hk_meida_url'], 'http://')
var hkrmv_1 = prompt(lang['enter_hk_media_input1'], '360')
var hkrmv_2 = prompt(lang['enter_hk_media_input2'], '300')
var hkrmv_3 = prompt(lang['enter_hk_media_input3'], '0')
var opentag = '[rm=' + hkrmv_1 + ',' + hkrmv_2 + ',' + hkrmv_3 + ']' + hkrmv_t;
var closetag = '[/rm]';
insertText(opentag + closetag, opentag.length, closetag.length);
}else if(cmd == 'hkrmv'){
var hkrmv_t = prompt(lang['enter_hk_meida_url'], 'http://')
var hkrmv_1 = prompt(lang['enter_hk_media_input1'], '360')
var hkrmv_2 = prompt(lang['enter_hk_media_input2'], '300')
var hkrmv_3 = prompt(lang['enter_hk_media_input3'], '0')
var opentag = '[rm=' + hkrmv_1 + ', ' + hkrmv_2 + ', ' + hkrmv_3 + ']' + hkrmv_t;
var closetag = '[/rm]';
insertText(opentag + closetag, opentag.length, closetag.length);
}else if(cmd == 'hkmp3'){
var hkmp3_t = prompt(lang['enter_hk_meida_url'], 'http://')
var opentag = '\n[gcx]' + lang['enter_hk_gcx'];
var closetag = '[/gcx][mp3]' + hkmp3_t + '[/mp3]';
insertText(opentag + closetag, opentag.length, closetag.length);
}else if(cmd == 'hkron'){
var hkmp3_t = prompt(lang['enter_hk_meida_url'], 'http://')
var opentag = '\n[gcx]' + lang['enter_hk_gcx'];
var closetag = '[/gcx][ron]' + hkmp3_t + '[/ron]';
insertText(opentag + closetag, opentag.length, closetag.length);
}else if(cmd == 'hkswf'){
var hkmp3_t = prompt(lang['enter_hk_meida_url'], 'http://')
var hkmp3_1 = prompt(lang['enter_hk_media_input1'], '360')
var hkmp3_2 = prompt(lang['enter_hk_media_input2'], '300')
var hkmp3_3 = prompt(lang['enter_hk_media_input3'], '0')
var opentag = '[swf=' + hkmp3_1 + ',' + hkmp3_2 + ',' + hkmp3_3 + ']' + hkmp3_t;
var closetag = '[/swf]';
insertText(opentag + closetag, opentag.length, closetag.length);复制代码
3. include/javascript/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";
}复制代码
4. templates\default\templates.lang.php
查找:
'post_discuzcode_expand' => '扩展编辑框',复制代码
加车之后加入:
'post_discuzcode_hkvod' => '插入 WMV 类型影像文件',
'post_discuzcode_hkrmv' => '插入 RM 类型影像文件',
'post_discuzcode_hkmp3' => '为一个 MP3 类型的音乐加入动态歌词功能',
'post_discuzcode_hkron' => '为一个 RM 类型的音乐加入动态歌词功能',
'post_discuzcode_hkswf' => '插入一个FLASH影像文件',
'post_discuzcode_gcx' => '\r在这里替换为滚动显示的歌词\r',
'post_discuzcode_meida_url' => '请输入影像文件的地址(URL):',
'post_discuzcode_media_input1' => '插入影像文件的宽度,推荐360-480',
'post_discuzcode_media_input2' => '插入影像文件的高度,推荐300-360',
'post_discuzcode_media_input3' => '是否让插入的影像文件自动播放,1=自动播放、0=手动播放',复制代码
5.templates\default\post_bbinsert.htm
查找:
lang['enter_link_url']复制代码
上面加:
lang['enter_hk_meida_url'] = "{lang post_discuzcode_meida_url}";
lang['enter_hk_gcx'] = "{lang post_discuzcode_gcx}";
lang['enter_hk_media_input1'] = "{lang post_discuzcode_media_input1}";
lang['enter_hk_media_input2'] = "{lang post_discuzcode_media_input2}";
lang['enter_hk_media_input3'] = "{lang post_discuzcode_media_input3}";
复制代码
查找最后一个:
<td><img src="images/common/bb_separator.gif" width="6" height="20" alt="" /></td>复制代码
下面加:
<td><div class="editor_buttonnormal" id="{$editorid}_cmd_vod" onclick="discuzcode('hkvod')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/hk_vod.gif" width="21" height="20" title="{lang post_discuzcode_hkvod}" alt="{lang post_discuzcode_hkvod}" /></div></td>
<td><div class="editor_buttonnormal" id="{$editorid}_cmd_rmv" onclick="discuzcode('hkrmv')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/hk_rmv.gif" width="21" height="20" title="{lang post_discuzcode_hkrmv}" alt="{lang post_discuzcode_hkrmv}" /></div></td>
<td><div class="editor_buttonnormal" id="{$editorid}_cmd_mp3" onclick="discuzcode('hkmp3')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/hk_mp3.gif" width="21" height="20" title="{lang post_discuzcode_hkmp3}" alt="{lang post_discuzcode_hkmp3}" /></div></td>
<td><div class="editor_buttonnormal" id="{$editorid}_cmd_ron" onclick="discuzcode('hkron')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/hk_ron.gif" width="21" height="20" title="{lang post_discuzcode_hkron}" alt="{lang post_discuzcode_hkron}" /></div></td>
<td><div class="editor_buttonnormal" id="{$editorid}_cmd_swf" onclick="discuzcode('hkswf')" onMouseOver="buttonContext(this, 'mouseover')" onMouseOut="buttonContext(this, 'mouseout')"><img src="images/common/hk_swf.gif" width="21" height="20" title="{lang post_discuzcode_hkswf}" alt="{lang post_discuzcode_hkswf}" /></div></td>复制代码
上传5个图片文件到 IMAGES/COMMON/目录下.
[
本帖最后由 oytktk 于 2007-8-24 09:05 编辑 ]