示例#1
0
function advanced_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
   <div class="comment-container" id="comment-<?php 
    comment_ID();
    ?>
">
        <div class="gravatar"> 
			<?php 
    echo get_avatar($comment);
    ?>
        </div>
        <span class="comment-author">
            <?php 
    echo get_comment_author_link();
    ?>
说道:
        </span>
        <div class="comment-time">
			<?php 
    echo get_comment_date();
    echo get_comment_time();
    ?>
            <span class="edit-comment"><?php 
    edit_comment_link('修改');
    ?>
</span>
        </div>
        <div class="comment-content">
			<?php 
    echo comment_text();
    ?>
        </div>
		<div class="comment-reply" onclick="replyComment(<?php 
    echo $comment->comment_post_ID;
    ?>
,<?php 
    echo $comment->comment_ID;
    ?>
,'<?php 
    echo get_option('siteurl');
    ?>
'+'/wp-comments-post.php','<?php 
    echo comment_author();
    ?>
','<?php 
    echo comment_author_email();
    ?>
','<?php 
    echo comment_author_url();
    ?>
')">
        	回复
      	</div>
   </div>
<?php 
}
示例#2
0
function dp_gravatar($size = 50, $attributes = '', $author_email = '')
{
    global $comment, $settings;
    if (dp_settings('gravatar') == 'enabled') {
        if (empty($author_email)) {
            ob_start();
            comment_author_email();
            $author_email = ob_get_clean();
        }
        $gravatar_url = 'http://www.gravatar.com/avatar/' . md5(strtolower($author_email)) . '?s=' . $size . '&amp;d=' . dp_settings('gravatar_fallback');
        ?>
<img src="<?php 
        echo $gravatar_url;
        ?>
" <?php 
        echo $attributes;
        ?>
/><?php 
    }
}
    private function confirm($action)
    {
        global $comment;
        $comment_id = intval($_GET['c']);
        $formaction = $action . 'comment';
        $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
        $nonce_action .= $comment_id;
        if (!($comment = get_comment_to_edit($comment_id))) {
            $this->base->ks_die(__('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>', 'edit-comments.php'), '', false);
        }
        if (!current_user_can('edit_post', $comment->comment_post_ID)) {
            $this->base->ks_die('delete' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.'));
        }
        include dirname(__FILE__) . '/admin-header.php';
        switch ($action) {
            case 'spam':
                $message = __('You are about to mark the following comment as spam:');
                break;
            case 'trash':
                $message = __('You are about to move the following comment to the Trash:', 'ktai_style');
                break;
            case 'delete':
                $message = __('You are about to delete the following comment:');
                break;
            default:
                $message = __('You are about to approve the following comment:');
                break;
        }
        echo '<p><img localsrc="1" alt="" /><font color="red">' . $message . '</font><br />' . __('Are you sure you want to do this?') . '</p>';
        ?>
<form action="edit-comments.php" method="get">
<?php 
        $this->admin->sid_field();
        ?>
<div><input type="submit" value="<?php 
        _e('No');
        ?>
" /></div></form>
<form action="comment.php" method="get">
<?php 
        $this->admin->sid_field();
        wp_nonce_field($nonce_action);
        ?>
<input type="hidden" name="action" value="<?php 
        echo esc_attr($formaction);
        ?>
" />
<input type="hidden" name="p" value="<?php 
        echo intval($comment->comment_post_ID);
        ?>
" />
<input type="hidden" name="c" value="<?php 
        echo intval($comment->comment_ID);
        ?>
" />
<input type="hidden" name="noredir" value="1" />
<div><input type="submit" value="<?php 
        _e('Yes');
        ?>
" /></div>
</form>
<dl><dt><img localsrc="<?php 
        comment_type(68, 112, 112);
        ?>
" alt="[<?php 
        comment_type(__('Comment', 'ktai_style'), __('Trackback'), __('Pingback'));
        ?>
] " /><?php 
        comment_author();
        ?>
<img localsrc="46" alt=" @ " /><font color="<?php 
        echo ks_option('ks_date_color');
        ?>
"><?php 
        ks_comment_datetime();
        ?>
</font></dt><dd><?php 
        if ($comment->comment_author_email) {
            ?>
<img localsrc="108" alt="" /><font color="olive"><?php 
            comment_author_email();
            ?>
</font><br /><?php 
        }
        if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) {
            ?>
<img localsrc="112" alt="" /><font color="olive"><?php 
            comment_author_url();
            ?>
</font><br /><?php 
        }
        comment_excerpt();
        ?>
</dd></dl><?php 
        include dirname(__FILE__) . '/admin-footer.php';
    }
