Version Description
= 8.1.06 =
- This version addresses various bug fixes, feature requests and security fixes.
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 8.1.07.002 |
Comparing to | |
See all releases |
Code changes from version 8.1.07.001 to 8.1.07.002
- changelog.txt +2 -0
- theme/wppa-theme.php +369 -413
- wppa-admin.php +17 -10
- wppa-functions.php +2 -2
- wppa-gutenberg-wppa.php +4 -4
- wppa-setup.php +32 -6
- wppa.php +2 -2
changelog.txt
CHANGED
@@ -5,6 +5,8 @@ WP Photo Album Plus Changelog
|
|
5 |
* Maintenance release
|
6 |
* Clicking the 'back to thumbnails' button in the slideshow breadcrumb now always returns to the right page,
|
7 |
hilgliting the right item, regardless of either page size.
|
|
|
|
|
8 |
|
9 |
= 8.1.06 =
|
10 |
|
5 |
* Maintenance release
|
6 |
* Clicking the 'back to thumbnails' button in the slideshow breadcrumb now always returns to the right page,
|
7 |
hilgliting the right item, regardless of either page size.
|
8 |
+
* Fixed a possible conflict with wp customizer.
|
9 |
+
* Fixed a db warning at initial installation.
|
10 |
|
11 |
= 8.1.06 =
|
12 |
|
theme/wppa-theme.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the albums/photos/slideshow in a page or post
|
6 |
-
* Version 8.
|
7 |
*/
|
8 |
function wppa_theme() {
|
9 |
|
10 |
-
global $wppa_version; $wppa_version = '8.
|
11 |
global $wppa;
|
12 |
global $wppa_show_statistics; // Can be set to true by a custom page template
|
13 |
global $wppa_empty_content;
|
@@ -18,460 +18,416 @@ global $wppa_empty_content;
|
|
18 |
$n_thumb_pages = '0'; // "
|
19 |
$mocc = wppa( 'mocc' );
|
20 |
|
21 |
-
//
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
$ajax_url = wppa_get_ajaxlink();
|
30 |
-
$extra_url = wppa_get_extra_url();
|
31 |
|
32 |
-
// Almost ready
|
33 |
-
$link_url .= $extra_url;
|
34 |
-
$ajax_url .= $extra_url;
|
35 |
|
36 |
-
|
37 |
-
$link_url = wppa_trim_wppa_( $link_url );
|
38 |
-
$ajax_url = wppa_trim_wppa_( $ajax_url );
|
39 |
|
40 |
-
//
|
41 |
-
$
|
42 |
-
$
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
//
|
45 |
-
$
|
|
|
46 |
|
47 |
-
|
48 |
-
|
|
|
49 |
|
50 |
-
//
|
51 |
-
$html = "\n" . '<script>jQuery(document).ready(function(){wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '\', \'' . $link_url . '\');});</script>';
|
52 |
|
53 |
-
//
|
54 |
-
|
|
|
55 |
|
56 |
-
//
|
57 |
-
|
|
|
58 |
|
59 |
-
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
// Display breadcrumb navigation only if it is set in the settings page
|
71 |
-
wppa_breadcrumb( 'optional' );
|
72 |
-
|
73 |
-
|
74 |
-
if ( wppa_page( 'albums' ) ) { // Page 'Albums' requested
|
75 |
-
|
76 |
-
// Init for possible alt thumbsize on masonry
|
77 |
-
$counter_thumbs = '0';
|
78 |
-
$is_alt_thumbsize = false;
|
79 |
-
$alb_id = wppa( 'start_album' );
|
80 |
-
if ( wppa_is_int( $alb_id ) && $alb_id > '0' ) {
|
81 |
-
$is_alt_thumbsize = wppa_get_album_item( $alb_id, 'alt_thumbsize' ) == 'yes';
|
82 |
-
}
|
83 |
-
|
84 |
-
// Get the albums and the thumbs and the number of pages for each set
|
85 |
-
$albums = wppa_get_albums(); // Get the albums
|
86 |
-
$n_album_pages = wppa_get_npages( 'albums', $albums ); // Get the number of album pages
|
87 |
-
|
88 |
-
if ( wppa_opt( 'thumbtype' ) != 'none' ) {
|
89 |
-
$thumbs = wppa_get_thumbs(); // Get the Thumbs
|
90 |
-
} else $thumbs = false;
|
91 |
-
|
92 |
-
$wanted_empty = wppa_is_wanted_empty( $thumbs ); // See if we need to display an empty thumbnail area
|
93 |
-
|
94 |
-
$n_thumb_pages = wppa_get_npages( 'thumbs', $thumbs ); // Get the number of thumb pages
|
95 |
-
if ( $n_thumb_pages == '0' && ! $wanted_empty ) $thumbs = false; // No pages: no thumbs. Maybe want covers only
|
96 |
-
if ( $wanted_empty ) $n_thumb_pages = '1';
|
97 |
-
|
98 |
-
// Get total number of pages
|
99 |
-
if ( ! wppa_is_pagination() ) $totpag = '1'; // If both pagination is off, there is only one page
|
100 |
-
else $totpag = $n_album_pages + $n_thumb_pages;
|
101 |
-
|
102 |
-
// Make pagelinkbar if requested on top
|
103 |
-
if ( wppa_opt( 'pagelink_pos' ) == 'top' || wppa_opt( 'pagelink_pos' ) == 'both' ) {
|
104 |
-
wppa_page_links( $totpag, $curpage );
|
105 |
-
}
|
106 |
-
|
107 |
-
// Process the albums
|
108 |
-
if ( ! wppa_switch( 'thumbs_first' ) ) {
|
109 |
-
if ( $albums ) {
|
110 |
-
$counter_albums = '0';
|
111 |
-
wppa_album_list( 'open' ); // Open Albums sub-container
|
112 |
-
foreach ( $albums as $album ) { // Loop the albums
|
113 |
-
$counter_albums++;
|
114 |
-
if ( wppa_onpage( 'albums', $counter_albums, $curpage ) ) {
|
115 |
-
wppa_album_cover( $album['id'] ); // Show the cover
|
116 |
-
$didsome = true;
|
117 |
-
} // End if on page
|
118 |
-
}
|
119 |
-
wppa_album_list( 'close' ); // Close Albums sub-container
|
120 |
-
} // If albums
|
121 |
-
}
|
122 |
-
|
123 |
-
if ( $didsome && wppa_is_pagination() ) $thumbs = false; // Pag on and didsome: force a pagebreak by faking no thumbs
|
124 |
-
if ( is_array( $thumbs ) && ! count( $thumbs ) && ! $wanted_empty ) $thumbs = false; // Less than treshold value
|
125 |
-
if ( wppa_switch( 'thumbs_first' ) && $curpage > $n_thumb_pages ) $thumbs = false; // If thumbs done, do not display an empty thumbarea
|
126 |
-
|
127 |
-
// Process the thumbs
|
128 |
-
if ( $thumbs || $wanted_empty )
|
129 |
-
if ( ! $wanted_empty || ! wppa_switch( 'thumbs_first' ) || wppa_get_curpage() == '1' )
|
130 |
-
if ( ! $wanted_empty || wppa_switch( 'thumbs_first' ) || wppa_get_curpage() == $totpag ) {
|
131 |
-
|
132 |
-
// As covers
|
133 |
-
if ( wppa_opt( 'thumbtype' ) == 'ascovers' ||
|
134 |
-
wppa_opt( 'thumbtype' ) == 'ascovers-mcr' ) { // Do the thumbs As covers
|
135 |
-
wppa_thumb_list( 'open' ); // Open Thumblist sub-container
|
136 |
-
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
137 |
-
foreach ( $thumbs as $tt ) : global $thumb; $thumb = $tt; // Loop the Thumbs
|
138 |
-
$counter_thumbs++;
|
139 |
-
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
140 |
$didsome = true;
|
141 |
-
wppa_thumb_ascover( $thumb['id'] ); // Show Thumb as cover
|
142 |
} // End if on page
|
143 |
-
endforeach;
|
144 |
-
wppa_thumb_list( 'close' ); // Close Thumblist sub-container
|
145 |
-
} // As covers
|
146 |
-
|
147 |
-
// Masonry vertical
|
148 |
-
elseif ( wppa_opt( 'thumbtype' ) == 'masonry-v' ) { // Masonry
|
149 |
-
|
150 |
-
// The header
|
151 |
-
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
152 |
-
wppa_popup(); // Prepare Popup box
|
153 |
-
wppa_album_name( 'top' ); // Optionally display album name
|
154 |
-
wppa_album_desc( 'top' ); // Optionally display album description
|
155 |
-
|
156 |
-
// Init
|
157 |
-
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
158 |
-
$cont_width = wppa_get_container_width();
|
159 |
-
$margin = wppa_opt( 'tn_margin' );
|
160 |
-
if ( wppa_is_mobile() ) $margin = ceil( $margin / 2 );
|
161 |
-
$count_cols = ceil( $cont_width / ( wppa_opt( $is_alt_thumbsize ? 'thumbsize_alt' : 'thumbsize' ) + $margin ) );
|
162 |
-
if ( wppa_is_mobile() ) {
|
163 |
-
$count_cols = ceil( $count_cols / 2 );
|
164 |
-
}
|
165 |
-
$correction = $margin * ( $cont_width / $count_cols ) / 100;
|
166 |
-
|
167 |
-
// Init the table
|
168 |
-
wppa_out( '<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" ><tr class="wppa-masonry" >' );
|
169 |
-
|
170 |
-
// Init the columns
|
171 |
-
$col_headers = array();
|
172 |
-
$col_contents = array();
|
173 |
-
$col_heights = array();
|
174 |
-
$col_widths = array();
|
175 |
-
|
176 |
-
for ( $col = 0; $col < $count_cols; $col++ ) {
|
177 |
-
$col_headers[$col] = '';
|
178 |
-
$col_contents[$col] = '';
|
179 |
-
$col_heights[$col] = 0;
|
180 |
-
$col_widths[$col] = 100;
|
181 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
-
$didsome = true;
|
196 |
}
|
|
|
197 |
}
|
|
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
}
|
210 |
}
|
|
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
-
$
|
278 |
-
|
279 |
-
if ( $row_width > $cont_width || $last ) {
|
280 |
-
$tot_marg = $rw_count * $correction;
|
281 |
-
$row_height = $row_width ? ( ( $target_row_height - $correction ) * ( $cont_width - $tot_marg ) / ( $row_width ) + $correction ) : '0';
|
282 |
-
if ( ! $last ) {
|
283 |
-
$max_row_height = max( $max_row_height, $row_height );
|
284 |
-
}
|
285 |
-
if ( $last && $row_height > wppa_get_thumby( $id ) ) {
|
286 |
-
$row_height = $max_row_height;
|
287 |
-
}
|
288 |
-
$row_height_p = $row_height / $cont_width * 100;
|
289 |
-
wppa_out( '<tr class="wppa-masonry" >' .
|
290 |
-
'<td style="border:none;padding:0;margin:0" >' .
|
291 |
-
'<div' .
|
292 |
-
' id="wppa-mas-h-'.$tr_count.'-'.wppa( 'mocc' ).'"' .
|
293 |
-
' style="height:'.$row_height.'px;"' .
|
294 |
-
' class="wppa-masonry"' .
|
295 |
-
' data-height-perc="'.$row_height_p.'"' .
|
296 |
-
' >');
|
297 |
-
wppa_out( $row_content );
|
298 |
-
wppa_out( '</div></td></tr>' );
|
299 |
-
$row_content = '';
|
300 |
-
$row_width = 0;
|
301 |
-
$row_height = wppa_opt( 'thumbsize' );
|
302 |
-
$rw_count = 0;
|
303 |
-
$tr_count += '1';
|
304 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
}
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
'
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
.grid-item-' . $mocc . ' img {
|
351 |
-
width: 100%;
|
352 |
-
}
|
353 |
-
</style>';
|
354 |
-
|
355 |
-
// The thumbs
|
356 |
-
foreach ( $thumbs as $tt ) {
|
357 |
-
$counter_thumbs++;
|
358 |
-
|
359 |
-
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
360 |
-
|
361 |
-
$didsome = true;
|
362 |
-
$html .= '
|
363 |
-
<div
|
364 |
-
style=""
|
365 |
-
id="grid-item-' . $mocc . '-' . wppa_encrypt_photo( $tt['id'] ) . '"
|
366 |
-
class="grid-item grid-item-' . $mocc . '" >' .
|
367 |
-
wppa_get_thumb_masonry( $tt['id'] ) . '
|
368 |
-
</div>';
|
369 |
-
}
|
370 |
}
|
|
|
|
|
|
|
|
|
371 |
|
372 |
-
|
373 |
-
|
374 |
-
}
|
375 |
-
wppa_out( wppa_compress_html( $html ) );
|
376 |
-
|
377 |
-
// The footer
|
378 |
-
wppa_album_name( 'bottom' ); // Optionally display album name
|
379 |
-
wppa_album_desc( 'bottom' ); // Optionally display album description
|
380 |
-
wppa_thumb_area( 'close' ); // Close Thumbarea sub-container
|
381 |
-
} // Masonry plus
|
382 |
-
|
383 |
-
// Default
|
384 |
-
elseif ( wppa_opt( 'thumbtype' ) == 'default' ) { // Do the thumbs As default
|
385 |
-
|
386 |
-
// The header
|
387 |
-
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
388 |
-
wppa_popup(); // Prepare Popup box
|
389 |
-
wppa_album_name( 'top' ); // Optionally display album name
|
390 |
-
wppa_album_desc( 'top' ); // Optionally display album description
|
391 |
-
|
392 |
-
// Init
|
393 |
-
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
394 |
-
|
395 |
-
// Process the thumbnails
|
396 |
-
if ( $thumbs ) foreach ( $thumbs as $tt ) {
|
397 |
$counter_thumbs++;
|
|
|
398 |
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
|
|
399 |
$didsome = true;
|
400 |
-
|
401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
}
|
403 |
|
404 |
-
//
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
//
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
-
} // If thumbs
|
415 |
-
|
416 |
-
if ( $didsome && wppa_is_pagination() ) $albums = false; // Pag on and didsome: force a pagebreak by faking no albums
|
417 |
-
if ( ! wppa_is_pagination() ) $n_thumb_pages = '0'; // Still on page one
|
418 |
-
|
419 |
-
// Process the albums
|
420 |
-
if ( wppa_switch( 'thumbs_first' ) ) {
|
421 |
-
if ( $albums ) {
|
422 |
-
$counter_albums = '0';
|
423 |
-
wppa_album_list( 'open' ); // Open Albums sub-container
|
424 |
-
foreach ( $albums as $album ) { // Loop the albums
|
425 |
-
$counter_albums++;
|
426 |
-
if ( wppa_onpage( 'albums', $counter_albums, $curpage - $n_thumb_pages ) ) {
|
427 |
-
wppa_album_cover( $album['id'] ); // Show the cover
|
428 |
-
$didsome = true;
|
429 |
-
} // End if on page
|
430 |
-
}
|
431 |
-
wppa_album_list( 'close' ); // Close Albums sub-container
|
432 |
-
} // If albums
|
433 |
-
}
|
434 |
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
439 |
|
440 |
-
//
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
}
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
$thumbs = wppa_get_thumbs();
|
460 |
-
wppa_dbg_msg( 'From theme: #thumbs='.( $thumbs ? count( $thumbs ) : '0' ) );
|
461 |
-
if ( $thumbs ) {
|
462 |
-
wppa_the_slideshow(); // Producs all the html required for the slideshow
|
463 |
-
wppa_run_slidecontainer( 'slideshow' ); // Fill in the photo array and display it.
|
464 |
}
|
465 |
else {
|
466 |
-
wppa_out( wppa_errorbox( __( 'No photos found matching your search criteria.', 'wp-photo-album-plus') ) );
|
467 |
-
wppa_report_nothing(
|
468 |
}
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
-
} // Not delaed
|
475 |
}
|
476 |
|
477 |
function wppa_is_wanted_empty( $thumbs ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the albums/photos/slideshow in a page or post
|
6 |
+
* Version 8.1.07.002
|
7 |
*/
|
8 |
function wppa_theme() {
|
9 |
|
10 |
+
global $wppa_version; $wppa_version = '8.1.07.002'; // The version number of this file
|
11 |
global $wppa;
|
12 |
global $wppa_show_statistics; // Can be set to true by a custom page template
|
13 |
global $wppa_empty_content;
|
18 |
$n_thumb_pages = '0'; // "
|
19 |
$mocc = wppa( 'mocc' );
|
20 |
|
21 |
+
// Open container
|
22 |
+
wppa_container( 'open' );
|
23 |
|
24 |
+
// Show statistics if set so by the page template
|
25 |
+
if ( $wppa_show_statistics ) wppa_statistics();
|
26 |
|
27 |
+
// Display breadcrumb navigation only if it is set in the settings page
|
28 |
+
wppa_breadcrumb( 'optional' );
|
|
|
|
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
+
if ( wppa_page( 'albums' ) ) { // Page 'Albums' requested
|
|
|
|
|
32 |
|
33 |
+
// Init for possible alt thumbsize on masonry
|
34 |
+
$counter_thumbs = '0';
|
35 |
+
$is_alt_thumbsize = false;
|
36 |
+
$alb_id = wppa( 'start_album' );
|
37 |
+
if ( wppa_is_int( $alb_id ) && $alb_id > '0' ) {
|
38 |
+
$is_alt_thumbsize = wppa_get_album_item( $alb_id, 'alt_thumbsize' ) == 'yes';
|
39 |
+
}
|
40 |
|
41 |
+
// Get the albums and the thumbs and the number of pages for each set
|
42 |
+
$albums = wppa_get_albums(); // Get the albums
|
43 |
+
$n_album_pages = wppa_get_npages( 'albums', $albums ); // Get the number of album pages
|
44 |
|
45 |
+
if ( wppa_opt( 'thumbtype' ) != 'none' ) {
|
46 |
+
$thumbs = wppa_get_thumbs(); // Get the Thumbs
|
47 |
+
} else $thumbs = false;
|
48 |
|
49 |
+
$wanted_empty = wppa_is_wanted_empty( $thumbs ); // See if we need to display an empty thumbnail area
|
|
|
50 |
|
51 |
+
$n_thumb_pages = wppa_get_npages( 'thumbs', $thumbs ); // Get the number of thumb pages
|
52 |
+
if ( $n_thumb_pages == '0' && ! $wanted_empty ) $thumbs = false; // No pages: no thumbs. Maybe want covers only
|
53 |
+
if ( $wanted_empty ) $n_thumb_pages = '1';
|
54 |
|
55 |
+
// Get total number of pages
|
56 |
+
if ( ! wppa_is_pagination() ) $totpag = '1'; // If both pagination is off, there is only one page
|
57 |
+
else $totpag = $n_album_pages + $n_thumb_pages;
|
58 |
|
59 |
+
// Make pagelinkbar if requested on top
|
60 |
+
if ( wppa_opt( 'pagelink_pos' ) == 'top' || wppa_opt( 'pagelink_pos' ) == 'both' ) {
|
61 |
+
wppa_page_links( $totpag, $curpage );
|
62 |
+
}
|
63 |
|
64 |
+
// Process the albums
|
65 |
+
if ( ! wppa_switch( 'thumbs_first' ) ) {
|
66 |
+
if ( $albums ) {
|
67 |
+
$counter_albums = '0';
|
68 |
+
wppa_album_list( 'open' ); // Open Albums sub-container
|
69 |
+
foreach ( $albums as $album ) { // Loop the albums
|
70 |
+
$counter_albums++;
|
71 |
+
if ( wppa_onpage( 'albums', $counter_albums, $curpage ) ) {
|
72 |
+
wppa_album_cover( $album['id'] ); // Show the cover
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$didsome = true;
|
|
|
74 |
} // End if on page
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
+
wppa_album_list( 'close' ); // Close Albums sub-container
|
77 |
+
} // If albums
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( $didsome && wppa_is_pagination() ) $thumbs = false; // Pag on and didsome: force a pagebreak by faking no thumbs
|
81 |
+
if ( is_array( $thumbs ) && ! count( $thumbs ) && ! $wanted_empty ) $thumbs = false; // Less than treshold value
|
82 |
+
if ( wppa_switch( 'thumbs_first' ) && $curpage > $n_thumb_pages ) $thumbs = false; // If thumbs done, do not display an empty thumbarea
|
83 |
+
|
84 |
+
// Process the thumbs
|
85 |
+
if ( $thumbs || $wanted_empty )
|
86 |
+
if ( ! $wanted_empty || ! wppa_switch( 'thumbs_first' ) || wppa_get_curpage() == '1' )
|
87 |
+
if ( ! $wanted_empty || wppa_switch( 'thumbs_first' ) || wppa_get_curpage() == $totpag ) {
|
88 |
+
|
89 |
+
// As covers
|
90 |
+
if ( wppa_opt( 'thumbtype' ) == 'ascovers' ||
|
91 |
+
wppa_opt( 'thumbtype' ) == 'ascovers-mcr' ) { // Do the thumbs As covers
|
92 |
+
wppa_thumb_list( 'open' ); // Open Thumblist sub-container
|
93 |
+
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
94 |
+
foreach ( $thumbs as $tt ) : global $thumb; $thumb = $tt; // Loop the Thumbs
|
95 |
+
$counter_thumbs++;
|
96 |
+
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
97 |
+
$didsome = true;
|
98 |
+
wppa_thumb_ascover( $thumb['id'] ); // Show Thumb as cover
|
99 |
+
} // End if on page
|
100 |
+
endforeach;
|
101 |
+
wppa_thumb_list( 'close' ); // Close Thumblist sub-container
|
102 |
+
} // As covers
|
103 |
+
|
104 |
+
// Masonry vertical
|
105 |
+
elseif ( wppa_opt( 'thumbtype' ) == 'masonry-v' ) { // Masonry
|
106 |
+
|
107 |
+
// The header
|
108 |
+
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
109 |
+
wppa_popup(); // Prepare Popup box
|
110 |
+
wppa_album_name( 'top' ); // Optionally display album name
|
111 |
+
wppa_album_desc( 'top' ); // Optionally display album description
|
112 |
+
|
113 |
+
// Init
|
114 |
+
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
115 |
+
$cont_width = wppa_get_container_width();
|
116 |
+
$margin = wppa_opt( 'tn_margin' );
|
117 |
+
if ( wppa_is_mobile() ) $margin = ceil( $margin / 2 );
|
118 |
+
$count_cols = ceil( $cont_width / ( wppa_opt( $is_alt_thumbsize ? 'thumbsize_alt' : 'thumbsize' ) + $margin ) );
|
119 |
+
if ( wppa_is_mobile() ) {
|
120 |
+
$count_cols = ceil( $count_cols / 2 );
|
121 |
+
}
|
122 |
+
$correction = $margin * ( $cont_width / $count_cols ) / 100;
|
123 |
+
|
124 |
+
// Init the table
|
125 |
+
wppa_out( '<table class="wppa-masonry" style="margin-top:3px;" ><tbody class="wppa-masonry" ><tr class="wppa-masonry" >' );
|
126 |
+
|
127 |
+
// Init the columns
|
128 |
+
$col_headers = array();
|
129 |
+
$col_contents = array();
|
130 |
+
$col_heights = array();
|
131 |
+
$col_widths = array();
|
132 |
+
|
133 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
134 |
+
$col_headers[$col] = '';
|
135 |
+
$col_contents[$col] = '';
|
136 |
+
$col_heights[$col] = 0;
|
137 |
+
$col_widths[$col] = 100;
|
138 |
+
}
|
139 |
|
140 |
+
// Process the thumbnails
|
141 |
+
$col = '0';
|
142 |
+
if ( $thumbs ) foreach ( $thumbs as $tt ) {
|
143 |
+
$id = $tt['id'];
|
144 |
+
$counter_thumbs++;
|
145 |
+
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
146 |
+
$col_contents[$col] .= wppa_get_thumb_masonry( $id );
|
147 |
+
$col_heights[$col] += ( $correction + wppa_get_thumby( $id ) ) / ( $correction + wppa_get_thumbx( $id ) ) * $col_widths[$col];
|
148 |
+
$col += '1';
|
149 |
+
if ( $col == $count_cols ) {
|
150 |
+
$col = '0';
|
|
|
|
|
151 |
}
|
152 |
+
$didsome = true;
|
153 |
}
|
154 |
+
}
|
155 |
|
156 |
+
// Find longest column
|
157 |
+
$long = 0;
|
158 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
159 |
+
if ( $col_heights[$col] > $long ) $long = $col_heights[$col];
|
160 |
+
}
|
161 |
|
162 |
+
// Adjust column widths to resize lengths to equal lengths
|
163 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
164 |
+
if ( $col_heights[$col] ) {
|
165 |
+
$col_widths[$col] = $long / $col_heights[$col] * $col_widths[$col];
|
|
|
166 |
}
|
167 |
+
}
|
168 |
|
169 |
+
// Adjust column widths to total 100
|
170 |
+
$wide = 0;
|
171 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
172 |
+
$wide += $col_widths[$col];
|
173 |
+
}
|
174 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
175 |
+
$col_widths[$col] = $col_widths[$col] * 100 / $wide;
|
176 |
+
}
|
177 |
|
178 |
+
// Make column headers
|
179 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
180 |
+
$col_headers[$col] = '<td style="width: '.$col_widths[$col].'%; vertical-align:top;" class="wppa-masonry" >';
|
181 |
+
}
|
182 |
|
183 |
+
// Add the columns to the output stream
|
184 |
+
for ( $col = 0; $col < $count_cols; $col++ ) {
|
185 |
+
wppa_out( $col_headers[$col] );
|
186 |
+
wppa_out( $col_contents[$col] );
|
187 |
+
wppa_out( '</td>' );
|
188 |
+
}
|
189 |
|
190 |
+
// Close the table
|
191 |
+
wppa_out( '</tr></tbody></table>' );
|
192 |
+
|
193 |
+
// The footer
|
194 |
+
wppa_album_name( 'bottom' ); // Optionally display album name
|
195 |
+
wppa_album_desc( 'bottom' ); // Optionally display album description
|
196 |
+
wppa_thumb_area( 'close' ); // Close Thumbarea sub-container
|
197 |
+
} // Masonry-v
|
198 |
+
|
199 |
+
// Masonry horizontal
|
200 |
+
elseif ( wppa_opt( 'thumbtype' ) == 'masonry-h' ) { // Masonry
|
201 |
+
|
202 |
+
// The header
|
203 |
+
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
204 |
+
wppa_popup(); // Prepare Popup box
|
205 |
+
wppa_album_name( 'top' ); // Optionally display album name
|
206 |
+
wppa_album_desc( 'top' ); // Optionally display album description
|
207 |
+
|
208 |
+
// Init
|
209 |
+
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
210 |
+
$cont_width = wppa_get_container_width( 'netto' );
|
211 |
+
$correction = wppa_opt( 'tn_margin' );
|
212 |
+
|
213 |
+
// Init the table
|
214 |
+
wppa_out( '<table class="wppa-masonry wppa-masonry-h" style="margin-top:3px;" ><tbody class="wppa-masonry" >' );
|
215 |
+
|
216 |
+
// Process the thumbnails
|
217 |
+
$row_content = '';
|
218 |
+
$row_width = 0;
|
219 |
+
$target_row_height = wppa_opt( $is_alt_thumbsize ? 'thumbsize_alt' : 'thumbsize' ) * 0.75 + $correction;
|
220 |
+
$rw_count = 0;
|
221 |
+
$tr_count = '1';
|
222 |
+
$done_count = 0;
|
223 |
+
$last = false;
|
224 |
+
$max_row_height = $target_row_height * 0.8; // Init keep track for last
|
225 |
+
if ( $thumbs ) foreach ( $thumbs as $tt ) {
|
226 |
+
$id = $tt['id'];
|
227 |
+
$counter_thumbs++;
|
228 |
+
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
229 |
+
$row_content .= wppa_get_thumb_masonry( $tt['id'] );
|
230 |
+
$rw_count += 1;
|
231 |
+
$row_width += wppa_get_thumbratioxy( $id ) * ( $target_row_height - $correction );
|
232 |
+
$didsome = true;
|
233 |
+
}
|
234 |
+
$done_count += 1;
|
235 |
+
$last = $done_count == count( $thumbs );
|
236 |
+
if ( $row_width > $cont_width || $last ) {
|
237 |
+
$tot_marg = $rw_count * $correction;
|
238 |
+
$row_height = $row_width ? ( ( $target_row_height - $correction ) * ( $cont_width - $tot_marg ) / ( $row_width ) + $correction ) : '0';
|
239 |
+
if ( ! $last ) {
|
240 |
+
$max_row_height = max( $max_row_height, $row_height );
|
241 |
}
|
242 |
+
if ( $last && $row_height > wppa_get_thumby( $id ) ) {
|
243 |
+
$row_height = $max_row_height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
+
$row_height_p = $row_height / $cont_width * 100;
|
246 |
+
wppa_out( '<tr class="wppa-masonry" >' .
|
247 |
+
'<td style="border:none;padding:0;margin:0" >' .
|
248 |
+
'<div' .
|
249 |
+
' id="wppa-mas-h-'.$tr_count.'-'.wppa( 'mocc' ).'"' .
|
250 |
+
' style="height:'.$row_height.'px;"' .
|
251 |
+
' class="wppa-masonry"' .
|
252 |
+
' data-height-perc="'.$row_height_p.'"' .
|
253 |
+
' >');
|
254 |
+
wppa_out( $row_content );
|
255 |
+
wppa_out( '</div></td></tr>' );
|
256 |
+
$row_content = '';
|
257 |
+
$row_width = 0;
|
258 |
+
$row_height = wppa_opt( 'thumbsize' );
|
259 |
+
$rw_count = 0;
|
260 |
+
$tr_count += '1';
|
261 |
}
|
262 |
+
}
|
263 |
+
wppa_out( '<tr class="wppa-masonry" ><td class="wppa-dummy" style="padding:0;border:none;" ></td></tr>' );
|
264 |
+
wppa_out( '</tbody></table>' );
|
265 |
+
|
266 |
+
// The footer
|
267 |
+
wppa_album_name( 'bottom' ); // Optionally display album name
|
268 |
+
wppa_album_desc( 'bottom' ); // Optionally display album description
|
269 |
+
wppa_out( '<script type="text/javascript" >' . // Fix bug in IE and Chrome
|
270 |
+
'jQuery(document).ready(function(){wppaSetMasHorFrameWidthsForIeAndChrome(' . wppa( 'mocc' ) . ');});' .
|
271 |
+
'</script>' );
|
272 |
+
wppa_thumb_area( 'close' ); // Close Thumbarea sub-container
|
273 |
+
|
274 |
+
} // Masonry-h
|
275 |
+
|
276 |
+
// Masonry plus
|
277 |
+
elseif ( wppa_opt( 'thumbtype' ) == 'masonry-plus' ) {
|
278 |
+
|
279 |
+
// The header
|
280 |
+
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
281 |
+
wppa_popup(); // Prepare Popup box
|
282 |
+
wppa_album_name( 'top' ); // Optionally display album name
|
283 |
+
wppa_album_desc( 'top' ); // Optionally display album description
|
284 |
+
|
285 |
+
// Init
|
286 |
+
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
287 |
+
|
288 |
+
// Process the thumbnails
|
289 |
+
if ( $thumbs ) {
|
290 |
+
|
291 |
+
// Open masonry contatiner
|
292 |
+
$html = '
|
293 |
+
<div
|
294 |
+
id="grid-' . $mocc . '"
|
295 |
+
class="grid-' . $mocc . ' grid-masonryplus"
|
296 |
+
style="padding-top:6px;padding-bottom:6px;padding-right:6px;margin:0 auto;"
|
297 |
+
>';
|
298 |
+
|
299 |
+
// Add css
|
300 |
+
$html .= '
|
301 |
+
<style type="text/css" >
|
302 |
+
.grid-item-' . $mocc . ' {
|
303 |
+
line-height: 0;
|
304 |
+
visibility: hidden;
|
305 |
+
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
}
|
307 |
+
.grid-item-' . $mocc . ' img {
|
308 |
+
width: 100%;
|
309 |
+
}
|
310 |
+
</style>';
|
311 |
|
312 |
+
// The thumbs
|
313 |
+
foreach ( $thumbs as $tt ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
$counter_thumbs++;
|
315 |
+
|
316 |
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
317 |
+
|
318 |
$didsome = true;
|
319 |
+
$html .= '
|
320 |
+
<div
|
321 |
+
style=""
|
322 |
+
id="grid-item-' . $mocc . '-' . wppa_encrypt_photo( $tt['id'] ) . '"
|
323 |
+
class="grid-item grid-item-' . $mocc . '" >' .
|
324 |
+
wppa_get_thumb_masonry( $tt['id'] ) . '
|
325 |
+
</div>';
|
326 |
+
}
|
327 |
}
|
328 |
|
329 |
+
// Close masonry container
|
330 |
+
$html .= '</div><div style="clear:both" ></div>';
|
331 |
+
}
|
332 |
+
wppa_out( wppa_compress_html( $html ) );
|
333 |
+
|
334 |
+
// The footer
|
335 |
+
wppa_album_name( 'bottom' ); // Optionally display album name
|
336 |
+
wppa_album_desc( 'bottom' ); // Optionally display album description
|
337 |
+
wppa_thumb_area( 'close' ); // Close Thumbarea sub-container
|
338 |
+
} // Masonry plus
|
339 |
+
|
340 |
+
// Default
|
341 |
+
elseif ( wppa_opt( 'thumbtype' ) == 'default' ) { // Do the thumbs As default
|
342 |
+
|
343 |
+
// The header
|
344 |
+
wppa_thumb_area( 'open' ); // Open Thumbarea sub-container
|
345 |
+
wppa_popup(); // Prepare Popup box
|
346 |
+
wppa_album_name( 'top' ); // Optionally display album name
|
347 |
+
wppa_album_desc( 'top' ); // Optionally display album description
|
348 |
+
|
349 |
+
// Init
|
350 |
+
$relpage = wppa_switch( 'thumbs_first' ) ? $curpage : $curpage - $n_album_pages;
|
351 |
+
|
352 |
+
// Process the thumbnails
|
353 |
+
if ( $thumbs ) foreach ( $thumbs as $tt ) {
|
354 |
+
$counter_thumbs++;
|
355 |
+
if ( wppa_onpage( 'thumbs', $counter_thumbs, $relpage ) ) {
|
356 |
+
$didsome = true;
|
357 |
+
wppa_thumb_default( $tt['id'] ); // Show Thumb as default
|
358 |
+
} // End if on page
|
359 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
|
361 |
+
// The footer
|
362 |
+
wppa_album_name( 'bottom' ); // Optionally display album name
|
363 |
+
wppa_album_desc( 'bottom' ); // Optionally display album description
|
364 |
+
wppa_thumb_area( 'close' ); // Close Thumbarea sub-container
|
365 |
+
} // As default
|
366 |
|
367 |
+
// Unimplemented thumbnail type
|
368 |
+
else {
|
369 |
+
wppa_out( 'Unimplemented thumbnail type: ' . wppa_opt( 'thumbtype' ) );
|
370 |
+
}
|
371 |
+
} // If thumbs
|
372 |
+
|
373 |
+
if ( $didsome && wppa_is_pagination() ) $albums = false; // Pag on and didsome: force a pagebreak by faking no albums
|
374 |
+
if ( ! wppa_is_pagination() ) $n_thumb_pages = '0'; // Still on page one
|
375 |
+
|
376 |
+
// Process the albums
|
377 |
+
if ( wppa_switch( 'thumbs_first' ) ) {
|
378 |
+
if ( $albums ) {
|
379 |
+
$counter_albums = '0';
|
380 |
+
wppa_album_list( 'open' ); // Open Albums sub-container
|
381 |
+
foreach ( $albums as $album ) { // Loop the albums
|
382 |
+
$counter_albums++;
|
383 |
+
if ( wppa_onpage( 'albums', $counter_albums, $curpage - $n_thumb_pages ) ) {
|
384 |
+
wppa_album_cover( $album['id'] ); // Show the cover
|
385 |
+
$didsome = true;
|
386 |
+
} // End if on page
|
387 |
+
}
|
388 |
+
wppa_album_list( 'close' ); // Close Albums sub-container
|
389 |
+
} // If albums
|
390 |
+
}
|
391 |
+
|
392 |
+
// Make pagelinkbar if requested on bottom
|
393 |
+
if ( wppa_opt( 'pagelink_pos' ) == 'bottom' || wppa_opt( 'pagelink_pos' ) == 'both' ) {
|
394 |
+
wppa_page_links( $totpag, $curpage );
|
395 |
+
}
|
396 |
+
|
397 |
+
// Empty results?
|
398 |
+
if ( ! $didsome && ! $wanted_empty ) {
|
399 |
+
if ( wppa( 'photos_only' ) ) {
|
400 |
+
wppa_out( wppa_errorbox( __( 'No photos found matching your search criteria.', 'wp-photo-album-plus' ) ) );
|
401 |
+
wppa_report_nothing(1);
|
402 |
}
|
403 |
+
elseif ( wppa( 'albums_only' ) ) {
|
404 |
+
wppa_out( wppa_errorbox( __( 'No albums found matching your search criteria.', 'wp-photo-album-plus' ) ) );
|
405 |
+
wppa_report_nothing(2);
|
|
|
|
|
|
|
|
|
|
|
406 |
}
|
407 |
else {
|
408 |
+
wppa_out( wppa_errorbox( __( 'No albums or photos found matching your search criteria.', 'wp-photo-album-plus' ) ) );
|
409 |
+
wppa_report_nothing(3);
|
410 |
}
|
411 |
+
$wppa_empty_content = true;
|
412 |
+
}
|
413 |
+
} // wppa_page( 'albums' )
|
414 |
+
|
415 |
+
elseif ( wppa_page( 'slide' ) || wppa_page( 'single' ) ) { // Page 'Slideshow' or 'Single' in browsemode requested
|
416 |
+
$thumbs = wppa_get_thumbs();
|
417 |
+
wppa_dbg_msg( 'From theme: #thumbs='.( $thumbs ? count( $thumbs ) : '0' ) );
|
418 |
+
if ( $thumbs ) {
|
419 |
+
wppa_the_slideshow(); // Producs all the html required for the slideshow
|
420 |
+
wppa_run_slidecontainer( 'slideshow' ); // Fill in the photo array and display it.
|
421 |
+
}
|
422 |
+
else {
|
423 |
+
wppa_out( wppa_errorbox( __( 'No photos found matching your search criteria.', 'wp-photo-album-plus') ) );
|
424 |
+
wppa_report_nothing(4);
|
425 |
+
}
|
426 |
+
} // wppa_page( 'slide' )
|
427 |
+
|
428 |
+
// Close container
|
429 |
+
wppa_container( 'close' );
|
430 |
|
|
|
431 |
}
|
432 |
|
433 |
function wppa_is_wanted_empty( $thumbs ) {
|
wppa-admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains the admin menu and startups the admin pages
|
6 |
-
* Version 8.1.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -340,22 +340,29 @@ add_filter( 'block_categories_all', 'wppa_block_categories', 10, 2 );
|
|
340 |
// Fix Gutenberg bug and clear cache selectively
|
341 |
function wppa_fix_gutenberg_shortcodes( $id, $post, $update ) {
|
342 |
|
|
|
343 |
$post_content = $post->post_content;
|
344 |
|
345 |
-
// Fix
|
346 |
$new_content = str_replace( array( 'wp:wppa/gutenberg-photo', 'wp:wppa/gutenberg-wppa' ), 'wp:shortcode', $post_content );
|
347 |
|
348 |
-
|
349 |
-
if (
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
355 |
-
$new_content = implode( '[wppa ', $temp );
|
356 |
}
|
357 |
|
358 |
-
// Update if
|
359 |
if ( $post_content != $new_content ) {
|
360 |
|
361 |
$post->post_content = $new_content;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains the admin menu and startups the admin pages
|
6 |
+
* Version 8.1.07.002
|
7 |
*
|
8 |
*/
|
9 |
|
340 |
// Fix Gutenberg bug and clear cache selectively
|
341 |
function wppa_fix_gutenberg_shortcodes( $id, $post, $update ) {
|
342 |
|
343 |
+
// Get content
|
344 |
$post_content = $post->post_content;
|
345 |
|
346 |
+
// Fix block type
|
347 |
$new_content = str_replace( array( 'wp:wppa/gutenberg-photo', 'wp:wppa/gutenberg-wppa' ), 'wp:shortcode', $post_content );
|
348 |
|
349 |
+
// Fix virtual identifiers
|
350 |
+
if ( strpos( $post_content, '[wppa' ) !== false ) {
|
351 |
+
|
352 |
+
$from = ['@topten', '@lasten', '@featen', '@comten', '@tags', '@cat', '@owner', '@upldr', '@all', '@last', '@owner', '@cat', '@all', '@potd', '@last'];
|
353 |
+
$to = ['#topten', '#lasten', '#featen', '#comten', '#tags', '#cat', '#owner', '#upldr', '#all', '#last', '#owner', '#cat', '#all', '#potd', '#last'];
|
354 |
+
$temp = explode( '[wppa ', $new_content );
|
355 |
+
if ( is_array( $temp ) ) {
|
356 |
+
foreach( array_keys( $temp ) as $key ) {
|
357 |
+
$t = explode( ']', $temp[$key] );
|
358 |
+
$t[0] = str_replace( $from, $to, $t[0] );
|
359 |
+
$temp[$key] = implode( ']', $t );
|
360 |
+
}
|
361 |
+
$new_content = implode( '[wppa ', $temp );
|
362 |
}
|
|
|
363 |
}
|
364 |
|
365 |
+
// Update if something changed
|
366 |
if ( $post_content != $new_content ) {
|
367 |
|
368 |
$post->post_content = $new_content;
|
wppa-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
-
* Version 8.1.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -949,7 +949,7 @@ global $other_deps;
|
|
949 |
}
|
950 |
else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
|
951 |
global $wppa_version;
|
952 |
-
$expected_version = '8.
|
953 |
if ( $wppa_version != $expected_version ) {
|
954 |
wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
|
955 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
+
* Version 8.1.07.002
|
7 |
*
|
8 |
*/
|
9 |
|
949 |
}
|
950 |
else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
|
951 |
global $wppa_version;
|
952 |
+
$expected_version = '8.1.07.002';
|
953 |
if ( $wppa_version != $expected_version ) {
|
954 |
wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
|
955 |
}
|
wppa-gutenberg-wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-gutenberg-wppa.php
|
3 |
* Pachkage: wp-photo-album-plus
|
4 |
*
|
5 |
-
* Version 8.1.07.
|
6 |
*/
|
7 |
|
8 |
function wppa_gutenberg_wppa_block() {
|
@@ -416,7 +416,7 @@ global $wpdb;
|
|
416 |
|
417 |
// Please select
|
418 |
$result .= '<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a photo', 'wp-photo-album-plus').' --</option>';
|
419 |
-
$result .= '<option value="
|
420 |
|
421 |
// Most recent 100 photos
|
422 |
foreach ( $photos as $photo ) {
|
@@ -445,8 +445,8 @@ global $wpdb;
|
|
445 |
' (' . wppa_get_album_name( $photo['album'] ) . ')' .
|
446 |
'</option>';
|
447 |
}
|
448 |
-
$result .= '<option value="
|
449 |
-
'<option value="
|
450 |
}
|
451 |
else {
|
452 |
$result .= '<option value="0" >'.__('There are no photos yet', 'wp-photo-album-plus').'</option>';
|
2 |
/* wppa-gutenberg-wppa.php
|
3 |
* Pachkage: wp-photo-album-plus
|
4 |
*
|
5 |
+
* Version 8.1.07.002
|
6 |
*/
|
7 |
|
8 |
function wppa_gutenberg_wppa_block() {
|
416 |
|
417 |
// Please select
|
418 |
$result .= '<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a photo', 'wp-photo-album-plus').' --</option>';
|
419 |
+
$result .= '<option value="@potd" >-- '.__('The photo of the day', 'wp-photo-album-plus').' --</option>';
|
420 |
|
421 |
// Most recent 100 photos
|
422 |
foreach ( $photos as $photo ) {
|
445 |
' (' . wppa_get_album_name( $photo['album'] ) . ')' .
|
446 |
'</option>';
|
447 |
}
|
448 |
+
$result .= '<option value="@last" >-- '.__('The most recently uploaded photo', 'wp-photo-album-plus').' --</option>'.
|
449 |
+
'<option value="@potd" >-- '.__('The photo of the day', 'wp-photo-album-plus').' --</option>';
|
450 |
}
|
451 |
else {
|
452 |
$result .= '<option value="0" >'.__('There are no photos yet', 'wp-photo-album-plus').'</option>';
|
wppa-setup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
-
* Version 8.1.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -38,8 +38,6 @@ global $wppa_error;
|
|
38 |
|
39 |
if ( $old_rev == $wppa_revno && ! $force ) return; // Nothing to do here
|
40 |
|
41 |
-
wppa_clear_cache( array( 'force' => true ) );
|
42 |
-
|
43 |
$wppa_error = false; // Init no error
|
44 |
|
45 |
$create_albums = "CREATE TABLE $wpdb->wppa_albums (
|
@@ -213,9 +211,34 @@ global $wppa_error;
|
|
213 |
// Create or update db tables
|
214 |
$tn = array( WPPA_ALBUMS, WPPA_PHOTOS, WPPA_RATING, WPPA_COMMENTS, WPPA_IPTC, WPPA_EXIF, WPPA_INDEX, WPPA_SESSION, WPPA_CACHES );
|
215 |
$tc = array( $create_albums, $create_photos, $create_rating, $create_comments, $create_iptc, $create_exif, $create_index, $create_session, $create_caches );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
$idx = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
// Change longtext into text in existring
|
219 |
if ( $old_rev > '100' ) {
|
220 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_albums CHANGE `custom` `custom` TEXT CHARACTER SET utf8 NOT NULL;" );
|
221 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_photos CHANGE `custom` `custom` TEXT CHARACTER SET utf8 NOT NULL;" );
|
@@ -223,13 +246,16 @@ global $wppa_error;
|
|
223 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_photos CHANGE `description` `description` TEXT CHARACTER SET utf8 NOT NULL;" );
|
224 |
}
|
225 |
|
|
|
|
|
226 |
while ( $idx < 9 ) {
|
227 |
-
dbDelta( $tc[$idx] );
|
228 |
$idx++;
|
229 |
}
|
230 |
wppa_log( 'OBS', 'DB UPDATED' );
|
231 |
|
232 |
-
// Clear cahce statistics
|
|
|
233 |
delete_option( 'wppa_cache_hits' );
|
234 |
delete_option( 'wppa_cache_misses' );
|
235 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
+
* Version 8.1.07.002
|
7 |
*
|
8 |
*/
|
9 |
|
38 |
|
39 |
if ( $old_rev == $wppa_revno && ! $force ) return; // Nothing to do here
|
40 |
|
|
|
|
|
41 |
$wppa_error = false; // Init no error
|
42 |
|
43 |
$create_albums = "CREATE TABLE $wpdb->wppa_albums (
|
211 |
// Create or update db tables
|
212 |
$tn = array( WPPA_ALBUMS, WPPA_PHOTOS, WPPA_RATING, WPPA_COMMENTS, WPPA_IPTC, WPPA_EXIF, WPPA_INDEX, WPPA_SESSION, WPPA_CACHES );
|
213 |
$tc = array( $create_albums, $create_photos, $create_rating, $create_comments, $create_iptc, $create_exif, $create_index, $create_session, $create_caches );
|
214 |
+
|
215 |
+
// Find existing tables
|
216 |
+
$r = $wpdb->get_results( "SHOW TABLES", ARRAY_A );
|
217 |
+
$s = array();
|
218 |
+
foreach( $r as $i ) {
|
219 |
+
foreach( $i as $j ) {
|
220 |
+
$existing_tables[] = $j;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
// Add missing tables
|
225 |
+
// W@e do this here because dbDelta() generates an error when a new table is created
|
226 |
$idx = 0;
|
227 |
+
while ( $idx < 9 ) {
|
228 |
+
if ( ! in_array( $tn[$idx], $existing_tables ) ) {
|
229 |
+
wppa_log( 'obs', 'Attempting to create ' . $tn[$idx] );
|
230 |
+
$bret = $wpdb->query( $tc[$idx] );
|
231 |
+
if ( $bret ) {
|
232 |
+
wppa_log( 'obs', $tn[$idx] . ' successfully created' );
|
233 |
+
}
|
234 |
+
else {
|
235 |
+
wppa_log( 'err', 'Failed to create ' . $tn[$idx] );
|
236 |
+
}
|
237 |
+
}
|
238 |
+
$idx++;
|
239 |
+
}
|
240 |
|
241 |
+
// Change longtext into text in existring tables
|
242 |
if ( $old_rev > '100' ) {
|
243 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_albums CHANGE `custom` `custom` TEXT CHARACTER SET utf8 NOT NULL;" );
|
244 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_photos CHANGE `custom` `custom` TEXT CHARACTER SET utf8 NOT NULL;" );
|
246 |
$wpdb->query( "ALTER TABLE $wpdb->wppa_photos CHANGE `description` `description` TEXT CHARACTER SET utf8 NOT NULL;" );
|
247 |
}
|
248 |
|
249 |
+
// Update tables with possibly new fields
|
250 |
+
$idx = 0;
|
251 |
while ( $idx < 9 ) {
|
252 |
+
@ dbDelta( $tc[$idx] );
|
253 |
$idx++;
|
254 |
}
|
255 |
wppa_log( 'OBS', 'DB UPDATED' );
|
256 |
|
257 |
+
// Clear cahce and statistics
|
258 |
+
wppa_clear_cache( array( 'force' => true ) );
|
259 |
delete_option( 'wppa_cache_hits' );
|
260 |
delete_option( 'wppa_cache_misses' );
|
261 |
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 8.1.07.
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
@@ -24,7 +24,7 @@ global $wp_version;
|
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
-
$wppa_api_version = '8.1.07.
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
+
* Version: 8.1.07.002
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
+
$wppa_api_version = '8.1.07.002'; // WPPA software version
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|