PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 1.9.12
Tutor LMS – eLearning and online course solution v1.9.12
3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / includes / tutor-template-functions.php
tutor / includes Last commit date
theme-compatibility 4 years ago tinymce_translate.php 4 years ago tutor-general-functions.php 4 years ago tutor-template-functions.php 4 years ago tutor-template-hook.php 4 years ago
tutor-template-functions.php
1620 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 /**
7 * @param null $template
8 * @param bool $tutor_pro
9 *
10 * @return bool|string
11 *
12 * Load template with override file system
13 *
14 * @since v.1.0.0
15 * @updated v.1.4.2
16 * @updated v.1.4.3
17 */
18
19 if ( ! function_exists('tutor_get_template')) {
20 function tutor_get_template( $template = null, $tutor_pro = false ) {
21 if ( ! $template ) {
22 return false;
23 }
24 $template = str_replace( '.', DIRECTORY_SEPARATOR, $template );
25
26 /**
27 * Get template first from child-theme if exists
28 * If child theme not exists, then get template from parent theme
29 */
30 $template_location = trailingslashit( get_stylesheet_directory() ) . "tutor/{$template}.php";
31 if ( ! file_exists($template_location)){
32 $template_location = trailingslashit( get_template_directory() ) . "tutor/{$template}.php";
33 }
34 $file_in_theme = $template_location;
35 if ( ! file_exists( $template_location ) ) {
36 $template_location = trailingslashit( tutor()->path ) . "templates/{$template}.php";
37
38 if ( $tutor_pro && function_exists('tutor_pro')){
39 $pro_template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
40 if (file_exists($pro_template_location)){
41 $template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
42 }
43 }
44
45 if ( ! file_exists($template_location)){
46 echo '<div class="tutor-notice-warning"> '.__(sprintf('The file you are trying to load does not exist in your theme or Tutor LMS plugin location. If you are extending the Tutor LMS plugin, please create a php file here: %s ', "<code>{$file_in_theme}</code>"), 'tutor').' </div>';
47 }
48 }
49
50 return apply_filters('tutor_get_template_path', $template_location, $template);
51 }
52 }
53
54 /**
55 * @param null $template
56 * @param bool $tutor_pro
57 *
58 * @return bool|mixed|void
59 *
60 * Get only template path without any warning...
61 *
62 * @since v.1.4.2
63 */
64 if ( ! function_exists('tutor_get_template_path')) {
65 function tutor_get_template_path( $template = null, $tutor_pro = false ) {
66 if ( ! $template ) {
67 return false;
68 }
69 $template = str_replace( '.', DIRECTORY_SEPARATOR, $template );
70
71 /**
72 * Get template first from child-theme if exists
73 * If child theme not exists, then get template from parent theme
74 */
75 $template_location = trailingslashit( get_stylesheet_directory() ) . "tutor/{$template}.php";
76 if ( ! file_exists( $template_location ) ) {
77 $template_location = trailingslashit( get_template_directory() ) . "tutor/{$template}.php";
78 }
79 if ( ! file_exists( $template_location ) ) {
80 $template_location = trailingslashit( tutor()->path ) . "templates/{$template}.php";
81 }
82 if ( ! file_exists($template_location) && $tutor_pro && function_exists('tutor_pro')){
83 $template_location = trailingslashit( tutor_pro()->path ) . "templates/{$template}.php";
84 }
85
86 return apply_filters( 'tutor_get_template_path', $template_location, $template );
87 }
88 }
89
90 /**
91 * @param null $template
92 *
93 * @param array $variables
94 *
95 * Load template for TUTOR
96 *
97 * @since v.1.0.0
98 *
99 * @updated v.1.1.2
100 */
101
102 if ( ! function_exists('tutor_load_template')) {
103 function tutor_load_template( $template = null, $variables = array(), $tutor_pro = false ) {
104 $variables = (array) $variables;
105 $variables = apply_filters('get_tutor_load_template_variables', $variables);
106 extract($variables);
107
108 $isLoad = apply_filters('should_tutor_load_template', true, $template, $variables);
109 if ( ! $isLoad){
110 return;
111 }
112
113 do_action('tutor_load_template_before', $template, $variables);
114 include tutor_get_template( $template, $tutor_pro );
115 do_action('tutor_load_template_after', $template, $variables);
116 }
117 }
118
119 /**
120 * @param null $template
121 * @param array $variables
122 * @param bool $tutor_pro
123 *
124 * @since v.1.4.3
125 */
126
127 if ( ! function_exists('tutor_load_template_part')) {
128 function tutor_load_template_part( $template = null, $variables = array(), $tutor_pro = false ) {
129 $variables = (array) $variables;
130 $variables = apply_filters( 'get_tutor_load_template_variables', $variables );
131 extract( $variables );
132
133 /**
134 * Get template first from child-theme if exists
135 * If child theme not exists, then get template from parent theme
136 */
137 $template_location = trailingslashit( get_stylesheet_directory() ) . "tutor/template.php";
138 if ( ! file_exists( $template_location ) ) {
139 $template_location = trailingslashit( get_template_directory() ) . "tutor/template.php";
140 }
141
142 if ( ! file_exists( $template_location ) ) {
143 $template_location = trailingslashit( tutor()->path ) . "templates/template.php";
144 if ( ! file_exists( $template_location ) && $tutor_pro && function_exists( 'tutor_pro' ) ) {
145 $template_location = trailingslashit( tutor_pro()->path ) . "templates/template.php";
146 }
147 }
148
149 include apply_filters( 'tutor_get_template_part_path', $template_location, $template );
150 }
151 }
152
153 /**
154 * @param $template_name
155 * @param array $variables
156 *
157 * @return string
158 *
159 * @since v.1.4.3
160 */
161
162 if ( ! function_exists('tutor_get_template_html')) {
163 function tutor_get_template_html( $template_name, $variables = array(), $tutor_pro = false ) {
164 ob_start();
165 tutor_load_template( $template_name, $variables, $tutor_pro );
166
167 return ob_get_clean();
168 }
169 }
170
171 if ( ! function_exists('tutor_course_loop_start')){
172 function tutor_course_loop_start($echo = true ){
173 ob_start();
174 tutor_load_template('loop.loop-start');
175 $output = apply_filters('tutor_course_loop_start', ob_get_clean());
176
177 if ( $echo ) {
178 echo $output;
179 }
180 return $output;
181 }
182 }
183
184 if ( ! function_exists('tutor_course_loop_end')) {
185 function tutor_course_loop_end( $echo = true ) {
186 ob_start();
187 tutor_load_template( 'loop.loop-end' );
188
189 $output = apply_filters( 'tutor_course_loop_end', ob_get_clean() );
190 if ( $echo ) {
191 echo $output;
192 }
193
194 return $output;
195 }
196 }
197
198 if ( ! function_exists('tutor_course_archive_pagination')) {
199 function tutor_course_archive_pagination( $echo = true ) {
200 ob_start();
201 tutor_load_template( 'loop.tutor-pagination' );
202
203 $output = apply_filters( 'tutor_course_archive_pagination', ob_get_clean() );
204 if ( $echo ) {
205 echo $output;
206 }
207
208 return $output;
209 }
210 }
211
212 function tutor_course_loop_before_content(){
213 ob_start();
214 tutor_load_template( 'loop.loop-before-content' );
215
216 $output = apply_filters( 'tutor_course_loop_before_content', ob_get_clean() );
217 echo $output;
218 }
219
220 function tutor_course_loop_after_content(){
221 ob_start();
222 tutor_load_template( 'loop.loop-after-content' );
223
224 $output = apply_filters( 'tutor_course_loop_after_content', ob_get_clean() );
225 echo $output;
226 }
227
228 if ( ! function_exists('tutor_course_loop_title')) {
229 function tutor_course_loop_title() {
230 ob_start();
231 tutor_load_template( 'loop.title' );
232 $output = apply_filters( 'tutor_course_loop_title', ob_get_clean() );
233
234 echo $output;
235 }
236 }
237
238
239 if ( ! function_exists('tutor_course_loop_header')) {
240 function tutor_course_loop_header() {
241 ob_start();
242 tutor_load_template( 'loop.header' );
243 $output = apply_filters( 'tutor_course_loop_header', ob_get_clean() );
244
245 echo $output;
246 }
247 }
248
249 if ( ! function_exists('tutor_course_loop_footer')) {
250 function tutor_course_loop_footer() {
251 ob_start();
252 tutor_load_template( 'loop.footer' );
253 $output = apply_filters( 'tutor_course_loop_footer', ob_get_clean() );
254
255 echo $output;
256 }
257 }
258
259 //tutor_course_loop_footer
260
261
262 if ( ! function_exists('tutor_course_loop_start_content_wrap')) {
263 function tutor_course_loop_start_content_wrap() {
264 ob_start();
265 tutor_load_template( 'loop.start_content_wrap' );
266 $output = apply_filters( 'tutor_course_loop_start_content_wrap', ob_get_clean() );
267
268 echo $output;
269 }
270 }
271
272 if ( ! function_exists('tutor_course_loop_end_content_wrap')) {
273 function tutor_course_loop_end_content_wrap() {
274 ob_start();
275 tutor_load_template( 'loop.end_content_wrap' );
276 $output = apply_filters( 'tutor_course_loop_end_content_wrap', ob_get_clean() );
277
278 echo $output;
279 }
280 }
281
282 if ( ! function_exists('tutor_course_loop_thumbnail')) {
283 function tutor_course_loop_thumbnail($echo = true) {
284 ob_start();
285 tutor_load_template( 'loop.thumbnail' );
286 $output = apply_filters( 'tutor_course_loop_thumbnail', ob_get_clean() );
287
288 if ($echo){
289 echo $output;
290 }else{
291 return $output;
292 }
293 }
294 }
295
296 if( ! function_exists('tutor_course_loop_wrap_classes')) {
297 function tutor_course_loop_wrap_classes( $echo = true ) {
298 $courseID = get_the_ID();
299 $classes = apply_filters( 'tutor_course_loop_wrap_classes', array(
300 'tutor-course',
301 'tutor-course-loop',
302 'tutor-course-loop-' . $courseID,
303 ) );
304
305 $class = implode( ' ', $classes );
306 if ( $echo ) {
307 echo $class;
308 }
309
310 return $class;
311 }
312 }
313
314 if( ! function_exists('tutor_course_loop_col_classes')) {
315 function tutor_course_loop_col_classes( $echo = true ) {
316 $course_filter = (bool) tutor_utils()->get_option('course_archive_filter', false);
317 $shortcode_arg = isset($GLOBALS['tutor_shortcode_arg']) ? $GLOBALS['tutor_shortcode_arg']['column_per_row'] : null;
318 $course_cols = $shortcode_arg===null ? tutor_utils()->get_option('courses_col_per_row', 3) : $shortcode_arg;
319 $classes = apply_filters( 'tutor_course_loop_col_classes', array(
320 'tutor-course-col-' . $course_cols,
321 ) );
322
323 $class = implode( ' ', $classes );
324 if ( $echo ) {
325 echo $class;
326 }
327
328 return $class;
329 }
330 }
331
332
333 if ( ! function_exists('tutor_container_classes')) {
334 function tutor_container_classes( $echo = true ) {
335
336 $classes = apply_filters( 'tutor_container_classes', array(
337 'tutor-wrap tutor-courses-wrap',
338 'tutor-container'
339 ) );
340
341 $class = implode( ' ', $classes );
342
343 if ( $echo ) {
344 echo $class;
345 }
346
347 return $class;
348 }
349 }
350 if ( ! function_exists('tutor_post_class')) {
351 function tutor_post_class($default = '') {
352 $classes = apply_filters( 'tutor_post_class', array(
353 'tutor-wrap',
354 $default
355 ) );
356
357 post_class( $classes );
358 }
359 }
360
361 if ( ! function_exists('tutor_course_archive_filter_bar')) {
362 function tutor_course_archive_filter_bar() {
363 ob_start();
364 tutor_load_template( 'global.course-archive-filter-bar' );
365 $output = apply_filters( 'tutor_course_archive_filter_bar', ob_get_clean() );
366
367 echo $output;
368 }
369 }
370
371 /**
372 *
373 * Get classes for widget loop single course wrap
374 *
375 * @param bool $echo
376 *
377 * @return string
378 *
379 * @since v.1.3.1
380 */
381 if( ! function_exists('tutor_widget_course_loop_classes')) {
382 function tutor_widget_course_loop_classes( $echo = true ) {
383
384 $classes = apply_filters( 'tutor_widget_course_loop_classes', array(
385 'tutor-widget-course-loop',
386 'tutor-widget-course',
387 'tutor-widget-course-'.get_the_ID(),
388 ) );
389
390 $class = implode( ' ', $classes );
391 if ( $echo ) {
392 echo $class;
393 }
394
395 return $class;
396 }
397 }
398
399 /**
400 * Get the post thumbnail
401 */
402 if ( ! function_exists('get_tutor_course_thumbnail')) {
403 function get_tutor_course_thumbnail($size = 'post-thumbnail', $url = false) {
404 $post_id = get_the_ID();
405 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
406
407 if ( $post_thumbnail_id ) {
408 //$size = apply_filters( 'post_thumbnail_size', $size, $post_id );
409 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
410 if ($url){
411 return wp_get_attachment_image_url($post_thumbnail_id, $size);
412 }
413
414 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false );
415 } else {
416 $placeHolderUrl = tutor()->url . 'assets/images/placeholder.jpg';
417 if ($url){
418 return $placeHolderUrl;
419 }
420 $html = sprintf('<img alt="%s" src="' . $placeHolderUrl . '" />', __('Placeholder', 'tutor'));
421 }
422
423 echo $html;
424 }
425 }
426 /**
427 * Get the course/post thumbnail src
428 */
429 if ( ! function_exists('get_tutor_course_thumbnail_src')) {
430 function get_tutor_course_thumbnail_src($size = 'post-thumbnail') {
431 $post_id = get_the_ID();
432 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
433
434 if ( $post_thumbnail_id ) {
435 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
436 $src = wp_get_attachment_image_url( $post_thumbnail_id, $size, false );
437 } else {
438 $src = tutor()->url . 'assets/images/placeholder.jpg';
439 }
440
441 return $src;
442 }
443 }
444
445 if ( ! function_exists('tutor_course_loop_meta')) {
446 function tutor_course_loop_meta() {
447 ob_start();
448 tutor_load_template( 'loop.meta' );
449 $output = apply_filters( 'tutor_course_loop_meta', ob_get_clean() );
450
451 echo $output;
452 }
453 }
454
455 /**
456 * Get course author name in loop
457 *
458 * @since: v.1.0.0
459 */
460
461 if ( ! function_exists('tutor_course_loop_author')) {
462 function tutor_course_loop_author() {
463 ob_start();
464 tutor_load_template( 'loop.course-author' );
465 $output = apply_filters( 'tutor_course_loop_author', ob_get_clean() );
466
467 echo $output;
468 }
469 }
470
471 /**
472 * Get formatted price with cart form
473 */
474
475 if ( ! function_exists('tutor_course_loop_price')) {
476 function tutor_course_loop_price() {
477 ob_start();
478
479 if(tutils()->is_course_added_to_cart(get_the_ID())){
480 tutor_load_template( 'loop.course-in-cart' );
481 }
482 else if(tutils()->is_enrolled(get_the_ID())){
483 tutor_load_template( 'loop.course-continue' );
484 }
485 else{
486 $tutor_course_sell_by = apply_filters('tutor_course_sell_by', null);
487 if ($tutor_course_sell_by){
488 tutor_load_template( 'loop.course-price-'.$tutor_course_sell_by );
489 }else{
490 tutor_load_template( 'loop.course-price' );
491 }
492 }
493
494 echo apply_filters( 'tutor_course_loop_price', ob_get_clean() );
495 }
496 }
497
498 /**
499 * Get Course rating
500 *
501 * @since v.1.0.0
502 * @updated v.1.4.5
503 */
504
505 if ( ! function_exists('tutor_course_loop_rating')) {
506 function tutor_course_loop_rating() {
507
508 $disable = get_tutor_option('disable_course_review');
509 if ($disable){
510 return;
511 }
512
513 ob_start();
514 tutor_load_template( 'loop.rating' );
515 $output = apply_filters( 'tutor_course_loop_rating', ob_get_clean() );
516
517 echo $output;
518 }
519 }
520
521 /**
522 * @param bool $echo
523 *
524 * @return mixed|void
525 *
526 * Get add to cart form
527 */
528
529 if ( ! function_exists('tutor_course_loop_add_to_cart')) {
530 function tutor_course_loop_add_to_cart($echo = true) {
531 ob_start();
532 $tutor_course_sell_by = apply_filters('tutor_course_sell_by', null);
533
534 if ($tutor_course_sell_by){
535 tutor_load_template( 'loop.add-to-cart-'.$tutor_course_sell_by );
536 }
537
538 $output = apply_filters( 'tutor_course_loop_add_to_cart_link', ob_get_clean() );
539
540 if ($echo){
541 echo $output;
542 }
543 return $output;
544 }
545 }
546
547 if ( ! function_exists('tutor_course_price')) {
548 function tutor_course_price() {
549 ob_start();
550 tutor_load_template( 'single.course.wc-price-html' );
551 $output = apply_filters( 'tutor_course_price', ob_get_clean() );
552
553 echo $output;
554 }
555 }
556
557 /**
558 * @param int $post_id
559 *
560 * echo the excerpt of TUTOR post type
561 *
562 * @since: v.1.0.0
563 */
564 if ( ! function_exists('tutor_the_excerpt')) {
565 function tutor_the_excerpt( $post_id = 0 ) {
566 if ( ! $post_id ) {
567 $post_id = get_the_ID();
568 }
569 echo tutor_get_the_excerpt( $post_id );
570 }
571 }
572 /**
573 * @param int $post_id
574 *
575 * @return mixed
576 *
577 * Return excerpt of TUTOR post type
578 *
579 * @since: v.1.0.0
580 */
581 if ( ! function_exists('tutor_get_the_excerpt')) {
582 function tutor_get_the_excerpt( $post_id = 0 ) {
583 if ( ! $post_id ) {
584 $post_id = get_the_ID();
585 }
586
587 $get_post = get_post($post_id);
588 return apply_filters( 'tutor_get_the_excerpt', $get_post->post_excerpt );
589 }
590 }
591
592 /**
593 * @return mixed
594 *
595 * return course author
596 *
597 * @since: v.1.0.0
598 */
599
600 if ( ! function_exists('get_tutor_course_author')) {
601 function get_tutor_course_author() {
602 global $post;
603 return apply_filters( 'get_tutor_course_author', get_the_author_meta( 'display_name', $post->post_author ) );
604 }
605 }
606
607 function get_tutor_course_author_id(){
608 global $post;
609 return (int) $post->post_author;
610 }
611
612 /**
613 * @param int $course_id
614 *
615 * @return mixed
616 * Course benefits return array
617 *
618 * @since: v.1.0.0
619 */
620
621 if ( ! function_exists('tutor_course_benefits')) {
622 function tutor_course_benefits( $course_id = 0 ) {
623 if ( ! $course_id ) {
624 $course_id = get_the_ID();
625 }
626 $benefits = get_post_meta( $course_id, '_tutor_course_benefits', true );
627
628 $benefits_array = array();
629 if ($benefits){
630 $benefits_array = explode("\n", $benefits);
631 }
632
633 $array = array_filter(array_map('trim', $benefits_array));
634
635 return apply_filters( 'tutor_course/single/benefits', $array, $course_id );
636 }
637 }
638
639 /**
640 * @param bool $echo
641 *
642 * @return mixed
643 *
644 * Course single page benefits
645 *
646 * @since: v.1.0.0
647 */
648
649 if ( ! function_exists('tutor_course_benefits_html')) {
650 function tutor_course_benefits_html($echo = true) {
651 ob_start();
652 tutor_load_template( 'single.course.course-benefits' );
653 $output = apply_filters( 'tutor_course/single/benefits_html', ob_get_clean() );
654
655 if ($echo){
656 echo $output;
657 }
658 return $output;
659 }
660 }
661
662 /**
663 * @param bool $echo
664 *
665 * @return mixed|void
666 *
667 * Return Topics HTML
668 *
669 * @since: v.1.0.0
670 */
671 if ( ! function_exists('tutor_course_topics')) {
672 function tutor_course_topics( $echo = true ) {
673 ob_start();
674 tutor_load_template( 'single.course.course-topics' );
675 $output = apply_filters( 'tutor_course/single/topics', ob_get_clean() );
676 wp_reset_postdata();
677
678 if ( $echo ) {
679 echo $output;
680 }
681
682 return $output;
683 }
684 }
685
686 /**
687 * @param int $course_id
688 *
689 * @return mixed|void
690 *
691 * return course requirements in array
692 *
693 * @since: v.1.0.0
694 */
695 if ( ! function_exists('tutor_course_requirements')) {
696 function tutor_course_requirements( $course_id = 0 ) {
697 if ( ! $course_id ) {
698 $course_id = get_the_ID();
699 }
700 $requirements = get_post_meta( $course_id, '_tutor_course_requirements', true );
701
702 $requirements_array = array();
703 if ($requirements){
704 $requirements_array = explode("\n", $requirements);
705 }
706
707 $array = array_filter(array_map('trim', $requirements_array));
708 return apply_filters( 'tutor_course/single/requirements', $array, $course_id );
709 }
710 }
711
712 /**
713 * @param bool $echo
714 *
715 * @return mixed|void
716 *
717 * Return course requirements in course single page
718 *
719 * @since: v.1.0.0
720 */
721 if ( ! function_exists('tutor_course_requirements_html')) {
722 function tutor_course_requirements_html($echo = true) {
723 ob_start();
724 tutor_load_template( 'single.course.course-requirements' );
725 $output = apply_filters( 'tutor_course/single/requirements_html', ob_get_clean() );
726
727 if ($echo){
728 echo $output;
729 }
730 return $output;
731 }
732 }
733
734
735 /**
736 * @param int $course_id
737 *
738 * @return mixed|void
739 *
740 * Return target audience in course single page
741 *
742 * @since: v.1.0.0
743 */
744 if ( ! function_exists('tutor_course_target_audience')) {
745 function tutor_course_target_audience( $course_id = 0 ) {
746 if ( ! $course_id ) {
747 $course_id = get_the_ID();
748 }
749 $target_audience = get_post_meta( $course_id, '_tutor_course_target_audience', true );
750
751 $target_audience_array = array();
752 if ($target_audience){
753 $target_audience_array = explode("\n", $target_audience);
754 }
755
756 $array = array_filter(array_map('trim', $target_audience_array));
757 return apply_filters( 'tutor_course/single/target_audience', $array, $course_id );
758 }
759 }
760
761 /**
762 * @param bool $echo
763 *
764 * @return mixed|void
765 *
766 * Return target audience in course single page
767 *
768 * @since: v.1.0.0
769 */
770 if ( ! function_exists('tutor_course_target_audience_html')) {
771 function tutor_course_target_audience_html($echo = true) {
772 ob_start();
773 tutor_load_template( 'single.course.course-target-audience' );
774 $output = apply_filters( 'tutor_course/single/audience_html', ob_get_clean() );
775
776 if ($echo){
777 echo $output;
778 }
779 return $output;
780 }
781 }
782
783
784 if ( ! function_exists('tutor_course_material_includes')) {
785 function tutor_course_material_includes( $course_id = 0 ) {
786 if ( ! $course_id ) {
787 $course_id = get_the_ID();
788 }
789 $target_audience = get_post_meta( $course_id, '_tutor_course_material_includes', true );
790
791 $target_audience_array = array();
792 if ($target_audience){
793 $target_audience_array = explode("\n", $target_audience);
794 }
795
796 $array = array_filter(array_map('trim', $target_audience_array));
797 return apply_filters( 'tutor_course/single/material_includes', $array, $course_id );
798 }
799 }
800
801 if ( ! function_exists('tutor_course_material_includes_html')) {
802 function tutor_course_material_includes_html($echo = true) {
803 ob_start();
804 tutor_load_template( 'single.course.material-includes' );
805 $output = apply_filters( 'tutor_course/single/material_includes', ob_get_clean() );
806
807 if ($echo){
808 echo $output;
809 }
810 return $output;
811 }
812 }
813
814 //tutor_course_material_includes_html
815
816
817 if ( ! function_exists('tutor_course_instructors_html')) {
818 function tutor_course_instructors_html($echo = true) {
819 $display_course_instructors = tutor_utils()->get_option('display_course_instructors');
820 if ( ! $display_course_instructors){
821 return null;
822 }
823
824 ob_start();
825 tutor_load_template( 'single.course.instructors' );
826 $output = apply_filters( 'tutor_course/single/instructors_html', ob_get_clean() );
827
828 if ($echo){
829 echo $output;
830 }
831 return $output;
832 }
833 }
834
835 if ( ! function_exists('tutor_course_target_reviews_html')) {
836 function tutor_course_target_reviews_html($echo = true) {
837 ob_start();
838 tutor_load_template( 'single.course.reviews' );
839 $output = apply_filters( 'tutor_course/single/reviews_html', ob_get_clean() );
840
841 if ($echo){
842 echo $output;
843 }
844 return $output;
845 }
846 }
847
848 if ( ! function_exists('tutor_course_target_review_form_html')) {
849 function tutor_course_target_review_form_html($echo = true) {
850 $isDisableReview = (bool) tutils()->get_option('disable_course_review');
851 if ($isDisableReview){
852 $output = apply_filters('tutor_review_disabled_text', '');
853
854 if ($echo){
855 echo $output;
856 }
857 return $output;
858 }
859
860 ob_start();
861 tutor_load_template( 'single.course.review-form' );
862 $output = apply_filters( 'tutor_course/single/reviews_form', ob_get_clean() );
863
864 if ($echo){
865 echo $output;
866 }
867 return $output;
868 }
869 }
870
871 /**
872 * @param bool $echo
873 *
874 * @return mixed
875 *
876 * Course single page main content / description
877 *
878 * @since: v.1.0.0
879 */
880 if ( ! function_exists('tutor_course_content')) {
881 function tutor_course_content( $echo = true ) {
882 ob_start();
883 tutor_load_template( 'single.course.course-content' );
884 $output = apply_filters( 'tutor_course/single/content', ob_get_clean() );
885
886 if ( $echo ) {
887 echo $output;
888 }
889
890 return $output;
891 }
892 }
893
894 /**
895 * Course single page lead info
896 *
897 * @since: v.1.0.0
898 */
899 if ( ! function_exists('tutor_course_lead_info')) {
900 function tutor_course_lead_info( $echo = true ) {
901 ob_start();
902
903 $course_id = get_the_ID();
904 $course_post_type = tutor()->course_post_type;
905 $queryCourse = new WP_Query(array('p' => $course_id, 'post_type' => $course_post_type));
906
907 if ($queryCourse->have_posts()){
908 while ($queryCourse->have_posts()){
909 $queryCourse->the_post();
910 tutor_load_template( 'single.course.lead-info' );
911 }
912 wp_reset_postdata();
913 }
914
915 $output = apply_filters( 'tutor_course/single/lead_info', ob_get_clean() );
916
917 if ( $echo ) {
918 echo $output;
919 }
920 return $output;
921 }
922 }
923
924 /**
925 * @param bool $echo
926 *
927 * @return mixed|void
928 */
929
930 if ( ! function_exists('tutor_course_enrolled_lead_info')) {
931 function tutor_course_enrolled_lead_info( $echo = true ) {
932 ob_start();
933
934 $course_id = get_the_ID();
935 $course_post_type = tutor()->course_post_type;
936 $queryCourse = new WP_Query( array( 'p' => $course_id, 'post_type' => $course_post_type ) );
937
938 if ( $queryCourse->have_posts() ) {
939 while ( $queryCourse->have_posts() ) {
940 $queryCourse->the_post();
941 tutor_load_template( 'single.course.enrolled.lead-info' );
942 }
943 wp_reset_postdata();
944 }
945
946 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
947
948 if ( $echo ) {
949 echo $output;
950 }
951
952 return $output;
953 }
954 }
955
956 if ( ! function_exists('tutor_lesson_lead_info')) {
957 function tutor_lesson_lead_info( $lesson_id = 0, $echo = true ) {
958 if ( ! $lesson_id ) {
959 $lesson_id = get_the_ID();
960 }
961
962 ob_start();
963 $course_id = tutor_utils()->get_course_id_by( 'lesson', $lesson_id );
964 $course_post_type = tutor()->course_post_type;
965 $queryCourse = new WP_Query( array( 'p' => $course_id, 'post_type' => $course_post_type ) );
966
967 if ( $queryCourse->have_posts() ) {
968 while ( $queryCourse->have_posts() ) {
969 $queryCourse->the_post();
970 tutor_load_template( 'single.course.enrolled.lead-info' );
971 }
972 wp_reset_postdata();
973 }
974 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
975
976 if ( $echo ) {
977 echo $output;
978 }
979
980 return $output;
981
982 }
983 }
984 /**
985 * @param bool $echo
986 *
987 * @return mixed
988 *
989 * Return enroll box in single course
990 *
991 * @since: v.1.0.0
992 */
993
994 if ( ! function_exists('tutor_course_enroll_box')) {
995 function tutor_course_enroll_box( $echo = true ) {
996 $isLoggedIn = is_user_logged_in();
997 $enrolled = tutor_utils()->is_enrolled();
998
999 $is_administrator = current_user_can('administrator');
1000 $is_instructor = tutor_utils()->is_instructor_of_this_course();
1001 $course_content_access = (bool) get_tutor_option('course_content_access_for_ia');
1002 ob_start();
1003
1004 if ( $enrolled ) {
1005 tutor_load_template( 'single.course.course-enrolled-box' );
1006 $output = apply_filters( 'tutor_course/single/enrolled', ob_get_clean() );
1007 } else if ( $course_content_access && ($is_administrator || $is_instructor) ) {
1008 tutor_load_template( 'single.course.continue-lesson' );
1009 $output = apply_filters( 'tutor_course/single/continue_lesson', ob_get_clean() );
1010 } else {
1011 tutor_load_template( 'single.course.course-enroll-box' );
1012 $output = apply_filters( 'tutor_course/single/enroll', ob_get_clean() );
1013 }
1014
1015 if ( $echo ) {
1016 echo $output;
1017 }
1018
1019 return $output;
1020 }
1021 }
1022
1023 /**
1024 * @param bool $echo
1025 *
1026 * @return string
1027 *
1028 * Get Only add to cart form
1029 */
1030
1031 function tutor_single_course_add_to_cart($echo = true){
1032 ob_start();
1033
1034 $isLoggedIn = is_user_logged_in();
1035 $output = '';
1036
1037 $template = tutor_utils()->is_course_fully_booked(null) ? 'closed-enrollment' : 'add-to-cart';
1038
1039 tutor_load_template( 'single.course.'.$template );
1040 $output .= apply_filters( 'tutor_course/single/'.$template, ob_get_clean() );
1041
1042 if (!$isLoggedIn) {
1043 ob_start();
1044 tutor_load_template( 'single.course.login' );
1045 $login_form = apply_filters( 'tutor_course/global/login', ob_get_clean() );
1046
1047 $output .= "<div class='tutor-cart-box-login-form' style='display: none;'><span class='login-overlay-close'></span><div class='tutor-cart-box-login-form-inner'><button class='tutor-popup-form-close tutor-icon-line-cross'></button>{$login_form}</div></div>";
1048 }
1049
1050 if ( $echo ) {
1051 echo $output;
1052 }
1053
1054 return $output;
1055 }
1056
1057 if ( ! function_exists('tutor_course_enrolled_nav')) {
1058 function tutor_course_enrolled_nav($echo = true) {
1059 $course_post_type = tutor()->course_post_type;
1060 $lesson_post_type = tutor()->lesson_post_type;
1061
1062 ob_start();
1063 global $post;
1064
1065 if ( ! empty($post->post_type) && $post->post_type === $course_post_type){
1066 tutor_load_template( 'single.course.enrolled.nav' );
1067 }elseif(! empty($post->post_type) && $post->post_type === $lesson_post_type){
1068 $lesson_id = get_the_ID();
1069 $course_id = tutor_utils()->get_course_id_by('lesson', $lesson_id);
1070
1071 $course_post_type = tutor()->course_post_type;
1072 $queryCourse = new WP_Query(array('p' => $course_id, 'post_type' => $course_post_type));
1073
1074 if ($queryCourse->have_posts()){
1075 while ($queryCourse->have_posts()){
1076 $queryCourse->the_post();
1077 tutor_load_template( 'single.course.enrolled.nav' );
1078 }
1079 wp_reset_postdata();
1080 }
1081 }
1082 $output = apply_filters( 'tutor_course/single/enrolled/nav', ob_get_clean() );
1083
1084 if ( $echo ) {
1085 echo $output;
1086 }
1087 return $output;
1088 }
1089 }
1090
1091 if ( ! function_exists('tutor_course_video')){
1092 function tutor_course_video($echo = true){
1093 ob_start();
1094 tutor_load_template( 'single.video.video' );
1095 $output = apply_filters( 'tutor_course/single/video', ob_get_clean() );
1096
1097 if ( $echo ) {
1098 echo $output;
1099 }
1100 return $output;
1101 }
1102 }
1103
1104 if ( ! function_exists('tutor_lesson_video')){
1105 function tutor_lesson_video($echo = true){
1106 ob_start();
1107 tutor_load_template( 'single.video.video' );
1108 $output = apply_filters( 'tutor_lesson/single/video', ob_get_clean() );
1109
1110 if ( $echo ) {
1111 echo $output;
1112 }
1113 return $output;
1114 }
1115 }
1116
1117 /**
1118 *
1119 * Get all lessons attachments
1120 *
1121 * @param bool $echo
1122 *
1123 * @return mixed
1124 *
1125 * @since v.1.0.0
1126 */
1127 if ( ! function_exists('get_tutor_posts_attachments')){
1128 function get_tutor_posts_attachments($echo = true){
1129 ob_start();
1130 tutor_load_template( 'global.attachments' );
1131 $output = apply_filters( 'tutor_lesson/single/attachments', ob_get_clean() );
1132
1133 if ( $echo ) {
1134 echo $output;
1135 }
1136 return $output;
1137 }
1138 }
1139
1140 /**
1141 * @param bool $echo
1142 *
1143 * @return mixed
1144 *
1145 * Get the lessons with topics
1146 *
1147 * @since v.1.0.0
1148 */
1149 if ( ! function_exists('tutor_lessons_sidebar')) {
1150 function tutor_lessons_sidebar( $echo = true ) {
1151 ob_start();
1152 tutor_load_template( 'single.lesson.lesson_sidebar' );
1153 $output = apply_filters( 'tutor_lesson/single/lesson_sidebar', ob_get_clean() );
1154
1155 if ( $echo ) {
1156 echo $output;
1157 }
1158
1159 return $output;
1160 }
1161 }
1162
1163 /**
1164 * @param bool $echo
1165 *
1166 * @return mixed
1167 *
1168 * Render Lesson Main Content
1169 * @since v.1.0.0
1170 */
1171 if ( ! function_exists('tutor_lesson_content')) {
1172 function tutor_lesson_content( $echo = true ) {
1173 ob_start();
1174 tutor_load_template( 'single.lesson.content' );
1175 $output = apply_filters( 'tutor_lesson/single/content', ob_get_clean() );
1176
1177 if ( $echo ) {
1178 echo $output;
1179 }
1180
1181 return $output;
1182 }
1183 }
1184
1185 if ( ! function_exists('tutor_lesson_mark_complete_html')) {
1186 function tutor_lesson_mark_complete_html( $echo = true ) {
1187 ob_start();
1188 tutor_load_template( 'single.lesson.complete_form' );
1189 $output = apply_filters( 'tutor_lesson/single/complete_form', ob_get_clean() );
1190
1191 if ( $echo ) {
1192 echo $output;
1193 }
1194
1195 return $output;
1196 }
1197 }
1198
1199 if ( ! function_exists('tutor_course_mark_complete_html')) {
1200 function tutor_course_mark_complete_html( $echo = true ) {
1201 ob_start();
1202 tutor_load_template( 'single.course.complete_form' );
1203 $output = apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );
1204
1205 if ( $echo ) {
1206 echo $output;
1207 }
1208
1209 return $output;
1210 }
1211 }
1212
1213
1214 /**
1215 * @param bool $echo
1216 *
1217 * @return mixed
1218 *
1219 * @show progress bar about course complete
1220 *
1221 * @since v.1.0.0
1222 */
1223
1224 if ( ! function_exists('tutor_course_completing_progress_bar')) {
1225 function tutor_course_completing_progress_bar( $echo = true ) {
1226 ob_start();
1227 tutor_load_template( 'single.course.enrolled.completing-progress' );
1228 $output = apply_filters( 'tutor_course/single/completing-progress-bar', ob_get_clean() );
1229
1230 if ( $echo ) {
1231 echo $output;
1232 }
1233
1234 return $output;
1235 }
1236 }
1237
1238 function tutor_course_question_and_answer($echo = true){
1239 ob_start();
1240 tutor_load_template( 'single.course.enrolled.question_and_answer' );
1241 $output = apply_filters( 'tutor_course/single/question_and_answer', ob_get_clean() );
1242
1243 if ( $echo ) {
1244 echo $output;
1245 }
1246
1247 return $output;
1248 }
1249
1250
1251 function tutor_course_announcements($echo = true){
1252 ob_start();
1253 tutor_load_template( 'single.course.enrolled.announcements' );
1254 $output = apply_filters( 'tutor_course/single/announcements', ob_get_clean() );
1255
1256 if ( $echo ) {
1257 echo $output;
1258 }
1259
1260 return $output;
1261 }
1262
1263 function tutor_single_quiz_top($echo = true){
1264 ob_start();
1265 tutor_load_template( 'single.quiz.top' );
1266 $output = apply_filters( 'tutor_single_quiz/top', ob_get_clean() );
1267
1268 if ( $echo ) {
1269 echo $output;
1270 }
1271 return $output;
1272 }
1273
1274 function tutor_single_quiz_body($echo = true){
1275 ob_start();
1276 tutor_load_template( 'single.quiz.body' );
1277 $output = apply_filters( 'tutor_single_quiz/body', ob_get_clean() );
1278
1279 if ( $echo ) {
1280 echo $output;
1281 }
1282 return $output;
1283 }
1284
1285 /**
1286 * @param bool $echo
1287 *
1288 * @return mixed|void
1289 *
1290 * Get the quiz description
1291 */
1292 function tutor_single_quiz_content($echo = true){
1293 ob_start();
1294 tutor_load_template( 'single.quiz.content' );
1295 $output = apply_filters( 'tutor_single_quiz/content', ob_get_clean() );
1296
1297 if ( $echo ) {
1298 echo $output;
1299 }
1300 return $output;
1301 }
1302
1303
1304 function tutor_single_quiz_no_course_belongs($echo = true){
1305 ob_start();
1306 tutor_load_template( 'single.quiz.no_course_belongs' );
1307 $output = apply_filters( 'tutor_single_quiz/no_course_belongs', ob_get_clean() );
1308
1309 if ( $echo ) {
1310 echo $output;
1311 }
1312 return $output;
1313 }
1314
1315 function single_quiz_contents($echo = true){
1316
1317 ob_start();
1318 tutor_load_template( 'single.quiz.single_quiz_contents' );
1319 $output = apply_filters( 'tutor_single_quiz/single_quiz_contents', ob_get_clean() );
1320
1321 if ( $echo ) {
1322 echo $output;
1323 }
1324 return $output;
1325 }
1326
1327 function get_tutor_course_level($course_id = 0){
1328 if ( ! $course_id){
1329 $course_id = get_the_ID();
1330 }
1331 if ( ! $course_id){
1332 return '';
1333 }
1334
1335 $course_level = get_post_meta($course_id, '_tutor_course_level', true);
1336
1337 if ($course_level){
1338 return tutor_utils()->course_levels($course_level);
1339 }
1340 return false;
1341 }
1342
1343 if ( ! function_exists('get_tutor_course_duration_context')) {
1344 function get_tutor_course_duration_context( $course_id = 0 ) {
1345 if ( ! $course_id ) {
1346 $course_id = get_the_ID();
1347 }
1348 if ( ! $course_id ) {
1349 return '';
1350 }
1351 $duration = get_post_meta( $course_id, '_course_duration', true );
1352 $durationHours = tutor_utils()->avalue_dot( 'hours', $duration );
1353 $durationMinutes = tutor_utils()->avalue_dot( 'minutes', $duration );
1354 $durationSeconds = tutor_utils()->avalue_dot( 'seconds', $duration );
1355
1356 if ( $duration ) {
1357 $output = '';
1358 if ( $durationHours > 0 ) {
1359 $output .= $durationHours . "h ";
1360 }
1361
1362 if ( $durationMinutes > 0 ) {
1363 $output .= $durationMinutes . "m ";
1364 }
1365
1366 if ( $durationSeconds > 0 ) {
1367 $output .= $durationSeconds ."s ";
1368 }
1369
1370 return $output;
1371 }
1372
1373 return false;
1374 }
1375 }
1376 if ( ! function_exists('get_tutor_course_categories')){
1377 function get_tutor_course_categories($course_id = 0){
1378 if ( ! $course_id ) {
1379 $course_id = get_the_ID();
1380 }
1381 $terms = get_the_terms( $course_id, 'course-category' );
1382
1383 return $terms;
1384 }
1385 }
1386
1387 /**
1388 * @param int $course_id
1389 *
1390 * @return array|false|WP_Error
1391 *
1392 * Get course tags
1393 */
1394
1395 if ( ! function_exists('get_tutor_course_tags')){
1396 function get_tutor_course_tags($course_id = 0){
1397 if ( ! $course_id ) {
1398 $course_id = get_the_ID();
1399 }
1400 $terms = get_the_terms( $course_id, 'course-tag' );
1401
1402 return $terms;
1403 }
1404 }
1405
1406 /**
1407 * @param bool $echo
1408 *
1409 * @return mixed|void
1410 *
1411 * Template for course tags html
1412 */
1413
1414 if ( ! function_exists('tutor_course_tags_html')) {
1415 function tutor_course_tags_html( $echo = true ) {
1416 ob_start();
1417 tutor_load_template( 'single.course.tags' );
1418 $output = apply_filters( 'tutor_course/single/tags_html', ob_get_clean() );
1419
1420 if ( $echo ) {
1421 echo $output;
1422 }
1423
1424 return $output;
1425 }
1426 }
1427
1428 /**
1429 * @param bool $echo
1430 *
1431 * @return mixed
1432 *
1433 * Get Q&A in lesson sidebar
1434 */
1435
1436 if ( ! function_exists('tutor_lesson_sidebar_question_and_answer')) {
1437 function tutor_lesson_sidebar_question_and_answer( $echo = true ) {
1438 ob_start();
1439 tutor_load_template( 'single.lesson.sidebar_question_and_answer' );
1440 $output = apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', ob_get_clean() );
1441
1442 if ( $echo ) {
1443 echo $output;
1444 }
1445
1446 return $output;
1447 }
1448 }
1449
1450 /**
1451 * @param bool $echo
1452 *
1453 * @return mixed|void
1454 *
1455 * Get Social Share button to share on social media
1456 */
1457
1458 if ( ! function_exists('tutor_social_share')) {
1459 function tutor_social_share( $echo = true ) {
1460
1461 $output = '';
1462 $tutor_social_share_icons = tutor_utils()->tutor_social_share_icons();
1463
1464 if (tutor_utils()->count($tutor_social_share_icons)) {
1465 ob_start();
1466 tutor_load_template( 'single.course.social_share', array( 'tutor_social_share_icons' => $tutor_social_share_icons ) );
1467 $output = apply_filters( 'tutor_course/single/social_share', ob_get_clean() );
1468 }
1469
1470 if ( $echo && $output!='' ) {
1471 echo '<span>' . __('Share:', 'tutor') . '</span>';
1472 echo $output;
1473 }
1474
1475 return $output;
1476 }
1477 }
1478
1479 /**
1480 * @param bool $echo
1481 *
1482 * @return mixed
1483 *
1484 * Get Assignment content
1485 *
1486 * @since v.1.3.3
1487 */
1488
1489 if ( ! function_exists('tutor_assignment_content')) {
1490 function tutor_assignment_content( $echo = true ) {
1491 ob_start();
1492 tutor_load_template( 'single.assignment.content' );
1493 $output = apply_filters( 'tutor_assignment/single/content', ob_get_clean() );
1494
1495 if ( $echo ) {
1496 echo $output;
1497 }
1498
1499 return $output;
1500 }
1501 }
1502
1503 /**
1504 * @param string $msg
1505 * @param string $title
1506 * @param string $type
1507 *
1508 * @return string
1509 *
1510 * @since v.1.4.0
1511 */
1512
1513 if ( ! function_exists('get_tnotice')) {
1514 function get_tnotice( $msg = '', $title = 'Success', $type = 'success' ) {
1515
1516 $output = '<div class="tnotice tnotice--' . $type . '">
1517 <div class="tnotice__icon">&iexcl;</div>
1518 <div class="tnotice__content">';
1519
1520 if ($title){
1521 $output .='<p class="tnotice__type">' . $title . '</p>';
1522 }
1523 $output .='<p class="tnotice__message">' . $msg . '</p>
1524 </div>
1525 </div>';
1526
1527 return $output;
1528 }
1529 }
1530
1531 /**
1532 * @param int $course_content_id
1533 * @param bool $echo
1534 *
1535 * @return mixed|void
1536 *
1537 * Next Previous Pagination
1538 *
1539 * @since v.1.4.7
1540 */
1541
1542 function tutor_next_previous_pagination($course_content_id = 0, $echo = true){
1543 $content_id = tutils()->get_post_id($course_content_id);
1544 $contents = tutils()->get_course_prev_next_contents_by_id($content_id);
1545 $previous_id = $contents->previous_id;
1546 $next_id = $contents->next_id;
1547
1548 ob_start();
1549 do_action('tutor_lesson_next_previous_pagination_before');
1550 tutor_load_template( 'single.next-previous-pagination', compact('previous_id', 'next_id') );
1551 do_action('tutor_lesson_next_previous_pagination_after');
1552 $output = apply_filters( 'tutor/single/next_previous_pagination', ob_get_clean() );
1553
1554 if ( $echo ) {
1555 echo $output;
1556 }
1557
1558 return $output;
1559 }
1560
1561
1562 /**
1563 * Required login form in archive page
1564 * @param bool $echo
1565 * @since v 1.5.5
1566 *
1567 * @todo, it will be remove from 2.0.0
1568 */
1569 function tutor_archive_course_add_to_cart($echo = true){
1570 _deprecated_function( __FUNCTION__, '1.5.8' );
1571
1572 $output = '';
1573 if ( $echo ) {
1574 echo $output;
1575 }
1576 return $output;
1577 }
1578
1579 /**
1580 * @param bool $echo
1581 * @return string
1582 *
1583 * Display login form in popup where necessary
1584 *
1585 * @since v.1.5.8
1586 */
1587
1588 if ( ! function_exists('tutor_login_form_popup')) {
1589 function tutor_login_form_popup($echo = true){
1590 $output = '';
1591 ob_start();
1592 tutor_load_template('single.course.login');
1593 $login_form = apply_filters('tutor_course/global/login', ob_get_clean());
1594 $output .= "<div class='tutor-cart-box-login-form' style='display: none;'><span class='login-overlay-close'></span><div class='tutor-cart-box-login-form-inner'><button class='tutor-popup-form-close tutor-icon-line-cross'></button>{$login_form}</div></div>";
1595
1596 $output = apply_filters('tutor_login_form_popup_html', $output);
1597
1598 if ($echo) {
1599 echo $output;
1600 }
1601 return $output;
1602 }
1603 }
1604
1605 /**
1606 * Load custom template from any given file
1607 *
1608 * Pass parameter as wish
1609 *
1610 * @since 1.9.8
1611 */
1612 if ( ! function_exists('tutor_load_template_from_custom_path')) {
1613 function tutor_load_template_from_custom_path( $template = null, $data=array() ) {
1614 do_action('tutor_load_template_from_custom_path_before', $template, $data);
1615 if ( file_exists($template) ) {
1616 include_once $template;
1617 }
1618 do_action('tutor_load_template_from_custom_path_after', $template, $data);
1619 }
1620 }