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.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 / templates / single / course / course-content.php
tutor / templates / single / course Last commit date
enrolled 4 years ago add-to-cart-edd.php 4 years ago add-to-cart-woocommerce.php 4 years ago add-to-cart.php 4 years ago continue-lesson.php 4 years ago course-benefits.php 4 years ago course-content.php 4 years ago course-enrolled-box.php 4 years ago course-entry-box.php 4 years ago course-requirements.php 4 years ago course-target-audience.php 4 years ago course-topics.php 4 years ago instructors.php 4 years ago lead-info.php 4 years ago material-includes.php 4 years ago q_and_a_turned_off.php 5 years ago reviews-loop.php 4 years ago reviews.php 4 years ago social_share.php 4 years ago tags.php 4 years ago wc-price-html.php 4 years ago
course-content.php
144 lines
1 <?php
2
3 /**
4 * Template for displaying course content
5 *
6 * @since v.1.0.0
7 *
8 * @author Themeum
9 * @url https://themeum.com
10 *
11 * @package TutorLMS/Templates
12 * @version 1.4.3
13 */
14
15 global $post;
16
17 function truncate($text, $length = 100, $ending = '...', $exact = true, $considerHtml = true)
18 {
19 if (is_array($ending)) {
20 extract($ending);
21 }
22 if ($considerHtml) {
23 if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
24 return $text;
25 }
26 $totalLength = mb_strlen($ending);
27 $openTags = array();
28 $truncate = '';
29 preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
30 foreach ($tags as $tag) {
31 if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) {
32 if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) {
33 array_unshift($openTags, $tag[2]);
34 } else if (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) {
35 $pos = array_search($closeTag[1], $openTags);
36 if ($pos !== false) {
37 array_splice($openTags, $pos, 1);
38 }
39 }
40 }
41 $truncate .= $tag[1];
42
43 $contentLength = mb_strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $tag[3]));
44 if ($contentLength + $totalLength > $length) {
45 $left = $length - $totalLength;
46 $entitiesLength = 0;
47 if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $tag[3], $entities, PREG_OFFSET_CAPTURE)) {
48 foreach ($entities[0] as $entity) {
49 if ($entity[1] + 1 - $entitiesLength <= $left) {
50 $left--;
51 $entitiesLength += mb_strlen($entity[0]);
52 } else {
53 break;
54 }
55 }
56 }
57
58 $truncate .= mb_substr($tag[3], 0 , $left + $entitiesLength);
59 break;
60 } else {
61 $truncate .= $tag[3];
62 $totalLength += $contentLength;
63 }
64 if ($totalLength >= $length) {
65 break;
66 }
67 }
68
69 } else {
70 if (mb_strlen($text) <= $length) {
71 return $text;
72 } else {
73 $truncate = mb_substr($text, 0, $length - strlen($ending));
74 }
75 }
76 if (!$exact) {
77 $spacepos = mb_strrpos($truncate, ' ');
78 if (isset($spacepos)) {
79 if ($considerHtml) {
80 $bits = mb_substr($truncate, $spacepos);
81 preg_match_all('/<\/([a-z]+)>/', $bits, $droppedTags, PREG_SET_ORDER);
82 if (!empty($droppedTags)) {
83 foreach ($droppedTags as $closingTag) {
84 if (!in_array($closingTag[1], $openTags)) {
85 array_unshift($openTags, $closingTag[1]);
86 }
87 }
88 }
89 }
90 $truncate = mb_substr($truncate, 0, $spacepos);
91 }
92 }
93
94 $truncate .= $ending;
95
96 if ($considerHtml) {
97 foreach ($openTags as $tag) {
98 $truncate .= '</'.$tag.'>';
99 }
100 }
101
102 return $truncate;
103 }
104
105
106
107 do_action('tutor_course/single/before/content');
108
109 if (tutor_utils()->get_option('enable_course_about', true, true)) {
110 $string = get_the_content();
111 $limit = 500;
112 $has_readmore = false;
113 if (strlen($string) > $limit) {
114 $has_readmore = true;
115 // truncate string
116 $first_part = truncate($string, $limit);
117 }
118 ?>
119 <div class='tab-item-content <?php echo $has_readmore ? 'tutor-has-showmore' : '' ?>'>
120 <div class='tutor-showmore-content'>
121 <div class="text-medium-h6 tutor-color-black">
122 <?php _e('About Course', 'tutor'); ?>
123 </div>
124 <div class="text-regular-body tutor-color-black-60 tutor-mt-12">
125 <?php
126 if ($has_readmore) {
127 echo "<div class='showmore-short-text'>{$first_part}</div>";
128 echo "<div class='showmore-text'>{$string}</div>";
129 } else {
130 echo $string;
131 }
132 ?>
133 </div>
134 </div>
135 <?php
136 if ($has_readmore) :
137 echo '<div class="tutor-showmore-btn tutor-mt-24" data-showmore="true"><button class="tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-md btn-showmore"><span class="btn-icon tutor-icon-plus-filled tutor-color-design-brand"></span><span class="tutor-color-black-60">Show More</span></button><button class="tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-md btn-showless"><span class="btn-icon tutor-icon-minus-filled tutor-color-design-brand"></span><span class="tutor-color-black-60">Show Less</span></button></div>';
138 endif;
139 ?>
140 </div>
141 <?php
142 }
143
144 do_action('tutor_course/single/after/content'); ?>