本帖最后由 yoyoliyang 于 2008-11-1 13:44 编辑
mp3plugin说明
支持手动和自动播放,flash用的wordpress的插件。真正实现了日志插入mp3功能,且界面简洁。
附件中三个文件:
flashplayer文件,和flash执行脚本,以及editor_boolbar.gif。
位置:
image/player.swf
image/audio-player.js
image/editor/editor_boolbar.gif
三个需要修改的文件
/www/editor.php,需要添加如下字段:
a.icoMp3{background-position:-580px 1px} //gif图标位置
<a href="javascript:;" class="icoMp3" id="icoMp3" onClick="createMp3(event, 1);return false;" title="插入音乐"></a> //执行脚本
<div id="createMp3" class="eMenu" style="display:none;top:35px;left:26px;width:400px;font-size:12px">
请输入MP3音乐URL地址:<br/>
<select name="vmp3auto" id="vmp3auto">
<option value="0">自动播放</option>
<option value="1">手动播放</option>
</select>
<input type="text" id="mp3Url" name="mp3Url" value="http://" class="t_input" style="width: 190px;" /> <input type="button" onclick="createMp3();" name="createURL" value="确定" class="submit" /> <a href="javascript:;" onclick="fHide($('createMp3'));">取消</a>
</div>[/code]/var/www/image/editor/editor_base.js,添加如下:- fInObj(el, "createMp3") ||
- [code]icoMp3:"createMp3", //mp3图标和变量
- /**
- * 创建MP3
- */
- function createMp3(e, show) {
- if(typeof show == 'undefined') {
- var mp3tag = '';
- var mp30bj = $('mp3Url');
- var sMp3 = mp30bj.value;
- if ((sMp3!=null) && (sMp3!="http://")){
- setCaret();
- var sIsAuto = $('vmp3auto').value;
- if(sIsAuto==1) {
- mp3tag = '[mp3=auto]';
- } else {
- mp3tag = '[mp3]';
- }
- format("insertHTML", mp3tag + sMp3 + '[/mp3]');
- }
- fHide($('createMp3'));
- mp3Obj.value = 'http://';
- } else {
- if(gIsIE){
- var e = window.event;
- }
- getCaret();
- var dvMp3Box = $("createMp3");
- var iX = e.clientX;
- var iY = e.clientY;
- dvMp3Box.style.display = "";
- dvMp3Box.style.left = (iX-300) + "px";
- dvMp3Box.style.top = 33 + "px";
- }
- }
复制代码 /www/source/space_blog.php,插入如下段落:- //插入视频文件
- function blog_bbcode( $message )
- {
- $message = preg_replace( "/\\[flash\\=?(media|real)*\\](.+?)\\[\\/flash\\]/ie", "blog_flash("\\2", "\\1")", $message );
- [color=Blue] $message = preg_replace( "/\\[mp3\\=?(auto)*\\](.+?)\\[\\/mp3\\]/ie","blog_mp3("\\2", "\\1")",$message);[/color] //在此加入这一蓝色段落
- return $message;
- }
- //插入mp3
- function blog_mp3( $mp3_url, $state )
- {
- $optauto = "";
- if ( $state == "auto" )
- {
- $optauto = "&autostart=yes";
- }
- $html = '<script language="JavaScript" src="image/audio-player.js"></script><object type="application/x-shockwave-flash" data="image/player.swf" id="_RANDOM_ID_" height="24" width="290"><param name="movie" value="image/player.swf"><param name="FlashVars" value="playerID=_RANDOM_ID_&soundFile='.$mp3_url.$optauto.'"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>';
- return $html;
- }
复制代码 寿光家园:[url]www.shouguang.org[/url] |