PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.9.1
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.9.1
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.9.1, at public/templates/pagination.php

81 lines 5.4 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 $more_button_label = ! empty( $attributes['more_button_label'] ) ? $attributes['more_button_label'] : __( 'Load More', 'automatic-youtube-gallery' );
15 $previous_button_label = ! empty( $attributes['previous_button_label'] ) ? $attributes['previous_button_label'] : __( 'Previous', 'automatic-youtube-gallery' );
16 $next_button_label = ! empty( $attributes['next_button_label'] ) ? $attributes['next_button_label'] : __( 'Next', 'automatic-youtube-gallery' );
17
18 $params = array(
19 'uid' => sanitize_text_field( $attributes['uid'] ),
20 'post_id' => (int) $attributes['post_id'],
21 'type' => $source_type,
22 'src' => sanitize_text_field( $attributes[ $source_type ] ),
23 'featured_video_id' => ! empty( $attributes['featured_video_id'] ) ? sanitize_text_field( $attributes['featured_video_id'] ) : '', // Works only when type=db (deeplinked video pinned first)
24 'order' => sanitize_text_field( $attributes['order'] ), // Works only when type=search
25 'sort_by' => ! empty( $attributes['sort_by'] ) ? sanitize_key( $attributes['sort_by'] ) : 'date', // Works only when type=db
26 'sort_order' => ! empty( $attributes['sort_order'] ) ? sanitize_key( $attributes['sort_order'] ) : 'desc', // Works only when type=db
27 'sort_seed' => ! empty( $attributes['sort_seed'] ) ? (int) $attributes['sort_seed'] : 0, // Works only when type=db + sort_by=random
28 'duration_filter' => ! empty( $attributes['duration_filter'] ) ? sanitize_key( $attributes['duration_filter'] ) : '', // Works only when type=db
29 'duration' => ! empty( $attributes['duration'] ) ? (int) $attributes['duration'] : 0, // Works only when type=db
30 'limit' => (int) $attributes['limit'], // Works only when type=search
31 'per_page' => (int) $attributes['per_page'],
32 'cache' => (int) $attributes['cache'],
33 'columns' => ! empty( $attributes['columns'] ) ? (int) $attributes['columns'] : 1,
34 'thumb_ratio' => ! empty( $attributes['thumb_ratio'] ) ? (float) $attributes['thumb_ratio'] : 56.25,
35 'thumb_title' => ! empty( $attributes['thumb_title'] ) ? (int) $attributes['thumb_title'] : 0,
36 'thumb_title_length' => ! empty( $attributes['thumb_title_length'] ) ? (int) $attributes['thumb_title_length'] : 0,
37 'thumb_excerpt' => ! empty( $attributes['thumb_excerpt'] ) ? (int) $attributes['thumb_excerpt'] : 0,
38 'thumb_excerpt_length' => ! empty( $attributes['thumb_excerpt_length'] ) ? (int) $attributes['thumb_excerpt_length'] : 0,
39 'player_description' => ! empty( $attributes['player_description'] ) ? (int) $attributes['player_description'] : 0,
40 'total_pages' => ! empty( $attributes['total_pages'] ) ? (int) $attributes['total_pages'] : 1,
41 'paged' => 1,
42 'next_page_token' => ! empty( $attributes['next_page_token'] ) ? sanitize_text_field( $attributes['next_page_token'] ) : '',
43 'prev_page_token' => ! empty( $attributes['prev_page_token'] ) ? sanitize_text_field( $attributes['prev_page_token'] ) : ''
44 );
45
46 $params = apply_filters( 'ayg_pagination_args', $params, $attributes );
47
48 // Signed last, so the signature covers the values that are actually sent — including any a filter
49 // changed above. It ties the gallery UID to its source and cache duration, so the AJAX endpoint
50 // can tell a genuine set from one a visitor put together. See ayg_get_gallery_signature().
51 $params['signature'] = ayg_get_gallery_signature(
52 isset( $params['uid'] ) ? $params['uid'] : '',
53 isset( $params['type'] ) ? $params['type'] : '',
54 isset( $params['src'] ) ? $params['src'] : '',
55 isset( $params['cache'] ) ? $params['cache'] : 0
56 );
57
58 // Process output
59 if ( $params['total_pages'] <= 1 ) {
60 return false;
61 }
62 ?>
63 <ayg-pagination class="ayg-pagination" data-params="<?php echo esc_attr( wp_json_encode( $params ) ); ?>">
64 <?php if ( 'pager' == $attributes['pagination_type'] ) : // pager ?>
65 <div class="ayg-pagination-prev">
66 <button type="button" class="ayg-btn ayg-pagination-prev-btn" data-type="previous" style="display: none;"><?php echo esc_html( $previous_button_label ); ?></button>
67 </div>
68 <div class="ayg-pagination-info">
69 <span class="ayg-pagination-current-page-number">1</span>
70 <?php esc_html_e( 'of', 'automatic-youtube-gallery' ); ?>
71 <span class="ayg-pagination-total-pages"><?php echo (int) $params['total_pages']; ?></span>
72 </div>
73 <div class="ayg-pagination-next">
74 <button type="button" class="ayg-btn ayg-pagination-next-btn" data-type="next"><?php echo esc_html( $next_button_label ); ?></button>
75 </div>
76 <?php else : // more ?>
77 <div class="ayg-pagination-next">
78 <button type="button" class="ayg-btn ayg-pagination-next-btn" data-type="more"><?php echo esc_html( $more_button_label ); ?></button>
79 </div>
80 <?php endif; ?>
81 </ayg-pagination>