/**
 * 同步列表
 * @since 1.9.10
 */
function wp_update_list($title, $postlink, $pic, $account)
{
    global $wptm_options;
    if ($pic[0] == 'video' && $pic[1]) {
        // 是否有视频
        $vurl = $pic[1];
        $url = $postlink;
    } elseif ($pic[0] == 'music' && $pic[1]) {
        if ($pic[2] && $pic[3]) {
            $vurl = '#' . $pic[1] . '#' . $pic[2] . ' ' . $pic[3];
            // #歌手# 歌曲 url
        } else {
            $vurl = $pic[1];
            // url
        }
        $url = $postlink;
    } else {
        $url = $postlink;
    }
    // 是否使用t.cn短网址
    if ($wptm_options['t_cn']) {
        $url = get_t_cn(urlencode($url));
    }
    // 处理完毕输出链接
    $postlink = trim($vurl . ' ' . $url);
    // 截取字数
    $status = wp_status($title, $postlink, 140);
    //网易/人人/饭否/做啥/雷猴
    $status2 = wp_status($title, $postlink, 200, 1);
    //搜狐/follow5
    $sina = wp_status($title, urlencode($postlink), 140, 1);
    //新浪
    $qq = wp_status($title, $postlink, 140, 1);
    //腾讯
    //$kaixin001 = wp_status($title, $postlink, 200); //开心
    $digu = wp_status($title, urlencode($postlink), 140);
    //嘀咕
    $twitter = wp_status($title, wp_urlencode($postlink), 140);
    //Twitter
    $wbto = wp_status($title, $postlink, 140, 1);
    //微博通
    $douban = wp_status($title, $postlink, 128);
    //豆瓣
    $renjian = wp_status($title, urlencode($postlink), 200, 1);
    //人间网
    // 开始同步
    require_once dirname(__FILE__) . '/OAuth/OAuth.php';
    $output = array();
    if ($account['sina']) {
        $ms = wp_update_t_sina($account['sina'], $sina, $pic);
        $output['sina'] = $ms['mid'];
    }
    //140*
    if ($account['qq']) {
        $output['qq'] = wp_update_t_qq($account['qq'], $qq, $pic);
    }
    //140*
    if ($account['netease']) {
        wp_update_t_163($account['netease'], $status, $pic);
    }
    //163
    if ($account['sohu']) {
        wp_update_t_sohu($account['sohu'], $status2, $pic);
    }
    //+
    if ($account['douban']) {
        wp_update_douban($account['douban'], $douban);
    }
    //128
    if ($account['digu']) {
        wp_update_digu($account['digu'], $digu);
    }
    //140
    if ($account['fanfou']) {
        wp_update_fanfou($account['fanfou'], $status);
    }
    //140
    if ($account['renjian']) {
        wp_update_renjian($account['renjian'], $renjian, $pic);
    }
    //+
    if ($account['zuosa']) {
        wp_update_zuosa($account['zuosa'], $status);
    }
    //140
    if ($account['wbto']) {
        wp_update_wbto($account['wbto'], $wbto, $pic);
    }
    //140+
    if ($account['tianya']) {
        wp_update_tianya($account['tianya'], $sina, $pic);
    }
    //140*
    if ($account['twitter']) {
        wp_update_twitter($account['twitter'], $twitter);
    }
    if ($account['renren']) {
        wp_update_renren($account['renren'], $status);
    }
    //140
    if ($account['kaixin001']) {
        wp_update_kaixin001($account['kaixin001'], $qq, $pic);
    }
    //140+
    return $output;
}
Exemple #2
0
function wp_update_page()
{
    $account = wp_option_account();
    $wptm_options = get_option('wptm_options');
    $wptm_advanced = get_option('wptm_advanced');
    $status = $text = mb_substr(trim(strip_tags($_POST['message'])), 0, 140, 'utf-8');
    $urls = trim(stripslashes($_POST['url']));
    $url = '';
    if (function_exists('wp_connect_advanced')) {
        include_once WP_PLUGIN_DIR . '/wp-connect-advanced/page.php';
    } else {
        if (!empty($urls) && strpos($urls, 'http') === 0) {
            $url = array('image', $urls);
        }
    }
    require_once dirname(__FILE__) . '/OAuth/OAuth.php';
    if (isset($_POST['qq']) && $account['qq']) {
        wp_update_t_qq($account['qq'], $text, $url);
    }
    if (isset($_POST['netease']) && $account['netease']) {
        wp_update_t_163($account['netease'], $status, $url);
    }
    if (isset($_POST['sohu']) && $account['sohu']) {
        wp_update_t_sohu($account['sohu'], $status, $url);
    }
    if (isset($_POST['sina']) && $account['sina']) {
        $sina = wp_update_t_sina($account['sina'], $status, $url);
        if ($_POST['subject'] == 2 && $sina['original_pic']) {
            $url = array('image', $sina['original_pic']);
        }
    }
    if (isset($_POST['douban']) && $account['douban']) {
        wp_update_douban($account['douban'], $status);
    }
    if (isset($_POST['digu']) && $account['digu']) {
        wp_update_digu($account['digu'], $status);
    }
    if (isset($_POST['tianya']) && $account['tianya']) {
        wp_update_tianya($account['tianya'], $status, $url);
    }
    if (isset($_POST['fanfou']) && $account['fanfou']) {
        wp_update_fanfou($account['fanfou'], $status);
    }
    if (isset($_POST['renjian']) && $account['renjian']) {
        wp_update_renjian($account['renjian'], $status, $url);
    }
    if (isset($_POST['zuosa']) && $account['zuosa']) {
        wp_update_zuosa($account['zuosa'], $status);
    }
    if (isset($_POST['wbto']) && $account['wbto']) {
        wp_update_wbto($account['wbto'], $status, $url);
    }
    if (isset($_POST['renren']) && $account['renren']) {
        wp_update_renren($account['renren'], $status);
    }
    if (isset($_POST['kaixin001']) && $account['kaixin001']) {
        wp_update_kaixin001($account['kaixin001'], $status, $url);
    }
    if (isset($_POST['twitter']) && $account['twitter']) {
        wp_update_twitter($account['twitter'], $status);
    }
}
Exemple #3
0
/**
 * 同步列表
 * @since 2.4.5
 */
