PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.1.6
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.1.6
4.6.0 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 year ago
YoutubeLayout.php
461 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', 'embbedpress'); ?></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 $html = "
61 <div class='youtube-video-description'>
62 <div class='youtube-video-header'>
63 <h1>{$title}</h1>
64 <div class='youtube-video-meta'>
65 <span>{$viewCount} views</span>
66 <span>{$publishedAt}</span>
67 </div>
68 </div>
69 <div class='youtube-video-body'>
70 <p>{$description}</p>
71 </div>
72 <div class='youtube-video-footer'>
73 <div class='youtube-video-stats'>
74 <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>
75 <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>
76 </div>
77 </div>
78 </div>";
79
80 return $html;
81 }
82
83
84 public static function create_list_layout($jsonResult, $gallobj, $options, $data, $channelTitle, $channelThumb){
85
86 // $channelTitle = $data['get_channel_info']['snippet']['title'];
87 // $channelThumb = $data['get_channel_info']['snippet']['thumbnails']['default']['url'];
88
89 foreach ($jsonResult->items as $item) : ?>
90 <?php
91 $privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
92 $thumbnail = Helper::get_thumbnail_url($item, $options['thumbnail'], $privacyStatus);
93 $vid = Helper::get_id($item);
94 $videoTitle = isset($item->snippet->title) ? $item->snippet->title : '';
95 $videoDescription = isset($item->snippet->description) ? $item->snippet->description : '';
96
97 $publishedAt = isset($item->snippet->publishedAt) ? $item->snippet->publishedAt : '';
98
99 if (empty($gallobj->first_vid)) {
100 $gallobj->first_vid = $vid;
101 }
102 if ($privacyStatus == 'private' && $options['hideprivate']) {
103 continue;
104 }
105 ?>
106 <div class="item" data-vid="<?php echo $vid; ?>">
107 <div class="thumb" style="background: <?php echo "url({$thumbnail}) no-repeat center"; ?>">
108 <div class="play-icon">
109 <img src="<?php echo esc_url(EMBEDPRESS_URL_ASSETS . 'images/youtube/youtube-play.png'); ?>" alt="">
110 </div>
111 </div>
112 <div class="body youtube-body-content">
113 <div class="description-container">
114 <div class="thumbnail"><img src="<?php echo esc_url($channelThumb ); ?>"/></div>
115 <div class="details">
116 <div class="channel"><?php echo esc_html($channelTitle); ?></div>
117 <div class="title"><?php echo esc_html($videoTitle); ?></div>
118 <p class="description"><?php echo esc_html(Helper::trimTitle($videoDescription, 25)); ?></p>
119
120 <div class="views-time">
121 <span class="time"><?php echo esc_html(Helper::timeAgo($publishedAt)); ?></span>
122 </div>
123 </div>
124 </div>
125 </div>
126 </div>
127 <?php endforeach;
128 }
129 public static function create_gallery_layout($jsonResult, $gallobj, $options, $data, $channelTitle, $channelThumb){
130
131 // $channelTitle = $data['get_channel_info']['snippet']['title'];
132 // $channelThumb = $data['get_channel_info']['snippet']['thumbnails']['default']['url'];
133
134 foreach ($jsonResult->items as $item) : ?>
135 <?php
136 $privacyStatus = isset($item->status->privacyStatus) ? $item->status->privacyStatus : null;
137 $thumbnail = Helper::get_thumbnail_url($item, $options['thumbnail'], $privacyStatus);
138 $vid = Helper::get_id($item);
139 $videoTitle = isset($item->snippet->title) ? $item->snippet->title : '';
140 $publishedAt = isset($item->snippet->publishedAt) ? $item->snippet->publishedAt : '';
141
142 if (empty($gallobj->first_vid)) {
143 $gallobj->first_vid = $vid;
144 }
145 if ($privacyStatus == 'private' && $options['hideprivate']) {
146 continue;
147 }
148 ?>
149 <div class="item" data-vid="<?php echo $vid; ?>">
150 <div class="thumb" style="background: <?php echo "url({$thumbnail}) no-repeat center"; ?>">
151 <div class="play-icon">
152 <img src="<?php echo esc_url(EMBEDPRESS_URL_ASSETS . 'images/youtube/youtube-play.png'); ?>" alt="">
153 </div>
154 </div>
155 <div class="body youtube-body-content">
156 <div class="description-container">
157 <div class="thumbnail"><img src="<?php echo esc_url($channelThumb ); ?>"/></div>
158 <div class="details">
159 <div class="channel"><?php echo esc_html($channelTitle); ?></div>
160 <div class="title"><?php echo esc_html(Helper::trimTitle($videoTitle, 6)); ?></div>
161
162 <div class="views-time">
163 <span class="time"><?php echo esc_html(Helper::timeAgo($publishedAt)); ?></span>
164 </div>
165 </div>
166 </div>
167 </div>
168 </div>
169 <?php endforeach;
170 }
171
172
173 public static function create_youtube_layout($options, $data, $layout, $url) {
174 $nextPageToken = '';
175 $prevPageToken = '';
176 $gallobj = new \stdClass();
177 $options = wp_parse_args($options, [
178 'playlistId' => '',
179 'pageToken' => '',
180 'pagesize' => $data['get_pagesize'] ? $data['get_pagesize'] : 6,
181 'currentpage' => '',
182 'columns' => 3,
183 'thumbnail' => 'medium',
184 'gallery' => true,
185 'autonext' => true,
186 'thumbplay' => true,
187 'apiKey' => $data['get_api_key'],
188 'hideprivate' => '',
189 ]);
190 $options['pagesize'] = $options['pagesize'] > 50 ? 50 : $options['pagesize'];
191 $options['pagesize'] = $options['pagesize'] < 1 ? 1 : $options['pagesize'];
192
193 if (empty($options['apiKey'])) {
194 $gallobj->html = $data['get_api_key_error_message'];
195 return $gallobj;
196 }
197
198 $apiEndpoint = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,status,contentDetails&playlistId=' . $options['playlistId']
199 . '&maxResults=' . $options['pagesize']
200 . '&key=' . $options['apiKey'];
201 if ($options['pageToken'] != null) {
202 $apiEndpoint .= '&pageToken=' . $options['pageToken'];
203 }
204
205
206
207 $transient_key = 'ep_embed_youtube_channel_' . md5($apiEndpoint);
208 $gallobj->transient_key = $transient_key;
209 $jsonResult = get_transient($transient_key);
210
211
212 if (empty($jsonResult)) {
213 $apiResult = wp_remote_get($apiEndpoint, array('timeout' => $data['curltimeout']));
214 if (is_wp_error($apiResult)) {
215 $gallobj->html = Helper::clean_api_error_html($apiResult->get_error_message(), true);
216 return $gallobj;
217 }
218 $jsonResult = json_decode($apiResult['body']);
219
220 if (empty($jsonResult->error)) {
221 set_transient($transient_key, $jsonResult, MINUTE_IN_SECONDS * 20);
222 }
223 else{
224 set_transient($transient_key, $jsonResult, 10);
225 }
226 }
227
228
229
230 if (isset($jsonResult->error)) {
231 if(!empty($jsonResult->error->errors[0]->reason) && $jsonResult->error->errors[0]->reason == 'playlistNotFound'){
232 $gallobj->html = Helper::clean_api_error_html(__('There is nothing on the playlist.', 'embedpress'));
233 return $gallobj;
234 }
235 if (isset($jsonResult->error->message)) {
236 $gallobj->html = Helper::clean_api_error_html($jsonResult->error->message);
237 return $gallobj;
238 }
239 $gallobj->html = Helper::clean_api_error_html(__('Sorry, there may be an issue with your YouTube API key.', 'embedpress'));
240 return $gallobj;
241 }
242
243
244
245 $resultsPerPage = $jsonResult->pageInfo->resultsPerPage;
246 $totalResults = $jsonResult->pageInfo->totalResults;
247 $totalPages = ceil($totalResults / $resultsPerPage);
248 if (isset($jsonResult->nextPageToken)) {
249 $nextPageToken = $jsonResult->nextPageToken;
250 }
251
252 if (isset($jsonResult->prevPageToken)) {
253 $prevPageToken = $jsonResult->prevPageToken;
254 }
255
256
257 if (!empty($jsonResult->items) && is_array($jsonResult->items)) :
258 if($options['gallery'] === "false"){
259 $gallobj->html = "";
260 if(count($jsonResult->items) === 1){
261 $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
262 }
263 return $gallobj;
264 }
265
266 if(count($jsonResult->items) === 1 && empty($nextPageToken) && empty($prevPageToken)){
267 $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
268 $gallobj->html = "";
269 return $gallobj;
270 }
271
272 if (strpos($options['playlistId'], 'UU') === 0) {
273 // sort only channels
274 usort($jsonResult->items, array(Helper::class, 'compare_vid_date')); // sorts in place
275 }
276
277
278
279
280 ob_start();
281
282 ?>
283
284
285 <?php
286 $channel_info = $data['get_channel_info'];
287
288
289
290 $chanelTitle = isset($channel_info['snippet']['title']) ? $channel_info['snippet']['title'] : null;
291 $channelThumb = isset($channel_info['snippet']['thumbnails']['high']['url']) ? $channel_info['snippet']['thumbnails']['high']['url'] : null;
292
293
294 echo self::create_channel_info_layout($channel_info, $url);
295
296 $channel_id = '';
297 if(isset($channel_info['id'])) {
298 $channel_id = $channel_info['id'];
299 }
300
301 $carouselWrapperClass = '';
302 $carouselSelectorId = '';
303 if($layout == 'carousel') {
304 $carouselWrapperClass = 'youtube-carousel';
305 $carouselSelectorId = 'data-youtube-channel-carousel="carousel-'.esc_attr(md5($channel_id)).'"';
306 }
307
308 ?>
309
310 <div class="ep-youtube__content__block" <?php echo $carouselSelectorId; ?> data-unique-id="<?php echo esc_attr(md5($channel_id)); ?>">
311 <div class="youtube__content__body youtube-carousel-container">
312 <div class="content__wrap <?php echo esc_attr($carouselWrapperClass); ?>" >
313
314 <?php
315 if($layout === 'gallery'){
316 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
317 }
318
319 else if($layout === 'list'){
320 echo self::create_list_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
321 }
322 else if($layout === 'grid'){
323 do_action('embedpress/youtube_grid_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
324
325 }
326 else if($layout === 'carousel'){
327 do_action('embedpress/youtube_carousel_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
328 }
329 else{
330 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
331
332 }
333 ?>
334 <div class="item" style="height: 0"></div>
335 </div>
336
337 <!-- Pagination and other content remains unchanged -->
338 <?php if ($totalPages > 1 && $layout !== 'carousel') : ?>
339 <div class="ep-youtube__content__pagination <?php echo (empty($prevPageToken) && empty($nextPageToken)) ? ' hide ' : ''; ?>">
340 <div
341 class="ep-prev" <?php echo empty($prevPageToken) ? ' style="display:none" ' : ''; ?>
342 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
343 data-pagetoken="<?php echo esc_attr($prevPageToken) ?>"
344 data-pagesize="<?php echo intval($options['pagesize']) ?>"
345
346 >
347 <span><?php _e("Prev", "embedpress"); ?></span>
348 </div>
349 <div class="is_desktop_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
350 <?php
351
352 $numOfPages = $totalPages;
353 $renderedEllipses = false;
354
355 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
356
357 for($i = 1; $i<=$numOfPages; $i++)
358 {
359 //render pages 1 - 3
360 if($i < 4) {
361 //render link
362 $is_current = $i == (int)$currentPage? "active__current_page" : "";
363
364 echo wp_kses_post("<span class='page-number $is_current' data-page='$i'>$i</span>");
365
366 }
367
368 //render current page number
369 else if($i == (int)$currentPage) {
370 //render link
371 echo wp_kses_post('<span class="page-number active__current_page" data-page="'.$i.'">'.$i.'</span>');
372 //reset ellipses
373 $renderedEllipses = false;
374 }
375
376 //last page number
377 else if ($i >= $numOfPages - 1) {
378 //render link
379 echo wp_kses_post('<span class="page-number" data-page="'.$i.'">'.$i.'</span>');
380 }
381
382 //make sure you only do this once per ellipses group
383 else {
384 if (!$renderedEllipses){
385 print("...");
386 $renderedEllipses = true;
387 }
388 }
389 }
390 ?>
391
392 </div>
393
394 <div class="is_mobile_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
395 <?php
396
397 $numOfPages = $totalPages;
398 $renderedEllipses = false;
399
400 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
401
402 for($i = 1; $i<=$numOfPages; $i++)
403 {
404
405 //render current page number
406 if($i == (int)$currentPage) {
407 //render link
408 echo wp_kses_post('<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
409 //reset ellipses
410 $renderedEllipses = false;
411 }
412
413 //last page number
414 else if ($i >= $numOfPages ) {
415 //render link
416 echo wp_kses_post('...<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
417 }
418 }
419 ?>
420
421 </div>
422
423
424 <div
425 class="ep-next " <?php echo empty($nextPageToken) ? ' style="display:none" ' : ''; ?>
426 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
427 data-pagetoken="<?php echo esc_attr($nextPageToken) ?>"
428 data-pagesize="<?php echo intval($options['pagesize']) ?>"
429 >
430 <span><?php _e("Next ", "embedpress"); ?> </span>
431 </div>
432 </div>
433 <?php endif; ?>
434
435 </div>
436
437
438 <?php if($layout === 'carousel'): ?>
439 <div class="carousel-controls">
440 <button class="preview"></button>
441 <button class="next"></button>
442 <?php endif; ?>
443
444 </div>
445
446 <?php
447 $gallobj->html = ob_get_clean();
448 else:
449 $gallobj->html = Helper::clean_api_error_html(__("There is nothing on the playlist.", 'embedpress'));
450 endif;
451
452 return $gallobj;
453 }
454
455 }
456
457
458
459
460
461