PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.3.8
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.3.8
2.9.1 2.9.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.0.0 2.1.0 2.2.0 2.3.2 2.3.3 2.3.5 2.3.6 2.3.8 2.3.9 2.4.3 All 37 releases
automatic-youtube-gallery / public / templates / pagination.php

pagination.php in Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels 2.3.8, at public/templates/pagination.php

76 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Pagination
5 *
6 * @link https://plugins360.com
7 * @since 1.0.0
8 *
9 * @package Automatic_YouTube_Gallery
10 */
11
12 // Build attributes
13 $source_type = sanitize_text_field( $attributes['type'] );
14
15 $params = array(
16 'uid' => sanitize_text_field( $attributes['uid'] ),
17 'post_id' => (int) $attributes['post_id'],
18 'type' => $source_type,
19 'src' => sanitize_text_field( $attributes[ $source_type ] ),
20 'order' => sanitize_text_field( $attributes['order'] ), // works only when type=search
21 'per_page' => (int) $attributes['per_page'],
22 'cache' => (int) $attributes['cache'],
23 'columns' => ! empty( $attributes['columns'] ) ? (int) $attributes['columns'] : 1,
24 'thumb_ratio' => ! empty( $attributes['thumb_ratio'] ) ? (float) $attributes['thumb_ratio'] : 56.25,
25 'thumb_title' => ! empty( $attributes['thumb_title'] ) ? (int) $attributes['thumb_title'] : 0,
26 'thumb_title_length' => ! empty( $attributes['thumb_title_length'] ) ? (int) $attributes['thumb_title_length'] : 0,
27 'thumb_excerpt' => ! empty( $attributes['thumb_excerpt'] ) ? (int) $attributes['thumb_excerpt'] : 0,
28 'thumb_excerpt_length' => ! empty( $attributes['thumb_excerpt_length'] ) ? (int) $attributes['thumb_excerpt_length'] : 0,
29 'player_description' => ! empty( $attributes['player_description'] ) ? (int) $attributes['player_description'] : 0,
30 'total_pages' => 1,
31 'paged' => 1,
32 'next_page_token' => ! empty( $attributes['next_page_token'] ) ? sanitize_text_field( $attributes['next_page_token'] ) : '',
33 'prev_page_token' => ! empty( $attributes['prev_page_token'] ) ? sanitize_text_field( $attributes['prev_page_token'] ) : ''
34 );
35
36 // Find total number of pages
37 $videos_found = ! empty( $attributes['videos_found'] ) ? (int) $attributes['videos_found'] : 0;
38
39 if ( $videos_found > 0 ) {
40 if ( 'search' == $source_type ) {
41 $limit = min( (int) $attributes['limit'], $videos_found );
42 $params['total_pages'] = ceil( $limit / (int) $attributes['per_page'] );
43 } else {
44 $params['total_pages'] = ceil( $videos_found / (int) $attributes['per_page'] );
45 }
46 }
47
48 // Process output
49 if ( $params['total_pages'] <= 1 ) {
50 return false;
51 }
52
53 $params = apply_filters( 'ayg_pagination_args', $params, $attributes );
54 ?>
55
56 <div class="ayg-pagination" data-params='<?php echo wp_json_encode( $params ); ?>'>
57 <?php if ( 'pager' == $attributes['pagination_type'] ) : // pager ?>
58 <div class="ayg-pagination-prev">
59 <button type="button" class="ayg-btn ayg-pagination-prev-btn" data-type="previous" style="display: none;"><?php echo esc_html( $attributes['previous_button_label'] ); ?></button>
60 </div>
61
62 <div class="ayg-pagination-info">
63 <span class="ayg-pagination-current-page-number">1</span>
64 <?php esc_html_e( 'of', 'automatic-youtube-gallery' ); ?>
65 <span class="ayg-pagination-total-pages"><?php echo (int) $params['total_pages']; ?></span>
66 </div>
67
68 <div class="ayg-pagination-next">
69 <button type="button" class="ayg-btn ayg-pagination-next-btn" data-type="next"><?php echo esc_html( $attributes['next_button_label'] ); ?></button>
70 </div>
71 <?php else : // more ?>
72 <div class="ayg-pagination-next">
73 <button type="button" class="ayg-btn ayg-pagination-next-btn" data-type="more"><?php echo esc_html( $attributes['more_button_label'] ); ?></button>
74 </div>
75 <?php endif; ?>
76 </div>