function wp_update_list($text, $url, $pic, $account, $post_id = '')
{
    global $wptm_options;
    if (is_array($pic)) {
        // 兼容旧版本
        if ($pic[0] == 'image') {
            $pic = array($pic[1], '', '');
        } elseif ($pic[0] == 'video') {
            $pic = array('', $pic[1], '');
        } elseif ($pic[0] == 'music') {
            $pic = array('', '', $pic[1]);
        }
        if ($pic[0]) {
            // 图片
            $picture = array('image', $pic[0]);
        }
        if ($pic[1] && $pic[1] != $url) {
            // 视频
            $vurl = $pic[1];
        } elseif (is_array($pic[2])) {
            // 音乐
            if ($pic[2][1] && $pic[2][2]) {
                $vurl = '#' . $pic[2][0] . '#' . $pic[2][1] . ' ' . $pic[2][2];
                // #歌手# 歌曲 url
            } else {
                $vurl = $pic[2][0];
                // url
            }
        }
    }
    // 是否使用短网址
    if ($wptm_options['t_cn']) {
        $url = get_url_short($url);
    }
    // 处理完毕输出链接
    $postlink = trim($vurl . ' ' . $url);
    // 截取字数
    $status = wp_status($text, '', 140, 1);
    //灯鹭
    $status1 = wp_status($text, $postlink, 140);
    //网易/人人/饭否/做啥
    $status2 = wp_status($text, urlencode($postlink), 140, 1);
    //新浪/天涯
    $status3 = wp_status($text, $postlink, 140, 1);
    //腾讯/开心
    // return var_dump($status3);
    // 开始同步
    require_once dirname(__FILE__) . '/OAuth/OAuth.php';
    $output = array();
    if ($account['sina']['mediaUserID']) {
        wp_update_share($account['sina']['mediaUserID'], $status, $url, '', $pic[0], $pic[1], $post_id);
    } elseif ($account['sina']) {
        // 新浪微博 /140*
        $ms = wp_update_t_sina($account['sina'], $status2, $picture);
        $output['sina'] = $ms['mid'];
    }
    $mediaUserID = '';
    if ($account['qq']['oauth_token']) {
        // 腾讯微博 /140*
        $output['qq'] = wp_update_t_qq($account['qq'], $status3, $pic);
    } elseif ($account['qq']['mediaUserID']) {
        $mediaUserID .= $account['qq']['mediaUserID'] . ',';
    }
    if ($account['shuoshuo']) {
        // 说说 /140
        wp_post_shuoshuo($account['shuoshuo'], $status2, $pic);
    }
    if ($account['sohu']['oauth_token']) {
        // 搜狐微博 /+
        wp_update_t_sohu($account['sohu'], wp_status($text, $postlink, 200, 1), $picture);
    } elseif ($account['sohu']['mediaUserID']) {
        $mediaUserID .= $account['sohu']['mediaUserID'] . ',';
    }
    if ($account['netease']['oauth_token']) {
        // 网易微博 /163
        wp_update_t_163($account['netease'], $status1, $picture);
    } elseif ($account['netease']['mediaUserID']) {
        $mediaUserID .= $account['netease']['mediaUserID'] . ',';
    }
    if ($account['renren']['mediaUserID']) {
        $mediaUserID .= $account['renren']['mediaUserID'] . ',';
    } elseif ($account['renren']) {
        // 人人网 /140
        wp_update_renren($account['renren'], $status1);
    }
    if ($account['tianya']['oauth_token']) {
        // 天涯 /140*
        wp_update_tianya($account['tianya'], $status2, $picture);
    } elseif ($account['tianya']['mediaUserID']) {
        $mediaUserID .= $account['tianya']['mediaUserID'];
    }
    if ($mediaUserID) {
        wp_update_share(rtrim($mediaUserID, ','), $status, $url, '', $pic[0], $pic[1], $post_id);
    }
    if ($account['wbto']) {
        // 微博通 /140+
        wp_update_wbto($account['wbto'], wp_status($text, $postlink, 140, 1), $picture);
    }
    if ($account['douban']) {
        // 豆瓣 /128
        wp_update_douban($account['douban'], wp_status($text, $postlink, 128));
    }
    if ($account['twitter']) {
        // twitter /140
        wp_update_twitter($account['twitter'], wp_status($text, wp_urlencode($postlink), 140));
    }
    if ($account['kaixin001']) {
        // 开心网 /140+
        wp_update_kaixin001($account['kaixin001'], $status3, $picture);
    }
    /*
    if ($account['digu']) { // 嘀咕 /140
    	wp_update_digu($account['digu'], wp_status($text, urlencode($postlink), 140));
    } 
    if ($account['fanfou']) { // 饭否 /140
    	wp_update_fanfou($account['fanfou'], $status1);
    } 
    if ($account['renjian']) { // 人间 /+
    	wp_update_renjian($account['renjian'], wp_status($text, urlencode($postlink), 200, 1), $picture);
    } 
    if ($account['zuosa']) { // 做啥 /140
    	wp_update_zuosa($account['zuosa'], $status1);
    } 
    */
    // 钩子,方便自定义插件
    do_action('wp_update_list_update', $output, $ms, $post_id);
    return $output;
}