PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 1.6.8
Tutor LMS – eLearning and online course solution v1.6.8
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 5 years ago tutor-general-functions.php 5 years ago tutor-template-functions.php 5 years ago tutor-template-hook.php 5 years ago
tutor-template-functions.php
1594 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 is not exists in your theme or tutor plugins location, if you are a developer and extending tutor plugin, please create a php file at location %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 $courseCols = tutor_utils()->get_option( 'courses_col_per_row', 4 );
317 $classes = apply_filters( 'tutor_course_loop_col_classes', array(
318 'tutor-course-col-' . $courseCols,
319 ) );
320
321 $class = implode( ' ', $classes );
322 if ( $echo ) {
323 echo $class;
324 }
325
326 return $class;
327 }
328 }
329
330
331 if ( ! function_exists('tutor_container_classes')) {
332 function tutor_container_classes( $echo = true ) {
333
334 $classes = apply_filters( 'tutor_container_classes', array(
335 'tutor-wrap tutor-courses-wrap',
336 'tutor-container'
337 ) );
338
339 $class = implode( ' ', $classes );
340
341 if ( $echo ) {
342 echo $class;
343 }
344
345 return $class;
346 }
347 }
348 if ( ! function_exists('tutor_post_class')) {
349 function tutor_post_class($default = '') {
350 $classes = apply_filters( 'tutor_post_class', array(
351 'tutor-wrap',
352 $default
353 ) );
354
355 post_class( $classes );
356 }
357 }
358
359 if ( ! function_exists('tutor_course_archive_filter_bar')) {
360 function tutor_course_archive_filter_bar() {
361 ob_start();
362 tutor_load_template( 'global.course-archive-filter-bar' );
363 $output = apply_filters( 'tutor_course_archive_filter_bar', ob_get_clean() );
364
365 echo $output;
366 }
367 }
368
369 /**
370 *
371 * Get classes for widget loop single course wrap
372 *
373 * @param bool $echo
374 *
375 * @return string
376 *
377 * @since v.1.3.1
378 */
379 if( ! function_exists('tutor_widget_course_loop_classes')) {
380 function tutor_widget_course_loop_classes( $echo = true ) {
381
382 $classes = apply_filters( 'tutor_widget_course_loop_classes', array(
383 'tutor-widget-course-loop',
384 'tutor-widget-course',
385 'tutor-widget-course-'.get_the_ID(),
386 ) );
387
388 $class = implode( ' ', $classes );
389 if ( $echo ) {
390 echo $class;
391 }
392
393 return $class;
394 }
395 }
396
397 /**
398 * Get the post thumbnail
399 */
400 if ( ! function_exists('get_tutor_course_thumbnail')) {
401 function get_tutor_course_thumbnail($size = 'post-thumbnail', $url = false) {
402 $post_id = get_the_ID();
403 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
404
405 if ( $post_thumbnail_id ) {
406 //$size = apply_filters( 'post_thumbnail_size', $size, $post_id );
407 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
408 if ($url){
409 return wp_get_attachment_image_url($post_thumbnail_id, $size);
410 }
411
412 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false );
413 } else {
414 $placeHolderUrl = tutor()->url . 'assets/images/placeholder.jpg';
415 if ($url){
416 return $placeHolderUrl;
417 }
418 $html = sprintf('<img alt="%s" src="' . $placeHolderUrl . '" />', __('Placeholder', 'tutor'));
419 }
420
421 echo $html;
422 }
423 }
424 /**
425 * Get the course/post thumbnail src
426 */
427 if ( ! function_exists('get_tutor_course_thumbnail_src')) {
428 function get_tutor_course_thumbnail_src($size = 'post-thumbnail') {
429 $post_id = get_the_ID();
430 $post_thumbnail_id = (int) get_post_thumbnail_id( $post_id );
431
432 if ( $post_thumbnail_id ) {
433 $size = apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );
434 $src = wp_get_attachment_image_url( $post_thumbnail_id, $size, false );
435 } else {
436 $src = tutor()->url . 'assets/images/placeholder.jpg';
437 }
438
439 return $src;
440 }
441 }
442
443 if ( ! function_exists('tutor_course_loop_meta')) {
444 function tutor_course_loop_meta() {
445 ob_start();
446 tutor_load_template( 'loop.meta' );
447 $output = apply_filters( 'tutor_course_loop_meta', ob_get_clean() );
448
449 echo $output;
450 }
451 }
452
453 /**
454 * Get course author name in loop
455 *
456 * @since: v.1.0.0
457 */
458
459 if ( ! function_exists('tutor_course_loop_author')) {
460 function tutor_course_loop_author() {
461 ob_start();
462 tutor_load_template( 'loop.course-author' );
463 $output = apply_filters( 'tutor_course_loop_author', ob_get_clean() );
464
465 echo $output;
466 }
467 }
468
469 /**
470 * Get formatted price with cart form
471 */
472
473 if ( ! function_exists('tutor_course_loop_price')) {
474 function tutor_course_loop_price() {
475 ob_start();
476
477 $tutor_course_sell_by = apply_filters('tutor_course_sell_by', null);
478 if ($tutor_course_sell_by){
479 tutor_load_template( 'loop.course-price-'.$tutor_course_sell_by );
480 }else{
481 tutor_load_template( 'loop.course-price' );
482 }
483 $output = apply_filters( 'tutor_course_loop_price', ob_get_clean() );
484
485 echo $output;
486 }
487 }
488
489 /**
490 * Get Course rating
491 *
492 * @since v.1.0.0
493 * @updated v.1.4.5
494 */
495
496 if ( ! function_exists('tutor_course_loop_rating')) {
497 function tutor_course_loop_rating() {
498
499 $disable = get_tutor_option('disable_course_review');
500 if ($disable){
501 return;
502 }
503
504 ob_start();
505 tutor_load_template( 'loop.rating' );
506 $output = apply_filters( 'tutor_course_loop_rating', ob_get_clean() );
507
508 echo $output;
509 }
510 }
511
512 /**
513 * @param bool $echo
514 *
515 * @return mixed|void
516 *
517 * Get add to cart form
518 */
519
520 if ( ! function_exists('tutor_course_loop_add_to_cart')) {
521 function tutor_course_loop_add_to_cart($echo = true) {
522 ob_start();
523 $tutor_course_sell_by = apply_filters('tutor_course_sell_by', null);
524
525 if ($tutor_course_sell_by){
526 tutor_load_template( 'loop.add-to-cart-'.$tutor_course_sell_by );
527 }
528
529 $output = apply_filters( 'tutor_course_loop_add_to_cart_link', ob_get_clean() );
530
531 if ($echo){
532 echo $output;
533 }
534 return $output;
535 }
536 }
537
538 if ( ! function_exists('tutor_course_price')) {
539 function tutor_course_price() {
540 ob_start();
541 tutor_load_template( 'single.course.wc-price-html' );
542 $output = apply_filters( 'tutor_course_price', ob_get_clean() );
543
544 echo $output;
545 }
546 }
547
548 /**
549 * @param int $post_id
550 *
551 * echo the excerpt of TUTOR post type
552 *
553 * @since: v.1.0.0
554 */
555 if ( ! function_exists('tutor_the_excerpt')) {
556 function tutor_the_excerpt( $post_id = 0 ) {
557 if ( ! $post_id ) {
558 $post_id = get_the_ID();
559 }
560 echo tutor_get_the_excerpt( $post_id );
561 }
562 }
563 /**
564 * @param int $post_id
565 *
566 * @return mixed
567 *
568 * Return excerpt of TUTOR post type
569 *
570 * @since: v.1.0.0
571 */
572 if ( ! function_exists('tutor_get_the_excerpt')) {
573 function tutor_get_the_excerpt( $post_id = 0 ) {
574 if ( ! $post_id ) {
575 $post_id = get_the_ID();
576 }
577
578 $get_post = get_post($post_id);
579 return apply_filters( 'tutor_get_the_excerpt', $get_post->post_excerpt );
580 }
581 }
582
583 /**
584 * @return mixed
585 *
586 * return course author
587 *
588 * @since: v.1.0.0
589 */
590
591 if ( ! function_exists('get_tutor_course_author')) {
592 function get_tutor_course_author() {
593 global $post;
594 return apply_filters( 'get_tutor_course_author', get_the_author_meta( 'display_name', $post->post_author ) );
595 }
596 }
597
598 function get_tutor_course_author_id(){
599 global $post;
600 return (int) $post->post_author;
601 }
602
603 /**
604 * @param int $course_id
605 *
606 * @return mixed
607 * Course benefits return array
608 *
609 * @since: v.1.0.0
610 */
611
612 if ( ! function_exists('tutor_course_benefits')) {
613 function tutor_course_benefits( $course_id = 0 ) {
614 if ( ! $course_id ) {
615 $course_id = get_the_ID();
616 }
617 $benefits = get_post_meta( $course_id, '_tutor_course_benefits', true );
618
619 $benefits_array = array();
620 if ($benefits){
621 $benefits_array = explode("\n", $benefits);
622 }
623
624 $array = array_filter(array_map('trim', $benefits_array));
625
626 return apply_filters( 'tutor_course/single/benefits', $array, $course_id );
627 }
628 }
629
630 /**
631 * @param bool $echo
632 *
633 * @return mixed
634 *
635 * Course single page benefits
636 *
637 * @since: v.1.0.0
638 */
639
640 if ( ! function_exists('tutor_course_benefits_html')) {
641 function tutor_course_benefits_html($echo = true) {
642 ob_start();
643 tutor_load_template( 'single.course.course-benefits' );
644 $output = apply_filters( 'tutor_course/single/benefits_html', ob_get_clean() );
645
646 if ($echo){
647 echo $output;
648 }
649 return $output;
650 }
651 }
652
653 /**
654 * @param bool $echo
655 *
656 * @return mixed|void
657 *
658 * Return Topics HTML
659 *
660 * @since: v.1.0.0
661 */
662 if ( ! function_exists('tutor_course_topics')) {
663 function tutor_course_topics( $echo = true ) {
664 ob_start();
665 tutor_load_template( 'single.course.course-topics' );
666 $output = apply_filters( 'tutor_course/single/topics', ob_get_clean() );
667 wp_reset_postdata();
668
669 if ( $echo ) {
670 echo $output;
671 }
672
673 return $output;
674 }
675 }
676
677 /**
678 * @param int $course_id
679 *
680 * @return mixed|void
681 *
682 * return course requirements in array
683 *
684 * @since: v.1.0.0
685 */
686 if ( ! function_exists('tutor_course_requirements')) {
687 function tutor_course_requirements( $course_id = 0 ) {
688 if ( ! $course_id ) {
689 $course_id = get_the_ID();
690 }
691 $requirements = get_post_meta( $course_id, '_tutor_course_requirements', true );
692
693 $requirements_array = array();
694 if ($requirements){
695 $requirements_array = explode("\n", $requirements);
696 }
697
698 $array = array_filter(array_map('trim', $requirements_array));
699 return apply_filters( 'tutor_course/single/requirements', $array, $course_id );
700 }
701 }
702
703 /**
704 * @param bool $echo
705 *
706 * @return mixed|void
707 *
708 * Return course requirements in course single page
709 *
710 * @since: v.1.0.0
711 */
712 if ( ! function_exists('tutor_course_requirements_html')) {
713 function tutor_course_requirements_html($echo = true) {
714 ob_start();
715 tutor_load_template( 'single.course.course-requirements' );
716 $output = apply_filters( 'tutor_course/single/requirements_html', ob_get_clean() );
717
718 if ($echo){
719 echo $output;
720 }
721 return $output;
722 }
723 }
724
725
726 /**
727 * @param int $course_id
728 *
729 * @return mixed|void
730 *
731 * Return target audience in course single page
732 *
733 * @since: v.1.0.0
734 */
735 if ( ! function_exists('tutor_course_target_audience')) {
736 function tutor_course_target_audience( $course_id = 0 ) {
737 if ( ! $course_id ) {
738 $course_id = get_the_ID();
739 }
740 $target_audience = get_post_meta( $course_id, '_tutor_course_target_audience', true );
741
742 $target_audience_array = array();
743 if ($target_audience){
744 $target_audience_array = explode("\n", $target_audience);
745 }
746
747 $array = array_filter(array_map('trim', $target_audience_array));
748 return apply_filters( 'tutor_course/single/target_audience', $array, $course_id );
749 }
750 }
751
752 /**
753 * @param bool $echo
754 *
755 * @return mixed|void
756 *
757 * Return target audience in course single page
758 *
759 * @since: v.1.0.0
760 */
761 if ( ! function_exists('tutor_course_target_audience_html')) {
762 function tutor_course_target_audience_html($echo = true) {
763 ob_start();
764 tutor_load_template( 'single.course.course-target-audience' );
765 $output = apply_filters( 'tutor_course/single/audience_html', ob_get_clean() );
766
767 if ($echo){
768 echo $output;
769 }
770 return $output;
771 }
772 }
773
774
775 if ( ! function_exists('tutor_course_material_includes')) {
776 function tutor_course_material_includes( $course_id = 0 ) {
777 if ( ! $course_id ) {
778 $course_id = get_the_ID();
779 }
780 $target_audience = get_post_meta( $course_id, '_tutor_course_material_includes', true );
781
782 $target_audience_array = array();
783 if ($target_audience){
784 $target_audience_array = explode("\n", $target_audience);
785 }
786
787 $array = array_filter(array_map('trim', $target_audience_array));
788 return apply_filters( 'tutor_course/single/material_includes', $array, $course_id );
789 }
790 }
791
792 if ( ! function_exists('tutor_course_material_includes_html')) {
793 function tutor_course_material_includes_html($echo = true) {
794 ob_start();
795 tutor_load_template( 'single.course.material-includes' );
796 $output = apply_filters( 'tutor_course/single/material_includes', ob_get_clean() );
797
798 if ($echo){
799 echo $output;
800 }
801 return $output;
802 }
803 }
804
805 //tutor_course_material_includes_html
806
807
808 if ( ! function_exists('tutor_course_instructors_html')) {
809 function tutor_course_instructors_html($echo = true) {
810 $display_course_instructors = tutor_utils()->get_option('display_course_instructors');
811 if ( ! $display_course_instructors){
812 return null;
813 }
814
815 ob_start();
816 tutor_load_template( 'single.course.instructors' );
817 $output = apply_filters( 'tutor_course/single/instructors_html', ob_get_clean() );
818
819 if ($echo){
820 echo $output;
821 }
822 return $output;
823 }
824 }
825
826 if ( ! function_exists('tutor_course_target_reviews_html')) {
827 function tutor_course_target_reviews_html($echo = true) {
828 ob_start();
829 tutor_load_template( 'single.course.reviews' );
830 $output = apply_filters( 'tutor_course/single/reviews_html', ob_get_clean() );
831
832 if ($echo){
833 echo $output;
834 }
835 return $output;
836 }
837 }
838
839 if ( ! function_exists('tutor_course_target_review_form_html')) {
840 function tutor_course_target_review_form_html($echo = true) {
841 $isDisableReview = (bool) tutils()->get_option('disable_course_review');
842 if ($isDisableReview){
843 $output = apply_filters('tutor_review_disabled_text', '');
844
845 if ($echo){
846 echo $output;
847 }
848 return $output;
849 }
850
851 ob_start();
852 tutor_load_template( 'single.course.review-form' );
853 $output = apply_filters( 'tutor_course/single/reviews_form', ob_get_clean() );
854
855 if ($echo){
856 echo $output;
857 }
858 return $output;
859 }
860 }
861
862 /**
863 * @param bool $echo
864 *
865 * @return mixed
866 *
867 * Course single page main content / description
868 *
869 * @since: v.1.0.0
870 */
871 if ( ! function_exists('tutor_course_content')) {
872 function tutor_course_content( $echo = true ) {
873 ob_start();
874 tutor_load_template( 'single.course.course-content' );
875 $output = apply_filters( 'tutor_course/single/content', ob_get_clean() );
876
877 if ( $echo ) {
878 echo $output;
879 }
880
881 return $output;
882 }
883 }
884
885 /**
886 * Course single page lead info
887 *
888 * @since: v.1.0.0
889 */
890 if ( ! function_exists('tutor_course_lead_info')) {
891 function tutor_course_lead_info( $echo = true ) {
892 ob_start();
893
894 $course_id = get_the_ID();
895 $course_post_type = tutor()->course_post_type;
896 $queryCourse = new WP_Query(array('p' => $course_id, 'post_type' => $course_post_type));
897
898 if ($queryCourse->have_posts()){
899 while ($queryCourse->have_posts()){
900 $queryCourse->the_post();
901 tutor_load_template( 'single.course.lead-info' );
902 }
903 wp_reset_postdata();
904 }
905
906 $output = apply_filters( 'tutor_course/single/lead_info', ob_get_clean() );
907
908 if ( $echo ) {
909 echo $output;
910 }
911 return $output;
912 }
913 }
914
915 /**
916 * @param bool $echo
917 *
918 * @return mixed|void
919 */
920
921 if ( ! function_exists('tutor_course_enrolled_lead_info')) {
922 function tutor_course_enrolled_lead_info( $echo = true ) {
923 ob_start();
924
925 $course_id = get_the_ID();
926 $course_post_type = tutor()->course_post_type;
927 $queryCourse = new WP_Query( array( 'p' => $course_id, 'post_type' => $course_post_type ) );
928
929 if ( $queryCourse->have_posts() ) {
930 while ( $queryCourse->have_posts() ) {
931 $queryCourse->the_post();
932 tutor_load_template( 'single.course.enrolled.lead-info' );
933 }
934 wp_reset_postdata();
935 }
936
937 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
938
939 if ( $echo ) {
940 echo $output;
941 }
942
943 return $output;
944 }
945 }
946
947 if ( ! function_exists('tutor_lesson_lead_info')) {
948 function tutor_lesson_lead_info( $lesson_id = 0, $echo = true ) {
949 if ( ! $lesson_id ) {
950 $lesson_id = get_the_ID();
951 }
952
953 ob_start();
954 $course_id = tutor_utils()->get_course_id_by_lesson( $lesson_id );
955 $course_post_type = tutor()->course_post_type;
956 $queryCourse = new WP_Query( array( 'p' => $course_id, 'post_type' => $course_post_type ) );
957
958 if ( $queryCourse->have_posts() ) {
959 while ( $queryCourse->have_posts() ) {
960 $queryCourse->the_post();
961 tutor_load_template( 'single.course.enrolled.lead-info' );
962 }
963 wp_reset_postdata();
964 }
965 $output = apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
966
967 if ( $echo ) {
968 echo $output;
969 }
970
971 return $output;
972
973 }
974 }
975 /**
976 * @param bool $echo
977 *
978 * @return mixed
979 *
980 * Return enroll box in single course
981 *
982 * @since: v.1.0.0
983 */
984
985 if ( ! function_exists('tutor_course_enroll_box')) {
986 function tutor_course_enroll_box( $echo = true ) {
987 $isLoggedIn = is_user_logged_in();
988 $enrolled = tutor_utils()->is_enrolled();
989
990 $is_administrator = current_user_can('administrator');
991 $is_instructor = tutor_utils()->is_instructor_of_this_course();
992
993 ob_start();
994
995 if ( $enrolled ) {
996 tutor_load_template( 'single.course.course-enrolled-box' );
997 $output = apply_filters( 'tutor_course/single/enrolled', ob_get_clean() );
998 } else if ( $is_administrator || $is_instructor ) {
999 tutor_load_template( 'single.course.continue-lesson' );
1000 $output = apply_filters( 'tutor_course/single/continue_lesson', ob_get_clean() );
1001 } else {
1002 tutor_load_template( 'single.course.course-enroll-box' );
1003 $output = apply_filters( 'tutor_course/single/enroll', ob_get_clean() );
1004 }
1005
1006 if ( $echo ) {
1007 echo $output;
1008 }
1009
1010 return $output;
1011 }
1012 }
1013
1014 /**
1015 * @param bool $echo
1016 *
1017 * @return string
1018 *
1019 * Get Only add to cart form
1020 */
1021
1022 function tutor_single_course_add_to_cart($echo = true){
1023 ob_start();
1024
1025 $isLoggedIn = is_user_logged_in();
1026 $output = '';
1027
1028 $total_enrolled = tutor_utils()->count_enrolled_users_by_course();
1029 $maximum_students = (int) tutor_utils()->get_course_settings(null, 'maximum_students');
1030
1031 if ($maximum_students && $maximum_students <= $total_enrolled) {
1032 $template = 'closed-enrollment';
1033 } else {
1034 $template = 'add-to-cart';
1035 }
1036
1037 tutor_load_template( 'single.course.'.$template );
1038 $output .= apply_filters( 'tutor_course/single/'.$template, ob_get_clean() );
1039
1040 if (!$isLoggedIn) {
1041 ob_start();
1042 tutor_load_template( 'single.course.login' );
1043 $login_form = apply_filters( 'tutor_course/global/login', ob_get_clean() );
1044
1045 $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>";
1046 }
1047
1048 if ( $echo ) {
1049 echo $output;
1050 }
1051
1052 return $output;
1053 }
1054
1055 if ( ! function_exists('tutor_course_enrolled_nav')) {
1056 function tutor_course_enrolled_nav($echo = true) {
1057 $course_post_type = tutor()->course_post_type;
1058 $lesson_post_type = tutor()->lesson_post_type;
1059
1060 ob_start();
1061 global $post;
1062
1063 if ( ! empty($post->post_type) && $post->post_type === $course_post_type){
1064 tutor_load_template( 'single.course.enrolled.nav' );
1065 }elseif(! empty($post->post_type) && $post->post_type === $lesson_post_type){
1066 $lesson_id = get_the_ID();
1067 $course_id = tutor_utils()->get_course_id_by_lesson($lesson_id);
1068
1069 $course_post_type = tutor()->course_post_type;
1070 $queryCourse = new WP_Query(array('p' => $course_id, 'post_type' => $course_post_type));
1071
1072 if ($queryCourse->have_posts()){
1073 while ($queryCourse->have_posts()){
1074 $queryCourse->the_post();
1075 tutor_load_template( 'single.course.enrolled.nav' );
1076 }
1077 wp_reset_postdata();
1078 }
1079 }
1080 $output = apply_filters( 'tutor_course/single/enrolled/nav', ob_get_clean() );
1081
1082 if ( $echo ) {
1083 echo $output;
1084 }
1085 return $output;
1086 }
1087 }
1088
1089 if ( ! function_exists('tutor_course_video')){
1090 function tutor_course_video($echo = true){
1091 ob_start();
1092 tutor_load_template( 'single.video.video' );
1093 $output = apply_filters( 'tutor_course/single/video', ob_get_clean() );
1094
1095 if ( $echo ) {
1096 echo $output;
1097 }
1098 return $output;
1099 }
1100 }
1101
1102 if ( ! function_exists('tutor_lesson_video')){
1103 function tutor_lesson_video($echo = true){
1104 ob_start();
1105 tutor_load_template( 'single.video.video' );
1106 $output = apply_filters( 'tutor_lesson/single/video', ob_get_clean() );
1107
1108 if ( $echo ) {
1109 echo $output;
1110 }
1111 return $output;
1112 }
1113 }
1114
1115 /**
1116 *
1117 * Get all lessons attachments
1118 *
1119 * @param bool $echo
1120 *
1121 * @return mixed
1122 *
1123 * @since v.1.0.0
1124 */
1125 if ( ! function_exists('get_tutor_posts_attachments')){
1126 function get_tutor_posts_attachments($echo = true){
1127 ob_start();
1128 tutor_load_template( 'global.attachments' );
1129 $output = apply_filters( 'tutor_lesson/single/attachments', ob_get_clean() );
1130
1131 if ( $echo ) {
1132 echo $output;
1133 }
1134 return $output;
1135 }
1136 }
1137
1138 /**
1139 * @param bool $echo
1140 *
1141 * @return mixed
1142 *
1143 * Get the lessons with topics
1144 *
1145 * @since v.1.0.0
1146 */
1147 if ( ! function_exists('tutor_lessons_sidebar')) {
1148 function tutor_lessons_sidebar( $echo = true ) {
1149 ob_start();
1150 tutor_load_template( 'single.lesson.lesson_sidebar' );
1151 $output = apply_filters( 'tutor_lesson/single/lesson_sidebar', ob_get_clean() );
1152
1153 if ( $echo ) {
1154 echo $output;
1155 }
1156
1157 return $output;
1158 }
1159 }
1160
1161 /**
1162 * @param bool $echo
1163 *
1164 * @return mixed
1165 *
1166 * Render Lesson Main Content
1167 * @since v.1.0.0
1168 */
1169 if ( ! function_exists('tutor_lesson_content')) {
1170 function tutor_lesson_content( $echo = true ) {
1171 ob_start();
1172 tutor_load_template( 'single.lesson.content' );
1173 $output = apply_filters( 'tutor_lesson/single/content', ob_get_clean() );
1174
1175 if ( $echo ) {
1176 echo $output;
1177 }
1178
1179 return $output;
1180 }
1181 }
1182
1183 if ( ! function_exists('tutor_lesson_mark_complete_html')) {
1184 function tutor_lesson_mark_complete_html( $echo = true ) {
1185 ob_start();
1186 tutor_load_template( 'single.lesson.complete_form' );
1187 $output = apply_filters( 'tutor_lesson/single/complete_form', ob_get_clean() );
1188
1189 if ( $echo ) {
1190 echo $output;
1191 }
1192
1193 return $output;
1194 }
1195 }
1196
1197 if ( ! function_exists('tutor_course_mark_complete_html')) {
1198 function tutor_course_mark_complete_html( $echo = true ) {
1199 ob_start();
1200 tutor_load_template( 'single.course.complete_form' );
1201 $output = apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );
1202
1203 if ( $echo ) {
1204 echo $output;
1205 }
1206
1207 return $output;
1208 }
1209 }
1210
1211
1212 /**
1213 * @param bool $echo
1214 *
1215 * @return mixed
1216 *
1217 * @show progress bar about course complete
1218 *
1219 * @since v.1.0.0
1220 */
1221
1222 if ( ! function_exists('tutor_course_completing_progress_bar')) {
1223 function tutor_course_completing_progress_bar( $echo = true ) {
1224 ob_start();
1225 tutor_load_template( 'single.course.enrolled.completing-progress' );
1226 $output = apply_filters( 'tutor_course/single/completing-progress-bar', ob_get_clean() );
1227
1228 if ( $echo ) {
1229 echo $output;
1230 }
1231
1232 return $output;
1233 }
1234 }
1235
1236 function tutor_course_question_and_answer($echo = true){
1237 ob_start();
1238 tutor_load_template( 'single.course.enrolled.question_and_answer' );
1239 $output = apply_filters( 'tutor_course/single/question_and_answer', ob_get_clean() );
1240
1241 if ( $echo ) {
1242 echo $output;
1243 }
1244
1245 return $output;
1246 }
1247
1248
1249 function tutor_course_announcements($echo = true){
1250 ob_start();
1251 tutor_load_template( 'single.course.enrolled.announcements' );
1252 $output = apply_filters( 'tutor_course/single/announcements', ob_get_clean() );
1253
1254 if ( $echo ) {
1255 echo $output;
1256 }
1257
1258 return $output;
1259 }
1260
1261 function tutor_single_quiz_top($echo = true){
1262 ob_start();
1263 tutor_load_template( 'single.quiz.top' );
1264 $output = apply_filters( 'tutor_single_quiz/top', ob_get_clean() );
1265
1266 if ( $echo ) {
1267 echo $output;
1268 }
1269 return $output;
1270 }
1271
1272 function tutor_single_quiz_body($echo = true){
1273 ob_start();
1274 tutor_load_template( 'single.quiz.body' );
1275 $output = apply_filters( 'tutor_single_quiz/body', ob_get_clean() );
1276
1277 if ( $echo ) {
1278 echo $output;
1279 }
1280 return $output;
1281 }
1282
1283 /**
1284 * @param bool $echo
1285 *
1286 * @return mixed|void
1287 *
1288 * Get the quiz description
1289 */
1290 function tutor_single_quiz_content($echo = true){
1291 ob_start();
1292 tutor_load_template( 'single.quiz.content' );
1293 $output = apply_filters( 'tutor_single_quiz/content', ob_get_clean() );
1294
1295 if ( $echo ) {
1296 echo $output;
1297 }
1298 return $output;
1299 }
1300
1301
1302 function tutor_single_quiz_no_course_belongs($echo = true){
1303 ob_start();
1304 tutor_load_template( 'single.quiz.no_course_belongs' );
1305 $output = apply_filters( 'tutor_single_quiz/no_course_belongs', ob_get_clean() );
1306
1307 if ( $echo ) {
1308 echo $output;
1309 }
1310 return $output;
1311 }
1312
1313 function single_quiz_contents($echo = true){
1314
1315 ob_start();
1316 tutor_load_template( 'single.quiz.single_quiz_contents' );
1317 $output = apply_filters( 'tutor_single_quiz/single_quiz_contents', ob_get_clean() );
1318
1319 if ( $echo ) {
1320 echo $output;
1321 }
1322 return $output;
1323 }
1324
1325 function get_tutor_course_level($course_id = 0){
1326 if ( ! $course_id){
1327 $course_id = get_the_ID();
1328 }
1329 if ( ! $course_id){
1330 return '';
1331 }
1332
1333 $course_level = get_post_meta($course_id, '_tutor_course_level', true);
1334
1335 if ($course_level){
1336 return tutor_utils()->course_levels($course_level);
1337 }
1338 return false;
1339 }
1340
1341 if ( ! function_exists('get_tutor_course_duration_context')) {
1342 function get_tutor_course_duration_context( $course_id = 0 ) {
1343 if ( ! $course_id ) {
1344 $course_id = get_the_ID();
1345 }
1346 if ( ! $course_id ) {
1347 return '';
1348 }
1349 $duration = get_post_meta( $course_id, '_course_duration', true );
1350 $durationHours = tutor_utils()->avalue_dot( 'hours', $duration );
1351 $durationMinutes = tutor_utils()->avalue_dot( 'minutes', $duration );
1352 $durationSeconds = tutor_utils()->avalue_dot( 'seconds', $duration );
1353
1354 if ( $duration ) {
1355 $output = '';
1356 if ( $durationHours > 0 ) {
1357 $output .= $durationHours . "h ";
1358 }
1359
1360 if ( $durationMinutes > 0 ) {
1361 $output .= $durationMinutes . "m ";
1362 }
1363
1364 if ( $durationSeconds > 0 ) {
1365 $output .= $durationSeconds ."s ";
1366 }
1367
1368 return $output;
1369 }
1370
1371 return false;
1372 }
1373 }
1374 if ( ! function_exists('get_tutor_course_categories')){
1375 function get_tutor_course_categories($course_id = 0){
1376 if ( ! $course_id ) {
1377 $course_id = get_the_ID();
1378 }
1379 $terms = get_the_terms( $course_id, 'course-category' );
1380
1381 return $terms;
1382 }
1383 }
1384
1385 /**
1386 * @param int $course_id
1387 *
1388 * @return array|false|WP_Error
1389 *
1390 * Get course tags
1391 */
1392
1393 if ( ! function_exists('get_tutor_course_tags')){
1394 function get_tutor_course_tags($course_id = 0){
1395 if ( ! $course_id ) {
1396 $course_id = get_the_ID();
1397 }
1398 $terms = get_the_terms( $course_id, 'course-tag' );
1399
1400 return $terms;
1401 }
1402 }
1403
1404 /**
1405 * @param bool $echo
1406 *
1407 * @return mixed|void
1408 *
1409 * Template for course tags html
1410 */
1411
1412 if ( ! function_exists('tutor_course_tags_html')) {
1413 function tutor_course_tags_html( $echo = true ) {
1414 ob_start();
1415 tutor_load_template( 'single.course.tags' );
1416 $output = apply_filters( 'tutor_course/single/tags_html', ob_get_clean() );
1417
1418 if ( $echo ) {
1419 echo $output;
1420 }
1421
1422 return $output;
1423 }
1424 }
1425
1426 /**
1427 * @param bool $echo
1428 *
1429 * @return mixed
1430 *
1431 * Get Q&A in lesson sidebar
1432 */
1433
1434 if ( ! function_exists('tutor_lesson_sidebar_question_and_answer')) {
1435 function tutor_lesson_sidebar_question_and_answer( $echo = true ) {
1436 ob_start();
1437 tutor_load_template( 'single.lesson.sidebar_question_and_answer' );
1438 $output = apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', ob_get_clean() );
1439
1440 if ( $echo ) {
1441 echo $output;
1442 }
1443
1444 return $output;
1445 }
1446 }
1447
1448 /**
1449 * @param bool $echo
1450 *
1451 * @return mixed|void
1452 *
1453 * Get Social Share button to share on social media
1454 */
1455
1456 if ( ! function_exists('tutor_social_share')) {
1457 function tutor_social_share( $echo = true ) {
1458 ob_start();
1459 tutor_load_template( 'single.course.social_share' );
1460 $output = apply_filters( 'tutor_course/single/social_share', ob_get_clean() );
1461
1462 if ( $echo ) {
1463 echo $output;
1464 }
1465
1466 return $output;
1467 }
1468 }
1469
1470 /**
1471 * @param bool $echo
1472 *
1473 * @return mixed
1474 *
1475 * Get Assignment content
1476 *
1477 * @since v.1.3.3
1478 */
1479
1480 if ( ! function_exists('tutor_assignment_content')) {
1481 function tutor_assignment_content( $echo = true ) {
1482 ob_start();
1483 tutor_load_template( 'single.assignment.content' );
1484 $output = apply_filters( 'tutor_assignment/single/content', ob_get_clean() );
1485
1486 if ( $echo ) {
1487 echo $output;
1488 }
1489
1490 return $output;
1491 }
1492 }
1493
1494 /**
1495 * @param string $msg
1496 * @param string $title
1497 * @param string $type
1498 *
1499 * @return string
1500 *
1501 * @since v.1.4.0
1502 */
1503
1504 if ( ! function_exists('get_tnotice')) {
1505 function get_tnotice( $msg = '', $title = 'Success', $type = 'success' ) {
1506
1507 $output = '<div class="tnotice tnotice--' . $type . '">
1508 <div class="tnotice__icon">&iexcl;</div>
1509 <div class="tnotice__content">';
1510
1511 if ($title){
1512 $output .='<p class="tnotice__type">' . $title . '</p>';
1513 }
1514 $output .='<p class="tnotice__message">' . $msg . '</p>
1515 </div>
1516 </div>';
1517
1518 return $output;
1519 }
1520 }
1521
1522 /**
1523 * @param int $course_content_id
1524 * @param bool $echo
1525 *
1526 * @return mixed|void
1527 *
1528 * Next Previous Pagination
1529 *
1530 * @since v.1.4.7
1531 */
1532
1533 function tutor_next_previous_pagination($course_content_id = 0, $echo = true){
1534 $content_id = tutils()->get_post_id($course_content_id);
1535 $contents = tutils()->get_course_prev_next_contents_by_id($content_id);
1536 $previous_id = $contents->previous_id;
1537 $next_id = $contents->next_id;
1538
1539 ob_start();
1540 do_action('tutor_lesson_next_previous_pagination_before');
1541 tutor_load_template( 'single.next-previous-pagination', compact('previous_id', 'next_id') );
1542 do_action('tutor_lesson_next_previous_pagination_after');
1543 $output = apply_filters( 'tutor/single/next_previous_pagination', ob_get_clean() );
1544
1545 if ( $echo ) {
1546 echo $output;
1547 }
1548
1549 return $output;
1550 }
1551
1552
1553 /**
1554 * Required login form in archive page
1555 * @param bool $echo
1556 * @since v 1.5.5
1557 *
1558 * @todo, it will be remove from 2.0.0
1559 */
1560 function tutor_archive_course_add_to_cart($echo = true){
1561 _deprecated_function( __FUNCTION__, '1.5.8' );
1562
1563 $output = '';
1564 if ( $echo ) {
1565 echo $output;
1566 }
1567 return $output;
1568 }
1569
1570 /**
1571 * @param bool $echo
1572 * @return string
1573 *
1574 * Display login form in popup where necessary
1575 *
1576 * @since v.1.5.8
1577 */
1578
1579 if ( ! function_exists('tutor_login_form_popup')) {
1580 function tutor_login_form_popup($echo = true){
1581 $output = '';
1582 ob_start();
1583 tutor_load_template('single.course.login');
1584 $login_form = apply_filters('tutor_course/global/login', ob_get_clean());
1585 $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>";
1586
1587 $output = apply_filters('tutor_login_form_popup_html', $output);
1588
1589 if ($echo) {
1590 echo $output;
1591 }
1592 return $output;
1593 }
1594 }