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

PHP vibe_validate函数代码示例

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

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



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


示例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;
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:10,代码来源:bp-course-filters.php


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


示例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,
开发者ID:emiisor,项目名称:diffhelper,代码行数:31,代码来源:single-wplms-event.php


示例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>';
开发者ID:inetbiz,项目名称:wordpress-lms,代码行数:31,代码来源:curriculum.php


示例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">
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:allinstructors.php


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


示例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);
    }
}
开发者ID:songlequang,项目名称:myclass,代码行数:96,代码来源:bp-course-functions.php


示例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;
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:10,代码来源:bp-course-offline.php


示例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' => '&laquo;', 'next_text' => '&raquo;'));
        ?>
  
      </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' => ''));
    }
}
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:course-review.php


示例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>';
            }
        }
    }
}
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:60,代码来源:func.php


示例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);
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:func.php


示例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);
    }
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:21,代码来源:bp-course-filters.php


示例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();
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:blog1.php


示例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;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:8,代码来源:tips.php


示例16: the_tags

 echo '</div>';
 the_tags('<ul><li>', '</li><li>', '</li></ul>');
 ?>
             <?php 
 wp_link_pages('before=<div class="page-links"><ul>&link_before=<li>&link_after=</li>&after=</ul></div>');
 ?>
                 <div class="social_sharing">
                      <?php 
 echo social_sharing();
 ?>
                 </div>
             </div>
         </div>
         <?php 
 $prenex = get_post_meta(get_the_ID(), 'vibe_prev_next', true);
 if (vibe_validate($prenex)) {
     ?>
             <div class="prev_next_links">
                 <ul class="prev_next">
                     <?php 
     echo '<li>';
     previous_post_link('<strong class="prev">%link</strong>');
     echo '</li><li> | </li><li>';
     next_post_link('<strong class="next">%link</strong>');
     echo '</li>';
     ?>
                 </ul>
             </div>
             <?php 
 }
 ?>
开发者ID:samoakley,项目名称:labtheme,代码行数:31,代码来源:single.php


示例17: wplms_assignment_maximum_marks

