PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.4.11
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.4.11
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 5 months ago
YoutubeLayout.php
456 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.svg'); ?>" 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.svg'); ?>" 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 $transient_key = 'ep_embed_youtube_channel_' . md5($apiEndpoint);
206 $gallobj->transient_key = $transient_key;
207 $jsonResult = get_transient($transient_key);
208
209
210 if (empty($jsonResult)) {
211 $apiResult = wp_remote_get($apiEndpoint, array('timeout' => $data['curltimeout']));
212 if (is_wp_error($apiResult)) {
213 $gallobj->html = Helper::clean_api_error_html($apiResult->get_error_message(), true);
214 return $gallobj;
215 }
216 $jsonResult = json_decode($apiResult['body']);
217
218 if (empty($jsonResult->error)) {
219 set_transient($transient_key, $jsonResult, MINUTE_IN_SECONDS * 20);
220 }
221 else{
222 set_transient($transient_key, $jsonResult, 10);
223 }
224 }
225
226
227 if (isset($jsonResult->error)) {
228 if(!empty($jsonResult->error->errors[0]->reason) && $jsonResult->error->errors[0]->reason == 'playlistNotFound'){
229 $gallobj->html = Helper::clean_api_error_html(__('There is nothing on the playlist.', 'embedpress'));
230 return $gallobj;
231 }
232 if (isset($jsonResult->error->message)) {
233 $gallobj->html = Helper::clean_api_error_html($jsonResult->error->message);
234 return $gallobj;
235 }
236 $gallobj->html = Helper::clean_api_error_html(__('Sorry, there may be an issue with your YouTube API key.', 'embedpress'));
237 return $gallobj;
238 }
239
240
241
242 $resultsPerPage = $jsonResult->pageInfo->resultsPerPage;
243 $totalResults = $jsonResult->pageInfo->totalResults;
244 $totalPages = ceil($totalResults / $resultsPerPage);
245 if (isset($jsonResult->nextPageToken)) {
246 $nextPageToken = $jsonResult->nextPageToken;
247 }
248
249 if (isset($jsonResult->prevPageToken)) {
250 $prevPageToken = $jsonResult->prevPageToken;
251 }
252
253
254 if (!empty($jsonResult->items) && is_array($jsonResult->items)) :
255 if($options['gallery'] === "false"){
256 $gallobj->html = "";
257 if(count($jsonResult->items) === 1){
258 $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
259 }
260 return $gallobj;
261 }
262
263 // if(count($jsonResult->items) === 1 && empty($nextPageToken) && empty($prevPageToken)){
264 // $gallobj->first_vid = Helper::get_id($jsonResult->items[0]);
265 // $gallobj->html = "";
266 // return $gallobj;
267 // }
268
269 if (strpos($options['playlistId'], 'UU') === 0) {
270 // sort only channels
271 usort($jsonResult->items, array(Helper::class, 'compare_vid_date')); // sorts in place
272 }
273
274
275 ob_start();
276
277 ?>
278
279
280 <?php
281 $channel_info = $data['get_channel_info'];
282
283
284
285 $chanelTitle = isset($channel_info['snippet']['title']) ? $channel_info['snippet']['title'] : null;
286 $channelThumb = isset($channel_info['snippet']['thumbnails']['high']['url']) ? $channel_info['snippet']['thumbnails']['high']['url'] : null;
287
288
289 echo self::create_channel_info_layout($channel_info, $url);
290
291 $channel_id = '';
292 if(isset($channel_info['id'])) {
293 $channel_id = $channel_info['id'];
294 }
295
296 $carouselWrapperClass = '';
297 $carouselSelectorId = '';
298 if($layout == 'carousel') {
299 $carouselWrapperClass = 'youtube-carousel';
300 $carouselSelectorId = 'data-youtube-channel-carousel="carousel-'.esc_attr(md5($channel_id)).'"';
301 }
302
303 ?>
304
305 <div class="ep-youtube__content__block" <?php echo $carouselSelectorId; ?> data-unique-id="<?php echo esc_attr(md5($channel_id)); ?>">
306 <div class="youtube__content__body youtube-carousel-container">
307 <div class="content__wrap <?php echo esc_attr($carouselWrapperClass); ?>" >
308
309 <?php
310 if($layout === 'gallery'){
311 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
312 }
313
314 else if($layout === 'list'){
315 echo self::create_list_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
316 }
317 else if($layout === 'grid'){
318 do_action('embedpress/youtube_grid_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
319
320 }
321 else if($layout === 'carousel'){
322 do_action('embedpress/youtube_carousel_layout', $jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
323 }
324 else{
325 echo self::create_gallery_layout($jsonResult, $gallobj, $options, $data, $chanelTitle, $channelThumb);
326
327 }
328 ?>
329 <div class="item" style="height: 0"></div>
330 </div>
331
332 <!-- Pagination and other content remains unchanged -->
333 <?php if ($totalPages > 1 && $layout !== 'carousel') : ?>
334 <div class="ep-youtube__content__pagination <?php echo (empty($prevPageToken) && empty($nextPageToken)) ? ' hide ' : ''; ?>">
335 <div
336 class="ep-prev" <?php echo empty($prevPageToken) ? ' style="display:none" ' : ''; ?>
337 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
338 data-pagetoken="<?php echo esc_attr($prevPageToken) ?>"
339 data-pagesize="<?php echo intval($options['pagesize']) ?>"
340
341 >
342 <span><?php _e("Prev", "embedpress"); ?></span>
343 </div>
344 <div class="is_desktop_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
345 <?php
346
347 $numOfPages = $totalPages;
348 $renderedEllipses = false;
349
350 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
351
352 for($i = 1; $i<=$numOfPages; $i++)
353 {
354 //render pages 1 - 3
355 if($i < 4) {
356 //render link
357 $is_current = $i == (int)$currentPage? "active__current_page" : "";
358
359 echo wp_kses_post("<span class='page-number $is_current' data-page='$i'>$i</span>");
360
361 }
362
363 //render current page number
364 else if($i == (int)$currentPage) {
365 //render link
366 echo wp_kses_post('<span class="page-number active__current_page" data-page="'.$i.'">'.$i.'</span>');
367 //reset ellipses
368 $renderedEllipses = false;
369 }
370
371 //last page number
372 else if ($i >= $numOfPages - 1) {
373 //render link
374 echo wp_kses_post('<span class="page-number" data-page="'.$i.'">'.$i.'</span>');
375 }
376
377 //make sure you only do this once per ellipses group
378 else {
379 if (!$renderedEllipses){
380 print("...");
381 $renderedEllipses = true;
382 }
383 }
384 }
385 ?>
386
387 </div>
388
389 <div class="is_mobile_device ep-page-numbers <?php echo $totalPages > 1 ? '' : 'hide'; ?>">
390 <?php
391
392 $numOfPages = $totalPages;
393 $renderedEllipses = false;
394
395 $currentPage = !empty($options['currentpage'])?$options['currentpage'] : 1;
396
397 for($i = 1; $i<=$numOfPages; $i++)
398 {
399
400 //render current page number
401 if($i == (int)$currentPage) {
402 //render link
403 echo wp_kses_post('<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
404 //reset ellipses
405 $renderedEllipses = false;
406 }
407
408 //last page number
409 else if ($i >= $numOfPages ) {
410 //render link
411 echo wp_kses_post('...<span class="page-number-mobile" data-page="'.$i.'">'.$i.'</span>');
412 }
413 }
414 ?>
415
416 </div>
417
418
419 <div
420 class="ep-next " <?php echo empty($nextPageToken) ? ' style="display:none" ' : ''; ?>
421 data-playlistid="<?php echo esc_attr($options['playlistId']) ?>"
422 data-pagetoken="<?php echo esc_attr($nextPageToken) ?>"
423 data-pagesize="<?php echo intval($options['pagesize']) ?>"
424 >
425 <span><?php _e("Next ", "embedpress"); ?> </span>
426 </div>
427 </div>
428 <?php endif; ?>
429
430 </div>
431
432
433 <?php if($layout === 'carousel'): ?>
434 <div class="carousel-controls">
435 <button class="preview"></button>
436 <button class="next"></button>
437 <?php endif; ?>
438
439 </div>
440
441 <?php
442 $gallobj->html = ob_get_clean();
443 else:
444 $gallobj->html = Helper::clean_api_error_html(__("There is nothing on the playlist.", 'embedpress'));
445 endif;
446
447 return $gallobj;
448 }
449
450 }
451
452
453
454
455
456