• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP STReview类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中STReview的典型用法代码示例。如果您正苦于以下问题:PHP STReview类的具体用法?PHP STReview怎么用?PHP STReview使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了STReview类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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) */
        ?>
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:comment-list.php


示例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);
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:39,代码来源:class.holiday.php


示例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);
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:66,代码来源:class.location.php


示例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');
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:review_summary.php


示例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>
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:review-list.php


示例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">&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>

开发者ID:DaddyFool,项目名称:travelTest,代码行数:29,代码来源:holiday.php


示例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 
}
?>
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:room.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();
    ?>
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:loop-wishlist.php


示例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);
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:5,代码来源:class.travelobject.php


示例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);
         }
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:64,代码来源:class.admin.holidays.php


示例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));
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:37,代码来源:class.location.php


示例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);
         }
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:39,代码来源:class.admin.hotel.php


示例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 
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:cart_item_html.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));
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:reviews.php


示例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');
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:31,代码来源:cart_item_html.php


示例16: foreach

</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>
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:review_detail.php


示例17: save_post_review_stats

 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);
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:7,代码来源:class.hotel.php


示例18: save_comment_meta_data

 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);
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:23,代码来源:class.review.php


示例19: st_write_review

 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;
             }
         }
     }
 }
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:50,代码来源:class.user.php


示例20: _update_duplicate_data

 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);
         }
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:52,代码来源:class.admin.rental.php



注:本文中的STReview类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP STemplate类代码示例发布时间:2022-05-23
下一篇:
PHP STInput类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap