예제 #1
0
                        echo $details['breakupDate'];
                        ?>
<br>
	<?php 
                    }
                    ?>
	<b>Zipcode of Origin</b>: <?php 
                    echo $details['formationZipCode'];
                    ?>
<br>
  </div>
</div>

<br>
<?php 
                    if (is_favorite($_SESSION['username'], $details['artistId'])) {
                        ?>
<a class="btn btn-warning btn-block" href="artists.php?action=removefavorite&id=<?php 
                        echo $details['artistId'];
                        ?>
">Remove from favorites</a><br>
<?php 
                    } else {
                        ?>
<a class="btn btn-success btn-block" href="artists.php?action=addfavorite&id=<?php 
                        echo $details['artistId'];
                        ?>
">Add to favorites</a><br>
<?php 
                    }
                    ?>
    $wpdb instanceof \wpdb;
    $charset = !empty($wpdb->charset) ? "DEFAULT CHARACTER SET {$wpdb->charset}" : '';
    $collate = !empty($wpdb->collate) ? "COLLATE {$wpdb->collate}" : '';
    $favorite_query = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}favorite` (" . "`favorite_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT," . "`post_id` bigint(20) unsigned NOT NULL DEFAULT '0'," . "`user_id` bigint(20) DEFAULT NULL," . "PRIMARY KEY (`favorite_id`)," . "KEY `post_id` (`post_id`)" . ") ENGINE=InnoDB {$charset} {$collate} AUTO_INCREMENT=1";
    $wpdb->query($favorite_query);
    $query = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}votes` (" . "`vote_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT," . "`post_id` bigint(20) unsigned NOT NULL DEFAULT '0'," . "`user_id` bigint(20) DEFAULT NULL," . "`vote_value` bigint(20)," . "PRIMARY KEY (`vote_id`)," . "KEY `post_id` (`post_id`)" . ") ENGINE=InnoDB {$charset} {$collate} AUTO_INCREMENT=1";
    $wpdb->query($query);
});
add_action('wp_ajax_user_post_toggle_favorite', function () {
    global $wpdb;
    $wpdb instanceof \wpdb;
    $Input = new \jptt\core\Input();
    $userdata = get_userdata(get_current_user_id());
    $post_id = (int) $Input->get('post_id');
    $user_id = (int) $userdata->ID;
    if (!is_favorite($post_id, $user_id)) {
        $wpdb->insert("{$wpdb->prefix}favorite", compact('post_id', 'user_id'));
        wp_send_json(TRUE);
    } else {
        $wpdb->delete("{$wpdb->prefix}favorite", compact('post_id', 'user_id'));
        wp_send_json(FALSE);
    }
}, 10);
add_action('wp_ajax_user_post_vote', function () {
    global $wpdb;
    $wpdb instanceof \wpdb;
    $Input = new \jptt\core\Input();
    $userdata = get_userdata(get_current_user_id());
    $post_id = (int) $Input->get('post_id');
    $user_id = (int) $userdata->ID;
    $vote_value = (int) $Input->get('post_id');
예제 #3
0
<span class="rating"><span style="width:' . $item->stars * 16 . 'px;"></span></span>
<div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
<span itemprop="average" style="display: none;">' . number_format($item->stars, 2) . '</span>
<span itemprop="best" style="display: none;">5</span>
</div>
<a href="' . $item->reviews_link . '"><span itemprop="votes">' . $item->reviews . '</span> reviews</a>
</div>

<div class="right">
<div class="title" itemprop="itemreviewed">' . $item->name . '</div>
<div class="description">' . (!empty($item->description) ? nl2br($item->description) : 'no description') . '</div>

<div class="links">
<a href="' . tlink('plugin/click.html', 'id=' . $item->ID) . '" target="_blank" class="btn open_site">Open website</a>';
    if (me()) {
        if (is_favorite()) {
            echo '<a href="' . tlink('ajax/favorite.html', 'action=remFavorite&amp;id=' . $item->ID, 'this') . '" class="btn remove_favorite">-Favorite</a>';
        } else {
            echo '<a href="' . tlink('ajax/favorite.html', 'action=addFavorite&amp;id=' . $item->ID, 'this') . '" class="btn add_favorite">+Favorite</a>';
        }
    }
    echo '</div>
</div>

</div>

<div class="share-coupon" style="display: block;">

Share on social networks or copy the link and share anywhere:

<div class="shareto">