Plugin Directory

Changeset 457635


Ignore:
Timestamp:
10/31/2011 08:43:05 AM (14 years ago)
Author:
cooiky
Message:
 
Location:
qqpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qqpress/trunk/qqpress.php

    r408132 r457635  
    1818add_action("admin_head", "qc_wp_head");
    1919add_action('admin_menu', 'qc_options_add_page');
     20add_action('admin_menu', 'qqweibo_option_menu');
    2021add_action('wp_insert_post', 'qqpress_run');
    2122add_option('qqpress_message', '新日志:[title] [permalink]##100', '', 'yes');
     
    3132}
    3233
     34//在文章发布页增加是否同步到微博的复选框
     35function qqweibo_option_menu() {
     36    if( function_exists('add_meta_box')) {
     37        add_meta_box('qqweibo_meta_box', __('腾讯微博同步设置'), 'inner_qqweibo_option_menu', 'post', 'advanced');
     38    }
     39}
     40
     41function inner_qqweibo_option_menu($post) {
     42    echo '<label for="xx">同步到腾讯微博</label>';
     43    echo '<input id="xx" name="istoqq" type="checkbox" value="1" checked />';
     44}
     45
    3346//新日志发布时执行
    3447function qqpress_run($postID) {
    35     $post = get_post($postID); //获取日志信息
    36    
    37     //如果该日志并未同步到腾讯微博
    38     if (!qqpress_was_qqed($postID))
    39         qqpress_db_update_post($postID, $post->post_status); //改变该日志的同步状态为"qqed"
    40 
    41     qqpress_process_posts(); //同步到腾讯微博
     48    if ($_POST['istoqq']) {
     49        $post = get_post($postID); //获取日志信息
     50   
     51        //如果该日志并未同步到腾讯微博
     52        if (!qqpress_was_qqed($postID))
     53            qqpress_db_update_post($postID, $post->post_status); //改变该日志的同步状态为"qqed"
     54
     55        qqpress_process_posts($istoqq); //同步到腾讯微博
     56    }
    4257}
    4358
     
    387402
    388403    return $resp["data"]["id"];
     404}
     405
     406//在文章发布页增加是否同步到微博的复选框
     407add_action('admin_menu', 'qqweibo_option_menu');
     408function qqweibo_option_menu() {
     409    if( function_exists('add_meta_box')) {
     410        add_meta_box('qqweibo_meta_box', __( '腾讯微博同步设置'), 'inner_qqweibo_option_menu', 'post', 'advanced');
     411    }
     412}
     413
     414function inner_weibo_option_menu($post) {
     415    echo '<label for="myplugin_new_field">同步到腾讯微博</label>';
     416    echo '<input name="istoqq" type="checkbox" value="1" checked />';
    389417}
    390418
  • qqpress/trunk/readme.txt

    r406705 r457635  
    1 === Plugin Name ===
     1=== Plugin Name ===
    22Contributors: cooiky
    33Donate link: http://app.hencuo.com/qqpress
    44Tags: qq,weibo,腾讯微博,腾讯微博同步,WordPress同步
    55Requires at least: 3.0
    6 Tested up to: 3.1.1
    7 Stable tag: 1.4
     6Tested up to: 3.2.1
     7Stable tag: 1.5
    88
    99支持将新日志标题和链接同步到腾讯微博,同时支持自定义文章内容预览长度。
    1010
    1111== Description ==
    12 发布日志时同步一条该日志标题和链接到腾讯微博,并可指定文章内容预览字数。
     12发布日志时,支持选择是否同步一条该日志标题和链接到腾讯微博,并可指定文章内容预览字数。
    1313支持自定义消息前缀。
    1414腾讯微博OAuth授权。
     
    3333
    3434== Changelog ==
     35= 1.5 =
     36* 2011/10/31
     37* 发布文章时,提供选择是否同步到腾讯微博。
     38
    3539= 1.4 =
    3640* 2011/07/08
Note: See TracChangeset for help on using the changeset viewer.