示例#1
0
            </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
0
 /**
  * @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
0
 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);
 }
        <?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
0
                    <?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
0
            </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">&nbsp;</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"> &nbsp;</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
0
?>
    <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 
}
?>
        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();
    ?>
 function update_avg_rate($post_id)
 {
     $avg = STReview::get_avg_rate($post_id);
     update_post_meta($post_id, 'rate_review', $avg);
 }
 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
0
 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
0
 /**
  *@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
0
        ?>
        <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
0
                                            </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
0
        ?>
        <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');
示例#16
0
</h4>
                <ul class="list booking-item-raiting-summary-list">
                    <?php 
    //$post_stats=get_post_meta(get_the_ID(),'review_stats',true);
    foreach ($hotel_stats as $key => $value) {
        ?>
                        <li>
                            <div class="booking-item-raiting-list-title"><?php 
        echo esc_html($value['title']);
        ?>
</div>
                            <ul class="icon-group booking-item-rating-stars">
                                <?php 
        for ($i = 1; $i <= 5; $i++) {
            //$avg=TravelHelper::find_in_array($post_stats,'title',sanitize_title($value['title']),'stat_value');
            $avg = STReview::get_avg_stat(get_the_ID(), $value['title']);
            $class = '';
            if ($i > $avg) {
                $class = 'text-gray';
            }
            echo '<li><i class="fa fa-smile-o ' . $class . '"></i>';
        }
        ?>
                            </ul>
                        </li>
                        <?php 
    }
    ?>

                </ul>
            </div>
示例#17
0
 function save_post_review_stats($comment_id)
 {
     $comemntObj = get_comment($comment_id);
     $post_id = $comemntObj->comment_post_ID;
     $avg = STReview::get_avg_rate($post_id);
     update_post_meta($post_id, 'rate_review', $avg);
 }
示例#18
0
 function save_comment_meta_data($comment_id)
 {
     if (isset($_POST['comment_title']) && $_POST['comment_title'] != '') {
         $title = wp_filter_nohtml_kses($_POST['comment_title']);
         add_comment_meta($comment_id, 'comment_title', $title);
     }
     if (isset($_POST['comment_rate']) && $_POST['comment_rate'] != '') {
         $rate = wp_filter_nohtml_kses($_POST['comment_rate']);
         if ($rate > 5) {
             //Max rate is 5
             $rate = 5;
         }
         add_comment_meta($comment_id, ' q', $rate);
     }
     $all_postype = st()->booking_post_type();
     $current_post_type = get_post_type(get_comment($comment_id)->comment_post_ID);
     global $wpdb;
     $wpdb->update($wpdb->comments, array('comment_type' => 'st_reviews'), array('comment_ID' => $comment_id));
     $comemntObj = get_comment($comment_id);
     $post_id = $comemntObj->comment_post_ID;
     $avg = STReview::get_avg_rate($post_id);
     update_post_meta($post_id, 'rate_review', $avg);
 }
示例#19
0
 function st_write_review()
 {
     if (STInput::request('write_review')) {
         if (!STInput::request('item_id')) {
             $user_url = st()->get_option('page_my_account_dashboard');
             if ($user_url) {
                 wp_safe_redirect(get_permalink($user_url));
             } else {
                 wp_safe_redirect(home_url());
             }
             die;
             //wp_safe_redirect();
         } else {
             if (!get_post_status(STInput::request('item_id'))) {
                 $user_url = st()->get_option('page_my_account_dashboard');
                 if ($user_url) {
                     wp_safe_redirect(get_permalink($user_url));
                 } else {
                     wp_safe_redirect(home_url());
                 }
                 die;
             }
         }
     }
     if (STInput::post() and STInput::post('comment_post_ID') and STInput::post('_wp_unfiltered_html_comment')) {
         if (wp_verify_nonce(STInput::post('st_user_write_review'), 'st_user_settings')) {
             global $current_user;
             $comment_data['comment_post_ID'] = STInput::post('comment_post_ID');
             $comment_data['comment_author'] = $current_user->data->user_nicename;
             $comment_data['comment_author_email'] = $current_user->data->user_email;
             $comment_data['comment_content'] = STInput::post('comment');
             $comment_data['comment_type'] = 'st_reviews';
             $comment_data['user_id'] = $current_user->ID;
             if (STInput::post('item_id')) {
                 $comment_data['comment_post_ID'] = STInput::post('item_id');
             }
             if (STReview::check_reviewable(STInput::post('comment_post_ID'))) {
                 $comment_id = wp_new_comment($comment_data);
                 if ($comment_id) {
                     update_comment_meta($comment_id, 'comment_title', STInput::post('comment_title'));
                     if (STInput::post('comment_rate')) {
                         update_comment_meta($comment_id, 'comment_rate', STInput::post('comment_rate'));
                     }
                 }
                 wp_safe_redirect(get_permalink(STInput::post('comment_post_ID')));
                 die;
             }
         }
     }
 }
示例#20
0
 function _update_duplicate_data($id, $data)
 {
     if (!TravelHelper::checkTableDuplicate('st_rental')) {
         return;
     }
     if (get_post_type($id) == 'st_rental') {
         $num_rows = TravelHelper::checkIssetPost($id, 'st_rental');
         $location_str = get_post_meta($id, 'multi_location', true);
         $location_id = '';
         // location_id
         $address = get_post_meta($id, 'address', true);
         // address
         $rentals_booking_period = get_post_meta($id, 'rentals_booking_period', true);
         // rentals_booking_period
         $rental_max_adult = get_post_meta($id, 'rental_max_adult', true);
         // rental max adult
         $rental_max_children = get_post_meta($id, 'rental_max_children', true);
         // rental max children
         $sale_price = get_post_meta($id, 'price', true);
         // sale price
         $discount = get_post_meta($id, 'discount_rate', 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;
         }
         $rate_review = STReview::get_avg_rate($id);
         // rate review
         if ($num_rows == 1) {
             $data = array('multi_location' => $location_str, 'location_id' => $location_id, 'address' => $address, 'rental_max_adult' => $rental_max_adult, 'rental_max_children' => $rental_max_children, 'rate_review' => $rate_review, 'sale_price' => $sale_price, 'rentals_booking_period' => $rentals_booking_period);
             $where = array('post_id' => $id);
             TravelHelper::updateDuplicate('st_rental', $data, $where);
         } elseif ($num_rows == 0) {
             $data = array('post_id' => $id, 'multi_location' => $location_str, 'location_id' => $location_id, 'address' => $address, 'rental_max_adult' => $rental_max_adult, 'rental_max_children' => $rental_max_children, 'rate_review' => $rate_review, 'sale_price' => $sale_price, 'rentals_booking_period' => $rentals_booking_period);
             TravelHelper::insertDuplicate('st_rental', $data);
         }
     }
 }
                    </li>
                    <li class=""><i class="fa fa-star-o"></i>
                    </li>
                </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>
           ';
    /* st update review without not login */
    $comment_form_arg = apply_filters(get_post_type($item_id) . '_wp_review_form_args', $comment_form, $item_id);
    if (STReview::check_reviewable($item_id)) {
        echo '<div class="box bg-gray">';
        comment_form($comment_form_arg);
        echo "</div>";
    }
    if (STReview::check_reviewed($item_id)) {
        echo '<div class="box bg-gray">';
        echo st_get_language('you_have_been_post_a_review') . ' ' . $title;
        echo '</div>';
    }
    ?>
    </form>
