get_user_IP(); if (empty($liked_ips)) { $liked_ips = array(); } if (in_array($user_ip, $liked_ips)) { $already_liked = 1; } if ((in_array($user_ip, $liked_ips))) { $already_liked = 1; if (isset($liked_ips_info[md5($user_ip)])) { $already_liked_type = $liked_ips_info[md5($user_ip)]; } else { $already_liked_type = 'na'; } } } /** * User Logged In validation */ if ($pld_settings['basic_settings']['like_dislike_resistriction'] == 'user') { if (is_user_logged_in()) { $liked_users = get_post_meta($post_id, 'pld_users', true); $liked_users = (empty($liked_users)) ? array() : $liked_users; $liked_users_info = get_post_meta($post_id, 'pld_users_info', true); $liked_users_info = (empty($liked_users_info)) ? array() : $liked_users_info; $current_user_id = get_current_user_id(); if (in_array($current_user_id, $liked_users)) { $already_liked = 1; } if (in_array($current_user_id, $liked_users)) { $already_liked = 1; if (isset($liked_users_info[$current_user_id])) { $already_liked_type = $liked_users_info[$current_user_id]; } else { $already_liked_type = 'na'; } } } else { $current_page_url = $this->get_current_page_url(); $href = (!empty($pld_settings['basic_settings']['login_link'])) ? $pld_settings['basic_settings']['login_link'] : admin_url() . '/wp-login.php?redirect=' . $current_page_url; } } if (!empty($pld_settings['basic_settings']['display_zero'])) { if (empty($like_count)) { $like_count = 0; } if (empty($dislike_count)) { $dislike_count = 0; } } /** * Filters like count * * @param type int $like_count * @param type int $post_id * * @since 1.0.0 */ $like_count = apply_filters('pld_like_count', $like_count, $post_id); /** * Filters dislike count * * @param type int $dislike_count * @param type int $post_id * * @since 1.0.0 */ $dislike_count = apply_filters('pld_dislike_count', $dislike_count, $post_id); $like_title = isset($pld_settings['basic_settings']['like_hover_text']) ? esc_attr($pld_settings['basic_settings']['like_hover_text']) : __('Like', PLD_TD); $dislike_title = isset($pld_settings['basic_settings']['dislike_hover_text']) ? esc_attr($pld_settings['basic_settings']['dislike_hover_text']) : __('Dislike', PLD_TD); //$this->print_array( $pld_settings ); ?>