Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[经验] [Ucenter Home扩展]添加分享音乐功能

[复制链接]
gesse 发表于 2008-11-6 01:48:47 | 显示全部楼层 |阅读模式
UCHome插件
语言编码: GBK简体 UTF8简体 
插件名称: 音乐共享
插件作者: Gesse
适用版本:
本帖最后由 gesse 于 2008-11-6 01:53 编辑

以下代码修改行数对照1.2版本,1.5版本的也差不多,以后补上

实现的功能:分享音乐

如图:
       添加

      

       feed 默认
      
       feed 点击以后
      


我觉得风格还行吧

下面开始修改:

1. template/yourstyle/space_share_list.htm  行 62 添加

        <form id="shareform2" name="shareform" action="cp.php?ac=share&type=music" method="post">
        <table cellspacing="2" cellpadding="2" width="100%">
            <tr><td><strong>分享音乐:</strong></td></tr>
            <tr><td><input type="text" class="t_input" name="link" id="share_link2" style="width:98%;" value="http://" /></td></tr>
            <tr><td><strong>描述:</strong></td></tr>
            <tr>

                <td>

                    <textarea id="share_general2" name="general" style="width:98%;" rows="3"></textarea>

                </td>

            </tr>
            <tr><td>
            <input type="hidden" name="refer" value="space.php?uid=$space[uid]&do=share&view=me" />
            <input type="hidden" name="sharesubmit" value="true" />
            <input type="button" id="sharesubmit_btn2" name="sharesubmit_btn" value="分享" class="submit" /></td></tr>
            <tr><td id="sharestatus2"></td></tr>
        </table>
        </form>   


2. source/cp_share.php 行 202 添加

        case 'music':
            $link = shtmlspecialchars(trim($_POST['link']));
            if($link) {
                if(!preg_match("/^http\:\/\/.{4,300}$/i", $link)) $link = '';
            }
            if(empty($link)) {
                showmessage('url_incorrect_format2');
            }
            $arr['title_template'] = lang('share_music');
            $arr['body_template'] = '{link}';
            $arr['body_data'] = array(
                'link'=>"<embed name=\"flashplayer\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" align=\"top\" src=\"http://www.macloo.com/examples/audio_player/player.swf\" width=\"200px\" height=\"20px\" type=\"application/x-shockwave-flash\" FLASHVARS=\"soundFile={$link}&autostart=no&loop=no\" quality=\"high\" menu=\"false\" wmode=\"transparent\"></embed>",
                'data'=>$link
            );
            break;        
也就是 case 'link':  ... break;后面

3. language/lang_showmessage.php 行 116   添加
    'url_incorrect_format2' => '分享的音乐路径格式不正确',

原则是你添加在$_SGLOBAL['msglang'] 内都可以,不过为了无缝结合原则还是应该这么写

4. language/lang_source.php 行 69 添加
    'share_music' => '分享了一首歌曲',
    原则同上

5. template/yourstyle/space_share_li.htm 行 4、5的判断条件里都加上
   || $value['type']=='music'
   也就是 <!--{if $value['type']=='link' || $value['type']=='music'}-->
   记得有两处哦

6. source/function_cp.php 行 425 添加

    if($type == 'music') {
        $body_data['link'] .= " (<a href=\"space.php?uid=$_SGLOBAL[supe_uid]&do=share&id=$sid\" target=\"_blank\">".lang('comment')."</a>)";
    }

   也就是在share_add函数里的if($type == 'link'){...}后面


PS: 1.5的话当然大家可以去按照这样的步骤去琢磨,相信应该差距不大,这个我有时间再补充上,还有就是flash播放器只支持mp3、wav目前,所以大家可以在添加的地方给出提示,就这么多了,最后,更改了以后要立即看到效果记得到后台刷新模板缓存
popingdhao 发表于 2008-11-6 02:22:07 | 显示全部楼层
呵呵,不错!已经有了,不过还是支持.
回复

使用道具 举报

GGGHHH 发表于 2008-11-6 02:58:25 | 显示全部楼层
不错,收了
回复

使用道具 举报

 楼主| gesse 发表于 2008-11-6 08:53:36 | 显示全部楼层
呵呵,不错!已经有了,不过还是支持.
popingdhao 发表于 2008-11-6 02:22


1.5已经有了?
回复

使用道具 举报

1753103 发表于 2008-11-6 09:27:29 | 显示全部楼层
支持下!早就有了
回复

使用道具 举报

abcnic1 发表于 2008-11-6 10:27:31 | 显示全部楼层
谢谢分享、、
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-16 01:48 , Processed in 0.104333 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表