function cbvote_code() { check_ajax_referer('getrends-settings', 'security'); $data = $_POST; unset($data['security'], $data['action']); if (isset($data['postID'])) { $postID = $data['postID']; } if (isset($data['type'])) { $type = $data['type']; } if (isset($data['conID'])) { $conID = $data['conID']; } $old = get_post_meta($postID, 'cb_vote_nb_vote', true); if (!$old || !is_numeric($old)) { $old = 0; } $user_id = get_current_user_id(); $my_ip = getenv("REMOTE_ADDR"); if ($user_id == 0) { $value = $my_ip; } else { $value = $user_id; } add_post_meta($postID, 'cb_vote_users_vote', $value); $old_cb_vote_details = get_post_meta($postID, 'cb_vote_details', true); $poddata = array('IP' => $value, 'time' => time()); $old_cb_vote_details[] = $poddata; update_post_meta($postID, 'cb_vote_details', $old_cb_vote_details); update_post_meta($postID, 'cb_vote_nb_vote', $old + 1); ob_start(); show_vote_button($postID, check_votes($postID), 'done', $conID); $data = ob_get_contents(); ob_end_clean(); die($data); }
function vote($atts, $content = null) { esc_attr(extract(shortcode_atts(array('title' => '', 'cb_vote_id' => ''), $atts))); ob_start(); echo '<div class="vote_block"><div id="vote_btn_' . $cb_vote_id . '">'; show_vote_button($cb_vote_id, check_votes($cb_vote_id), 'post-page', 'vote_btn_' . $cb_vote_id); echo '</div></div>'; $return_html = ob_get_contents(); ob_end_clean(); return apply_filters('vote', $return_html); }
} if ($fb != '') { echo '<a href="' . $fb . '" target="_blank"><i class="icon-facebook transi"></i></a>'; } if ($tw != '') { echo '<a href="' . $tw . '" target="_blank"><i class="icon-twitter transi"></i></a>'; } ?> <div class="cl"></div> </div> <div class="vote_now rounder"> <?php $cb_get_votes = check_votes($post->ID); /* show vote button functions.php:783*/ echo '<div id="vote_btn_' . $post->ID . '">'; show_vote_button($post->ID, $cb_get_votes, 'post-page', 'vote_btn_' . $post->ID); echo '</div>'; ?> </div> <div class="vote_excerpt"> <?php echo get_the_excerpt(); ?> </div> </div> <?php } ?> <?php