function wp_update_t_sohu($tok, $status, $value)
{
    if (!class_exists('sohuOAuth')) {
        include dirname(__FILE__) . '/OAuth/sohu_OAuth.php';
    }
    $to = new sohuClient(SOHU_APP_KEY, SOHU_APP_SECRET, $tok['oauth_token'], $tok['oauth_token_secret']);
    $result = $to->update($status, $value);
    return $result;
}
function wp_connect_comment($id)
{
    global $siteurl, $post, $wptm_options, $wptm_connect, $wptm_advanced;
    $post_id = $_POST['comment_post_ID'] ? $_POST['comment_post_ID'] : $post->ID;
    if (!$post_id) {
        return;
    }
    @ini_set("max_execution_time", 60);
    $comments = get_comment($id);
    $user_id = $comments->user_id;
    $comment_content = wp_replace($comments->comment_content);
    $parent_id = $comments->comment_parent;
    if ($user_id) {
        if ($parent_id) {
            $comment_parent = get_comment($parent_id);
            $parent_uid = $comment_parent->user_id;
            $name = get_user_meta($parent_uid, 'login_name', true);
        }
        $tid = $_POST['sync_comment'];
        if ($tid) {
            if (!is_object($post)) {
                $post = get_post($post_id);
            }
            $url = get_permalink($post_id) . '#comment-' . $id;
            if ($wptm_options['t_cn']) {
                $url = get_t_cn(urlencode($url));
            }
            $title = wp_replace($post->post_title);
            $username = get_user_meta($user_id, 'login_name', true);
            require_once dirname(__FILE__) . '/OAuth/OAuth.php';
            if ($tid == 'stid') {
                $login = get_user_meta($user_id, 'login_sina', true);
                if ($login[0] && $login[1]) {
                    if (!class_exists('sinaOAuth')) {
                        include dirname(__FILE__) . '/OAuth/sina_OAuth.php';
                    }
                    $to = new sinaClient(SINA_APP_KEY, SINA_APP_SECRET, $login[0], $login[1]);
                    $content = at_username($name['sina'], $username['sina'], $wptm_connect['sina_username'], $comment_content);
                    //return var_dump($content);
                    $status = wp_status('评论《' . $title . '》: ' . $content, urlencode($url), 140, 1);
                    $result = $to->update($status);
                }
            } elseif ($tid == 'qtid') {
                $login = get_user_meta($user_id, 'login_qq', true);
                if ($login[0] && $login[1]) {
                    if (!class_exists('qqOAuth')) {
                        include dirname(__FILE__) . '/OAuth/qq_OAuth.php';
                    }
                    $to = new qqClient(QQ_APP_KEY, QQ_APP_SECRET, $login[0], $login[1]);
                    $content = at_username($name['qq'], $username['qq'], $wptm_connect['qq_username'], $comment_content);
                    $status = wp_status('评论《' . $title . '》: ' . $content, $url, 140, 1);
                    $result = $to->update($status);
                }
            } elseif ($tid == 'ntid') {
                $login = get_user_meta($user_id, 'login_netease', true);
                if ($login[0] && $login[1]) {
                    if (!class_exists('neteaseOAuth')) {
                        include dirname(__FILE__) . '/OAuth/netease_OAuth.php';
                    }
                    $to = new neteaseClient(APP_KEY, APP_SECRET, $login[0], $login[1]);
                    $content = at_username($name['netease'], $username['netease'], $wptm_connect['netease_username'], $comment_content);
                    $status = wp_status('评论《' . $title . '》: ' . $content, $url, 163);
                    $result = $to->update($status);
                }
            } elseif ($tid == 'shtid') {
                $login = get_user_meta($user_id, 'login_sohu', true);
                if ($login[0] && $login[1]) {
                    if (!class_exists('sohuOAuth')) {
                        include dirname(__FILE__) . '/OAuth/sohu_OAuth.php';
                    }
                    $to = new sohuClient(SOHU_APP_KEY, SOHU_APP_SECRET, $login[0], $login[1]);
                    $content = at_username($name['sohu'], $username['sohu'], $wptm_connect['sohu_username'], $comment_content);
                    $status = wp_status('评论《' . $title . '》: ' . $content, urlencode($url), 140, 1);
                    $result = $to->update($status);
                }
            } elseif ($tid == 'dtid') {
                if ($login = get_user_meta($user_id, 'login_douban', true)) {
                    if ($login[0] && $login[1]) {
                        if (!class_exists('doubanOAuth')) {
                            include dirname(__FILE__) . '/OAuth/douban_OAuth.php';
                        }
                        $to = new doubanClient(DOUBAN_APP_KEY, DOUBAN_APP_SECRET, $login[0], $login[1]);
                        $status = wp_status('评论《' . $title . '》: ' . $comment_content, $url, 128);
                        $result = $to->update($status);
                    }
                }
            }
        }
    }
}
Beispiel #3
0
     $result = $result['data'];
     $only_id = $username = $at = $result['name'];
     // return var_dump($result);
     if ($only_id) {
         $tid = "qtid";
         $id = 'tqqid';
         // $only_id = $last_key['name'];
         $email = $only_id . '@t.qq.com';
         $name = $result['nick'];
         $url = 'http://t.qq.com/' . $only_id;
         $head = $result['head'];
         $uid = ifab(get_user_by_meta_value($id, $only_id), email_exists($email));
     }
     break;
 case "sohu":
     $to = new sohuClient(WEIBO_APP_KEY, WEIBO_SECRET, $last_key['oauth_token'], $last_key['oauth_token_secret']);
     $result = $to->verify_credentials();
     $only_id = $username = $result['id'];
     // return var_dump($result);
     if ($only_id) {
         $tid = "shtid";
         $id = 'sohuid';
         $email = $only_id . '@t.sohu.com';
         $name = $at = $result['screen_name'];
         $url = 'http://t.sohu.com/u/' . $only_id;
         $head = $result['profile_image_url'];
         $uid = ifab(get_user_by_meta_value($id, $only_id), email_exists($email));
     }
     break;
 case "netease":
     $to = new neteaseClient(WEIBO_APP_KEY, WEIBO_SECRET, $last_key['oauth_token'], $last_key['oauth_token_secret']);