PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.2.6
Gallery : FooGallery v3.2.6
3.3.2 3.3.3 3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / extensions / albums / album-default.php
foogallery / extensions / albums Last commit date
admin 1 month ago css 1 month ago js 1 month ago public 1 month ago album-default.php 1 month ago album-stack.php 1 month ago class-albums-extension.php 1 month ago class-foogallery-album.php 1 month ago class-posttypes.php 1 month ago foogallery-albums.png 1 month ago functions.php 1 month ago
album-default.php
109 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * FooGallery default responsive album template
9 */
10 global $current_foogallery_album;
11 global $current_foogallery_album_arguments;
12 global $current_foogallery;
13 $gallery = foogallery_album_get_current_gallery();
14 $alignment = foogallery_album_template_setting( 'alignment', 'alignment-left' );
15 $foogallery = false;
16
17 if ( !empty( $gallery ) ) {
18 $foogallery = FooGallery::get_by_slug( $gallery );
19
20 //check to see if the gallery belongs to the album
21 if ( $foogallery !== false && !$current_foogallery_album->includes_gallery( $foogallery->ID ) ) {
22 $foogallery = false;
23 }
24 }
25
26 if ( false !== $foogallery ) {
27 $album_url = esc_url( trailingslashit( foogallery_album_remove_gallery_from_link() ) );
28
29 // Allow only safe heading tags (h1-h6), default to h2 if invalid
30 $allowed_headings = ['h2', 'h3', 'h4', 'h5', 'h6'];
31 $gallery_title_size = foogallery_album_template_setting('gallery_title_size', 'h2');
32 $gallery_title_size = in_array( $gallery_title_size, $allowed_headings ) ? $gallery_title_size : 'h2';
33
34 echo '<div id="' . esc_attr( $current_foogallery_album->slug ) . '" class="foogallery-album-header">';
35 echo '<p><a href="' . esc_url( $album_url ) . '">' . esc_html( foogallery_get_setting( 'language_back_to_album_text', __( '&laquo; back to album', 'foogallery' ) ) ) . '</a></p>';
36 echo '<' . esc_html( $gallery_title_size ) . '>' . esc_html( $foogallery->name ) . '</' . esc_html( $gallery_title_size ) . '>';
37 echo apply_filters('foogallery_album_default_gallery_content', '', $foogallery); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
38 echo '</div>';
39 echo do_shortcode( foogallery_build_gallery_shortcode( $foogallery->ID ) );
40 } else {
41 $title_bg = foogallery_album_template_setting( 'title_bg', '#ffffff' );
42 $title_font_color = foogallery_album_template_setting( 'title_font_color', '#000000' );
43 $foogallery_album_show_gallery_description_in_caption = 'on' === foogallery_album_template_setting( 'show_gallery_description_in_caption', '' );
44 $args = foogallery_album_template_setting( 'thumbnail_dimensions', array() );
45 if ( !empty( $title_bg ) || !empty( $title_font_color ) ) {
46 echo '<style type="text/css">';
47 if ( !empty( $title_bg ) ) {
48 echo '.foogallery-album-gallery-list .foogallery-pile h3, .foogallery-album-gallery-list .foogallery-pile .foogallery-pile-caption { background: ' . esc_attr( $title_bg ) . ' !important; }';
49 }
50 if ( !empty( $title_font_color ) ) {
51 echo '.foogallery-album-gallery-list .foogallery-pile h3, .foogallery-album-gallery-list .foogallery-pile .foogallery-pile-caption { color: ' . esc_attr( $title_font_color ) . ' !important; }';
52 }
53 echo '</style>';
54 }
55 ?>
56 <div id="foogallery-album-<?php echo esc_attr( $current_foogallery_album->ID ); ?>">
57 <ul class="foogallery-album-gallery-list <?php echo esc_attr( $alignment ); ?>">
58 <?php
59 foreach ( $current_foogallery_album->galleries() as $gallery ) {
60 $current_foogallery = $gallery;
61 if (!empty($gallery->has_items())) {
62 $attachment = $gallery->featured_attachment();
63
64 if ( false === $attachment ) continue;
65
66 $img_html = $attachment->html_img( $args );
67 $images = $gallery->image_count();
68 $gallery_link = foogallery_album_build_gallery_link( $current_foogallery_album, $gallery );
69 $gallery_link_target = foogallery_album_build_gallery_link_target( $current_foogallery_album, $gallery );
70 ?>
71 <li>
72 <div class="foogallery-pile">
73 <div class="foogallery-pile-inner">
74 <?php
75 $title = empty( $gallery->name ) ?
76 /* translators: 1: Plugin name, 2: Gallery ID. */
77 sprintf( __( '%s #%s', 'foogallery' ), foogallery_plugin_name(), $gallery->ID ) :
78 $gallery->name;
79 $foogallery_album_gallery_description = $foogallery_album_show_gallery_description_in_caption ? foogallery_album_gallery_description_html( $gallery ) : '';
80 ?>
81 <a class="foogallery-pile-thumbnail" href="<?php echo esc_url( $gallery_link ); ?>" target="<?php echo esc_attr( $gallery_link_target ); ?>">
82 <?php echo $img_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
83 <?php if ( empty( $foogallery_album_gallery_description ) ) { ?>
84 <h3><?php echo esc_html( $title ); ?>
85 <span><?php echo esc_html( $images ); ?></span>
86 </h3>
87 <?php } ?>
88 </a>
89 <?php if ( ! empty( $foogallery_album_gallery_description ) ) { ?>
90 <div class="foogallery-pile-caption">
91 <h3>
92 <a class="foogallery-pile-title-link" href="<?php echo esc_url( $gallery_link ); ?>" target="<?php echo esc_attr( $gallery_link_target ); ?>">
93 <?php echo esc_html( $title ); ?>
94 <span><?php echo esc_html( $images ); ?></span>
95 </a>
96 </h3>
97 <div class="foogallery-pile-description"><?php echo $foogallery_album_gallery_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Sanitized by foogallery_album_gallery_description_html(). ?></div>
98 </div>
99 <?php } ?>
100 </div>
101 </div>
102 </li>
103 <?php } ?>
104 <?php } ?>
105 </ul>
106 <div style="clear: both;"></div>
107 </div>
108 <?php }
109