本文整理汇总了PHP中vibe_validate函数的典型用法代码示例。如果您正苦于以下问题:PHP vibe_validate函数的具体用法?PHP vibe_validate怎么用?PHP vibe_validate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vibe_validate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wplms_edd_completed_purchase
function wplms_edd_completed_purchase($payment_id, $new_status, $old_status)
{
if ($old_status == 'publish' || $old_status == 'complete') {
return;
}
// Make sure that payments are only completed once
// Make sure the payment completion is only processed when new status is complete
if ($new_status != 'publish' && $new_status != 'complete') {
return;
}
$user_id = get_current_user_id();
$cart_items = edd_get_payment_meta_cart_details($payment_id);
foreach ($cart_items as $key => $cart_item) {
$item_id = isset($cart_item['id']) ? $cart_item['id'] : $cart_item;
if (is_numeric($item_id) && get_post_type($item_id) == 'download') {
$courses = vibe_sanitize(get_post_meta($item_id, 'vibe_courses', false));
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
if (vibe_validate($subscribed)) {
$duration = get_post_meta($product_id, 'vibe_duration', true);
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
// Product duration for subscription based
$t = time() + $duration * $product_duration_parameter;
foreach ($courses as $course) {
update_post_meta($course, $user_id, 0);
update_user_meta($user_id, $course, $t);
$group_id = get_post_meta($course, 'vibe_group', true);
if (isset($group_id) && $group_id != '') {
groups_join_group($group_id, $user_id);
}
bp_course_record_activity(array('action' => __('Student subscribed for course ', 'vibe') . get_the_title($course), 'content' => __('Student ', 'vibe') . bp_core_get_userlink($user_id) . __(' subscribed for course ', 'vibe') . get_the_title($course) . __(' for ', 'vibe') . $duration . __(' days', 'vibe'), 'type' => 'subscribe_course', 'item_id' => $course, 'primary_link' => get_permalink($course), 'secondary_item_id' => $user_id));
}
} else {
if (isset($courses) && is_array($courses)) {
foreach ($courses as $course) {
$duration = get_post_meta($course, 'vibe_duration', true);
$course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
// Course duration for subscription based
$t = time() + $duration * $course_duration_parameter;
update_post_meta($course, $user_id, 0);
update_user_meta($user_id, $course, $t);
$group_id = get_post_meta($course, 'vibe_group', true);
if (isset($group_id) && $group_id != '') {
groups_join_group($group_id, $user_id);
}
bp_course_record_activity(array('action' => __('Student subscribed for course ', 'vibe') . get_the_title($course), 'content' => __('Student ', 'vibe') . bp_core_get_userlink($user_id) . __(' subscribed for course ', 'vibe') . get_the_title($course) . __(' for ', 'vibe') . $duration . __(' days', 'vibe'), 'type' => 'subscribe_course', 'item_id' => $course, 'primary_link' => get_permalink($course), 'secondary_item_id' => $user_id));
}
}
}
}
}
}
示例2: total_drip_duration
function total_drip_duration($value, $course_id, $unit_id)
{
$course_drip_duration_type = get_post_meta($course_id, 'vibe_course_drip_duration_type', true);
if (vibe_validate($course_drip_duration_type)) {
$unit_duration = get_post_meta($unit_id, 'vibe_duration', true);
$unit_duration_parameter = apply_filters('vibe_drip_duration_parameter', 60, $unit_id);
$value = $unit_duration * $unit_duration_parameter;
}
return $value;
}
示例3: get_permalink
echo '<li>';
if (isset($next_post)) {
echo '<a href="' . get_permalink($next_post->ID) . '" class="next"><span>' . $next_post->post_title . '</span>' . get_the_post_thumbnail($next_post->ID, 'thumbnail') . '</a>';
}
echo '</li>';
?>
</ul>
</div>
<?php
}
?>
</div>
<?php
$author = getPostMeta($post->ID, 'vibe_author', true);
if (vibe_validate($author)) {
?>
<div class="postauthor">
<div class="auth_image">
<?php
echo get_avatar(get_the_author_meta('email'), '160');
$instructing_courses = apply_filters('wplms_instructing_courses_endpoint', 'instructing-courses');
?>
</div>
<div class="author_info">
<a href="<?php
echo get_author_posts_url(get_the_author_meta('ID'));
?>
" class="readmore link"><?php
_e('Posts', 'vibe');
?>
示例4: do_action
?>
<div class="extra_buttons">
<?php
do_action('wplms_event_extra_buttons');
if (vibe_validate($print)) {
echo '<a href="#" class="certificate_print"><i class="icon-printer-1"></i></a>';
}
?>
</div>
<?php
if (apply_filters('wplms_event_access_flag', $access_flag)) {
the_content();
?>
<?php
if (vibe_validate($show_location)) {
$map_zoom = vibe_get_option('map_zoom');
echo '<h3 class="heading">' . __('Event Location', 'vibe') . '</h3>';
echo '<div class="vibe_gmap"><script>
function initialize() {
var myLatlng = new google.maps.LatLng(' . $location['latitude'] . ',' . $location['longitude'] . ');
var mapOptions = {
zoom: ' . (isset($map_zoom) ? $map_zoom : 15) . ',
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
示例5: do_action
<?php
do_action('wplms_course_curriculum_section', $id);
$course_curriculum = vibe_sanitize(get_post_meta($id, 'vibe_course_curriculum', false));
if (isset($course_curriculum)) {
foreach ($course_curriculum as $lesson) {
if (is_numeric($lesson)) {
$icon = get_post_meta($lesson, 'vibe_type', true);
if (get_post_type($lesson) == 'quiz') {
$icon = 'task';
}
$href = get_the_title($lesson);
$free = '';
$free = get_post_meta($lesson, 'vibe_free', true);
$curriculum_course_link = apply_filters('wplms_curriculum_course_link', 0);
if (vibe_validate($free) || $post->post_author == get_current_user_id() || current_user_can('manage_options') || $curriculum_course_link) {
$href = apply_filters('wplms_course_curriculum_free_access', '<a href="' . get_permalink($lesson) . '?id=' . get_the_ID() . '">' . get_the_title($lesson) . (vibe_validate($free) ? '<span>' . __('FREE', 'vibe') . '</span>' : '') . '</a>', $lesson, $free);
}
echo '<div class="course_lesson">
<i class="icon-' . $icon . '"></i><h6>' . apply_filters('wplms_curriculum_course_lesson', $href, $lesson) . '</h6>';
$minutes = 0;
$hours = 0;
$min = get_post_meta($lesson, 'vibe_duration', true);
$minutes = $min;
if ($minutes) {
if ($minutes > 60) {
$hours = intval($minutes / 60);
$minutes = $minutes - $hours * 60;
}
echo apply_filters('wplms_curriculum_time_filter', '<span><i class="icon-clock"></i> ' . (isset($hours) ? $hours . __(' Hours', 'vibe') : '') . ' ' . $minutes . ' ' . __('minutes', 'vibe') . '</span><b>' . (isset($hours) && $hours ? sprintf('%02d', $hours) : "00") . ':' . sprintf('%02d', $minutes) . '</b>', $min, $lesson);
}
echo '</div>';
示例6: foreach
foreach ($admin_query->results as $user) {
$instructors[] = $user->ID;
}
}
if (!empty($user_query->results)) {
foreach ($user_query->results as $user) {
$instructors[] = $user->ID;
}
}
$instructors = array_unique($instructors);
$ifield = vibe_get_option('instructor_field');
if (!isset($ifield) || $ifield == '') {
$ifield = 'Expertise';
}
$title = get_post_meta(get_the_ID(), 'vibe_title', true);
if (vibe_validate($title)) {
?>
<section class="title-area">
<?php
if (has_post_thumbnail()) {
$url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
} else {
$vibe = Wplms_Modern_Init::init();
$url = $vibe->option('hero_img');
}
?>
<div class="title-content" style="background:url(<?php
echo is_Array($url) ? $url[0] : $url;
?>
) no-repeat 50% 50%; ">
<div class="container">
示例7: foreach
?>
</strong>
</li>
<?php
}
?>
</ul>
<div class="clear"></div>
<?php
$items = $order->get_items();
foreach ($items as $item) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$subs = '';
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
if (vibe_validate($subscribed)) {
$duration = get_post_meta($product_id, 'vibe_duration', true);
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
$date = tofriendlytime($duration * $product_duration_parameter);
$subs = '<strong>' . __('COURSE SUBSCRIBED FOR ', 'vibe') . ' : <span>' . $date . '</span></strong>';
} else {
$subs = '<strong>' . __('SUSBSCRIBED FOR FULL COURSE', 'vibe') . '</strong>';
}
$vcourses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false));
if (count($vcourses)) {
echo '<h3 class="heading">' . __('Courses Subscribed', 'vibe') . '</h3>
<ul class="order_details">
<li><a>' . __('COURSE', 'vibe') . '</a>
<strong>' . __('SUBSCRIPTION', 'vibe') . '</strong></li>';
if ($order->status == 'completed' || $order->status == 'complete') {
$ostatus = __('START COURSE', 'vibe');
示例8: bp_course_quiz_auto_submit
function bp_course_quiz_auto_submit($quiz_id, $user_id)
{
$quiz_auto_evaluate = get_post_meta($quiz_id, 'vibe_quiz_auto_evaluate', true);
if (vibe_validate($quiz_auto_evaluate)) {
// Auto Evaluate for Quiz Enabled, Quiz auto evaluate, autoevaluate
$total_marks = 0;
$questions = vibe_sanitize(get_post_meta($quiz_id, 'quiz_questions' . $user_id, false));
if (!isset($questions) || !is_array($questions)) {
// Fallback for Older versions
$questions = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_questions', false));
}
if (count($questions)) {
$sum = $max_sum = 0;
foreach ($questions['ques'] as $key => $question) {
// Grab all the Questions
$marks = 0;
if (isset($question) && $question) {
$type = get_post_meta($question, 'vibe_question_type', true);
$auto_evaluate_question_types = vibe_get_option('auto_eval_question_type');
if (isset($auto_evaluate_question_types) && is_Array($auto_evaluate_question_types) && count($auto_evaluate_question_types)) {
// Validated
} else {
$auto_evaluate_question_types = array('single');
}
if (isset($type) && in_array($type, $auto_evaluate_question_types)) {
$correct_answer = get_post_meta($question, 'vibe_question_answer', true);
$comments_query = new WP_Comment_Query();
$comments = $comments_query->query(array('post_id' => $question, 'user_id' => $user_id, 'number' => 1, 'status' => 'approve'));
foreach ($comments as $comment) {
$comment->comment_content = trim($comment->comment_content, ',');
if ($comment->comment_content == $correct_answer) {
$marks = $questions['marks'][$key];
$total_marks = $total_marks + $marks;
} else {
// Use cases for No exact match for answer
if ($type == 'multiple') {
if (!strlen($comment->comment_content)) {
$marks = 0;
} else {
$marked_answers = explode(',', $comment->comment_content);
if (!is_array($marks_answers)) {
// Force Array Form
$marks_answers = array($marks_answers);
}
$correct_answers = explode(',', $correct_answer);
if (!is_array($correct_answers)) {
// Force Array Form
$correct_answers = array($correct_answers);
}
sort($marked_answers);
sort($correct_answers);
if (array_diff($marked_answers, $correct_answers) == array_diff($correct_answers, $marked_answers)) {
$marks = $questions['marks'][$key];
$total_marks = $total_marks + $marks;
} else {
$marks = apply_filters('wplms_incorrect_quiz_answer', 0, $quiz_id, $comment->comment_content, $question);
$total_marks = $total_marks + $marks;
}
}
} else {
if ($type == 'smalltext' || $type == 'fillblank') {
if (strpos($correct_answer, ',')) {
$correct_answers_array = explode(',', $correct_answer);
foreach ($correct_answers_array as $c_answer) {
if (strtolower($c_answer) == strtolower($comment->comment_content)) {
$marks = $questions['marks'][$key];
$total_marks = $total_marks + $marks;
break;
} else {
$marks = apply_filters('wplms_incorrect_quiz_answer', 0, $quiz_id, $comment->comment_content, $question);
$total_marks = $total_marks + $marks;
}
}
}
}
}
// If user does not marks in any of above use cases
if ($marks == 0) {
$marks = apply_filters('wplms_incorrect_quiz_answer', 0, $quiz_id, $comment->comment_content, $question);
}
}
update_comment_meta($comment->comment_ID, 'marks', $marks);
}
//END-For
}
}
}
update_post_meta($quiz_id, $user_id, $total_marks);
$max_marks = array_sum($questions['marks']);
do_action('wplms_evaluate_quiz', $quiz_id, $total_marks, $user_id, $max_marks);
}
} else {
// End Auto evaluate and Send notification to instructor
do_action('wplms_submit_quiz', $quiz_id, $course_id, $user_id);
}
}
示例9: display_time
function display_time($time, $seconds, $course_id)
{
$button_access = get_post_meta($course_id, 'vibe_course_button', true);
if (vibe_validate($button_access)) {
if (empty($seconds)) {
$time = __('COURSE FINISHED', 'vibe');
}
}
return $time;
}
示例10: _e
}
?>
</ul>
</div>
</div>
<div class="show_course_reviews">
<?php
if (get_comments_number() == 0) {
echo '<div id="message" class="notice"><p>';
_e('No Reviews found for this course.', 'vibe');
echo '</p></div>';
} else {
?>
<ol class="reviewlist commentlist">
<?php
wp_list_comments(array('type' => 'comment', 'reverse_top_level' => false, 'avatar_size' => 120, 'callback' => 'wplms_course_reviews'));
paginate_comments_links(array('prev_text' => '«', 'next_text' => '»'));
?>
</ol>
<?php
}
?>
</div>
<?php
$course_review = get_post_meta(get_the_ID(), 'vibe_course_review', true);
if (is_user_logged_in() && vibe_validate($course_review) && bp_course_is_member($post->ID, $user_id)) {
comment_form(array('fields' => $fields, 'comment_field' => $comment_field, 'label_submit' => __('Post Review', 'vibe'), 'title_reply' => '<span>' . __('Post Review', 'vibe') . '</span>', 'logged_in_as' => '', 'comment_notes_after' => ''));
}
}
示例11: wplms_redirect_to_course
function wplms_redirect_to_course($order_id)
{
if (!class_exists('WC_Order')) {
return;
}
$order = new WC_Order($order_id);
$items = $order->get_items();
$order_courses = array();
foreach ($items as $item) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$vcourses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false));
if (isset($vcourses) && is_array($vcourses) && count($vcourses) && $vcourses != '') {
$order_courses[$product_id]['courses'] = $vcourses;
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
if (vibe_validate($subscribed)) {
$duration = get_post_meta($product_id, 'vibe_duration', true);
$product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
$date = tofriendlytime($duration * $product_duration_parameter);
$order_courses[$product_id]['subs'] = '<strong>' . __('COURSE SUBSCRIBED FOR ', 'vibe') . ' : <span>' . $date . '</span></strong>';
} else {
$order_courses[$product_id]['subs'] = '<strong>' . __('SUSBSCRIBED FOR FULL COURSE', 'vibe') . '</strong>';
}
}
}
if (isset($order_courses) && is_array($order_courses) && count($order_courses)) {
echo '<h3 class="heading">' . __('Courses Subscribed', 'vibe') . '</h3>
<ul class="order_details">
<li><a>' . __('COURSE', 'vibe') . '</a>
<strong>' . __('SUBSCRIPTION', 'vibe') . '</strong></li>';
if ($order->status == 'completed' || $order->status == 'complete') {
$ostatus = __('START COURSE', 'vibe');
} else {
if ($order->status == 'pending') {
do_action('wplms_force_woocommerce_order_complete', $order);
$ostatus = __('WAITING FOR ORDER CONFIRMATION TO START COURSE', 'vibe');
} else {
$ostatus = __('WAITING FOR ADMIN APPROVAL', 'vibe');
}
}
foreach ($order_courses as $order_course) {
foreach ($order_course['courses'] as $course) {
echo '<li>
<a class="course_name">' . get_the_title($course) . '</a>
<a href="' . get_permalink($course) . '" class="button">
' . $ostatus . '</a>' . $order_course['subs'] . '
</li>';
}
}
echo '</ul>';
if (count($order_courses) == 1 && count($order_courses[$product_id]['courses']) == 1 && ($order->status == 'completed' || $order->status == 'complete')) {
$thankyou_redirect = vibe_get_option('thankyou_redirect');
if (isset($thankyou_redirect) && $thankyou_redirect) {
echo '<script>
jQuery(location).attr("href","' . get_permalink($course) . '");
</script>';
}
}
}
}
示例12: bp_course_get_full_course_curriculum
function bp_course_get_full_course_curriculum($course_id = NULL)
{
$curriculum = array();
global $post;
if (empty($course_id) && $post->post_type == 'course') {
$course_id = $post->ID;
}
if (!isset($course_id) || !is_numeric($course_id)) {
return $curriculum;
}
$course_items = bp_course_get_curriculum($course_id);
foreach ($course_items as $key => $item) {
if (is_numeric($item)) {
$type = get_post_type($item);
$labels = '';
if ($type == 'unit') {
$free_access = get_post_meta($item, 'vibe_free', true);
$labels = vibe_validate($free_access) ? '<span class="free">' . __('FREE', 'vibe') . '</span>' : '';
}
$duration = get_post_meta($item, 'vibe_duration', true);
$duration_parameter = apply_filters("vibe_{$type_duration_parameter}", 60);
$duration = '<span class="time"><i class="fa fa-clock-o"></i> ' . gmdate("H:i:s", $duration * $duration_parameter) . '</span>';
//apply_filters('wplms_curriculum_time_filter',//,$duration,$item);
$curriculum_course_link = apply_filters('wplms_curriculum_course_link', 0);
$curriculum[] = array('id' => $item, 'key' => $key, 'type' => $type, 'icon' => $type == 'unit' ? get_post_meta($item, 'vibe_type', true) : 'task', 'labels' => apply_filters('bp_course_curriculum_item_labels', $labels, $item, $type), 'title' => get_the_title($item), 'link' => vibe_validate($free) || $post->post_author == get_current_user_id() || current_user_can('manage_options') || $curriculum_course_link ? get_permalink($item) . '?id=' . $course_id : '', 'duration' => $duration, 'extras' => apply_filters('course_curriculum_extras', 0, $item));
} else {
$curriculum[] = array('type' => 'section', 'key' => $key, 'title' => $item);
}
}
return apply_filters('bp_course_get_full_course_curriculum', $curriculum, $course_id);
}
示例13: wplms_renew_free_course
function wplms_renew_free_course()
{
global $post;
if (!is_user_logged_in()) {
return;
}
$course_id = get_the_ID();
$user_id = get_current_user_id();
$expiry = get_user_meta($user_id, $course_id, true);
if ($expiry > time()) {
return;
}
$free = get_post_meta($course_id, 'vibe_course_free', true);
if (vibe_validate($free) && isset($_REQUEST['renew'])) {
$course_duration = get_post_meta($course_id, 'vibe_duration', true);
$course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
$new_expiry = time() + $course_duration * $course_duration_parameter;
update_user_meta($user_id, $course_id, $new_expiry);
do_action('wplms_renew_course', $course_id, $user_id);
}
}
示例14: get_header
<?php
/**
* Template Name: Blog 1
*/
if (!defined('ABSPATH')) {
exit;
}
get_header(vibe_get_header());
$page_id = get_the_ID();
$title = get_post_meta(get_the_ID(), 'vibe_title', true);
if (!isset($title) || !$title || vibe_validate($title)) {
?>
<section id="title">
<div class="<?php
echo vibe_get_container();
?>
">
<div class="row">
<div class="col-md-9 col-sm-8">
<div class="pagetitle">
<?php
vibe_breadcrumbs();
?>
<h1><?php
the_title();
?>
</h1>
<?php
the_sub_title();
示例15: free_label
function free_label($label, $course_id)
{
$free = get_post_meta($course_id, 'vibe_course_free', true);
if (vibe_validate($free)) {
$label = __('Take this Course', 'vibe-customtypes');
}
return $label;
}