コード例 #1
0
">
				<!-- TODO: OPTION - avatar size in question list -->
				<?php 
echo get_avatar(get_the_author_meta('ID'), 45);
?>

			</a>
		</div>
		<div class="ap-list-counts">
			<?php 
if (!ap_opt('disable_voting_on_question')) {
    ?>

				<span class="ap-questions-count ap-questions-vcount">
					<span><?php 
    echo ap_net_vote();
    ?>
</span>
					<?php 
    _e('votes', 'ap');
    ?>

				</span>
			<?php 
}
?>

		</div>
		<div class="ap-questions-summery no-overflow">
			<span class="ap-questions-title entry-title" itemprop="title">
				<a class="ap-questions-hyperlink" itemprop="url" href="<?php 
コード例 #2
0
ファイル: answer-loop.php プロジェクト: troe/anspress
/**
 * Return count of net vote of a answer
 * @return integer
 * @since 2.1
 */
function ap_answer_get_the_net_vote()
{
    return ap_net_vote(ap_answer_the_object());
}
コード例 #3
0
ファイル: vote.php プロジェクト: kennyma603/anspress
/**
 * Output voting button.
 *
 * @param int $post
 *
 * @return null|string
 *
 * @since 0.1
 */
function ap_vote_btn($post = false, $echo = true)
{
    if (false === $post) {
        global $post;
    }
    if ('answer' == $post->post_type && ap_opt('disable_voting_on_answer')) {
        return;
    }
    if ('question' == $post->post_type && ap_opt('disable_voting_on_question')) {
        return;
    }
    $nonce = wp_create_nonce('vote_' . $post->ID);
    $vote = ap_is_user_voted($post->ID, 'vote');
    $voted = $vote ? true : false;
    $type = $vote ? $vote->type : '';
    $html = '';
    $html .= '<div data-id="' . $post->ID . '" class="ap-vote net-vote" data-action="vote">';
    $html .= '<a class="' . ap_icon('vote_up') . ' ap-tip vote-up' . ($voted ? ' voted' : '') . ($type == 'vote_down' ? ' disable' : '') . '" data-query="ap_ajax_action=vote&type=up&post_id=' . $post->ID . '&__nonce=' . $nonce . '" href="#" title="' . __('Up vote this post', 'ap') . '"></a>';
    $html .= '<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount">' . ap_net_vote() . '</span>';
    if ('question' == $post->post_type && !ap_opt('disable_down_vote_on_question') || 'answer' == $post->post_type && !ap_opt('disable_down_vote_on_answer')) {
        $html .= '<a data-tipposition="bottom center" class="' . ap_icon('vote_down') . ' ap-tip vote-down' . ($voted ? ' voted' : '') . ($type == ' vote_up' ? ' disable' : '') . '" data-query="ap_ajax_action=vote&type=down&post_id=' . $post->ID . '&__nonce=' . $nonce . '" href="#" title="' . __('Down vote this post', 'ap') . '"></a>';
    }
    $html .= '</div>';
    if ($echo) {
        echo $html;
    } else {
        return $html;
    }
}
コード例 #4
0
ファイル: question-loop.php プロジェクト: haythameyd/powrly
/**
 * Return count of net vote of a question
 * @return integer
 * @since 2.1
 */
function ap_question_get_the_net_vote()
{
    return ap_net_vote(ap_question_the_object());
}
コード例 #5
0
ファイル: vote.php プロジェクト: haythameyd/powrly
/**
 * Output voting button
 * @param  int $post 
 * @return null|string
 * @since 0.1
 */
function ap_vote_btn($post = false, $echo = true)
{
    if (false === $post) {
        global $post;
    }
    if ('answer' == $post->post_type && ap_opt('disable_voting_on_answer')) {
        return;
    }
    if ('question' == $post->post_type && ap_opt('disable_voting_on_question')) {
        return;
    }
    $nonce = wp_create_nonce('vote_' . $post->ID);
    $vote = ap_is_user_voted($post->ID, 'vote');
    $voted = $vote ? true : false;
    $type = $vote ? $vote->type : '';
    ob_start();
    ?>
		<div data-id="<?php 
    echo $post->ID;
    ?>
" class="ap-vote net-vote" data-action="vote">
			<a class="<?php 
    echo ap_icon('vote_up');
    ?>
 ap-tip vote-up<?php 
    echo $voted ? ' voted' : '';
    echo $type == 'vote_down' ? ' disable' : '';
    ?>
" data-query="ap_ajax_action=vote&type=up&post_id=<?php 
    echo $post->ID;
    ?>
&__nonce=<?php 
    echo $nonce;
    ?>
" href="#" title="<?php 
    _e('Up vote this post', 'ap');
    ?>
"></a>
			
			<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount"><?php 
    echo ap_net_vote();
    ?>
</span>
			
			<a data-tipposition="bottom" class="<?php 
    echo ap_icon('vote_down');
    ?>
 ap-tip vote-down<?php 
    echo $voted ? ' voted' : '';
    echo $type == 'vote_up' ? ' disable' : '';
    ?>
" data-query="ap_ajax_action=vote&type=down&post_id=<?php 
    echo $post->ID;
    ?>
&__nonce=<?php 
    echo $nonce;
    ?>
" href="#" title="<?php 
    _e('Down vote this post', 'ap');
    ?>
"></a>
		</div>
	<?php 
    $html = ob_get_clean();
    if ($echo) {
        echo $html;
    } else {
        return $html;
    }
}
コード例 #6
0
ファイル: anspress-vote.php プロジェクト: jessor/anspress
function ap_vote_html($post = false)
{
    if (!$post) {
        global $post;
    }
    $nonce = wp_create_nonce('vote_' . $post->ID);
    ?>
		<div data-action="vote" data-id="<?php 
    echo $post->ID;
    ?>
" class="ap-voting net-vote">
			<a class="ap-icon-thumbsup vote-up<?php 
    echo $post->user_voted_up ? ' voted' : '';
    echo $post->user_voted_down ? ' disable' : '';
    ?>
" data-args="up-<?php 
    echo $post->ID . '-' . $nonce;
    ?>
" href="#" title="<?php 
    _e('Up vote this post', 'ap');
    ?>
"></a>
			
			<span class="net-vote-count" data-view="ap-net-vote" itemprop="upvoteCount"><?php 
    echo ap_net_vote();
    ?>
</span>
			
			<a class="ap-icon-thumbsdown vote-down<?php 
    echo $post->user_voted_down ? ' voted' : '';
    echo $post->user_voted_up ? ' disable' : '';
    ?>
" data-args="down-<?php 
    echo $post->ID . '-' . $nonce;
    ?>
" href="#" title="<?php 
    _e('Down vote this post', 'ap');
    ?>
"></a>
		</div>
	<?php 
}