Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getILikeThis($arg) {
- global $wpdb;
- $post_ID = get_the_ID();
- $ip = $_SERVER['REMOTE_ADDR'];
- $liked = get_post_meta($post_ID, '_liked', true) != '' ? get_post_meta($post_ID, '_liked', true) : '0';
- $voteStatusByIp = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."ilikethis_votes WHERE post_id = '$post_ID' AND ip = '$ip'");
- if (!isset($_COOKIE['liked-'.$post_ID]) && $voteStatusByIp == 0) {
- if (get_option('ilt_textOrImage') == 'image') {
- $counter = '<a onclick="likeThis('.$post_ID.');" class="image">'.$liked.'</a>';
- }
- else {
- $counter = $liked.' <a onclick="likeThis('.$post_ID.');">'.get_option('ilt_text').'</a>';
- }
- }
- else {
- $counter = $liked;
- }
- $iLikeThis = '<div id="iLikeThis-'.$post_ID.'" class="iLikeThis">';
- $iLikeThis .= '<span class="counter">'.$counter.'</span>';
- $iLikeThis .= '</div>';
- if ($arg == 'put') {
- return $iLikeThis;
- }
- else {
- echo $iLikeThis;
- }
- }
- if (get_option('ilt_onPage') == '1') {
- function putILikeThis($content) {
- if(!is_feed() && !is_page()) {
- $content.= getILikeThis('put');
- }
- return $content;
- }
- add_filter('the_content', putILikeThis);
- }
- function enqueueScripts() {
- if (get_option('ilt_jquery') == '1') {
- wp_enqueue_script('iLikeThis', WP_PLUGIN_URL.'/i-like-this/js/i-like-this.js', array('jquery'));
- }
- else {
- wp_enqueue_script('iLikeThis', WP_PLUGIN_URL.'/i-like-this/js/i-like-this.js');
- }
- }
- function addHeaderLinks() {
- echo '<link rel="stylesheet" type="text/css" href="'.WP_PLUGIN_URL.'/i-like-this/css/i-like-this.css" media="screen" />'."\n";
- echo '<script type="text/javascript">var blogUrl = \''.get_bloginfo('wpurl').'\'</script>'."\n";
- }
- add_action('init', enqueueScripts);
- add_action('wp_head', addHeaderLinks);
- ?>
Add Comment
Please, Sign In to add comment