示例#4
0
        $historyStack = array();
        $historyBidID = array();
        foreach ($comments3 as $comment) {
            array_push($historyStack, $comment->comment_content);
            array_push($historyBidID, $comment->comment_ID);
        }
        // Highest bid in history
        $highestBidIndex = array_search(max($historyStack), $historyStack);
        $highestBidID = $historyBidID[$highestBidIndex];
        echo "This item is sold.";
        echo "</br>Winning Bid is CAD ";
        print_r(max($historyStack));
        echo "</br>Winning Bidder is ";
        comment_author($highestBidID);
        echo "</br>Current Owner's Email Address: ";
        comment_author_email($highestBidID);
        echo "</br></br>Previous owner of the item: ";
        the_author_meta('user_email');
        $to = '<?php the_author_meta(user_email); ?>';
        wp_mail($to, 'Montreal Auction', 'You have won an auction.');
        //wp_mail( $to, 'Montreal Auction', 'You have a winner for your auction' );*/
    } elseif ($commentcount2 == 0) {
        echo "<p>This auction is currently running</p>";
        $comments_args = array('label_submit' => 'Post Your Bid', 'title_reply' => 'Write a Reply or Comment', 'comment_notes_after' => '');
        comment_form($comments_args);
    }
} else {
    // Display comments from last 5 minutes
    $comments = get_comments(['date_query' => ['after' => '5 minutes ago', 'inclusive' => true], 'post_id' => $postID, 'status' => 'approve']);
    printf(wp_list_comments($args = ['echo' => 0], $comments));
    // Retrieve bids and push them in an array
示例#5
0
</th>
<td><?php 
        comment_author($comment);
        ?>
</td>
</tr>
<?php 
        if (get_comment_author_email($comment)) {
            ?>
<tr>
<th scope="row"><?php 
            _e('Email');
            ?>
</th>
<td><?php 
            comment_author_email($comment);
            ?>
</td>
</tr>
<?php 
        }
        if (get_comment_author_url($comment)) {
            ?>
<tr>
<th scope="row"><?php 
            _e('URL');
            ?>
</th>
<td><a href="<?php 
            comment_author_url($comment);
            ?>
示例#6
0
function advanced_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    ?>
   <div class="comment-container" id="comment-<?php 
    comment_ID();
    ?>
">
        <div class="gravatar"> 
			<?php 
    echo get_avatar($comment);
    ?>
        </div>
        <span class="comment-author">
            <?php 
    echo get_comment_author_link();
    ?>
        </span>
        <div class="comment-content">
			<?php 
    echo comment_text();
    ?>
        </div>
        <div class="comment-time">
			<?php 
    echo get_comment_date("m月d日");
    ?>
            <span class="edit-comment"><?php 
    edit_comment_link('修改');
    ?>
</span>
        </div>
        <div class="comment-reply" onclick="replyComment(<?php 
    echo $comment->comment_post_ID;
    ?>
,<?php 
    echo $comment->comment_ID;
    ?>
,'<?php 
    echo get_option('siteurl');
    ?>
'+'/wp-comments-post.php','<?php 
    echo comment_author();
    ?>
','<?php 
    echo comment_author_email();
    ?>
','<?php 
    echo comment_author_url();
    ?>
')">
        	<img src="<?php 
    bloginfo('template_url');
    ?>
/images/reply.png"/>
        	<span>回复</span>
      	</div>
           <div class="reply-emotion-content" id="reply-emotion-content-<?php 
    comment_ID();
    ?>
">
        	<div id="replysmilelink">
				<a onclick="javascript:replyGrin(':?:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_question.gif" title="疑问" alt="疑问" /></a>
				<a onclick="javascript:replyGrin(':razz:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_razz.gif" title="调皮" alt="调皮" /></a>
				<a onclick="javascript:replyGrin(':sad:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_sad.gif" title="不开森" alt="不开森" /></a>
				<a onclick="javascript:replyGrin(':evil:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_evil.gif" title="挖鼻" alt="挖鼻" /></a>
				<a onclick="javascript:replyGrin(':!:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_exclaim.gif" title="吓" alt="吓" /></a>
				<a onclick="javascript:replyGrin(':smile:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_smile.gif" title="微笑" alt="微笑" /></a>
				<a onclick="javascript:replyGrin(':oops:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_redface.gif" title="可爱" alt="可爱" /></a>
				<a onclick="javascript:replyGrin(':grin:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_biggrin.gif" title="坏笑" alt="坏笑" /></a>
				<a onclick="javascript:replyGrin(':eek:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_eek.gif" title="吃惊" alt="吃惊" /></a>
				<a onclick="javascript:replyGrin(':shock:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_surprised.gif" title="吃惊" alt="吃惊" /></a>
				<a onclick="javascript:replyGrin(':???:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_confused.gif" title="撇嘴" alt="撇嘴" /></a>
				<a onclick="javascript:replyGrin(':cool:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_cool.gif" title="酷" alt="酷" /></a>
				<a onclick="javascript:replyGrin(':lol:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_lol.gif" title="偷笑" alt="偷笑" /></a>
				<a onclick="javascript:replyGrin(':mad:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_mad.gif" title="怒骂" alt="怒骂" /></a>
				<a onclick="javascript:replyGrin(':twisted:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_twisted.gif" title="怒" alt="怒" /></a>
				<a onclick="javascript:replyGrin(':roll:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_rolleyes.gif" title="白眼" alt="白眼" /></a>
				<a onclick="javascript:replyGrin(':wink:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_wink.gif" title="喝彩" alt="喝彩" /></a>
				<a onclick="javascript:replyGrin(':idea:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_idea.gif" title="得意" alt="得意" /></a>
				<a onclick="javascript:replyGrin(':arrow:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_arrow.gif" title="无语" alt="无语" /></a>
				<a onclick="javascript:replyGrin(':neutral:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_neutral.gif" title="亲亲" alt="亲亲" /></a>
<a onclick="javascript:replyGrin(':cry:')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_cry.gif" title="大哭" alt="大哭" /></a>
				<a onclick="javascript:replyGrin(':mrgreen:','<?php 
    comment_ID();
    ?>
')"><img src="wp-content/themes/AlaricBlog/images/emotion/icon_mrgreen.gif" title="咧嘴" alt="咧嘴" /></a>
			</div>
        </div>
   </div>
<?php 
}
    private function comment_list_item($_comment)
    {
        global $comment;
        $comment = $_comment;
        $comment_status = wp_get_comment_status($comment->comment_ID);
        if ('unapproved' == $comment_status) {
            $gray_start = '<font color="gray">';
            $gray_end = '</font>';
        } else {
            $gray_start = '';
            $gray_end = '';
        }
        $checkbox = '';
        if (current_user_can('edit_post', $comment->comment_post_ID)) {
            $checkbox = '<input type="checkbox" name="delete_comments[]" value="' . intval($comment->comment_ID) . '" />';
        }
        echo '<dt>';
        printf(_c('%1$s%2$d:%3$s|comment-list-title', 'ktai_style'), $checkbox, $comment->comment_ID, $gray_start . mb_strcut(get_comment_excerpt(), 0, self::COMMENT_EXCERPT_SIZE) . $gray_end);
        echo '</dt><dd>';
        ?>
<img localsrc="46" alt=" @ " /><font color="<?php 
        echo ks_option('ks_date_color');
        ?>
"><?php 
        echo ks_comment_datetime();
        ?>
</font>
<img localsrc="<?php 
        comment_type(68, 112, 112);
        ?>
" alt="[<?php 
        comment_type(__('Comment', 'ktai_style'), __('Trackback'), __('Pingback'));
        ?>
] " /><?php 
        comment_author();
        ?>
<br /><?php 
        if (strlen($author_url_display) > self::COMMENT_AUTHOR_URL_LENGTH) {
            $author_url_display = substr($author_url_display, 0, self::COMMENT_AUTHOR_URL_LENGTH - 1) . '...';
        }
        if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) {
            $author_url_display = $comment->comment_author_url;
            $author_url_display = str_replace('http://www.', '', $author_url_display);
            $author_url_display = str_replace('http://', '', $author_url_display);
            if (strlen($author_url_display) > self::COMMENT_AUTHOR_URL_LENGTH) {
                $author_url_display = substr($author_url_display, 0, self::COMMENT_AUTHOR_URL_LENGTH - 1) . '...';
            }
            ?>
<img localsrc="112" alt="" /><font color="olive"><?php 
            echo esc_html($author_url_display);
            ?>
</font><br /><?php 
        }
        if ($comment->comment_author_email && current_user_can('edit_post', $comment->comment_post_ID)) {
            ?>
<img localsrc="108" alt="" /><font color="olive"><?php 
            comment_author_email();
            ?>
</font><br /><?php 
        }
        if (!$this->post_id && ($title = $this->get_post_title($comment->comment_post_ID))) {
            ?>
<font color="gray" size="-1"><img localsrc="97" /><?php 
            echo $title;
            ?>
</font><br /><?php 
        }
        $app_nonce = esc_html('&_wpnonce=' . wp_create_nonce("approve-comment_{$comment->comment_ID}"));
        $del_nonce = esc_html('&_wpnonce=' . wp_create_nonce("delete-comment_{$comment->comment_ID}"));
        $approve_url = esc_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . $app_nonce);
        $unapprove_url = esc_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . $app_nonce);
        $spam_url = esc_url('comment.php?action=spamcomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . $del_nonce);
        $unspam_url = esc_url('comment.php?action=unspamcomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . $del_nonce);
        $trash_url = esc_url('comment.php?action=trashcomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID . $del_nonce);
        $untrash_url = esc_url('comment.php?action=untrashcomment&c=' . $comment->comment_ID . $del_nonce);
        $delete_url = esc_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID);
        // do not add nonce
        $edit_url = esc_url('comment.php?action=editcomment&c=' . $comment->comment_ID);
        $reply_url = esc_url('comment-reply.php?replytocom=' . $comment->comment_ID);
        $action_template_color = '<a href="%s"><font color="%s">%s</font></a>';
        $action_template = '<a href="%s">%s</a>';
        if (current_user_can('edit_post', $comment->comment_post_ID)) {
            $actions = array();
            if (current_user_can('moderate_comments')) {
                if ('unapproved' == $comment_status || 'moderated' == $comment_status) {
                    $actions['approve'] = sprintf($action_template_color, $approve_url, 'green', __('Approve'));
                    $actions['spam'] = sprintf($action_template_color, $spam_url, 'red', __('Spam'));
                } elseif ('approved' == $_GET['comment_status'] && 'approved' == $comment_status) {
                    $actions['unapprove'] = sprintf($action_template_color, $unapprove_url, '#ff9900', __('Unapprove'));
                } elseif ('spam' == $comment_status) {
                    if (function_exists('wp_trash_comment') && EMPTY_TRASH_DAYS) {
                        $actions['unspam'] = sprintf($action_template_color, $unspam_url, 'orange', __('Restore'));
                        $actions['trash'] = sprintf($action_template_color, $trash_url, 'red', __('Trash'));
                    } else {
                        $actions['approve'] = sprintf($action_template_color, $approve_url, 'green', __('Approve'));
                        $actions['delete'] = sprintf($action_template_color, $delete_url, 'red', __('Delete'));
                    }
                }
            }
            if ('trash' == $comment_status) {
                $actions['restore'] = sprintf($action_template_color, $untrash_url, 'green', __('Restore'));
                $actions['delete'] = sprintf($action_template_color, $delete_url, 'red', __('Delete'));
            } elseif ('spam' != $comment_status) {
                $actions['edit'] = '<img localsrc="104" alt="" />' . sprintf($action_template, $edit_url, __('Edit'));
                if ('approved' == $comment_status && (NULL == $this->post_status || 'published' == $this->post_status)) {
                    $actions['reply'] = '<img localsrc="149" alt="" />' . sprintf($action_template, $reply_url, __('Reply', 'ktai_style'));
                }
            }
            if ($actions) {
                $actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
                echo '[ ' . implode(' | ', $actions) . ' ]';
            }
        }
    }
    /**
     * Renders an individual comment's media element.
     *
     * @param string $align Either `left` or `right`
     * @param WP_Comment $comment
     * @param array $args
     * @param int $depth
     *
     * @return void
     */
    protected static function renderCommentMedia($align, $comment, $args, $depth)
    {
        ?>
    <div class="media-<?php 
        print esc_attr($align);
        ?>
 media-bottom vcard">
        <span class="comment-author fn"><?php 
        comment_author($comment);
        ?>
</span>
        <a href="mailto:<?php 
        print esc_attr(comment_author_email($comment));
        ?>
">
            <?php 
        print get_avatar($comment, 48, '', false, array('class' => 'media-object'));
        ?>
        </a>
    </div>
<?php 
    }