PluginProbe
Gallery : FooGallery / 3.1.36
Gallery : FooGallery v3.1.36
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
album-default.php
107 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * FooGallery default responsive album template
4 */
5 global $current_foogallery_album;
6 global $current_foogallery_album_arguments;
7 global $current_foogallery;
8 $gallery = foogallery_album_get_current_gallery();
9 $alignment = foogallery_album_template_setting( 'alignment', 'alignment-left' );
10 $foogallery = false;
11
12 if ( !empty( $gallery ) ) {
13 $foogallery = FooGallery::get_by_slug( $gallery );
14
15 //check to see if the gallery belongs to the album
16 if ( $foogallery !== false && !$current_foogallery_album->includes_gallery( $foogallery->ID ) ) {
17 $foogallery = false;
18 }
19 }
20
21 if ( false !== $foogallery ) {
22 $album_url = esc_url( trailingslashit( foogallery_album_remove_gallery_from_link() ) );
23
24 // Allow only safe heading tags (h1-h6), default to h2 if invalid
25 $allowed_headings = ['h2', 'h3', 'h4', 'h5', 'h6'];
26 $gallery_title_size = foogallery_album_template_setting('gallery_title_size', 'h2');
27 $gallery_title_size = in_array( $gallery_title_size, $allowed_headings ) ? $gallery_title_size : 'h2';
28
29 echo '<div id="' . esc_attr( $current_foogallery_album->slug ) . '" class="foogallery-album-header">';
30 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>';
31 echo '<' . esc_html( $gallery_title_size ) . '>' . esc_html( $foogallery->name ) . '</' . esc_html( $gallery_title_size ) . '>';
32 echo apply_filters('foogallery_album_default_gallery_content', '', $foogallery); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33 echo '</div>';
34 echo do_shortcode( foogallery_build_gallery_shortcode( $foogallery->ID ) );
35 } else {
36 $title_bg = foogallery_album_template_setting( 'title_bg', '#ffffff' );
37 $title_font_color = foogallery_album_template_setting( 'title_font_color', '#000000' );
38 $foogallery_album_show_gallery_description_in_caption = 'on' === foogallery_album_template_setting( 'show_gallery_description_in_caption', '' );
39 $args = foogallery_album_template_setting( 'thumbnail_dimensions', array() );
40 if ( !empty( $title_bg ) || !empty( $title_font_color ) ) {
41 echo '<style type="text/css">';
42 if ( !empty( $title_bg ) ) {
43 echo '.foogallery-album-gallery-list .foogallery-pile h3, .foogallery-album-gallery-list .foogallery-pile .foogallery-pile-caption { background: ' . esc_attr( $title_bg ) . ' !important; }';
44 }
45 if ( !empty( $title_font_color ) ) {
46 echo '.foogallery-album-gallery-list .foogallery-pile h3, .foogallery-album-gallery-list .foogallery-pile .foogallery-pile-caption { color: ' . esc_attr( $title_font_color ) . ' !important; }';
47 }
48 echo '</style>';
49 }
50 ?>
51 <div id="foogallery-album-<?php echo esc_attr( $current_foogallery_album->ID ); ?>">
52 <ul class="foogallery-album-gallery-list <?php echo esc_attr( $alignment ); ?>">
53 <?php
54 foreach ( $current_foogallery_album->galleries() as $gallery ) {
55 $current_foogallery = $gallery;
56 if (!empty($gallery->has_items())) {
57 $attachment = $gallery->featured_attachment();
58
59 if ( false === $attachment ) continue;
60
61 $img_html = $attachment->html_img( $args );
62 $images = $gallery->image_count();
63 $gallery_link = foogallery_album_build_gallery_link( $current_foogallery_album, $gallery );
64 $gallery_link_target = foogallery_album_build_gallery_link_target( $current_foogallery_album, $gallery );
65 ?>
66 <li>
67 <div class="foogallery-pile">
68 <div class="foogallery-pile-inner">
69 <a href="<?php echo esc_url( $gallery_link ); ?>" target="<?php echo esc_attr( $gallery_link_target ); ?>">
70 <?php echo $img_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
71 <?php
72
73 $title = empty( $gallery->name ) ?
74 sprintf( __( '%s #%s', 'foogallery' ), foogallery_plugin_name(), $gallery->ID ) :
75 $gallery->name;
76
77 ?>
78 <?php
79 $foogallery_album_gallery_description = $foogallery_album_show_gallery_description_in_caption ? foogallery_album_gallery_description_html( $gallery ) : '';
80 if ( ! empty( $foogallery_album_gallery_description ) ) {
81 ?>
82 <div class="foogallery-pile-caption">
83 <h3><?php echo esc_html( $title ); ?>
84 <span><?php echo esc_html( $images ); ?></span>
85 </h3>
86 <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>
87 </div>
88 <?php
89 } else {
90 ?>
91 <h3><?php echo esc_html( $title ); ?>
92 <span><?php echo esc_html( $images ); ?></span>
93 </h3>
94 <?php
95 }
96 ?>
97 </a>
98 </div>
99 </div>
100 </li>
101 <?php } ?>
102 <?php } ?>
103 </ul>
104 <div style="clear: both;"></div>
105 </div>
106 <?php }
107