1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/** |
3
|
|
|
* FooGallery All-In-One Stack Album template |
4
|
|
|
*/ |
5
|
|
|
global $current_foogallery_album; |
6
|
|
|
global $current_foogallery_album_arguments; |
7
|
|
|
global $current_foogallery; |
|
|
|
|
8
|
|
|
$args = foogallery_album_template_setting( 'thumbnail_dimensions', array() ); |
9
|
|
|
$lightbox = foogallery_album_template_setting( 'lightbox', 'unknown' ); |
10
|
|
|
$random_angle = foogallery_album_template_setting( 'random_angle', 'false' ); |
11
|
|
|
$gutter = foogallery_album_template_setting( 'gutter', '40' ); |
12
|
|
|
$delay = foogallery_album_template_setting( 'delay', '0' ); |
13
|
|
|
$pile_angles = foogallery_album_template_setting( 'pile_angles', '2' ); |
14
|
|
|
if ( !function_exists( 'foogallery_album_all_in_one_stack_render_gallery_attachment' ) ) { |
15
|
|
|
function foogallery_album_all_in_one_stack_render_gallery_attachment( $gallery, $attachment, $args, $lightbox ) { |
16
|
|
|
echo '<li data-pile="' . esc_attr( $gallery->name ) . '">'; |
17
|
|
|
$args['link_attributes']['rel'] = 'lightbox[' . $gallery->ID . ']'; |
18
|
|
|
$args['link_attributes']['class'] = apply_filters( 'foogallery_album_stack_link_class_name', $lightbox ); |
19
|
|
|
echo $attachment->html( $args, false, false ); |
20
|
|
|
if ( $attachment->caption ) { |
21
|
|
|
echo '<span class="tp-info"><span>' . wp_filter_nohtml_kses( $attachment->caption ) . '</span></span>'; |
22
|
|
|
} |
23
|
|
|
echo $attachment->html_img( $args ); |
24
|
|
|
echo '</a>'; |
25
|
|
|
echo '</li>'; |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
?> |
29
|
|
|
<div id="foogallery-album-<?php echo $current_foogallery_album->ID; ?>" class="foogallery-container foogallery-stack-album"> |
30
|
|
|
<div class="topbar"> |
31
|
|
|
<span id="foogallery-stack-album-back-<?php echo $current_foogallery_album->ID; ?>" class="back">←</span> |
32
|
|
|
<h2><?php echo $current_foogallery_album->name; ?></h2><h3 id="foogallery-stack-album-gallery-<?php echo $current_foogallery_album->ID; ?>"></h3> |
33
|
|
|
</div> |
34
|
|
|
<ul id="foogallery-stack-album-<?php echo $current_foogallery_album->ID; ?>" class="tp-grid"> |
35
|
|
|
<?php |
36
|
|
|
foreach ( $current_foogallery_album->galleries() as $gallery ) { |
37
|
|
|
$current_foogallery = $gallery; |
38
|
|
|
$featured_attachment = $gallery->featured_attachment(); |
39
|
|
|
//render the featured attachment first |
40
|
|
|
foogallery_album_all_in_one_stack_render_gallery_attachment( $gallery, $featured_attachment, $args, $lightbox ); |
41
|
|
|
|
42
|
|
|
foreach ( $gallery->attachments() as $attachment ) { |
43
|
|
|
if ( $featured_attachment->ID !== $attachment->ID ) { |
44
|
|
|
//render all but the featured attachment |
45
|
|
|
foogallery_album_all_in_one_stack_render_gallery_attachment( $gallery, $attachment, $args, $lightbox ); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
?> |
50
|
|
|
</ul> |
51
|
|
|
</div> |
52
|
|
|
<script type="text/javascript"> |
53
|
|
|
jQuery(function($) { |
54
|
|
|
|
55
|
|
|
var $grid = $( '#foogallery-stack-album-<?php echo $current_foogallery_album->ID; ?>' ), |
56
|
|
|
$name = $( '#foogallery-stack-album-gallery-<?php echo $current_foogallery_album->ID; ?>' ), |
57
|
|
|
$close = $( '#foogallery-stack-album-back-<?php echo $current_foogallery_album->ID; ?>' ), |
58
|
|
|
$loader = $( '<div class="loader"><i></i><i></i><i></i><i></i><i></i><i></i></div>' ).insertBefore( $grid ), |
59
|
|
|
stapel = $grid.stapel( { |
60
|
|
|
delay : <?php echo $delay; ?>, |
61
|
|
|
randomAngle : <?php echo $random_angle; ?>, |
62
|
|
|
gutter : <?php echo $gutter; ?>, |
63
|
|
|
pileAngles : <?php echo $pile_angles; ?>, |
64
|
|
|
onLoad : function() { |
65
|
|
|
$loader.remove(); |
66
|
|
|
}, |
67
|
|
|
onBeforeOpen : function( pileName ) { |
68
|
|
|
$name.html( pileName ); |
69
|
|
|
}, |
70
|
|
|
onAfterOpen : function( pileName ) { |
71
|
|
|
$close.show(); |
72
|
|
|
} |
73
|
|
|
} ); |
74
|
|
|
|
75
|
|
|
$close.on( 'click', function() { |
76
|
|
|
$close.hide(); |
77
|
|
|
$name.empty(); |
78
|
|
|
stapel.closePile(); |
79
|
|
|
} ); |
80
|
|
|
} ); |
81
|
|
|
</script> |
82
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.