本文整理汇总了PHP中STReview类的典型用法代码示例。如果您正苦于以下问题:PHP STReview类的具体用法?PHP STReview怎么用?PHP STReview使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了STReview类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: human_time_diff
</div>
<span class="comment-time">
<?php
echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . st_get_language('_ago');
?>
</span>
<span class="comment-reply"><i class="fa fa-reply"></i>
<?php
comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
?>
</span>
<!-- <a class="comment-like" href="#"><i class="fa fa-heart"></i> 23</a>-->
<p class="comment-like">
<?php
$review_obj = new STReview();
if ($review_obj->check_like(get_comment_ID())) {
?>
<a class="comment-like st-like-comment fa fa-heart" data-id="<?php
comment_ID();
?>
" href="#"><i class=""></i> <?php
echo get_comment_meta(get_comment_ID(), '_comment_like_count', true);
?>
</a>
<!-- <a data-id="<?php
/*comment_ID(); */
?>
" class="st-like-review fa fa-thumbs-o-down box-icon-inline round" href="#"></a><b class="text-color"> <?php
/*echo get_comment_meta($comment_id,'_comment_like_count',true) */
?>
示例2: _save_review_stats
/**
* @since 1.1.9
* @param $comment_id
*/
function _save_review_stats($comment_id)
{
$comemntObj = get_comment($comment_id);
$post_id = $comemntObj->comment_post_ID;
if (get_post_type($post_id) == 'st_holidays') {
$all_stats = $this->get_review_stats();
$st_review_stats = STInput::post('st_review_stats');
if (!empty($all_stats) and is_array($all_stats)) {
$total_point = 0;
foreach ($all_stats as $key => $value) {
if (isset($st_review_stats[$value['title']])) {
$total_point += $st_review_stats[$value['title']];
//Now Update the Each Stat Value
update_comment_meta($comment_id, 'st_stat_' . sanitize_title($value['title']), $st_review_stats[$value['title']]);
}
}
$avg = round($total_point / count($all_stats), 1);
//Update comment rate with avg point
$rate = wp_filter_nohtml_kses($avg);
if ($rate > 5) {
//Max rate is 5
$rate = 5;
}
update_comment_meta($comment_id, 'comment_rate', $rate);
//Now Update the Stats Value
update_comment_meta($comment_id, 'st_review_stats', $st_review_stats);
}
if (STInput::post('comment_rate')) {
update_comment_meta($comment_id, 'comment_rate', STInput::post('comment_rate'));
}
//review_stats
$avg = STReview::get_avg_rate($post_id);
update_post_meta($post_id, 'rate_review', $avg);
}
}
示例3: get_info_by_post_type
static function get_info_by_post_type($id, $post_type = null, $list = NULL)
{
if (!$post_type) {
return;
}
if (!in_array($post_type, array('st_activity', 'st_hotel', 'st_rental', 'st_cars', 'st_tours', 'st_holidays', 'hotel_room'))) {
return;
}
$location_meta_text = 'id_location';
if ($post_type == 'st_rental') {
$location_meta_text = 'location_id';
}
$where = " (1= 1 )";
$location_id = get_the_ID();
if (!$list) {
$list = TravelHelper::getLocationByParent($location_id);
}
if (is_array($list) and !empty($list)) {
$where .= " AND (";
$where_tmp = "";
foreach ($list as $item) {
if (empty($where_tmp)) {
$where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
} else {
$where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
}
}
$list = implode(',', $list);
$where_tmp .= " OR tb.{$location_meta_text} IN ({$list})";
$where .= $where_tmp . ")";
} else {
$where = "(tb.multi_location LIKE '%_{$location_id}_%' \r\n OR tb.{$location_meta_text} IN ('{$location_id}')) ";
}
$results = array();
$num_rows = 0;
global $wpdb;
$table = $wpdb->prefix . $post_type;
$join = " {$table} as tb ON {$wpdb->posts}.ID = tb.post_id ";
$join = self::edit_join_wpml($join, $post_type);
$where = self::edit_where_wpml($where, $post_type);
if (TravelHelper::checkTableDuplicate($post_type)) {
$sql = "SELECT {$wpdb->posts}.ID\r\n FROM {$wpdb->posts} \r\n join {$join} \r\n where {$where}\r\n GROUP BY {$wpdb->posts}.ID";
//echo $sql ;
$results = $wpdb->get_results($sql, ARRAY_A);
$num_rows = $wpdb->num_rows;
wp_reset_postdata();
}
// get review = count all comment number
$comment_num = 0;
if (is_array($results) and !empty($results)) {
foreach ($results as $row) {
$comment_num = $comment_num + STReview::count_all_comment($row['ID']);
}
}
if ($num_rows > 1) {
$name = self::get_post_type_name($post_type);
} else {
$name = self::get_post_type_name($post_type, true);
}
if ($list = TravelHelper::getLocationByParent(get_the_ID())) {
$min_max_price = self::get_min_max_price_location($post_type, $list);
} else {
$min_max_price = self::get_min_max_price_location($post_type, $location_id);
}
return array('post_type' => $post_type, 'post_type_name' => $name, 'reviews' => $comment_num, 'offers' => $num_rows, 'min_max_price' => $min_max_price);
}
示例4: st_the_language
<?php
if ($avg <= 1) {
st_the_language('clean');
} elseif ($avg <= 2) {
st_the_language('good');
} elseif ($avg <= 3) {
st_the_language('very_good');
} elseif ($avg <= 4) {
st_the_language('superior');
} elseif ($avg <= 5) {
st_the_language('exceptional');
}
?>
</h2>
<h3><?php
echo STReview::get_percent_recommend();
?>
% <small><?php
st_the_language('of_guests_recommend');
?>
</small></h3>
<div class="booking-item-rating">
<ul class="icon-list icon-group booking-item-rating-stars">
<?php
echo TravelHelper::rate_to_string($avg);
?>
</ul><span class="booking-item-rating-number"><b><?php
echo balanceTags($avg);
?>
</b> <?php
st_the_language('of_5_guest_rating');
示例5: get_comment_meta
<?php
$count_like = get_comment_meta($comment_id, '_comment_like_count', true);
if (intval($count_like) <= 0) {
$count_like = 0;
}
?>
<b class="text-color"> <span class="number"><?php
echo $count_like;
?>
</span> <?php
echo __('like this', ST_TEXTDOMAIN);
?>
</b>
<?php
$review_obj = new STReview();
if ($review_obj->check_like($comment_id)) {
?>
<a data-id="<?php
echo esc_attr($comment_id);
?>
" class="st-like-review fa fa-thumbs-o-down box-icon-inline round" href="#"></a>
<?php
} else {
?>
<a data-id="<?php
echo esc_attr($comment_id);
?>
" class="st-like-review fa fa-thumbs-o-up box-icon-inline round" href="#"></a></b>
示例6: _e
</div>
<div class="row mt10">
<div class="col-md-6 col-sm-6 col-xs-6">
<p class="mb0 text-darken">
<i class="fa fa-money"> </i>
<?php
_e('Price', ST_TEXTDOMAIN);
?>
:
<span> <?php
echo STHoliday::get_price_html(false, false, ' <br> -');
?>
</span>
</p>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 text-right">
<i class="fa fa-thumbs-o-up icon-like"> </i>
<ul class="icon-group text-color pull-right">
<?php
echo TravelHelper::rate_to_string(STReview::get_avg_rate());
?>
</ul>
</div>
</div>
</div>
</div>
<div class="gap"></div>
</div>
示例7: st
?>
<div class="thumb item_map">
<header class="thumb-header">
<img src="<?php
echo $img;
?>
" alt="" class="img-responsive">
</header>
<div class="thumb-caption">
<?php
$view_star_review = st()->get_option('view_star_review', 'review');
if ($view_star_review == 'review') {
?>
<ul class="icon-group text-color">
<?php
$avg = STReview::get_avg_rate($hotel_id);
echo TravelHelper::rate_to_string($avg);
?>
</ul>
<?php
} elseif ($view_star_review == 'star') {
?>
<ul class="icon-list icon-group booking-item-rating-stars text-color">
<?php
$star = STHotel::getStar($hotel_id);
echo TravelHelper::rate_to_string($star);
?>
</ul>
<?php
}
?>
示例8: balanceTags
echo balanceTags($img);
} else {
echo '<img width="800" height="600" alt="no-image" class="wp-post-image" src="' . bfi_thumb(get_template_directory_uri() . '/img/no-image.png', array('width' => 800, 'height' => 600)) . '">';
}
?>
</div>
<div class="col-md-6">
<div class="booking-item-rating">
<ul class="icon-group booking-item-rating-stars">
<?php
echo TravelHelper::rate_to_string(STReview::get_avg_rate());
?>
</ul>
<span class="booking-item-rating-number">
<b><?php
echo STReview::get_avg_rate();
?>
</b> <?php
st_the_language('user_of_5');
?>
</span>
<small>
(<?php
comments_number(st_get_language('user_no_reviews'), st_get_language('user_1_review'), '% ' . st_get_language('user_reviews'));
?>
)
</small>
</div>
<h5 class="booking-item-title"><?php
the_title();
?>
示例9: update_avg_rate
function update_avg_rate($post_id)
{
$avg = STReview::get_avg_rate($post_id);
update_post_meta($post_id, 'rate_review', $avg);
}
示例10: _update_duplicate_data
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_holidays')) {
return;
}
if (get_post_type($id) == 'st_holidays') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_holidays');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$address = get_post_meta($id, 'address', true);
// address
$max_people = get_post_meta($id, 'max_people', true);
// maxpeople
$check_in = get_post_meta($id, 'check_in', true);
// check in
$check_out = get_post_meta($id, 'check_out', true);
// check out
$type_holiday = get_post_meta($id, 'type_holiday', true);
// check out
$duration_day = get_post_meta($id, 'duration_day', true);
// duration_day
$holidays_booking_period = get_post_meta($id, 'holidays_booking_period', true);
// holidays_booking_period
$sale_price = get_post_meta($id, 'price', true);
// sale_price
$child_price = get_post_meta($id, 'child_price', true);
$adult_price = get_post_meta($id, 'adult_price', true);
$infant_price = get_post_meta($id, 'infant_price', true);
$discount = get_post_meta($id, 'discount', true);
$is_sale_schedule = get_post_meta($id, 'is_sale_schedule', true);
if ($is_sale_schedule == 'on') {
$sale_from = get_post_meta($id, 'sale_price_from', true);
$sale_to = get_post_meta($id, 'sale_price_to', true);
if ($sale_from and $sale_from) {
$today = date('Y-m-d');
$sale_from = date('Y-m-d', strtotime($sale_from));
$sale_to = date('Y-m-d', strtotime($sale_to));
if ($today >= $sale_from && $today <= $sale_to) {
} else {
$discount = 0;
}
} else {
$discount = 0;
}
}
if ($discount) {
$sale_price = $sale_price - $sale_price / 100 * $discount;
$child_price = $child_price - $child_price / 100 * $discount;
$adult_price = $adult_price - $adult_price / 100 * $discount;
$infant_price = $infant_price - $infant_price / 100 * $discount;
}
$rate_review = STReview::get_avg_rate($id);
// rate review
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'type_holiday' => $type_holiday, 'check_in' => $check_in, 'check_out' => $check_out, 'sale_price' => $sale_price, 'child_price' => $child_price, 'adult_price' => $adult_price, 'infant_price' => $infant_price, 'max_people' => $max_people, 'rate_review' => $rate_review, 'duration_day' => $duration_day, 'holidays_booking_period' => $holidays_booking_period);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_holidays', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'type_holiday' => $type_holiday, 'check_in' => $check_in, 'check_out' => $check_out, 'sale_price' => $sale_price, 'child_price' => $child_price, 'adult_price' => $adult_price, 'infant_price' => $infant_price, 'max_people' => $max_people, 'rate_review' => $rate_review, 'duration_day' => $duration_day, 'holidays_booking_period' => $holidays_booking_period);
TravelHelper::insertDuplicate('st_holidays', $data);
}
}
}
示例11: get_info_by_post_type
static function get_info_by_post_type($id, $post_type = null)
{
if (in_array($post_type, array("hotel", "hotels", "st_hotels"))) {
$post_type = "st_hotel";
}
if (in_array($post_type, array("car", "cars", "st_car"))) {
$post_type = "st_cars";
}
if (in_array($post_type, array("rental", "rentals", "st_rentals"))) {
$post_type = "st_rental";
}
if (in_array($post_type, array("activity", "activities", "st_activity"))) {
$post_type = "st_activity";
}
if (in_array($post_type, array("tour", "tours", "st_tour"))) {
$post_type = "st_tours";
}
if (!$post_type) {
return;
}
$location_meta_text = 'id_location';
if ($post_type == 'st_rental') {
$location_meta_text = 'location_id';
}
$location_id = get_the_ID();
global $wpdb;
$sql = "SELECT ID\r\n\t\t\t\tFROM `{$wpdb->postmeta}` \r\n\t\t\t\tJOIN `{$wpdb->posts}` \r\n\t\t\t\tON \t{$wpdb->posts}.ID = {$wpdb->postmeta}.post_id \r\n\t\t\t\t\tand {$wpdb->postmeta}.meta_key = '{$location_meta_text}' \r\n\t\t\t\t\tand {$wpdb->postmeta}.meta_value = '{$location_id}'\r\n\t\t\t\t\tand {$wpdb->posts}.post_status = 'publish'\r\n\t\t\t\t\tand {$wpdb->posts}.post_type = '{$post_type}'\r\n\t\t\t\tGROUP BY {$wpdb->posts}.ID";
$results = $wpdb->get_results($sql, OBJECT);
$num_rows = $wpdb->num_rows;
// get review = count all comment number
$comment_num = 0;
foreach ($results as $row) {
$comment_num = $comment_num + STReview::count_all_comment($row->ID);
}
wp_reset_query();
return array('post_type' => $post_type, 'post_type_name' => self::get_post_type_name($post_type), 'reviews' => $comment_num, 'offers' => $num_rows, 'min_max_price' => self::get_min_max_price_location($post_type, $location_id));
}
示例12: _update_duplicate_data
/**
*@since 1.1.8
**/
function _update_duplicate_data($id, $data)
{
if (!TravelHelper::checkTableDuplicate('st_hotel')) {
return;
}
if (get_post_type($id) == 'st_hotel') {
$num_rows = TravelHelper::checkIssetPost($id, 'st_hotel');
$location_str = get_post_meta($id, 'multi_location', true);
$location_id = '';
// location_id
$address = get_post_meta($id, 'address', true);
// address
$allow_full_day = get_post_meta($id, 'allow_full_day', true);
// address
$rate_review = STReview::get_avg_rate($id);
// rate review
$hotel_star = get_post_meta($id, 'hotel_star', true);
// hotel star
$price_avg = get_post_meta($id, 'price_avg', true);
// price avg
$hotel_booking_period = get_post_meta($id, 'hotel_booking_period', true);
// price avg
$map_lat = get_post_meta($id, 'map_lat', true);
// map_lat
$map_lng = get_post_meta($id, 'map_lng', true);
// map_lng
if ($num_rows == 1) {
$data = array('multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'allow_full_day' => $allow_full_day, 'rate_review' => $rate_review, 'hotel_star' => $hotel_star, 'price_avg' => $price_avg, 'hotel_booking_period' => $hotel_booking_period, 'map_lat' => $map_lat, 'map_lng' => $map_lng);
$where = array('post_id' => $id);
TravelHelper::updateDuplicate('st_hotel', $data, $where);
} elseif ($num_rows == 0) {
$data = array('post_id' => $id, 'multi_location' => $location_str, 'id_location' => $location_id, 'address' => $address, 'allow_full_day' => $allow_full_day, 'rate_review' => $rate_review, 'hotel_star' => $hotel_star, 'price_avg' => $price_avg, 'hotel_booking_period' => $hotel_booking_period, 'map_lat' => $map_lat, 'map_lng' => $map_lng);
TravelHelper::insertDuplicate('st_hotel', $data);
}
}
}
示例13: get_the_post_thumbnail
?>
<a class="booking-item-payment-img" href="#">
<?php
echo get_the_post_thumbnail($holiday_id, array(98, 74, 'bfi_thumb' => true));
?>
</a>
<h5 class="booking-item-payment-title"><a href="<?php
echo get_permalink($holiday_id);
?>
"><?php
echo get_the_title($holiday_id);
?>
</a></h5>
<ul class="icon-group booking-item-rating-stars">
<?php
echo TravelHelper::rate_to_string(STReview::get_avg_rate($holiday_id));
?>
</ul>
<?php
} else {
st_the_language('sorry_holiday_not_found');
}
?>
</header>
<ul class="booking-item-payment-details">
<li>
<h5><?php
st_the_language('holidays_information');
?>
</h5>
<p class="booking-item-payment-item-title"><?php
示例14: st_get_language
</ul>
<input name="comment_rate" class="comment_rate" type="hidden">
</div>';
$comment_form['comment_field'] .= '<div class="form-group">
<label>' . st_get_language('review_title') . '</label>
<input class="form-control" type="text" name="comment_title">
</div>';
$comment_form['comment_field'] .= '<div class="form-group">
<label>' . st_get_language('review_text') . '</label>
<textarea name="comment" id="comment" class="form-control" rows="6"></textarea>
</div>
';
/* comment message for user and guest */
$comment_form_arg = apply_filters(get_post_type($item_id) . '_wp_review_form_args', $comment_form, $item_id);
$review_check = STReview::review_check($item_id);
switch ($review_check) {
case "true":
echo '<div class="box bg-gray">';
comment_form($comment_form_arg);
echo "</div>";
break;
case "must_login":
echo '<div class="box bg-gray">';
$login_link = get_the_permalink(st()->get_option('page_user_login'));
echo sprintf(st_get_language('you_must') . '<a href="' . $login_link . '">' . __('log in ', ST_TEXTDOMAIN) . '</a>' . st_get_language('to_write_review'), get_permalink(st()->get_option('user_login_page')));
echo '</div>';
break;
case "need_open":
echo '<div class="box bg-gray">';
echo sprintf(__("Review is disabled from administrator", ST_TEXTDOMAIN));
示例15: get_the_post_thumbnail
?>
<a class="booking-item-payment-img" href="#">
<?php
echo get_the_post_thumbnail($id_activity, array(98, 74, 'bfi_thumb' => true));
?>
</a>
<h5 class="booking-item-payment-title"><a href="<?php
echo get_permalink($id_activity);
?>
"><?php
echo get_the_title($id_activity);
?>
</a></h5>
<ul class="icon-group booking-item-rating-stars">
<?php
echo TravelHelper::rate_to_string(STReview::get_avg_rate($id_activity));
?>
</ul>
<?php
} else {
st_the_language('sorry_activity_not_found');
}
?>
</header>
<ul class="booking-item-payment-details">
<?php
if (!empty($check_in) and !empty($check_out)) {
?>
<li>
<h5><?php
st_the_language('activity');