Plugin Directory

Changeset 382164


Ignore:
Timestamp:
05/07/2011 02:42:56 PM (15 years ago)
Author:
cooiky
Message:
 
Location:
qqpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qqpress/trunk/qqpress.php

    r381634 r382164  
    66Plugin URI: http://app.hencuo.com/qqpress
    77Description: 新文章发布时,将文章标题和URL发布到你的腾讯微博。
    8 Version: 1.1
     8Version: 1.2
    99*/
    1010
     
    2424    if (session_id() == "")
    2525        session_start();
     26    if (isset($_POST["qqpress_send"]) && "1" == isset($_POST["qqpress_send"]) && isset($_POST["qqpress_tweet"])) {
     27        echo qqpress_publish_2_qq($_POST["qqpress_tweet"]);
     28        die();
     29    }
    2630}
    2731
     
    190194    if (get_option("qq_oauth_token") != false && get_option("qq_oauth_token_secret") != false) {
    191195?>
    192         <div class="wrap">
     196        <div class="wrap"><div id="icon-options-general" class="icon32"><br /></div>
    193197        <h2>腾讯微博同步</h2>
    194         <div id="message" class="updated fade"><p>授权成功</p></div>
     198        <div class="updated fade"><p>已成功授权</p></div>
    195199        <p>取消授权请访问:<a href="http://open.t.qq.com/apps/appslist.php" target="_blank">http://open.t.qq.com/apps/appslist.php</a></p>
    196200        </div>
     
    216220        <h2>腾讯微博同步授权</h2>
    217221        <style type="text/css">
    218             .qc_button img{ border:none;}
     222            .qc_button img{border:none;}
    219223        </style>
    220224        <p id="qc_connect" class="qc_button">
     
    232236    $message = get_option('qqpress_message');
    233237    $submitFieldID = 'qqpress_submit_hidden';
    234 
     238   
    235239    if ($_POST[$submitFieldID] == 'Y') {
    236240        update_option('qqpress_message', $_POST['qqpress_form_message']);
    237241        echo '<div class="updated"><p><strong>更新成功</strong></p></div>';
    238242    }
     243
     244    $qc_url = WP_PLUGIN_URL.'/'.dirname(plugin_basename (__FILE__));
    239245?>
    240 
     246    <script type="text/javascript">
     247    /*<![CDATA[*/
     248    jQuery(function() {
     249        jQuery("#qqpress_tweet").click(function() {
     250            var tweet = jQuery.trim(jQuery("#qqpress_tweet_content").val());
     251            if ("" != tweet) {
     252                jQuery.ajax({
     253                    type : "POST",
     254                    beforeSend : disable_button,
     255                    dataType : "text",
     256                    url : "<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>",
     257                    data : "qqpress_tweet=" + tweet + "&qqpress_send=1&timestamp=" + (new Date().getTime()),
     258                    success : show_message
     259                });
     260            } else {
     261                alert("广播内容不能为空!");
     262            }
     263        });
     264    })
     265   
     266    function disable_button() {
     267        jQuery("#qqpress_tweet").attr("disabled", "disabled");
     268    }
     269
     270    function show_message(data) {
     271        jQuery("#qqpress_result").html("发布成功。<a href='http://t.qq.com/p/t/"+data+"' target='_blank'>查看</a>").css("color", "red");
     272        jQuery("#qqpress_tweet").attr("disabled", "");
     273    }
     274    /*]]>*/
     275    </script>
    241276    <div class="wrap">
    242     <h2>腾讯微博同步选项</h2>
    243 
    244     <form name="qqpress_form" method="post" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
    245     <input type="hidden" name="qqpress_submit_hidden" value="Y" />
    246     <p><h3>同步内容格式</h3><textarea name="qqpress_form_message" rows="3" cols="80" /><?php echo (get_option('qqpress_message')); ?></textarea></p>
    247     <p class="submit"><input type="submit" name="Submit" value="更新" /></p>
    248     <p>同步内容支持以下格式:
    249     <ul>
    250         <li><strong>[title]</strong>:日志标题</li>
    251         <li><strong>[permalink]</strong>:自定义的日志永久链接<em>(<a href="http://www.hencuo.com/archives/119" target="_blank">http://www.hencuo.com/archives/119</a>)</em></li>
    252         <li><strong>[link]</strong>:默认的日志链接<em>(<a href="http://www.hencuo.com/index.php?p=119" target="_blank">http://www.hencuo.com/index.php?p=119</a>)</em></li>
    253     </ul>
    254     </p>
    255     </form>
     277        <div class="tool-box">
     278            <h3>发微博</h3>
     279            <textarea id="qqpress_tweet_content" name="qqpress_tweet_content" rows="2" cols="80" />#半醒WP微博同步#</textarea><br />
     280            <input type="button" id="qqpress_tweet" name="qqpress_tweet_button" value=" 广 播 " class="button" /><span id="qqpress_result"></span><br /><br />
     281           
     282            <h3>腾讯微博同步格式</h3>
     283            <p><form name="qqpress_form" method="post" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
     284                <input type="hidden" name="qqpress_submit_hidden" value="Y" />
     285                <label for="qqpress_form_message">同步内容格式:</label>
     286                <input type="text" class="regular-text" id="qqpress_form_message" name="qqpress_form_message" value="<?php echo (get_option('qqpress_message')); ?>" /><input type="submit" name="Submit" class="button" value="保存修改" />
     287            </form></p>
     288            <p>同步内容支持以下格式:
     289            <ul>
     290                <li><strong>[title]</strong>:日志标题</li>
     291                <li><strong>[permalink]</strong>:自定义的日志永久链接<em>(<a href="http://www.hencuo.com/archives/119" target="_blank">http://www.hencuo.com/archives/119</a>)</em></li>
     292                <li><strong>[link]</strong>:默认的日志链接<em>(<a href="http://www.hencuo.com/index.php?p=119" target="_blank">http://www.hencuo.com/index.php?p=119</a>)</em></li>
     293            </ul>
     294            </p>
     295        </div>
    256296    </div>
    257297    <?php
     
    292332
    293333    $resp = $to->post('http://open.t.qq.com/api/t/add?f=1', $params);
     334
     335    return $resp["data"]["id"];
    294336}
    295337
  • qqpress/trunk/readme.txt

    r381634 r382164  
    55Requires at least: 3.0
    66Tested up to: 3.1.1
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88
    99支持将新日志标题和链接同步到腾讯微博。
     
    3030
    3131== Changelog ==
     32= 1.2 =
     33* 2011/05/07
     34* 增加在插件设置页面直接发微博功能
     35
    3236= 1.11 =
    3337* 2011/05/06
    3438* 修正插件在进行微博同步时获取日志永久链接错误的bug
     39
    3540= 1.1 =
    3641* 2011/05/05
Note: See TracChangeset for help on using the changeset viewer.