function wplms_assignment_maximum_marks($maximum_marks, $course_id, $user_id)
{
    global $wpdb;
    $members_assignments = $wpdb->get_results($wpdb->prepare("SELECT post_id as assignment_id FROM {$wpdb->postmeta} WHERE meta_key='vibe_assignment_course' AND meta_value = %d", $course_id), ARRAY_A);
    if (isset($members_assignments) && is_array($members_assignments) && count($members_assignments)) {
        foreach ($members_assignments as $members_assignment) {
            $include_in_course = get_post_meta($members_assignment['assignment_id'], 'vibe_assignment_evaluation', true);
            if (vibe_validate($include_in_course)) {
                $newmaximum_marks = get_post_meta($members_assignment['assignment_id'], 'vibe_assignment_marks', true);
                if (is_numeric($newmaximum_marks)) {
                    $maximum_marks += $newmaximum_marks;
                }
            }
        }
    }
    return $maximum_marks;
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:17,代码来源:assignments_functions.php


示例18: bp_course_enable_access

 function bp_course_enable_access($order_id)
 {
     $order = new WC_Order($order_id);
     $items = $order->get_items();
     $user_id = $order->user_id;
     $order_total = $order->get_total();
     $commission_array = array();
     foreach ($items as $item_id => $item) {
         $instructors = array();
         $courses = get_post_meta($item['product_id'], 'vibe_courses', true);
         $product_id = apply_filters('bp_course_product_id', $item['product_id'], $item);
         $subscribed = get_post_meta($product_id, 'vibe_subscription', true);
         if (isset($courses) && is_array($courses)) {
             if (vibe_validate($subscribed)) {
                 $duration = get_post_meta($product_id, 'vibe_duration', true);
                 foreach ($courses as $course) {
                     bp_course_add_user_to_course($user_id, $course, $duration, 1);
                     $instructors[$course] = apply_filters('wplms_course_instructors', get_post_field('post_author', $course), $course);
                     do_action('wplms_course_product_puchased', $course, $user_id, $t, 1);
                 }
             } else {
                 if (isset($courses) && is_array($courses)) {
                     foreach ($courses as $course) {
                         bp_course_add_user_to_course($user_id, $course, '', 1);
                         $instructors[$course] = apply_filters('wplms_course_instructors', get_post_field('post_author', $course, 'raw'), $course);
                         do_action('wplms_course_product_puchased', $course, $user_id, $t, 0);
                     }
                 }
             }
             //End Else
             $line_total = $item['line_total'];
             //Commission Calculation
             $commission_array[$item_id] = array('instructor' => $instructors, 'course' => $courses, 'total' => $line_total);
         }
         //End If courses
     }
     // End Item for loop
     if (function_exists('vibe_get_option')) {
         $instructor_commission = vibe_get_option('instructor_commission');
     }
     if ($instructor_commission == 0) {
         return;
     }
     if (!isset($instructor_commission) || !$instructor_commission) {
         $instructor_commission = 70;
     }
     $commissions = get_option('instructor_commissions');
     foreach ($commission_array as $item_id => $commission_item) {
         foreach ($commission_item['course'] as $course_id) {
             if (count($commission_item['instructor'][$course_id]) > 1) {
                 // Multiple instructors
                 $calculated_commission_base = round($commission_item['total'] * ($instructor_commission / 100) / count($commission_item['instructor'][$course_id]), 0);
                 // Default Slit equal propertion
                 foreach ($commission_item['instructor'][$course_id] as $instructor) {
                     if (empty($commissions[$course_id][$instructor])) {
                         $calculated_commission_base = round($commission_item['total'] * $instructor_commission / 100, 2);
                     } else {
                         $calculated_commission_base = round($commission_item['total'] * $commissions[$course_id][$instructor] / 100, 2);
                     }
                     $calculated_commission_base = apply_filters('wplms_calculated_commission_base', $calculated_commission_base, $instructor);
                     woocommerce_update_order_item_meta($item_id, 'commission' . $instructor, $calculated_commission_base);
                 }
             } else {
                 if (is_array($commission_item['instructor'][$course_id])) {
                     // Single Instructor
                     $instructor = $commission_item['instructor'][$course_id][0];
                 } else {
                     $instructor = $commission_item['instructor'][$course_id];
                 }
                 if (isset($commissions[$course_id][$instructor]) && is_numeric($commissions[$course_id][$instructor])) {
                     $calculated_commission_base = round($commission_item['total'] * $commissions[$course_id][$instructor] / 100, 2);
                 } else {
                     $calculated_commission_base = round($commission_item['total'] * $instructor_commission / 100, 2);
                 }
                 $calculated_commission_base = apply_filters('wplms_calculated_commission_base', $calculated_commission_base, $instructor);
                 woocommerce_update_order_item_meta($item_id, 'commission' . $instructor, $calculated_commission_base);
             }
         }
     }
     // End Commissions_array
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:81,代码来源:bp-course-actions.php


示例19: bp_get_course_check_course_complete

function bp_get_course_check_course_complete($args = NULL)
{
    // AUTO EVALUATION FOR COURSE
    global $post;
    $defaults = array('id' => $post->ID, 'user_id' => get_current_user_id());
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $return = '<div class="course_finish">';
    $course_curriculum = bp_course_get_curriculum_units($id);
    //vibe_sanitize(get_post_meta($id,'vibe_course_curriculum',false));
    if (isset($course_curriculum) && count($course_curriculum)) {
        $flag = 0;
        foreach ($course_curriculum as $unit_id) {
            //if(is_numeric($unit_id)){
            $unittaken = get_user_meta($user_id, $unit_id, true);
            if (!isset($unittaken) || !$unittaken) {
                $flag = $unit_id;
                break;
            }
            //}
        }
        $flag = apply_filters('wplms_finish_course_check', $flag, $course_curriculum);
        if (!$flag) {
            $course_id = $id;
            $auto_eval = get_post_meta($id, 'vibe_course_auto_eval', true);
            if (vibe_validate($auto_eval)) {
                // AUTO EVALUATION
                $curriculum = bp_course_get_curriculum_units($id);
                //vibe_sanitize(get_post_meta($id,'vibe_course_curriculum',false));
                $total_marks = $student_marks = 0;
                foreach ($curriculum as $c) {
                    if (is_numeric($c)) {
                        if (get_post_type($c) == 'quiz') {
                            $k = get_post_meta($c, $user_id, true);
                            $student_marks += $k;
                            //Current user is the Student here
                            $questions = vibe_sanitize(get_post_meta($c, 'quiz_questions' . $user_id, false));
                            if (!isset($questions) || !is_array($questions)) {
                                $questions = vibe_sanitize(get_post_meta($c, 'vibe_quiz_questions', false));
                            }
                            $total_marks += array_sum($questions['marks']);
                        }
                    }
                }
                do_action('wplms_submit_course', $post->ID, $user_id);
                // Apply Filters on Auto Evaluation
                $student_marks = apply_filters('wplms_course_student_marks', $student_marks, $id, $user_id);
                $total_marks = apply_filters('wplms_course_maximum_marks', $total_marks, $id, $user_id);
                if (!$total_marks) {
                    $total_marks = $student_marks = 1;
                }
                // Avoid the Division by Zero Error
                $marks = round($student_marks * 100 / $total_marks);
                $return .= '<div class="message" class="updated"><p>' . __('COURSE EVALUATED ', 'vibe') . '</p></div>';
                $badge_per = get_post_meta($id, 'vibe_course_badge_percentage', true);
                $passing_cert = get_post_meta($id, 'vibe_course_certificate', true);
                // Certificate Enable
                $passing_per = get_post_meta($id, 'vibe_course_passing_percentage', true);
                // Certificate Passing Percentage
                //finish bit for student 1.8.4
                update_user_meta($user_id, 'course_status' . $id, 3);
                //end finish bit
                do_action('wplms_evaluate_course', $id, $marks, $user_id, 1);
                $badge_filter = 0;
                if (isset($badge_per) && $badge_per && $marks >= $badge_per) {
                    $badge_filter = 1;
                }
                $badge_filter = apply_filters('wplms_course_student_badge_check', $badge_filter, $course_id, $user_id, $marks, $badge_per);
                if ($badge_filter) {
                    $badges = array();
                    $badges = vibe_sanitize(get_user_meta($user_id, 'badges', false));
                    if (isset($badges) && is_array($badges)) {
                        $badges[] = $id;
                    } else {
                        $badges = array($id);
                    }
                    update_user_meta($user_id, 'badges', $badges);
                    $b = bp_get_course_badge($id);
                    $badge = wp_get_attachment_info($b);
                    $badge_url = wp_get_attachment_image_src($b);
                    if (isset($badge) && is_numeric($b)) {
                        $return .= '<div class="congrats_badge">' . __('Congratulati 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP vider_url函数代码示例发布时间:2022-05-23
下一篇:
PHP vibe_site_url函数代码示例发布时间: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