手动插入格式(宽、高、自播)默认为:
- [wmv=360,300,1]http://[/wmv]
- [rm=360,300,1]http://[/rm]
复制代码
需要修改的文件有
- include/discuzcode.func.php
- include/bbcode.js
- templates\default\templates.lang.php
- templates\default\post_bbinsert.htm
复制代码
打开include/discuzcode.func.php,查找
- "/\[img\]\s*([^\[\<\r\n]+?)\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",
复制代码
查找
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle"> <a href="%s" target="_blank">Flash: %s</a> ')",
复制代码
替换为
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle"> <a href="%s" target="_blank">在新窗口中打开</a><br><br><embed width="360" height="300" src="%s" type="application/x-shockwave-flash"></embed>')",
复制代码
查找(紧跟着这段)
- "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);">')",
复制代码
在下面添加:
- "bbcodeurl('\\1', ' <img src="images/attachicons/flash.gif" align="absmiddle"> <a href="%s" target="_blank">在新窗口中打开</a><br><br><embed width="360" height="300" src="%s" type="application/x-shockwave-flash"></embed>')",
- "bbcodeurl('\\1', '<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', '<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', '<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', '<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>')",
复制代码
include/discuzcode.func.php修改结束。
打开include/bbcode.js,在最后加上以下代码:
- 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 mp3() {
- if (helpmode){
- alert(mp3_help);
- } else if (getSelectedText()) {
- var range = document.selection.createRange();
- range.text = "[mp3=360,50,1]" + range.text + "[/mp3]";
- } else if (advmode) {
- AddTxt="[mp3=360,50,1]http://[/mp3]";
- AddText(AddTxt);
- } else {
- txt=prompt(mp3_normal,"http://");
- if (txt!=null){
- txt2=prompt(media_input1,"360");
- txt3=prompt(media_input2,"50");
- txt4=prompt(media_input3,"1");
- txt2=txt2==null?'360':txt2;
- txt3=txt3==null?'50':txt3;
- txt4=txt4==null?'0':txt4;
- if (txt2!="" && txt3!="" && txt4!=""){
- AddTxt="[mp3="+txt2+","+txt3+","+txt4+"]"+txt;
- AddText(AddTxt);
- AddText("[/mp3]");
- }else{
- AddTxt="[wmv=360,50,1]"+txt;
- AddText(AddTxt);
- AddText("[/mp3]");
- }
- }
- }
- }
- 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]");
- }
- }
- }
- }
复制代码
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,swf',
- 'post_discuzcode_mp3' => '插入 mp3 类型影像文件',
- 'post_discuzcode_mp3_comment' => '在文本中插入一个 mp3 类型影像文件。\n其类型包括:mp3',
- 'post_discuzcode_rm' => '插入 RM 类型影像文件',
- 'post_discuzcode_rm_comment' => '在文本中插入一个 RM 类型影像文件。\n其类型包括:rm,rmvb,ra,ram',
- 'post_discuzcode_wmv_normal' => '请输入影像文件的 URL。',
- 'post_discuzcode_mp3_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 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:mp3()"><img src="{IMGDIR}/bb_mp3.gif" border="0" alt="{lang post_discuzcode_mp3}"></a>
复制代码
templates\default\post_bbinsert.htm修改结束
附件内所有图片文件放到[IMAGES/模板名]目录中。
至此,插件全部结束。
[ 本帖最后由 heima9121 于 2006-9-18 14:59 编辑 ] |