<?php 
}
示例#22
0
    $count += count($gallery);
    foreach ($gallery as $key => $value) {
        $img_link = wp_get_attachment_image_src($value, array(800, 600, 'bfi_thumb' => TRUE));
        if (isset($img_link[0])) {
            echo "<a class='st-gp-item' href='{$img_link[0]}'></a>";
        }
    }
}
?>
                </div>
            </div>
        </header>
        <div class="thumb-caption">
            <ul class="icon-group text-tiny text-color">
                <?php 
$avg = STReview::get_avg_rate();
echo TravelHelper::rate_to_string($avg);
?>
            </ul>
            <h5 class="thumb-title"><a class="text-darken"
                                       href="<?php 
echo esc_url($link);
?>
"><?php 
the_title();
?>
</a></h5>
            <?php 
if ($address = get_post_meta(get_the_ID(), 'address', TRUE)) {
    ?>
                <p class="mb0">
示例#23
0
                        <h5 class="booking-item-title" <?php 
        if ($layout == 'layout2') {
            echo 'style="font-size: 20px;"';
        }
        ?>
><a href="<?php 
        echo esc_url($link);
        ?>
"><?php 
        echo get_the_title($post_id);
        ?>
</a> </h5>
                        <ul class="icon-group booking-item-rating-stars">
                            <?php 
        if ($instance['post_type'] != 'st_cars') {
            $avg = STReview::get_avg_rate($post_id);
            echo TravelHelper::rate_to_string($avg);
        }
        ?>
                        </ul>
                    </div>
                    <div class="<?php 
        if ($layout == 'layout2') {
            echo 'col-xs-12';
        } else {
            echo 'col-xs-3';
        }
        ?>
">
                        <?php 
        switch ($instance['post_type']) {