PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.5.4
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.5.4
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 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.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Providers / TemplateLayouts / YoutubeLayout.php
embedpress / EmbedPress / Providers / TemplateLayouts Last commit date
YoutubeLayout.php 1 month ago
YoutubeLayout.php
463 lines
1 <?php
2
3 namespace EmbedPress\Providers\TemplateLayouts;
4
5
6 use Embera\Provider\ProviderAdapter;
7 use Embera\Provider\ProviderInterface;
8 use Embera\Url;
9 use EmbedPress\Includes\Classes\Helper;
10
11
12 class YoutubeLayout
13 {
14
15
16
17 public static function create_channel_info_layout($channel_info, $channel_url)
18 {
19 $title = isset($channel_info['snippet']['title']) ? $channel_info['snippet']['title'] : null;
20 $handle = isset($channel_info['snippet']['customUrl']) ? $channel_info['snippet']['customUrl'] : null;
21 $subscriberCount = isset($channel_info['statistics']['subscriberCount']) ? $channel_info['statistics']['subscriberCount'] : null;
22 $videoCount = isset($channel_info['statistics']['videoCount']) ? $channel_info['statistics']['videoCount'] : null;
23 $thumbnailUrl = isset($channel_info['snippet']['thumbnails']['high']['url']) ? $channel_info['snippet']['thumbnails']['high']['url'] : null;
24
25 ob_start();
26 ?>
27 <div class="channel-header" data-channel-url="<?php echo esc_url($channel_url); ?>">
28 <img src="<?php echo esc_url($thumbnailUrl); ?>" alt="<?php echo esc_attr($title); ?>" class="profile-picture">
29 <div class="channel-info">
30 <div class="info-description">
31 <h1 class="channel-name"><?php echo esc_html($title); ?></h1>
32 <p class="channel-details"><?php echo esc_html($handle); ?> · <?php echo esc_html(Helper::format_number($subscriberCount)); ?> subscribers · <?php echo esc_html(Helper::format_number($videoCount)); ?> videos</p>
33 </div>
34 <a target="_blank" href="<?php echo esc_url('https://www.youtube.com/' . $handle); ?>" class="subscribe-button">
35 <svg width="16" height="20" viewBox="0 0 16 20" fill="none" xmlns="http://www.w3.org/2000/svg">
36 <path fill-rule="evenodd" clip-rule="evenodd" d="M9.467 1.653A1.6 1.6 0 0 1 8.4 3.093 6.026 6.026 0 0 1 14 9.067v4.586c0 1.067.053 1.92.96 2.4a.694.694 0 0 1-.267 1.28H8.88a1.333 1.333 0 1 1-1.76 0H1.36a.693.693 0 0 1-.32-1.28c.907-.48.96-1.333.96-2.4V9.067a6.027 6.027 0 0 1 5.6-5.974 1.493 1.493 0 1 1 1.867-1.44m-1.44 2.774a4.8 4.8 0 0 0-4.694 4.64v4.693c0 .587 0 1.493-.373 2.293h10.133c-.426-.8-.373-1.653-.373-2.293V9.067a4.8 4.8 0 0 0-1.405-3.289c-.874-.874-2.052-1.324-3.288-1.351" fill="#fff" /></svg>
37 <?php echo esc_html__('Subscribe', 'embedpress'); ?></a>
38 </div>
39 </div>
40 <?php
41
42 $channel_layout = ob_get_clean();
43
44 return $channel_layout;
45 }
46
47
48 public static function generate_youtube_video_description($video_data) {
49 $title = isset($video_data['snippet']['title']) ? $video_data['snippet']['title'] : null;
50 $description = isset($video_data['snippet']['description']) ? $video_data['snippet']['description'] : null;
51 $publishedAt = isset($video_data['snippet']['publishedAt']) ? date("M j, Y", strtotime($video_data['snippet']['publishedAt'])) : null;
52 $channelTitle = isset($video_data['snippet']['channelTitle']) ? $video_data['snippet']['channelTitle'] : null;
53 $viewCount = isset($video_data['statistics']['viewCount']) ? $video_data['statistics']['viewCount'] : null;
54 $likeCount = isset($video_data['statistics']['likeCount']) ? $video_data['statistics']['likeCount'] : null;
55 $commentCount = isset($video_data['statistics']['commentCount']) ? $video_data['statistics']['commentCount'] : null;
56 $videoId = isset($video_data['id']) ? $video_data['id'] : null;
57 $videoUrl = $videoId ? "https://www.youtube.com/watch?v={$videoId}" : null;
58
59
60 $title = esc_html($title);
61 $description = esc_html($description);
62 $viewCount = esc_html($viewCount);
63 $likeCount = esc_html($likeCount);
64 $commentCount = esc_html($commentCount);
65 $publishedAt = esc_html($publishedAt);
66
67 $html = "
68 <div class='youtube-video-description'>
69 <div class='youtube-video-header'>
70 <h1>{$title}</h1>
71 <div class='youtube-video-meta'>
72 <span>{$viewCount} views</span>
73 <span>{$publishedAt}</span>
74 </div>
75 </div>
76 <div class='youtube-video-body'>
77 <p>{$description}</p>
78 </div>
79 <div class='youtube-video-footer'>
80 <div class='youtube-video-stats'>
81 <span><svg width='20' height='17.539' viewBox='0 0 20 17.539' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M12.648.109a2.814 2.814 0 0 0-3.477 1.93l-.223.781a3.4 3.4 0 0 1-.762 1.367L6.182 6.39a.937.937 0 0 0 1.387 1.261l2.004-2.203a5.3 5.3 0 0 0 1.176-2.113l.223-.781a.937.937 0 1 1 1.805.515l-.223.781a7.2 7.2 0 0 1-1.039 2.168c-.203.285-.227.66-.066.973s.48.508.832.508H17.5a.627.627 0 0 1 .219 1.211.94.94 0 0 0-.375 1.5.624.624 0 0 1-.352 1.027.938.938 0 0 0-.562 1.504.625.625 0 0 1-.265.969.94.94 0 0 0-.563 1.125.627.627 0 0 1-.602.793h-3.809c-.492 0-.977-.145-1.387-.418l-2.41-1.605c-.43-.289-1.012-.172-1.301.262s-.172 1.012.262 1.301l2.41 1.605c.719.48 1.563.734 2.426.734H15a2.5 2.5 0 0 0 2.5-2.422 2.5 2.5 0 0 0 .887-2.461 2.49 2.49 0 0 0 .879-2.722A2.53 2.53 0 0 0 20 8.125a2.5 2.5 0 0 0-2.5-2.5h-3.605c.184-.406.34-.828.461-1.258l.223-.781a2.814 2.814 0 0 0-1.93-3.477M1.25 6.25A1.25 1.25 0 0 0 0 7.5v8.75c0 .691.559 1.25 1.25 1.25h2.5A1.25 1.25 0 0 0 5 16.25V7.5a1.25 1.25 0 0 0-1.25-1.25z' fill='#fff'/></svg> {$likeCount}</span>
82 <span><svg width='20' height='15.975' viewBox='0 0 20 15.975' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M2.783 9.644a1.5 1.5 0 0 0-.234-1.741c-.664-.699-1.02-1.538-1.02-2.412 0-1.981 1.991-3.994 4.992-3.994s4.992 2.012 4.992 3.994-1.991 3.994-4.992 3.994a6.3 6.3 0 0 1-1.179-.112 1.5 1.5 0 0 0-.958.131q-.192.098-.393.187c-.499.225-1.027.421-1.557.562a14 14 0 0 0 .346-.608zM.031 5.491c0 1.304.537 2.499 1.432 3.441l-.087.159C1.055 9.665.68 10.23.234 10.717a.751.751 0 0 0 .546 1.264c1.342 0 2.699-.415 3.828-.927q.227-.104.443-.212c.471.094.964.14 1.47.14 3.585 0 6.49-2.459 6.49-5.491S10.106 0 6.521 0 .031 2.459.031 5.491m13.479 9.485c.505 0 .995-.05 1.47-.14q.217.109.443.212c1.129.512 2.487.927 3.828.927a.746.746 0 0 0 .542-1.26c-.443-.487-.817-1.051-1.142-1.626l-.087-.159c.899-.945 1.435-2.14 1.435-3.445 0-2.945-2.743-5.351-6.184-5.485q.192.712.193 1.491v.019c2.721.209 4.493 2.106 4.493 3.975 0 .874-.356 1.713-1.02 2.409a1.5 1.5 0 0 0-.234 1.741l.1.184q.118.21.246.424a10 10 0 0 1-1.557-.562q-.201-.089-.393-.187a1.5 1.5 0 0 0-.958-.131q-.566.112-1.179.112c-1.925 0-3.432-.827-4.268-1.944a8.7 8.7 0 0 1-1.56.368c1.058 1.823 3.274 3.078 5.832 3.078' fill='#fff'/></svg> {$commentCount}</span>
83 </div>
84 </div>
85 </div>";
86
87 return $html;
88 }
89
90
91 public static function create_list_layout($jsonResult, $gallobj, $options, $data, $channelTitle, $channelThumb){
92
93 // $channelTitle = $data['get_channel_info']['snippet']['title'];
94 // $channelThumb = $data['get_channel_info']['snippet']['thumbnails']['default']['url'];
95
96 foreach ($jsonResult->items as $item) : ?>
97 <?php
98 $privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
99 $thumbnail = Helper::get_thumbnail_url($item, $options['thumbnail'], $privacyStatus);
100 $vid = Helper::get_id($item);
101 $videoTitle = isset($item->snippet->title) ? $item->snippet->title : '';
102 $videoDescription = isset($item->snippet->description) ? $item->snippet->description : '';
103
104 $publishedAt = isset($item->snippet->publishedAt) ? $item->snippet->publishedAt : '';
105
106 if (empty($gallobj->first_vid)) {
107 $gallobj->first_vid = $vid;
108 }
109 if ($privacyStatus == 'private' && $options['hideprivate']) {
110 continue;
111 }
112 ?>
113 <div class="item" data-vid="<?php echo $vid; ?>">
114 <div class="thumb" style="background: <?php echo "url({$thumbnail}) no-repeat center"; ?>">
115 <div class="play-icon">
116 <img src="<?php echo esc_url(EMBEDPRESS_URL_ASSETS. 'images/youtube.svg'); ?>" alt="">
117 </div>
118 </div>
119 <div class="body youtube-body-content">
120 <div class="description-container">
121 <div class="thumbnail"><img src="<?php echo esc_url($channelThumb ); ?>"/></div>
122 <div class="details">
123 <div class="channel"><?php echo esc_html($channelTitle); ?></div>
124 <div class="title"><?php echo esc_html($videoTitle); ?></div>
125 <p class="description"><?php echo esc_html(Helper::trimTitle($videoDescription, 25)); ?></p>
126
127 <div class="views-time">
128 <span class="time"><?php echo esc_html(Helper::timeAgo($publishedAt)); ?></span>
129 </div>
130 </div>
131 </div>
132 </div>
133 </div>
134 <?php endforeach;
135 }
136 public static function create_gallery_layout($jsonResult, $gallobj, $options, $data, $channelTitle, $channelThumb){
137
138 // $channelTitle = $data['get_channel_info']['snippet']['title'];
139 // $channelThumb = $data['get_channel_info']['snippet']['thumbnails']['default']['url'];
140
141 foreach ($jsonResult->items as $item) : ?>
142 <?php
143 $privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
144 $thumbnail = Helper::get_thumbnail_url($item, $options['thumbnail'], $privacyStatus);
145 $vid = Helper::get_id($item);
146 $videoTitle = isset($item->snippet->title) ? $item->snippet->title : '';
147 $publishedAt = isset($item->snippet->publishedAt) ? $item->snippet->publishedAt : '';
148
149 if (empty($gallobj->first_vid)) {
150 $gallobj->first_vid = $vid;
151 }
152 if ($privacyStatus == 'private' && $options['hideprivate']) {
153 continue;
154 }
155 ?>
156 <div class="item" data-vid="<?php echo $vid; ?>">
157 <div class="thumb" style="background: <?php echo "url({$thumbnail}) no-repeat center"; ?>">
158 <div class="play-icon">
159 <img src="<?php echo esc_url(EMBEDPRESS_URL_ASSETS. 'images/youtube.svg'); ?>" alt="">
160 </div>
161 </div>
162 <div class="body youtube-body-content">
163 <div class="description-container">
164 <div class="thumbnail"><img src="<?php echo esc_url($channelThumb ); ?>"/></div>
165 <div class="details">
166 <div class="channel"><?php echo esc_html($channelTitle); ?></div>
167 <div class="title"><?php echo esc_html(Helper::trimTitle($videoTitle, 6)); ?></div>
168
169 <div class="views-time">
170 <span class="time"><?php echo esc_html(Helper::timeAgo($publishedAt)); ?></span>
171 </div>
172 </div>
173 </div>
174 </div>
175 </div>
176 <?php endforeach;
177 }
178
179
180 public static function create_youtube_layout($options, $data, $layout, $url) {
181 $nextPageToken = '';
182 $prevPageToken = '';
183 $gallobj = new \stdClass();
184 $options = wp_parse_args($options, [
185 'playlistId' => '',
186 'pageToken' => '',
187 'pagesize' => $data['get_pagesize'] ? $data['get_pagesize'] : 6,
188 'currentpage' => '',
189 'columns' => 3,
190 'thumbnail' => 'medium',
191 'gallery' => true,
192 'autonext' => true,
193 'thumbplay' => true,
194 'apiKey' => $data['get_api_key'],
195 'hideprivate' => '',
196 ]);
197 $options['pagesize'] = $options['pagesize'] > 50 ? 50 : $options['pagesize'];
198 $options['pagesize'] = $options['pagesize'] < 1 ? 1 : $options['pagesize'];
199
200 if (empty($options['apiKey'])) {
201 $gallobj->html = $data['get_api_key_error_message'];
202 return $gallobj;
203 }
204
205 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status,contentDetails&playlistId=' . $options['playlistId']
206 . '&maxResults=' . $options['pagesize']
207 . '&key=' . $options['apiKey'];
208 if ($options['pageToken'] != null) {
209 $apiEndpoint .= '&pageToken=' . $options['pageToken'];
210 }
211
212 $transient_key = 'ep_embed_youtube_channel_' . md5($apiEndpoint);
213 $gallobj->transient_key = $transient_key;
214 $jsonResult = get_transient($transient_key);
215
216
217 if (empty($jsonResult)) {
218 $apiResult = wp_remote_get($apiEndpoint, array('timeout' => $data['curltimeout']));
219 if (is_wp_error($apiResult)) {
220 $gallobj->html = Helper::clean_api_error_html($apiResult->get_error_message(), true);
221 return $gallobj;
222 }
223 $jsonResult = json_decode($apiResult['body']);
224
225 if (empty($jsonResult->error)) {
226 set_transient($transient_key, $jsonResult, MINUTE_IN_SECONDS * 20);
227 }
228 else{
229 set_transient($transient_key, $jsonResult, 10);
230 }
231 }
232
233
234 if (isset($jsonResult->error)) {
235 if(!empty($jsonResult->error->errors[0]->reason) && $jsonResult->error->errors[0]->reason == 'playlistNotFound'){
236 $gallobj->html = Helper::clean_api_error_html(__('There is nothing on the playlist.', 'embedpress'));
237 return $gallobj;
238 }
239 if (isset($jsonResult->error->message)) {
240 $gallobj->html = Helper::clean_api_error_html($jsonResult->error->message);
241 return $gallobj;
242 }
243 $gallobj->html = Helper::clean_api_error_html(__('Sorry, there may be an issue with your YouTube API key.', 'embedpress'));
244 return $gallobj;
245 }
246
247
248
249 $resultsPerPage = $jsonResult->pageInfo->resultsPerPage;
250 $totalResults = $jsonResult->pageInfo->totalResults;
251 $totalPages = ceil($totalResults / $resultsPerPage);
252 if (isset($jsonResult->nextPageToken)) {
253 $nextPageToken = $jsonResult->nextPageToken;
254 }
255
256 if (isset($jsonResult->prevPageToken)) {
257 $prevPageToken = $jsonResult->prevPageToken;
258 }
259
260
261 if (!empty($jsonResult->items) && is_array($jsonResult->items)) :
262 if($options['gallery'] === "false"){
263 $gallobj->html = "";
264 if(count($jsonResult->items) === 1){
265 $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
266 }
267 return $gallobj;
268 }
269
270 // if(count($jsonResult->items) === 1 && empty($nextPageToken) && empty($prevPageToken)){
271 // $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
272 // $gallobj->html = "";
273 // return $gallobj;
274 // }
275
276 if (strpos($options['playlistId'], 'UU') === 0) {
277 // sort only channels
278 usort($jsonResult->items, array(Helper::class, 'compare_vid_date')); // sorts in place
279 }
280
281
282 ob_start();
283
284 ?>
285
286
287 <?php
288 $channel_info = $data['get_channel_info'];
289
290
291
292 $chanelTitle = isset($channel_info['snippet']['title']) ? $channel_info['snippet']['title'] : null;
293 $channelThumb = isset($channel_info['snippet']['thumbnails']['high']['url']) ? $channel_info['snippet']['thumbnails']['high']['url'] : null;
294
295
296 echo self::create_channel_info_layout($channel_info, $url);
297
298 $channel_id = '';
299 if(isset($channel_info['id'])) {
300 $channel_id = $channel_info['id'];
301 }
302
303 $carouselWrapperClass = '';
304 $carouselSelectorId = '';
305 if($layout == 'carousel') {
306 $carouselWrapperClass = 'youtube-carousel';
307 $carouselSelectorId = 'data-youtube-channel-carousel="carousel-'.esc_attr(md5($channel_id)).'"';
308 }
309
310 ?>
311
312 <div class="ep-youtube__content__block" <?php echo $carouselSelectorId; ?> data-unique-id="<?php echo esc_attr(md5($channel_id)); ?>">
313 <div class="youtube__content__body youtube-carousel-container">
314 <div class="content__wrap <?php echo esc_attr($carouselWrapperClass); ?>" >
315
316 <?php
317 if($layout === 'gallery'){
318 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
319 }
320
321 else if($layout === 'list'){
322 echo self::create_list_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
323 }
324 else if($layout === 'grid'){
325 do_action('embedpress/youtube_grid_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
326
327 }
328 else if($layout === 'carousel'){
329 do_action('embedpress/youtube_carousel_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
330 }
331 else{
332 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
333
334 }
335 ?>
336 <div class="item" style="height: 0"></div>
337 </div>
338
339 <!-- Pagination and other content remains unchanged -->
340 <?php if ($totalPages > 1 && $layout !== 'carousel') : ?>
341 <div class="ep-youtube__content__pagination <?php echo (empty($prevPageToken) && empty($nextPageToken)) ? ' hide ' : ''; ?>">
342 <div
343 class="ep-prev" <?php echo empty($prevPageToken) ? ' style="display:none" ' : ''; ?>
344 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
345 data-pagetoken="<?php echo esc_attr($prevPageToken) ?>"
346 data-pagesize="<?php echo intval($options['pagesize']) ?>"
347
348 >
349 <span><?php _e("Prev", "embedpress"); ?></span>
350 </div>
351 <div class="is_desktop_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
352 <?php
353
354 $numOfPages = $totalPages;
355 $renderedEllipses = false;
356
357 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
358
359 for($i = 1; $i<=$numOfPages; $i++)
360 {
361 //render pages 1 - 3
362 if($i < 4) {
363 //render link
364 $is_current = $i == (int)$currentPage? "active__current_page" : "";
365
366 echo wp_kses_post("<span class='page-number $is_current' data-page='$i'>$i</span>");
367
368 }
369
370 //render current page number
371 else if($i == (int)$currentPage) {
372 //render link
373 echo wp_kses_post('<span class="page-number active__current_page" data-page="'.$i.'">'.$i.'</span>');
374 //reset ellipses
375 $renderedEllipses = false;
376 }
377
378 //last page number
379 else if ($i >= $numOfPages - 1) {
380 //render link
381 echo wp_kses_post('<span class="page-number" data-page="'.$i.'">'.$i.'</span>');
382 }
383
384 //make sure you only do this once per ellipses group
385 else {
386 if (!$renderedEllipses){
387 print("...");
388 $renderedEllipses = true;
389 }
390 }
391 }
392 ?>
393
394 </div>
395
396 <div class="is_mobile_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
397 <?php
398
399 $numOfPages = $totalPages;
400 $renderedEllipses = false;
401
402 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
403
404 for($i = 1; $i<=$numOfPages; $i++)
405 {
406
407 //render current page number
408 if($i == (int)$currentPage) {
409 //render link
410 echo wp_kses_post('<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
411 //reset ellipses
412 $renderedEllipses = false;
413 }
414
415 //last page number
416 else if ($i >= $numOfPages ) {
417 //render link
418 echo wp_kses_post('...<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
419 }
420 }
421 ?>
422
423 </div>
424
425
426 <div
427 class="ep-next " <?php echo empty($nextPageToken) ? ' style="display:none" ' : ''; ?>
428 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
429 data-pagetoken="<?php echo esc_attr($nextPageToken) ?>"
430 data-pagesize="<?php echo intval($options['pagesize']) ?>"
431 >
432 <span><?php _e("Next ", "embedpress"); ?> </span>
433 </div>
434 </div>
435 <?php endif; ?>
436
437 </div>
438
439
440 <?php if($layout === 'carousel'): ?>
441 <div class="carousel-controls">
442 <button class="preview"></button>
443 <button class="next"></button>
444 <?php endif; ?>
445
446 </div>
447
448 <?php
449 $gallobj->html = ob_get_clean();
450 else:
451 $gallobj->html = Helper::clean_api_error_html(__("There is nothing on the playlist.", 'embedpress'));
452 endif;
453
454 return $gallobj;
455 }
456
457 }
458
459
460
461
462
463