本文整理汇总了PHP中STReview::check_reviewable方法的典型用法代码示例。如果您正苦于以下问题:PHP STReview::check_reviewable方法的具体用法?PHP STReview::check_reviewable怎么用?PHP STReview::check_reviewable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STReview
的用法示例。
在下文中一共展示了STReview::check_reviewable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: st_get_language
</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
}
示例2: 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;
}
}
}
}