本文整理汇总了PHP中vibe_sanitize函数的典型用法代码示例。如果您正苦于以下问题:PHP vibe_sanitize函数的具体用法?PHP vibe_sanitize怎么用?PHP vibe_sanitize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vibe_sanitize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: the_quiz_button
function the_quiz_button($button, $quiz_id)
{
global $post;
$quiz_id = get_the_ID();
$user_id = get_current_user_id();
$flag = 1;
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$pid = get_post_meta($quiz_id, 'vibe_quiz_product', true);
if (isset($pid) && is_numeric($pid) && get_post_type($pid) == 'product') {
$product_taken = wc_customer_bought_product('', $user_id, $pid);
if (!$product_taken) {
$pid = get_permalink($pid);
$check = vibe_get_option('direct_checkout');
$check = intval($check);
if (isset($check) && $check) {
$pid .= '?redirect';
}
$flag = 0;
$html = '<a href="' . $pid . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
} else {
$flag = 1;
}
}
}
if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
$membership_ids = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_membership', false));
if (!pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
$membership_taken = get_user_meta($user_id, $quiz_id, true);
if (!$membership_taken) {
$pmpro_levels_page_id = get_option('pmpro_levels_page_id');
$link = get_permalink($pmpro_levels_page_id);
$html = '<a href="' . $link . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
$flag = 0;
} else {
$flag = 1;
}
}
}
if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$points = get_post_meta($quiz_id, 'vibe_quiz_mycred_points', true);
$mycred = mycred();
$balance = $mycred->get_users_cred($user_id);
if ($balance < $points) {
$flag = 0;
$html = '<a href="#"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '<span>' . __('<br/>Not enough points.', 'vibe') . '</span></a>';
}
if (!$mycred->has_entry('purchase_quiz', $quiz_id, $user_id)) {
$flag = 1;
$deduct = -1 * $points;
$mycred->update_users_balance($user_id, $deduct);
$mycred->add_to_log('purchase_quiz', $user_id, $deduct, __('Student subscibed to quiz', 'wplms-mycred'), $quiz_id);
} else {
$flag = 1;
}
}
if (!$flag) {
return $html;
}
return $button;
}
开发者ID:VibeThemes,项目名称:wplms_sell_quiz,代码行数:60,代码来源:sell_quiz.php
示例2: get_order_report_data
function get_order_report_data($start_date, $end_date)
{
global $wpdb;
$order_item_meta_table = $wpdb->prefix . 'woocommerce_order_itemmeta';
$order_items_table = $wpdb->prefix . 'woocommerce_order_items';
$inst_commissions = $wpdb->get_results("SELECT order_items.order_id,order_meta.meta_key as instructor,order_meta.meta_value as commission\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key LIKE 'commission%'");
if (is_array($inst_commissions)) {
foreach ($inst_commissions as $inst_commission) {
$order_ids[] = $inst_commission->order_id;
$inst = explode('commission', $inst_commission->instructor);
if (is_numeric($inst[1])) {
$instructor_commissions[$inst[1]] += $inst_commission->commission;
}
}
if (is_array($order_ids)) {
$order_id_string = implode(',', $order_ids);
}
}
$query = "SELECT order_items.order_item_id,order_meta.meta_value as total_sales\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key = '_line_total'";
if (isset($order_id_string)) {
$query .= "AND posts.ID NOT IN ({$order_id_string})";
}
$inst_commissions = $wpdb->get_results($query);
$commissions = get_option('instructor_commissions');
foreach ($inst_commissions as $inst_commission) {
$oid = $inst_commission->order_item_id;
$pid = woocommerce_get_order_item_meta($oid, '_product_id', true);
$courses = vibe_sanitize(get_post_meta($pid, 'vibe_courses', false));
if (isset($courses) && is_array($courses) && count($courses)) {
$n = count($courses);
foreach ($courses as $course) {
$instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', $course), $course);
if (is_numeric($instructors)) {
if (!isset($commission[$course][$instructors])) {
$commission[$course][$instructors] = 70;
}
echo $commission[$course][$instructors] * $inst_commission->total_sales;
$instructor_commissions[$instructors] += $commission[$course][$instructors] * $inst_commission->total_sales;
} else {
if (is_Array($instructors)) {
$k = count($instructors);
foreach ($instructors as $instructor) {
if (!isset($commission[$course][$instructor])) {
$commission[$course][$instructor] = floor(70 / $k);
}
$instructor_commissions[$instructor] += $commission[$course][$instructor] * $inst_commission->total_sales;
}
}
}
}
}
}
return $instructor_commissions;
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:54,代码来源:wplms_commissions_class.php
示例3: 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
示例4: wplms_unit_assignments
function wplms_unit_assignments($unit_id)
{
$assignment_ids = get_post_meta($unit_id, 'vibe_assignment', false);
if (is_Array($assignment_ids) && is_array($assignment_ids[0])) {
$assignment_ids = vibe_sanitize($assignment_ids);
}
$assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400);
if (isset($assignment_ids) && is_array($assignment_ids)) {
foreach ($assignment_ids as $assignment_id) {
if (is_numeric($assignment_id)) {
$marks = get_post_meta($assignment_id, 'vibe_assignment_marks', true);
$duration = get_post_meta($assignment_id, 'vibe_assignment_duration', true);
echo '<h3 class="assignment_heading heading">' . __('ASSIGNMENT : ', 'wplms-assignments') . '
<strong><a href="' . get_permalink($assignment_id) . '" target="_blank">' . get_the_title($assignment_id) . '<i class="icon-in-alt"></i></a></strong>
<span>' . __('MARKS : ', 'wplms-assignments') . $marks . '</span>
<span>' . __('DURATION : ', 'wplms-assignments') . (function_exists('tofriendlytime') ? tofriendlytime($duration * $assignment_duration_parameter) : $duration . __(' days', 'wplms-assignments')) . '</span>
</h3>';
}
}
}
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:21,代码来源:assignments_functions.php
示例5: array
<?php
/**
* Single product short description
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
global $post;
$vcourses = array();
$vcourses = apply_filters('wplms_product_course_order_filter', vibe_sanitize(get_post_meta($post->ID, 'vibe_courses', false)));
if (count($vcourses)) {
echo '<div class="connected_courses"><h6>';
_e('Courses Included', 'wplms_modern');
echo '</h6><ul>';
foreach ($vcourses as $course) {
echo '<li><a href="' . get_permalink($course) . '"><i class="icon-book-open"></i> ' . get_the_title($course) . '</a></li>';
}
echo '</ul></div>';
}
if (!$post->post_excerpt) {
return;
}
?>
<div itemprop="description">
<?php
echo apply_filters('woocommerce_short_description', $post->post_excerpt);
?>
</div>
开发者ID:nikitansk,项目名称:devschool,代码行数:30,代码来源:short-description.php
示例6: get_header
<?php
get_header();
if (have_posts()) {
while (have_posts()) {
the_post();
$print = get_post_meta($post->ID, 'vibe_print', true);
$course = get_post_meta($post->ID, 'vibe_event_course', true);
$private_event = get_post_meta($post->ID, 'vibe_private_event', true);
$icon_class = get_post_meta($post->ID, 'vibe_icon', true);
$color = get_post_meta($post->ID, 'vibe_color', true);
$start_date = get_post_meta($post->ID, 'vibe_start_date', true);
$end_date = get_post_meta($post->ID, 'vibe_end_date', true);
$show_location = get_post_meta($post->ID, 'vibe_show_location', true);
$location = vibe_sanitize(get_post_meta($post->ID, 'vibe_location', false));
$additional_info = vibe_sanitize(get_post_meta($post->ID, 'vibe_additional_info', false));
$more_info = get_post_meta($post->ID, 'vibe_more_info', true);
$send_invitation = get_post_meta($post->ID, 'vibe_send_invitation', true);
$access_flag = 1;
if (vibe_validate($private_event)) {
$access_flag = 0;
}
do_action('wplms_before_single_event');
?>
<section id="title">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-8">
<div class="pagetitle">
<span><?php
echo '<a href="' . get_permalink($course) . '">' . get_the_title($course) . '</a>';
开发者ID:emiisor,项目名称:diffhelper,代码行数:31,代码来源:single-wplms-event.php
示例7: bp_course_disable_access
function bp_course_disable_access($order_id)
{
$order = new WC_Order($order_id);
$items = $order->get_items();
$user_id = $order->user_id;
foreach ($items as $item) {
$product_id = $item['product_id'];
$subscribed = get_post_meta($product_id, 'vibe_subscription', true);
$courses = vibe_sanitize(get_post_meta($product_id, 'vibe_courses', false));
if (isset($courses) && is_array($courses)) {
foreach ($courses as $course) {
delete_post_meta($course, $user_id);
delete_user_meta($user_id, $course);
$group_id = get_post_meta($course, 'vibe_group', true);
if (isset($group_id) && function_exists('groups_remove_member')) {
groups_remove_member($user_id, $group_id);
} else {
$group_id = '';
}
$instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', $course, 'raw'), $course);
if (is_array($instructors)) {
foreach ($instructors as $instructor) {
woocommerce_update_order_item_meta($item_id, 'commission' . $instructor, 0);
//Nulls the commission
}
}
do_action('wplms_course_unsubscribe', $course_id, $user_id, $group_id);
}
}
}
}
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:bp-course-actions.php
示例8: wp_nonce_field
echo '</li>';
}
}
echo '</ul>';
}
wp_nonce_field('vibe_assignment', 'asecurity');
echo '</div>';
}
/*========================================================================*/
/* 02. QUIZ SUBMISSIONS
/*========================================================================*/
echo '<div class="submissions"><h4 class="minmax">';
_e('QUIZ SUBMISSIONS', 'vibe');
echo '<i class="icon-plus-1"></i></h4>';
$student_field = vibe_get_option('student_field');
$curriculum = vibe_sanitize(get_post_meta(get_the_ID(), 'vibe_course_curriculum', false));
echo '<ul class="quiz_students">';
if (isset($curriculum) && is_array($curriculum)) {
foreach ($curriculum as $c) {
if (is_numeric($c)) {
if (get_post_type($c) == 'quiz') {
// RUN META QUERY : GET ALL POST META WITH VALUE 0 FOR UNCHECKED QUIZ, THE KEY IS THE USERID
$members_unchecked_quiz = $wpdb->get_results("select meta_key from {$wpdb->postmeta} where meta_value = '0' && post_id = {$c}", ARRAY_A);
// Internal Query
if (count($members_unchecked_quiz)) {
foreach ($members_unchecked_quiz as $unchecked_quiz) {
if (is_numeric($unchecked_quiz['meta_key'])) {
$member_id = $unchecked_quiz['meta_key'];
$bp_name = bp_core_get_userlink($member_id);
if (isset($student_field)) {
$profile_data = 'field=' . $student_field . '&user_id=' . $member_id;
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:submissions.php
示例9: generate_fields
//.........这里部分代码省略.........
?>
">
<?php
$field = array('label' => __('Question Tags', 'wplms-front-end'), 'type' => 'taxonomy', 'taxonomy' => 'question-tag', 'from' => 'taxonomy', 'value_type' => 'single', 'style' => '', 'id' => 'question-tag', 'default' => __('Select a Tag', 'wplms-front-end'));
self::generate_fields($field);
?>
<?php
$question_types = apply_filters('wplms_question_types', array(array('label' => __('True or False', 'vibe-customtypes'), 'value' => 'truefalse'), array('label' => __('Multiple Choice', 'vibe-customtypes'), 'value' => 'single'), array('label' => __('Multiple Correct', 'vibe-customtypes'), 'value' => 'multiple'), array('label' => __('Sort Answers', 'vibe-customtypes'), 'value' => 'sort'), array('label' => __('Match Answers', 'vibe-customtypes'), 'value' => 'match'), array('label' => __('Fill in the Blank', 'vibe-customtypes'), 'value' => 'fillblank'), array('label' => __('Dropdown Select', 'vibe-customtypes'), 'value' => 'select'), array('label' => __('Small Text', 'vibe-customtypes'), 'value' => 'smalltext'), array('label' => __('Large Text', 'vibe-customtypes'), 'value' => 'largetext')));
?>
<select class="chosen" id="vibe_question_template">
<?php
foreach ($question_types as $type) {
echo '<option value="' . $type['value'] . '">' . $type['label'] . '</option>';
}
?>
</select>
<a class="button small" id="create_new_question"><?php
_e('Create question', 'wplms-front-end');
?>
</a>
</div>
</div>
</div>
</div>
<?php
?>
<?php
break;
case 'curriculum':
?>
<ul class="curriculum post_field">
<?php
if (isset($_GET['action'])) {
$curriculum = vibe_sanitize(get_post_meta($_GET['action'], 'vibe_course_curriculum', false));
if (isset($curriculum) && is_array($curriculum)) {
foreach ($curriculum as $kid) {
if (is_numeric($kid)) {
if (get_post_type($kid) == 'unit') {
echo '<li><strong class="title" data-id="' . $kid . '"><i class="icon-file"></i> ' . get_the_title($kid) . '</strong>
<ul class="data_links">
<li><a class="edit" title="' . __('Edit Unit', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li>
<li><a class="preview" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li>
<li><a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li>
<li><a class="delete" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li>
</ul>
</li>';
} else {
echo '<li><strong class="title" data-id="' . $kid . '"><i class="icon-task"></i> ' . get_the_title($kid) . '</strong>
<ul class="data_links">
<li><a class="edit" title="' . __('Edit Quiz', 'wplms-front-end') . '"><span class="dashicons dashicons-edit"></span></a></li>
<li><a class="preview" title="' . __('Preview', 'wplms-front-end') . '" target="_blank"><span class="dashicons dashicons-visibility"></span></a></li>
<li><a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a></li>
<li><a class="delete" title="' . __('Delete', 'wplms-front-end') . '"><span class="dashicons dashicons-trash"></span></a></li>
</ul>
</li>';
}
} else {
echo '<li class="new_section"><strong>' . $kid . '</strong>
<ul class="data_links">
<li>
<a class="remove" title="' . __('Remove', 'wplms-front-end') . '"><span class="dashicons dashicons-no-alt"></span></a>
</li>
</ul>
</li>';
}
}
开发者ID:nikitansk,项目名称:devschool,代码行数:67,代码来源:class.generate_fields.php
示例10: WP_QUERY
$the_quiz = new WP_QUERY(array('post_type' => 'quiz', 'paged' => $paged, 'meta_query' => array(array('key' => $user_id, 'compare' => 'EXISTS'))));
if ($the_quiz->have_posts()) {
?>
<h3 class="heading"><?php
_e('Quiz Results', 'vibe');
?>
</h3>
<ul class="quiz_results">
<?php
while ($the_quiz->have_posts()) {
$the_quiz->the_post();
$value = get_post_meta(get_the_ID(), $user_id, true);
$questions = vibe_sanitize(get_post_meta(get_the_ID(), 'quiz_questions' . $user_id, false));
if (!isset($questions) || !is_array($questions)) {
// Fallback for Older versions
$questions = vibe_sanitize(get_post_meta(get_the_ID(), 'vibe_quiz_questions', false));
}
if (is_Array($questions['marks']) && isset($questions['marks'])) {
$max = array_sum($questions['marks']);
} else {
$max = 0;
}
?>
<li><i class="icon-task"></i>
<a href="?action=<?php
echo get_the_ID();
?>
"><?php
the_title();
?>
</a>
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:results.php
示例11: get_post_meta
$myavg = get_post_meta($course->ID, $user_id, true);
if (!isset($myavg) || $myavg == '') {
$myavg = __('TAKING', 'vibe');
}
echo '<strong>' . __('MY SCORE : ', 'vibe') . '<span>' . apply_filters('wplms_course_marks', $myavg . '/100', $course->ID) . '</span></strong>';
echo '<ul class="in_details">';
if (isset($curriculum) && is_array($curriculum)) {
foreach ($curriculum as $c) {
if (is_numeric($c)) {
if (get_post_type($c) == 'quiz') {
$myavg = get_post_meta($c, $user_id, true);
$avg = get_post_meta($c, 'average', true);
$questions = vibe_sanitize(get_post_meta($c, 'quiz_questions' . $user_id, false));
if (!isset($questions) || !is_array($questions)) {
// Fallback for Older versions
$questions = vibe_sanitize(get_post_meta($c, 'vibe_quiz_questions', false));
}
if (isset($questions['marks']) && is_array($questions['marks'])) {
$marks = $questions['marks'];
$max = array_sum($marks);
}
if (isset($myavg) && $myavg != '') {
echo '<li>' . __('Average Marks in', 'vibe') . ' ' . get_the_title($c) . ' : ' . $avg . '';
echo '<strong>' . __('My Marks', 'vibe') . ' : ' . $myavg . ' / ' . $max . '</strong></li>';
}
} else {
$check = get_user_meta($user_id, $c, true);
echo '<li>' . get_the_title($c) . '<strong>' . ($check ? '<i class="icon-check"></i>' : '<i class="icon-alarm-clock"></i>') . '</strong></li>';
}
}
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:stats.php
示例12: incourse_start_quiz
function incourse_start_quiz()
{
$quiz_id = $_POST['quiz_id'];
if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security') || !is_numeric($quiz_id)) {
_e('Security check Failed. Contact Administrator.', 'vibe');
die;
}
$user_id = get_current_user_id();
do_action('wplms_before_quiz_begining', $quiz_id);
$get_questions = vibe_sanitize(get_post_meta($quiz_id, 'quiz_questions' . $user_id, false));
if (!isset($get_questions) || !is_array($get_questions)) {
$get_questions = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_questions', false));
update_post_meta($quiz_id, 'quiz_questions' . $user_id, $get_questions);
}
// Fallback for Older versions
if (!is_array($get_questions) || !is_array($get_questions['ques']) || !is_array($get_questions['marks'])) {
_e('Questions not set.', 'vibe');
die;
}
$questions = $get_questions['ques'];
$marks = $get_questions['marks'];
$posts_per_page = apply_filters('wplms_incourse_quiz_per_page', 10);
$page = $_POST['page'];
if (!isset($page) || !is_numeric($page) || !$page) {
$page = 1;
// Add user to quiz : Quiz attempted by user
update_post_meta($quiz_id, $user_id, 0);
$quiz_duration_parameter = apply_filters('vibe_quiz_duration_parameter', 60);
$quiz_duration = get_post_meta($quiz_id, 'vibe_duration', true) * $quiz_duration_parameter;
// Quiz duration in seconds
$expire = time() + $quiz_duration;
update_user_meta($user_id, $quiz_id, $expire);
do_action('wplms_start_quiz', $quiz_id, $user_id);
// Start Quiz Notifications
}
$args = apply_filters('wplms_in_course_quiz_args', array('post__in' => $questions, 'post_type' => 'question', 'posts_per_page' => $posts_per_page, 'paged' => $page, 'orderby' => 'post__in'));
$the_query = new WP_Query($args);
$quiz_questions = array();
if ($the_query->have_posts()) {
echo '<script>var all_questions_json = ' . json_encode($questions) . '</script>';
while ($the_query->have_posts()) {
$the_query->the_post();
global $post;
$loaded_questions[] = get_the_ID();
$key = array_search(get_the_ID(), $questions);
$hint = get_post_meta(get_the_ID(), 'vibe_question_hint', true);
$type = get_post_meta(get_the_ID(), 'vibe_question_type', true);
echo '<div class="in_question " data-ques="' . $post->ID . '">';
echo '<i class="marks">' . (isset($marks[$key]) ? '<i class="icon-check-5"></i>' . $marks[$key] : '') . '</i>';
echo '<div class="question ' . $type . '">';
the_content();
if (isset($hint) && strlen($hint) > 5) {
echo '<a class="show_hint tip" tip="' . __('SHOW HINT', 'vibe') . '"><span></span></a>';
echo '<div class="hint"><i>' . __('HINT', 'vibe') . ' : ' . apply_filters('the_content', $hint) . '</i></div>';
}
echo '</div>';
switch ($type) {
case 'truefalse':
case 'single':
case 'multiple':
case 'sort':
case 'match':
$options = vibe_sanitize(get_post_meta(get_the_ID(), 'vibe_question_options', false));
if ($type == 'truefalse') {
$options = array(0 => __('FALSE', 'vibe'), 1 => __('TRUE', 'vibe'));
}
if (isset($options) || $options) {
$answers = get_comments(array('post_id' => $post->ID, 'status' => 'approve', 'user_id' => $user_id));
if (isset($answers) && is_array($answers) && count($answers)) {
$answer = reset($answers);
$content = explode(',', $answer->comment_content);
} else {
$content = array();
}
echo '<ul class="question_options ' . $type . '">';
if ($type == 'single') {
foreach ($options as $key => $value) {
echo '<li>
<div class="radio">
<input type="radio" id="' . $post->post_name . $key . '" class="ques' . $post->ID . '" name="' . $post->ID . '" value="' . ($key + 1) . '" ' . (in_array($key + 1, $content) ? 'checked' : '') . '/>
<label for="' . $post->post_name . $key . '">' . do_shortcode($value) . '</label>
</div>
</li>';
}
} else {
if ($type == 'sort') {
foreach ($options as $key => $value) {
echo '<li id="' . ($key + 1) . '" class="ques' . $post->ID . ' sort_option">
<label for="' . $post->post_name . $key . '"><span></span> ' . do_shortcode($value) . '</label>
</li>';
}
} else {
if ($type == 'match') {
foreach ($options as $key => $value) {
echo '<li id="' . ($key + 1) . '" class="ques' . $post->ID . ' match_option">
<label for="' . $post->post_name . $key . '"><span></span> ' . do_shortcode($value) . '</label>
</li>';
}
} else {
if ($type == 'truefalse') {
//.........这里部分代码省略.........
开发者ID:nikitansk,项目名称:devschool,代码行数:101,代码来源:bp-course-ajax.php
示例13: thumbnail_generator
//.........这里部分代码省略.........
<p>' . custom_excerpt($n, $custom_post->ID) . ($n < strlen($custom_post->post_content) ? $read_more : '') . '</p>
<div class="author">
' . $image . '
<h4>' . html_entity_decode($author) . '</h4>
<small>' . html_entity_decode($designation) . '</small>
</div>
</div>
</div>';
$return .= '</div>';
break;
case 'blogpost':
$return .= '<div class="block blogpost">';
$return .= '<div class="blog-item">
' . apply_filters('vibe_thumb_date', '<div class="blog-item-date">
<span class="day">' . get_the_time('d') . '</span>
<p class="month">' . get_the_time('M') . '\'' . get_the_time('y') . '</p>
</div>', $featured_style) . '
' . apply_filters('vibe_thumb_heading', '<h4><a href="' . get_permalink($custom_post->ID) . '" title="' . $custom_post->post_title . '">' . $custom_post->post_title . '</a></h4>', $featured_style) . '
<p>' . apply_filters('vibe_thumb_desc', custom_excerpt($n, $custom_post->ID), $featured_style) . '</p>
</div>';
$return .= '</div>';
break;
case 'event_card':
$return .= '<div class="event_card">';
$icon_class = get_post_meta($custom_post->ID, 'vibe_icon', true);
$color = get_post_meta($custom_post->ID, 'vibe_color', true);
$start_date = get_post_meta($custom_post->ID, 'vibe_start_date', true);
$end_date = get_post_meta($custom_post->ID, 'vibe_end_date', true);
$start_time = get_post_meta($custom_post->ID, 'vibe_start_time', true);
$end_time = get_post_meta($custom_post->ID, 'vibe_end_time', true);
$show_location = get_post_meta($custom_post->ID, 'vibe_show_location', true);
$all_day = get_post_meta($custom_post->ID, 'vibe_all_day', true);
$location = vibe_sanitize(get_post_meta($custom_post->ID, 'vibe_location', false));
$repeatable = get_post_meta($custom_post->ID, 'vibe_repeatable', true);
$repeat_value = get_post_meta($custom_post->ID, 'vibe_repeat_value', true);
$repeat_unit = get_post_meta($custom_post->ID, 'vibe_repeat_unit', true);
$repeat_count = get_post_meta($custom_post->ID, 'vibe_repeat_count', true);
$return .= ' <span class="event_icon" style="color:' . $color . '"><i class="' . $icon_class . '"></i></span>
<h4 style="background:' . $color . '"><i class="' . $icon_class . '"></i> ' . __('Event ', 'vibe-customtypes') . '</label><span><a href="' . get_permalink($custom_post->ID) . '">' . get_the_title($custom_post->ID) . '</a></span></h4>
<ul>
';
if (isset($start_date) && $start_date != '') {
$return .= '<li><label><i class="icon-calendar"></i> ' . __('Start Date ', 'vibe-customtypes') . '</label><span>' . date('F j Y', strtotime($start_date)) . '</span></li>';
}
if (isset($end_date) && $end_date != '') {
$return .= '<li><label><i class="icon-calendar"></i> ' . __('End Date ', 'vibe-customtypes') . '</label><span>' . date('F j Y', strtotime($end_date)) . '</span>';
}
if (isset($start_time) && $start_time != '') {
$return .= '<li><label><i class="icon-clock"></i> ' . __('Start Time ', 'vibe-customtypes') . '</label><span>' . $start_time . '</span>';
}
if (isset($end_time) && $end_time != '') {
$return .= '<li><label><i class="icon-clock"></i> ' . __('End Time ', 'vibe-customtypes') . '</label><span>' . $end_time . '</span>';
}
if (vibe_validate($all_day)) {
$return .= '<li><label><i class="icon-circle-full"></i> ' . __('All Day ', 'vibe-customtypes') . '</label><span>' . __('Yes', 'vibe-customtypes') . '</span>';
}
if (vibe_validate($repeatable)) {
$return .= '<li><label><i class="icon-flash"></i> ' . __('Frequency ', 'vibe-customtypes') . '</label><span>' . __('Every ', 'vibe-customtypes') . (isset($repeat_value) && $repeat_value > 1 ? $repeat_value : '') . ' ' . $repeat_unit . ' ' . __('for ', 'vibe-customtypes') . $repeat_count . ' ' . $repeat_unit . '</span>';
}
if (vibe_validate($show_location)) {
$return .= '<li><label><i class="icon-pin-alt"></i> ' . __('Venue ', 'vibe-customtypes') . '</label><span>' . (isset($location['staddress']) ? $location['staddress'] : '') . (isset($location['city']) ? ', ' . $location['city'] : '') . (isset($location['state']) ? ', ' . $location['state'] : '') . (isset($location['country']) ? ', ' . $location['country'] : '') . (isset($location['pincode']) ? ' - ' . $location['pincode'] : '') . '</span>';
}
$return .= '</ul>
<a href="' . get_permalink($custom_post->ID) . '" class="event_full_details tip" title="' . __('View full details', 'vibe-customtypes') . '" style="background:' . $color . '"><i class="icon-plus-1"></i></a>
</div>';
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:67,代码来源:featured.php
示例14: _e
<a id="add_course_section" data-help-tag="14" class="button primary small"><?php
_e('ADD SECTION', 'vibe');
?>
</a>
<a id="add_course_unit" data-help-tag="15" class="button primary small"><?php
_e('ADD UNIT', 'vibe');
?>
</a>
<a id="add_course_quiz" data-help-tag="15" class="button primary small"><?php
_e('ADD QUIZ', 'vibe');
?>
</a>
<ul class="curriculum">
<?php
if (isset($_GET['action'])) {
$curriculum = vibe_sanitize(get_post_meta($_GET['action'], 'vibe_course_curriculum', false));
if (isset($curriculum) && is_array($curriculum)) {
foreach ($curriculum as $kid) {
if (is_numeric($kid)) {
if (get_post_type($kid) == 'unit') {
echo '<li><h3 class="title" data-id="' . $kid . '"><i class="icon-file"></i> ' . get_the_title($kid) . '</h3>
<div class="btn-group">
<button type="button" class="btn btn-course dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . get_permalink($kid) . 'edit/?id=' . $_GET['action'] . '" target="_blank" class="edit_unit">' . __('Edit Unit', 'vibe') . '</a></li>
<li><a href="' . get_permalink($kid) . '?id=' . $_GET['action'] . '" target="_blank">' . __('Preview', 'vibe') . '</a></li>
<li><a class="remove">' . __('Remove', 'vibe') . '</a></li>
<li><a class="delete">' . __('Delete', 'vibe') . '</a></li>
</ul>
</div>
</li>';
开发者ID:songlequang,项目名称:myclass,代码行数:31,代码来源:create_content.php
示例15: getAllowedFileExtensions
/**
* Gets allowed file types extensions
*
* @return array
*/
public function getAllowedFileExtensions()
{
$return = array();
$pluginFileTypes = $this->getMimeTypes();
if (!function_exists('vibe_sanitize')) {
return;
}
global $post;
if (isset($_POST['comment_post_ID'])) {
$assignment_id = $_POST[
|
请发表评论