本文整理汇总了PHP中wc_review_is_from_verified_owner函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_review_is_from_verified_owner函数的具体用法?PHP wc_review_is_from_verified_owner怎么用?PHP wc_review_is_from_verified_owner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_review_is_from_verified_owner函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_product_reviews
/**
* Get the reviews for a product
*
* @since 2.1
* @param int $id the product ID to get reviews for
* @param string $fields fields to include in response
* @return array
*/
public function get_product_reviews($id, $fields = null)
{
$id = $this->validate_request($id, 'product', 'read');
if (is_wp_error($id)) {
return $id;
}
$comments = get_approved_comments($id);
$reviews = array();
foreach ($comments as $comment) {
$reviews[] = array('id' => intval($comment->comment_ID), 'created_at' => $this->server->format_datetime($comment->comment_date_gmt), 'review' => $comment->comment_content, 'rating' => get_comment_meta($comment->comment_ID, 'rating', true), 'reviewer_name' => $comment->comment_author, 'reviewer_email' => $comment->comment_author_email, 'verified' => wc_review_is_from_verified_owner($comment->comment_ID));
}
return array('product_reviews' => apply_filters('woocommerce_api_product_reviews_response', $reviews, $id, $fields, $comments, $this->server));
}
示例2: prepare_item_for_response
/**
* Prepare a single product review output for response.
*
* @param WP_Comment $review Product review object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response($review, $request)
{
$data = array('id' => (int) $review->comment_ID, 'date_created' => wc_rest_prepare_date_response($review->comment_date_gmt), 'review' => $review->comment_content, 'rating' => (int) get_comment_meta($review->comment_ID, 'rating', true), 'reviewer_name' => $review->comment_author, 'reviewer_email' => $review->comment_author_email, 'verified' => wc_review_is_from_verified_owner($review->comment_ID));
$context = !empty($request['context']) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object($data, $request);
$data = $this->filter_response_by_context($data, $context);
// Wrap the data in a response object.
$response = rest_ensure_response($data);
$response->add_links($this->prepare_links($review, $request));
/**
* Filter product reviews object returned from the REST API.
*
* @param WP_REST_Response $response The response object.
* @param WP_Comment $review Product review object used to create response.
* @param WP_REST_Request $request Request object.
*/
return apply_filters('woocommerce_rest_prepare_product_review', $response, $review, $request);
}
示例3: intval
* HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
* will need to copy the new files to your theme to maintain compatibility. We try to do this.
* as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes.
*
* @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
*/
if (!defined('ABSPATH')) {
exit;
// Exit if accessed directly
}
$rating = intval(get_comment_meta($comment->comment_ID, 'rating', true));
$verified = wc_review_is_from_verified_owner($comment->comment_ID);
?>
<li itemprop="review" itemscope itemtype="http://schema.org/Review" <?php
comment_class();
?>
id="li-comment-<?php
comment_ID();
?>
">
<div id="comment-<?php
comment_ID();
?>
" class="comment_container">
<?php
示例4: _e
?>
<p class="meta"><em><?php
_e('Your comment is awaiting approval', 'swiftframework');
?>
</em></p>
<?php
} else {
?>
<p class="meta">
<?php
if (get_option('woocommerce_review_rating_verification_label') === 'yes') {
if (function_exists('wc_review_is_from_verified_owner')) {
$verified = wc_review_is_from_verified_owner($comment_id);
if ($verified) {
echo '<em class="verified">(' . __('verified owner', 'swiftframework') . ')</em> ';
}
}
}
?>
</p>
<?php
}
?>
<div itemprop="description" class="description">
<?php