コード例 #1
0
ファイル: mo_comments_list.php プロジェクト: yszar/linuxwp
/**
 * [mo_comments_list description]
 * @param  [type] $comment [description]
 * @param  [type] $args    [description]
 * @param  [type] $depth   [description]
 * @return [type]          [description]
 */
function mo_comments_list($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount, $wpdb, $post;
    if (!$commentcount) {
        //初始化楼层计数器
        $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID} AND comment_type = '' AND comment_approved = '1' AND !comment_parent");
        $cnt = count($comments);
        //获取主评论总数量
        $page = get_query_var('cpage');
        //获取当前评论列表页码
        $cpp = get_option('comments_per_page');
        //获取每页评论显示数量
        if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) {
            $commentcount = $cnt + 1;
            //如果评论只有1页或者是最后一页,初始值为主评论总数
        } else {
            $commentcount = $cpp * $page + 1;
        }
    }
    echo '<li ';
    comment_class();
    echo ' id="comment-' . get_comment_ID() . '">';
    //楼层
    if (!($parent_id = $comment->comment_parent)) {
        echo '<span class="comt-f">';
        printf('#%1$s', --$commentcount);
        echo '</span>';
    }
    //头像
    echo '<div class="comt-avatar">';
    echo _get_the_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email);
    echo '</div>';
    //内容
    echo '<div class="comt-main" id="div-comment-' . get_comment_ID() . '">';
    // echo str_replace(' src=', ' data-src=', convert_smilies(get_comment_text()));
    comment_text();
    if ($comment->comment_approved == '0') {
        echo '<span class="comt-approved">待审核</span>';
    }
    echo '<div class="comt-meta"><span class="comt-author">' . get_comment_author_link() . '</span>';
    echo _get_time_ago($comment->comment_date);
    if ($comment->comment_approved !== '0') {
        $replyText = get_comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
        // echo str_replace(' href', ' href="javascript:;" data-href', $replyText );
        if (strstr($replyText, 'reply-login')) {
            echo preg_replace('# class="[\\s\\S]*?" href="[\\s\\S]*?"#', ' class="signin-loader" href="javascript:;"', $replyText);
        } else {
            echo preg_replace('# href=[\\s\\S]*? onclick=#', ' href="javascript:;" onclick=', $replyText);
        }
    }
    echo '</div>';
    echo '</div>';
}
コード例 #2
0
ファイル: widget-comments.php プロジェクト: yszar/linuxwp
function mod_newcomments($limit, $outpost, $outer)
{
    global $wpdb;
    if (!$outer || $outer == 0) {
        $outer = 11111111111;
    }
    $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved,comment_author_email, comment_type,comment_author_url, SUBSTRING(comment_content,1,100) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_post_ID!='" . $outpost . "' AND user_id!='" . $outer . "' AND comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$limit}";
    $comments = $wpdb->get_results($sql);
    foreach ($comments as $comment) {
        $output .= '<li><a href="' . get_comment_link($comment->comment_ID) . '" title="' . $comment->post_title . '上的评论">' . _get_the_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email) . ' <strong>' . $comment->comment_author . '</strong> ' . _get_time_ago($comment->comment_date_gmt) . '说:<br>' . str_replace(' src=', ' data-original=', convert_smilies(strip_tags($comment->com_excerpt))) . '</a></li>';
    }
    echo $output;
}
コード例 #3
0
ファイル: comments.php プロジェクト: yszar/linuxwp
    echo get_option('siteurl');
    ?>
/wp-comments-post.php" method="post" id="commentform">
		<div class="comt">
			<div class="comt-title">
				<?php 
    if (is_user_logged_in()) {
        global $current_user;
        get_currentuserinfo();
        echo _get_the_avatar($user_id = get_current_user_id(), $user_email = $current_user->user_email);
        echo '<p>' . $user_identity . '</p>';
    } else {
        if ($comment_author_email !== '') {
            echo _get_the_avatar($user_id = '', $user_email = $comment->comment_author_email);
        } else {
            echo _get_the_avatar($user_id = '', $user_email = '');
        }
        if (!empty($comment_author)) {
            echo '<p>' . $comment_author . '</p>';
            echo '<p><a href="javascript:;" evt="comment-user-change">更换</a></p>';
        }
    }
    ?>
				<p><a id="cancel-comment-reply-link" href="javascript:;">取消</a></p>
			</div>
			<div class="comt-box">
				<textarea placeholder="<?php 
    echo _hui('comment_text');
    ?>
" class="input-block-level comt-area" name="comment" id="comment" cols="100%" rows="3" tabindex="1" onkeydown="if(event.ctrlKey&amp;&amp;event.keyCode==13){document.getElementById('submit').click();return false};"></textarea>
				<div class="comt-ctrl">
コード例 #4
0
ファイル: user.php プロジェクト: zce/wp-theme-wedn
    exit('该功能需要开启!');
}
?>
<section class="container">
	<div class="container-user"<?php 
echo is_user_logged_in() ? '' : ' id="issignshow" style="height:500px;"';
?>
>
		<?php 
if (is_user_logged_in()) {
    global $current_user;
    ?>
		<div class="userside">
			<div class="usertitle">
				<?php 
    echo _get_the_avatar($user_id = $current_user->ID, $user_email = $current_user->user_email, true);
    ?>
				<h2><?php 
    echo $current_user->display_name;
    ?>
</h2>
			</div>
			<div class="usermenus">
				<ul class="usermenu">
					<li class="usermenu-post-new"><a href="#post-new">发布文章</a></li>
					<li class="usermenu-posts"><a href="#posts/all">我的文章</a></li>
					<li class="usermenu-comments"><a href="#comments">我的评论</a></li>
					<li class="usermenu-info"><a href="#info">修改资料</a></li>
					<li class="usermenu-password"><a href="#password">修改密码</a></li>
					<li class="usermenu-signout"><a href="<?php 
    echo wp_logout_url(home_url());
コード例 #5
0
ファイル: widget-readers.php プロジェクト: yszar/linuxwp
function dtheme_readers($outer, $timer, $limit, $addlink)
{
    global $wpdb;
    $comments = $wpdb->get_results("SELECT count(comment_author) AS cnt, comment_author, comment_author_url, comment_author_email FROM {$wpdb->comments} WHERE comment_date > date_sub( now(), interval {$timer} day ) AND user_id!='1' AND comment_author!={$outer} AND comment_approved='1' AND comment_type='' GROUP BY comment_author ORDER BY cnt DESC LIMIT {$limit}");
    foreach ($comments as $comment) {
        $c_url = $comment->comment_author_url;
        if ($c_url == '') {
            $c_url = 'javascript:;';
        }
        if ($addlink == 'on') {
            $c_urllink = ' href="' . $c_url . '"';
        } else {
            $c_urllink = '';
        }
        $type .= '<li><a title="[' . $comment->comment_author . '] 近期点评' . $comment->cnt . '次" target="_blank"' . $c_urllink . '>' . _get_the_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email) . '</a></li>';
    }
    echo $type;
}
コード例 #6
0
ファイル: comment.php プロジェクト: sunyang3721/wdy-wordpress
$comment_depth = 1;
//为评论的 class 属性准备的
$tmp_c = $comment;
while ($tmp_c->comment_parent != 0) {
    $comment_depth++;
    $tmp_c = get_comment($tmp_c->comment_parent);
}
//以下是評論式樣, 不含 "回覆". 要用你模板的式樣 copy 覆蓋.
echo '<li ';
comment_class();
echo ' id="comment-' . get_comment_ID() . '">';
echo '<span class="comt-f">#</span>';
//头像
echo '<div class="comt-avatar">';
/*global $loguser;
if( $loguser ){
	echo '<img src="'.$loguser->avatar.'">';
}else{*/
echo _get_the_avatar($user_id = $comment->user_id, $user_email = $comment->comment_author_email, $src = true);
// }
echo '</div>';
//内容
echo '<div class="comt-main" id="div-comment-' . get_comment_ID() . '">';
echo str_replace(' src=', ' data-src=', convert_smilies(get_comment_text()));
echo '<div class="comt-meta"><span class="comt-author">' . get_comment_author_link() . '</span>';
echo '<time>' . _get_time_ago($comment->comment_date) . '</time>';
echo '</div>';
if ($comment->comment_approved == '0') {
    echo '<span class="comt-approved">待审核</span>';
}
echo '</div>';