Version Description
= 8.1.08 =
- 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.2.04.005 |
Comparing to | |
See all releases |
Code changes from version 8.2.04.004 to 8.2.04.005
- changelog.txt +3 -1
- theme/wppa-theme.php +6 -6
- wppa-ajax.php +4 -4
- wppa-album-admin-autosave.php +24 -82
- wppa-album-covers.php +202 -205
- wppa-album-navigator-widget.php +4 -11
- wppa-album-widget.php +6 -8
- wppa-boxes-html.php +6 -6
- wppa-cloudinary.php +2 -2
- wppa-comment-widget.php +2 -2
- wppa-common-functions.php +3 -60
- wppa-dashboard-widgets.php +52 -58
- wppa-date-time.php +2 -2
- wppa-featen-widget.php +5 -8
- wppa-functions.php +68 -128
- wppa-index.php +2 -2
- wppa-init.php +3 -1
- wppa-items.php +81 -81
- wppa-lasten-widget.php +3 -25
- wppa-links.php +12 -10
- wppa-maintenance.php +5 -5
- wppa-non-admin.php +3 -3
- wppa-photo-admin-autosave.php +2 -2
- wppa-photo-files.php +5 -5
- wppa-picture.php +14 -7
- wppa-slideshow-widget.php +2 -2
- wppa-slideshow.php +6 -8
- wppa-statistics.php +85 -83
- wppa-styles.php +2 -2
- wppa-thumbnails.php +6 -6
- wppa-topten-widget.php +4 -20
- wppa-utils.php +43 -65
- wppa-video.php +10 -5
- wppa-widget-functions.php +2 -7
- wppa-wpdb-insert.php +3 -3
- wppa-wpdb-update.php +4 -4
- wppa.php +2 -2
changelog.txt
CHANGED
@@ -5,7 +5,9 @@ WP Photo Album Plus Changelog
|
|
5 |
* The width and height of portrait oriented mp4 videos is now properly recorded.
|
6 |
* The dirs wp-content/cache and wp-content/widget-cache are now skipped when scanning for importable files.
|
7 |
* To improve previews, you can now add your theme and custom css at the backend. See new settings Advanced settings -> Admin -> VI -> Items 15, 16 and 17.
|
8 |
-
*
|
|
|
|
|
9 |
|
10 |
= 8.2.03 =
|
11 |
|
5 |
* The width and height of portrait oriented mp4 videos is now properly recorded.
|
6 |
* The dirs wp-content/cache and wp-content/widget-cache are now skipped when scanning for importable files.
|
7 |
* To improve previews, you can now add your theme and custom css at the backend. See new settings Advanced settings -> Admin -> VI -> Items 15, 16 and 17.
|
8 |
+
* Improved algorithm to decide if an album or item (photo, video, document) is visble for the current visitor.
|
9 |
+
This takes in account: itmem (photo) status, album status, user status: admin/superuser, logged-in or out, owner of the item or not etc.
|
10 |
+
Note: Published items that reside in albums that can not be seen by the current visitor are also hidden.
|
11 |
|
12 |
= 8.2.03 =
|
13 |
|
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;
|
@@ -43,7 +43,7 @@ global $wppa_empty_content;
|
|
43 |
$n_album_pages = wppa_get_npages( 'albums', $albums ); // Get the number of album pages
|
44 |
|
45 |
if ( wppa_opt( 'thumbtype' ) != 'none' ) {
|
46 |
-
$thumbs =
|
47 |
} else $thumbs = false;
|
48 |
|
49 |
$wanted_empty = wppa_is_wanted_empty( $thumbs ); // See if we need to display an empty thumbnail area
|
@@ -411,11 +411,11 @@ global $wppa_empty_content;
|
|
411 |
} // wppa_page( 'albums' )
|
412 |
|
413 |
elseif ( wppa_page( 'slide' ) || wppa_page( 'single' ) ) { // Page 'Slideshow' or 'Single' in browsemode requested
|
414 |
-
$thumbs =
|
415 |
wppa_dbg_msg( 'From theme: #thumbs='.( $thumbs ? count( $thumbs ) : '0' ) );
|
416 |
if ( $thumbs ) {
|
417 |
-
wppa_the_slideshow(); // Producs all the html required for the slideshow
|
418 |
-
wppa_run_slidecontainer(
|
419 |
}
|
420 |
else {
|
421 |
wppa_out( wppa_errorbox( __( 'No photos found matching your search criteria.', 'wp-photo-album-plus') ) );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the albums/photos/slideshow in a page or post
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
function wppa_theme() {
|
9 |
|
10 |
+
global $wppa_version; $wppa_version = '8.2.04.005'; // 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;
|
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_photos(); // 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
|
411 |
} // wppa_page( 'albums' )
|
412 |
|
413 |
elseif ( wppa_page( 'slide' ) || wppa_page( 'single' ) ) { // Page 'Slideshow' or 'Single' in browsemode requested
|
414 |
+
$thumbs = wppa_get_photos();
|
415 |
wppa_dbg_msg( 'From theme: #thumbs='.( $thumbs ? count( $thumbs ) : '0' ) );
|
416 |
if ( $thumbs ) {
|
417 |
+
wppa_the_slideshow( $thumbs ); // Producs all the html required for the slideshow
|
418 |
+
wppa_run_slidecontainer( $thumbs ); // Fill in the photo array and display it.
|
419 |
}
|
420 |
else {
|
421 |
wppa_out( wppa_errorbox( __( 'No photos found matching your search criteria.', 'wp-photo-album-plus') ) );
|
wppa-ajax.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
-
* Version 8.2.04.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -1995,7 +1995,7 @@ global $wppa;
|
|
1995 |
wppa_exit(); // Nonce check failed
|
1996 |
}
|
1997 |
|
1998 |
-
|
1999 |
if ( wppa_add_watermark( $photo ) ) {
|
2000 |
if ( wppa_switch( 'watermark_thumbs' ) ) {
|
2001 |
wppa_create_thumbnail( $photo ); // create new thumb
|
@@ -4064,8 +4064,8 @@ function wppa_json_photo_update( $id, $txt, $err = '0', $thumbmod = false, $phot
|
|
4064 |
$ty = wppa_get_thumby($id, true);
|
4065 |
$px = wppa_get_photox($id, true);
|
4066 |
$py = wppa_get_photoy($id, true);
|
4067 |
-
|
4068 |
-
$t =
|
4069 |
|
4070 |
// Just to be sure increment version numbers
|
4071 |
if ( $thumbmod || $magickmod ) {
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
+
* Version 8.2.04.005
|
6 |
*
|
7 |
*/
|
8 |
|
1995 |
wppa_exit(); // Nonce check failed
|
1996 |
}
|
1997 |
|
1998 |
+
wppa_cache_photo( $photo );
|
1999 |
if ( wppa_add_watermark( $photo ) ) {
|
2000 |
if ( wppa_switch( 'watermark_thumbs' ) ) {
|
2001 |
wppa_create_thumbnail( $photo ); // create new thumb
|
4064 |
$ty = wppa_get_thumby($id, true);
|
4065 |
$px = wppa_get_photox($id, true);
|
4066 |
$py = wppa_get_photoy($id, true);
|
4067 |
+
wppa_cache_photo( 'invalidate', $id );
|
4068 |
+
$t = wppa_cache_photo( $id );
|
4069 |
|
4070 |
// Just to be sure increment version numbers
|
4071 |
if ( $thumbmod || $magickmod ) {
|
wppa-album-admin-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* create, edit and delete albums
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -137,11 +137,6 @@ global $wppa_revno;
|
|
137 |
// Edit by search token
|
138 |
if ( wppa_get( 'edit-id' ) == 'search' ) {
|
139 |
|
140 |
-
// if ( wppa_get( 'searchstring' ) ) {
|
141 |
-
// $back_url .= '&wppa-searchstring=' . wppa_get( 'searchstring' );
|
142 |
-
// }
|
143 |
-
// $back_url .= '#wppa-edit-search-tag';
|
144 |
-
|
145 |
$task = __( 'Edit photo information', 'wp-photo-album-plus' );
|
146 |
if ( wppa_get( 'bulk' ) ) {
|
147 |
$task = __( 'Copy / move / delete / edit name / edit description / change status', 'wp-photo-album-plus' );
|
@@ -157,9 +152,6 @@ global $wppa_revno;
|
|
157 |
</h2>' .
|
158 |
$back_link_html . '
|
159 |
<br><br>' );
|
160 |
-
// <a href="' . $back_url . '" >' .
|
161 |
-
// $back_title .
|
162 |
-
// '</a><br><br>' );
|
163 |
|
164 |
if ( wppa_get( 'bulk' ) ) {
|
165 |
wppa_album_photos_bulk( $ei );
|
@@ -169,10 +161,6 @@ global $wppa_revno;
|
|
169 |
}
|
170 |
|
171 |
wppa_echo( $top_link_html . '<br>' . $back_link_html );
|
172 |
-
// <a href="' . $back_url . '" >' .
|
173 |
-
// $back_title .
|
174 |
-
// '</a>' );
|
175 |
-
|
176 |
return;
|
177 |
}
|
178 |
|
@@ -1353,77 +1341,31 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
|
|
1353 |
__( 'Custom data fields', 'wp-photo-album-plus' ) . '
|
1354 |
</legend>' );
|
1355 |
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
<span style="float:left">' .
|
1379 |
-
apply_filters( 'translate_text', wppa_opt( 'album_custom_caption_' . $key ) ) . ' (w#cc' . $key . ')
|
1380 |
-
</span>
|
1381 |
-
<span style="float:right">
|
1382 |
-
(w#cd' . $key . ')
|
1383 |
-
</span>
|
1384 |
-
</label><br>
|
1385 |
-
<input
|
1386 |
-
type="text"
|
1387 |
-
style="width:100%"
|
1388 |
-
id="album_custom_' . $key . '-' . $id . '"
|
1389 |
-
onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'album_custom_' . $key . '\', this.value)"
|
1390 |
-
value="' . esc_attr( stripslashes( $custom_data[$key] ) ) . '"
|
1391 |
-
/>
|
1392 |
-
<div>' );
|
1393 |
-
/*
|
1394 |
-
wppa_echo( '
|
1395 |
-
<tr>
|
1396 |
-
<td>
|
1397 |
-
' . apply_filters( 'translate_text', wppa_opt( 'album_custom_caption_' . $key ) ) . '
|
1398 |
-
<small style="float:right" >
|
1399 |
-
(w#cc' . $key . ')
|
1400 |
-
</small>
|
1401 |
-
</td>
|
1402 |
-
<td>
|
1403 |
-
<input
|
1404 |
-
type="text"
|
1405 |
-
style="width:100%"
|
1406 |
-
id="album_custom_' . $key . '-' . $id . '"
|
1407 |
-
onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'album_custom_' . $key . '\', this );"
|
1408 |
-
value="' . esc_attr( stripslashes( $custom_data[$key] ) ) . '"
|
1409 |
-
/>
|
1410 |
-
</td>
|
1411 |
-
<td>
|
1412 |
-
<small>
|
1413 |
-
(w#cd' . $key . ')
|
1414 |
-
</small>
|
1415 |
-
</td>
|
1416 |
-
</tr>' );
|
1417 |
-
*/
|
1418 |
-
}
|
1419 |
}
|
|
|
1420 |
|
1421 |
-
/*
|
1422 |
-
wppa_echo( '
|
1423 |
-
</tbody>
|
1424 |
-
</table>
|
1425 |
-
</fieldset>' );
|
1426 |
-
*/
|
1427 |
wppa_echo( '</fieldset>' );
|
1428 |
}
|
1429 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* create, edit and delete albums
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
137 |
// Edit by search token
|
138 |
if ( wppa_get( 'edit-id' ) == 'search' ) {
|
139 |
|
|
|
|
|
|
|
|
|
|
|
140 |
$task = __( 'Edit photo information', 'wp-photo-album-plus' );
|
141 |
if ( wppa_get( 'bulk' ) ) {
|
142 |
$task = __( 'Copy / move / delete / edit name / edit description / change status', 'wp-photo-album-plus' );
|
152 |
</h2>' .
|
153 |
$back_link_html . '
|
154 |
<br><br>' );
|
|
|
|
|
|
|
155 |
|
156 |
if ( wppa_get( 'bulk' ) ) {
|
157 |
wppa_album_photos_bulk( $ei );
|
161 |
}
|
162 |
|
163 |
wppa_echo( $top_link_html . '<br>' . $back_link_html );
|
|
|
|
|
|
|
|
|
164 |
return;
|
165 |
}
|
166 |
|
1341 |
__( 'Custom data fields', 'wp-photo-album-plus' ) . '
|
1342 |
</legend>' );
|
1343 |
|
1344 |
+
foreach( array_keys( $custom_data ) as $key ) {
|
1345 |
+
if ( wppa_opt( 'album_custom_caption_' . $key ) ) {
|
1346 |
+
|
1347 |
+
wppa_echo( '
|
1348 |
+
<div>
|
1349 |
+
<label>
|
1350 |
+
<span style="float:left">' .
|
1351 |
+
apply_filters( 'translate_text', wppa_opt( 'album_custom_caption_' . $key ) ) . ' (w#cc' . $key . ')
|
1352 |
+
</span>
|
1353 |
+
<span style="float:right">
|
1354 |
+
(w#cd' . $key . ')
|
1355 |
+
</span>
|
1356 |
+
</label><br>
|
1357 |
+
<input
|
1358 |
+
type="text"
|
1359 |
+
style="width:100%"
|
1360 |
+
id="album_custom_' . $key . '-' . $id . '"
|
1361 |
+
onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'album_custom_' . $key . '\', this.value)"
|
1362 |
+
value="' . esc_attr( stripslashes( $custom_data[$key] ) ) . '"
|
1363 |
+
/>
|
1364 |
+
<div>' );
|
1365 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1366 |
}
|
1367 |
+
}
|
1368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1369 |
wppa_echo( '</fieldset>' );
|
1370 |
}
|
1371 |
|
wppa-album-covers.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Functions for album covers
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -13,9 +13,14 @@ if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
|
13 |
// decide wich cover type and call the types function
|
14 |
function wppa_album_cover( $id ) {
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
// Find the album specific cover type
|
17 |
$cover_type = wppa_get_album_item( $id, 'cover_type' );
|
18 |
-
|
19 |
// No type specified (0), use default
|
20 |
if ( ! $cover_type ) {
|
21 |
$cover_type = wppa_opt( 'cover_type' );
|
@@ -91,7 +96,7 @@ global $wpdb;
|
|
91 |
|
92 |
// Find album details
|
93 |
$coverphoto = wppa_get_coverphoto_id( $albumid );
|
94 |
-
$image =
|
95 |
$photocount = wppa_get_visible_photo_count( $albumid );
|
96 |
$albumcount = wppa_get_album_count( $albumid, 'use_treecounts' );
|
97 |
|
@@ -417,7 +422,7 @@ global $wpdb;
|
|
417 |
// Find the coverphotos details
|
418 |
foreach ( $coverphotos as $coverphoto ) {
|
419 |
|
420 |
-
$images[] =
|
421 |
$path = wppa_get_thumb_path( $coverphoto );
|
422 |
$paths[] = $path;
|
423 |
$cpsize = count( $coverphotos ) == '1' ?
|
@@ -574,7 +579,7 @@ global $wpdb;
|
|
574 |
if ( $multicolresp ) $mcr = 'mcr-'; else $mcr = '';
|
575 |
|
576 |
$coverphoto = wppa_get_coverphoto_id( $albumid );
|
577 |
-
$image =
|
578 |
$photocount = wppa_get_visible_photo_count( $albumid );
|
579 |
$albumcount = wppa_get_album_count( $albumid, true );
|
580 |
$title = '';
|
@@ -759,7 +764,7 @@ global $wpdb;
|
|
759 |
// Find album details
|
760 |
$coverphoto = wppa_get_coverphoto_id( $id );
|
761 |
if ( ! $coverphoto ) return;
|
762 |
-
$image =
|
763 |
$photocount = wppa_get_visible_photo_count( $id );
|
764 |
$albumcount = wppa_get_album_count( $id, 'use_treecounts' );
|
765 |
|
@@ -985,7 +990,7 @@ global $wpdb;
|
|
985 |
wppa_get_photo_order( $albumid ), $albumid
|
986 |
), ARRAY_A );
|
987 |
|
988 |
-
|
989 |
|
990 |
if ( $thumbs ) foreach ( $thumbs as $thumb ) {
|
991 |
$id = $thumb['id'];
|
@@ -1343,7 +1348,7 @@ function wppa_get_coverphoto_id( $xalb = '' ) {
|
|
1343 |
// See if current photo still exists
|
1344 |
$current = wppa_get_album_item( $xalb, 'main_photo' );
|
1345 |
if ( $current > '0' ) {
|
1346 |
-
if ( ! wppa_photo_exists( $current ) ) {
|
1347 |
wppa_update_album( array( 'id' => $xalb, 'main_photo' => '0' ) );
|
1348 |
}
|
1349 |
else {
|
@@ -1368,9 +1373,12 @@ function wppa_get_coverphoto_id( $xalb = '' ) {
|
|
1368 |
}
|
1369 |
|
1370 |
if ( $save_it ) {
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
|
|
|
|
|
|
1374 |
}
|
1375 |
return $result['0'];
|
1376 |
}
|
@@ -1408,7 +1416,15 @@ static $cached_cover_photo_ids;
|
|
1408 |
}
|
1409 |
|
1410 |
// Make the private clause
|
1411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1412 |
|
1413 |
// Other inits
|
1414 |
$user = wppa_get_user();
|
@@ -1528,6 +1544,12 @@ static $cached_cover_photo_ids;
|
|
1528 |
function wppa_get_album_title_attr_a( $albumid, $linktype, $linkpage, $has_content, $coverphoto, $photocount ) {
|
1529 |
|
1530 |
$album = wppa_cache_album( $albumid );
|
|
|
|
|
|
|
|
|
|
|
|
|
1531 |
|
1532 |
// Init
|
1533 |
$href_title = '';
|
@@ -1554,7 +1576,7 @@ function wppa_get_album_title_attr_a( $albumid, $linktype, $linkpage, $has_conte
|
|
1554 |
'type' => $linktype ) );
|
1555 |
}
|
1556 |
else {
|
1557 |
-
$href_title =
|
1558 |
}
|
1559 |
break;
|
1560 |
case 'slide':
|
@@ -1563,11 +1585,11 @@ function wppa_get_album_title_attr_a( $albumid, $linktype, $linkpage, $has_conte
|
|
1563 |
'page' => $linkpage ) );
|
1564 |
}
|
1565 |
else {
|
1566 |
-
$href_title =
|
1567 |
}
|
1568 |
break;
|
1569 |
case 'page':
|
1570 |
-
$href_title =
|
1571 |
break;
|
1572 |
default:
|
1573 |
break;
|
@@ -1652,52 +1674,12 @@ global $wpdb;
|
|
1652 |
$class = 'wppa-box-text wppa-black wppa-info wppa-viewlink-sym wppa-album-cover-link';
|
1653 |
}
|
1654 |
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
$nta = $treecount['treealbums'];
|
1660 |
-
$ntp = $treecount['treephotos'];
|
1661 |
-
if ( ! wppa_user_is( 'administrator' ) ) {
|
1662 |
-
$na -= $treecount['hiddenalbums'];
|
1663 |
-
// $np -= $treecount['pendselfphotos'];
|
1664 |
-
$nta -= $treecount['hiddentreealbums'];
|
1665 |
-
$ntp -= $treecount['pendtreephotos'];
|
1666 |
-
}
|
1667 |
-
if ( ! is_user_logged_in() ) {
|
1668 |
-
$na -= $treecount['privatealbums'];
|
1669 |
-
// $np -= $treecount[];
|
1670 |
-
$nta -= $treecount['privatetreealbums'];
|
1671 |
-
// $ntp -= $treecount[];
|
1672 |
-
}
|
1673 |
-
*/
|
1674 |
-
$na = wppa_get_visible_album_count( $id );
|
1675 |
-
$np = wppa_get_visible_photo_count( $id );
|
1676 |
-
$nta = wppa_get_visible_subtree_album_count( $id );
|
1677 |
-
$ntp = wppa_get_visible_subtree_photo_count( $id );
|
1678 |
-
|
1679 |
-
/*
|
1680 |
-
// Verify the direct subalbums left (if any) are all non-empty
|
1681 |
-
if ( $na ) {
|
1682 |
-
$children = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
|
1683 |
-
$new_na = '0';
|
1684 |
-
foreach( $children as $c ) {
|
1685 |
-
if ( ! wppa_is_album_empty( $c ) ) {
|
1686 |
-
$new_na++;
|
1687 |
-
}
|
1688 |
-
}
|
1689 |
-
if ( $new_na != $na ) {
|
1690 |
-
wppa_log('obs', "na corrected from $na to $new_na for album $id");
|
1691 |
-
|
1692 |
-
// Correct tree albums
|
1693 |
-
$nta = $nta + $new_na - $na;
|
1694 |
-
$na = $new_na;
|
1695 |
-
}
|
1696 |
-
}
|
1697 |
|
1698 |
-
|
1699 |
-
|
1700 |
-
// Anything left to show?
|
1701 |
if ( ! $na && ! $np && ! $nta && ! $ntp ) {
|
1702 |
return;
|
1703 |
}
|
@@ -2048,169 +2030,184 @@ global $wpdb;
|
|
2048 |
// Process the subalbums
|
2049 |
foreach( $subs as $album ) {
|
2050 |
|
2051 |
-
//
|
2052 |
-
|
2053 |
-
if ( ! $linktype ) $linktype = 'content'; // Default
|
2054 |
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
$href_content = wppa_get_album_url( array( 'album' => $albumid,
|
2067 |
-
'page' => $linkpage ) );
|
2068 |
-
$ajax_content = wppa_get_album_url_ajax( array( 'album' => $albumid,
|
2069 |
-
'page' => $linkpage ) );
|
2070 |
|
2071 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2072 |
|
2073 |
-
|
2074 |
-
}
|
2075 |
|
2076 |
-
|
2077 |
-
|
2078 |
-
$href_content = wppa_get_slideshow_url( array( 'album' => $albumid,
|
2079 |
-
'page' => $linkpage ) );
|
2080 |
-
$ajax_content = wppa_get_slideshow_url_ajax( array( 'album' => $albumid,
|
2081 |
-
'page' => $linkpage ) );
|
2082 |
|
2083 |
-
|
|
|
|
|
|
|
|
|
|
|
2084 |
|
2085 |
-
|
2086 |
-
}
|
2087 |
|
2088 |
-
|
2089 |
-
|
2090 |
-
$pc = wppa_get_visible_photo_count( $albumid, true );
|
2091 |
-
$ac = wppa_get_album_count( $albumid, true );
|
2092 |
-
$sub_attr = wppa_get_album_title_attr_a( $albumid,
|
2093 |
-
$album['cover_linktype'],
|
2094 |
-
$album['cover_linkpage'],
|
2095 |
-
( $pc + $ac > 0 ),
|
2096 |
-
false,
|
2097 |
-
$pc
|
2098 |
-
);
|
2099 |
-
$href_content = $sub_attr['href'];
|
2100 |
-
$onclick_content = $sub_attr['onclick'];
|
2101 |
-
$title = $sub_attr['title'];
|
2102 |
-
}
|
2103 |
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2110 |
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
|
|
|
|
|
|
|
|
2120 |
}
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2124 |
( $href_content ? ' href="' . $href_content . '"' : '' ) .
|
2125 |
( $onclick_content ? ' onclick="' . $onclick_content . '"' : '' ) .
|
2126 |
' title="' . $title . '"' .
|
2127 |
' >' .
|
2128 |
wppa_get_album_name( $album['id'] ) .
|
2129 |
-
'</a>'
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
' alt="' . wppa_get_album_name( $album['id'] ) . '"' .
|
2194 |
-
' style="' .
|
2195 |
-
'width:' . $x . 'px;' .
|
2196 |
-
'height:' . $y . 'px;' .
|
2197 |
-
'padding:1px;' .
|
2198 |
-
'margin:1px;' .
|
2199 |
-
'background-color:' . wppa_opt( 'bgcolor_img' ) . ';' .
|
2200 |
-
'float:left;' .
|
2201 |
-
'"' .
|
2202 |
-
' />' .
|
2203 |
-
'</a>'
|
2204 |
-
);
|
2205 |
-
}
|
2206 |
-
break;
|
2207 |
-
default:
|
2208 |
-
break;
|
2209 |
-
}
|
2210 |
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
|
|
2214 |
}
|
2215 |
}
|
2216 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Functions for album covers
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
13 |
// decide wich cover type and call the types function
|
14 |
function wppa_album_cover( $id ) {
|
15 |
|
16 |
+
// Is this album visible for the current user?
|
17 |
+
if ( ! wppa_is_album_visible( $id ) ) {
|
18 |
+
return;
|
19 |
+
}
|
20 |
+
|
21 |
// Find the album specific cover type
|
22 |
$cover_type = wppa_get_album_item( $id, 'cover_type' );
|
23 |
+
|
24 |
// No type specified (0), use default
|
25 |
if ( ! $cover_type ) {
|
26 |
$cover_type = wppa_opt( 'cover_type' );
|
96 |
|
97 |
// Find album details
|
98 |
$coverphoto = wppa_get_coverphoto_id( $albumid );
|
99 |
+
$image = wppa_cache_photo( $coverphoto );
|
100 |
$photocount = wppa_get_visible_photo_count( $albumid );
|
101 |
$albumcount = wppa_get_album_count( $albumid, 'use_treecounts' );
|
102 |
|
422 |
// Find the coverphotos details
|
423 |
foreach ( $coverphotos as $coverphoto ) {
|
424 |
|
425 |
+
$images[] = wppa_cache_photo( $coverphoto );
|
426 |
$path = wppa_get_thumb_path( $coverphoto );
|
427 |
$paths[] = $path;
|
428 |
$cpsize = count( $coverphotos ) == '1' ?
|
579 |
if ( $multicolresp ) $mcr = 'mcr-'; else $mcr = '';
|
580 |
|
581 |
$coverphoto = wppa_get_coverphoto_id( $albumid );
|
582 |
+
$image = wppa_cache_photo( $coverphoto );
|
583 |
$photocount = wppa_get_visible_photo_count( $albumid );
|
584 |
$albumcount = wppa_get_album_count( $albumid, true );
|
585 |
$title = '';
|
764 |
// Find album details
|
765 |
$coverphoto = wppa_get_coverphoto_id( $id );
|
766 |
if ( ! $coverphoto ) return;
|
767 |
+
$image = wppa_cache_photo( $coverphoto );
|
768 |
$photocount = wppa_get_visible_photo_count( $id );
|
769 |
$albumcount = wppa_get_album_count( $id, 'use_treecounts' );
|
770 |
|
990 |
wppa_get_photo_order( $albumid ), $albumid
|
991 |
), ARRAY_A );
|
992 |
|
993 |
+
wppa_cache_photo( 'add', $thumbs ); // Save rsult in 2nd level cache
|
994 |
|
995 |
if ( $thumbs ) foreach ( $thumbs as $thumb ) {
|
996 |
$id = $thumb['id'];
|
1348 |
// See if current photo still exists
|
1349 |
$current = wppa_get_album_item( $xalb, 'main_photo' );
|
1350 |
if ( $current > '0' ) {
|
1351 |
+
if ( ! wppa_photo_exists( $current ) || ! wppa_is_photo_visible( $current) ) {
|
1352 |
wppa_update_album( array( 'id' => $xalb, 'main_photo' => '0' ) );
|
1353 |
}
|
1354 |
else {
|
1373 |
}
|
1374 |
|
1375 |
if ( $save_it ) {
|
1376 |
+
$status = wppa_get_photo_item( $result['0'], 'status' );
|
1377 |
+
if ( ! in_array( $status,['scheduled','private','pending'] ) ) {
|
1378 |
+
wppa_update_album( array( 'id' => $xalb, 'main_photo' => $result['0'] ) );
|
1379 |
+
wppa_cache_album( 'invalidate', $xalb );
|
1380 |
+
// wppa_log( 'obs', 'Cover photo of album ' . $xalb . ' set to ' . $result['0'] );
|
1381 |
+
}
|
1382 |
}
|
1383 |
return $result['0'];
|
1384 |
}
|
1416 |
}
|
1417 |
|
1418 |
// Make the private clause
|
1419 |
+
if ( wppa_user_is( 'administrator' ) ) {
|
1420 |
+
$non_private = '';
|
1421 |
+
}
|
1422 |
+
elseif ( is_user_logged_in() ) {
|
1423 |
+
$non_private = "AND status NOT IN ('pending','scheduled') ";
|
1424 |
+
}
|
1425 |
+
else {
|
1426 |
+
$non_private = "AND status NOT IN ('pending','scheduled','private') ";
|
1427 |
+
}
|
1428 |
|
1429 |
// Other inits
|
1430 |
$user = wppa_get_user();
|
1544 |
function wppa_get_album_title_attr_a( $albumid, $linktype, $linkpage, $has_content, $coverphoto, $photocount ) {
|
1545 |
|
1546 |
$album = wppa_cache_album( $albumid );
|
1547 |
+
if ( $album['cover_linkpage'] > '0' ) {
|
1548 |
+
$page_link = get_page_link( $album['cover_linkpage'] );
|
1549 |
+
}
|
1550 |
+
else {
|
1551 |
+
$page_link = '';
|
1552 |
+
}
|
1553 |
|
1554 |
// Init
|
1555 |
$href_title = '';
|
1576 |
'type' => $linktype ) );
|
1577 |
}
|
1578 |
else {
|
1579 |
+
$href_title = $page_link;
|
1580 |
}
|
1581 |
break;
|
1582 |
case 'slide':
|
1585 |
'page' => $linkpage ) );
|
1586 |
}
|
1587 |
else {
|
1588 |
+
$href_title = $page_link;
|
1589 |
}
|
1590 |
break;
|
1591 |
case 'page':
|
1592 |
+
$href_title = $page_link;
|
1593 |
break;
|
1594 |
default:
|
1595 |
break;
|
1674 |
$class = 'wppa-box-text wppa-black wppa-info wppa-viewlink-sym wppa-album-cover-link';
|
1675 |
}
|
1676 |
|
1677 |
+
$na = strval( wppa_get_visible_album_count( $id ) );
|
1678 |
+
$np = strval( wppa_get_visible_photo_count( $id ) );
|
1679 |
+
$nta = strval( wppa_get_visible_subtree_album_count( $id ) );
|
1680 |
+
$ntp = strval( wppa_get_visible_subtree_photo_count( $id ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1681 |
|
1682 |
+
// Anything to show?
|
|
|
|
|
1683 |
if ( ! $na && ! $np && ! $nta && ! $ntp ) {
|
1684 |
return;
|
1685 |
}
|
2030 |
// Process the subalbums
|
2031 |
foreach( $subs as $album ) {
|
2032 |
|
2033 |
+
// This subalbum visible for this user?
|
2034 |
+
if ( wppa_is_album_visible( $album['id'] ) ) {
|
|
|
2035 |
|
2036 |
+
// What is the albums title linktype
|
2037 |
+
$linktype = $album['cover_linktype'];
|
2038 |
+
if ( ! $linktype ) $linktype = 'content'; // Default
|
2039 |
|
2040 |
+
// What is the albums title linkpage
|
2041 |
+
$linkpage = $album['cover_linkpage'];
|
2042 |
+
if ( $linkpage == '-1' ) $linktype = 'none'; // for backward compatibility
|
2043 |
|
2044 |
+
// Find the content 'View' link
|
2045 |
+
$albumid = $album['id'];
|
2046 |
+
$photocount = wppa_get_visible_photo_count( $albumid );
|
|
|
|
|
|
|
|
|
2047 |
|
2048 |
+
// Thumbnails and covers, show subalbum covers
|
2049 |
+
// in case slideshow is requested on an empty album
|
2050 |
+
if ( wppa_opt( 'cover_sublinks' ) == 'content' || ! $photocount ) {
|
2051 |
+
$href_content = wppa_get_album_url( array( 'album' => $albumid,
|
2052 |
+
'page' => $linkpage ) );
|
2053 |
+
$ajax_content = wppa_get_album_url_ajax( array( 'album' => $albumid,
|
2054 |
+
'page' => $linkpage ) );
|
2055 |
|
2056 |
+
$onclick_content = "wppaDoAjaxRender( " . wppa( 'mocc' ) . ", '" . $ajax_content . "', '" . $href_content . "' )";
|
|
|
2057 |
|
2058 |
+
$title = esc_attr( __( 'View the album', 'wp-photo-album-plus' ) . ': ' . wppa_get_album_name( $albumid ) );
|
2059 |
+
}
|
|
|
|
|
|
|
|
|
2060 |
|
2061 |
+
// Slideshow
|
2062 |
+
elseif ( wppa_opt( 'cover_sublinks' ) == 'slide' ) {
|
2063 |
+
$href_content = wppa_get_slideshow_url( array( 'album' => $albumid,
|
2064 |
+
'page' => $linkpage ) );
|
2065 |
+
$ajax_content = wppa_get_slideshow_url_ajax( array( 'album' => $albumid,
|
2066 |
+
'page' => $linkpage ) );
|
2067 |
|
2068 |
+
$onclick_content = "wppaDoAjaxRender( " . wppa( 'mocc' ) . ", '" . $alax_content . "', '" . $href_content . "' )";
|
|
|
2069 |
|
2070 |
+
$title = esc_attr( __( 'View the album', 'wp-photo-album-plus' ) . ': ' . wppa_get_album_name( $albumid ) );
|
2071 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2072 |
|
2073 |
+
// Subalbum title link
|
2074 |
+
elseif ( wppa_opt( 'cover_sublinks' ) == 'title' ) {
|
2075 |
+
$pc = wppa_get_visible_photo_count( $albumid, true );
|
2076 |
+
$ac = wppa_get_album_count( $albumid, true );
|
2077 |
+
$sub_attr = wppa_get_album_title_attr_a( $albumid,
|
2078 |
+
$album['cover_linktype'],
|
2079 |
+
$album['cover_linkpage'],
|
2080 |
+
( $pc + $ac > 0 ),
|
2081 |
+
false,
|
2082 |
+
$pc
|
2083 |
+
);
|
2084 |
+
$href_content = $sub_attr['href'];
|
2085 |
+
$onclick_content = $sub_attr['onclick'];
|
2086 |
+
$title = $sub_attr['title'];
|
2087 |
+
}
|
2088 |
|
2089 |
+
// None
|
2090 |
+
else {
|
2091 |
+
$href_content = '';
|
2092 |
+
$onclick_content = '';
|
2093 |
+
$title = '';
|
2094 |
+
}
|
2095 |
+
|
2096 |
+
// Physical empty? Even no link for admin, except when empty thumblist requested and upload link on thumblist
|
2097 |
+
if ( wppa_is_album_empty( $albumid ) ) {
|
2098 |
+
if ( ! wppa_switch( 'show_empty_thumblist' ) || wppa_opt( 'upload_link_thumbs' ) == 'none' ) {
|
2099 |
+
$href_content = '';
|
2100 |
+
$onclick_content = '';
|
2101 |
+
$title = __( 'This album is empty', 'wp-photo-album-plus' );
|
2102 |
}
|
2103 |
+
}
|
2104 |
+
|
2105 |
+
// Do the output
|
2106 |
+
switch( $display_type ) {
|
2107 |
+
case 'list':
|
2108 |
+
case 'recursivelist':
|
2109 |
+
if ( $link_type == 'none' ) {
|
2110 |
+
wppa_out( '<li style="margin:0;cursor:pointer">' .
|
2111 |
+
wppa_get_album_name( $album['id'] ) .
|
2112 |
+
'</li>'
|
2113 |
+
);
|
2114 |
+
}
|
2115 |
+
else {
|
2116 |
+
wppa_out( '<li style="margin:0;cursor:pointer">' .
|
2117 |
+
'<a' .
|
2118 |
+
( $href_content ? ' href="' . $href_content . '"' : '' ) .
|
2119 |
+
( $onclick_content ? ' onclick="' . $onclick_content . '"' : '' ) .
|
2120 |
+
' title="' . $title . '"' .
|
2121 |
+
' >' .
|
2122 |
+
wppa_get_album_name( $album['id'] ) .
|
2123 |
+
'</a>' .
|
2124 |
+
'</li>'
|
2125 |
+
);
|
2126 |
+
}
|
2127 |
+
break;
|
2128 |
+
case 'enum':
|
2129 |
+
if ( ! $first ) {
|
2130 |
+
wppa_out( ', ' );
|
2131 |
+
}
|
2132 |
+
if ( $link_type == 'none' ) {
|
2133 |
+
wppa_out( wppa_get_album_name( $album['id'] ) );
|
2134 |
+
}
|
2135 |
+
else {
|
2136 |
+
wppa_out( '<a' .
|
2137 |
( $href_content ? ' href="' . $href_content . '"' : '' ) .
|
2138 |
( $onclick_content ? ' onclick="' . $onclick_content . '"' : '' ) .
|
2139 |
' title="' . $title . '"' .
|
2140 |
' >' .
|
2141 |
wppa_get_album_name( $album['id'] ) .
|
2142 |
+
'</a>'
|
2143 |
+
);
|
2144 |
+
}
|
2145 |
+
$first = false;
|
2146 |
+
break;
|
2147 |
+
case 'microthumbs':
|
2148 |
+
$coverphoto_id = wppa_get_coverphoto_id( $album['id'] );
|
2149 |
+
$x = max( '1', wppa_get_thumbx( $coverphoto_id ) );
|
2150 |
+
$y = max( '1', wppa_get_thumby( $coverphoto_id ) );
|
2151 |
+
if ( $x > ( $y * 2 ) ) { // x limits
|
2152 |
+
$f = $x / 100;
|
2153 |
+
$x = 100;
|
2154 |
+
$y = floor( $y / $f );
|
2155 |
+
}
|
2156 |
+
else { // y limits
|
2157 |
+
$f = $y / 50;
|
2158 |
+
$y = 50;
|
2159 |
+
$x = floor( $x / $f );
|
2160 |
+
}
|
2161 |
+
$src = wppa_get_thumb_url( $coverphoto_id, true, '', $x, $y, wppa_switch( 'cover_use_thumb' ) );
|
2162 |
+
wppa_out( '<div style="width:' . $x . 'px;height:' . $y . 'px;overflow:hidden;float:left;" >' );
|
2163 |
+
if ( $link_type == 'none' ) {
|
2164 |
+
wppa_out( '<img' .
|
2165 |
+
' class="wppa-cover-sublink-img"' .
|
2166 |
+
' src="' . $src . '"' .
|
2167 |
+
' alt="' . wppa_get_album_name( $album['id'] ) . '"' .
|
2168 |
+
' style="' .
|
2169 |
+
'width:' . $x . 'px;' .
|
2170 |
+
'height:' . $y . 'px;' .
|
2171 |
+
'padding:1px;' .
|
2172 |
+
'margin:1px;' .
|
2173 |
+
'background-color:' . wppa_opt( 'bgcolor_img' ) . ';' .
|
2174 |
+
'float:left;' .
|
2175 |
+
'"' .
|
2176 |
+
' />'
|
2177 |
+
);
|
2178 |
+
}
|
2179 |
+
else {
|
2180 |
+
wppa_out( '<a' .
|
2181 |
+
( $href_content ? ' href="' . $href_content . '"' : '' ) .
|
2182 |
+
( $onclick_content ? ' onclick="' . $onclick_content . '"' : '' ) .
|
2183 |
+
' title="' . $title . '"' .
|
2184 |
+
' >' .
|
2185 |
+
'<img' .
|
2186 |
+
' class="wppa-cover-sublink-img"' .
|
2187 |
+
' src="' . $src . '"' .
|
2188 |
+
' alt="' . wppa_get_album_name( $album['id'] ) . '"' .
|
2189 |
+
' style="' .
|
2190 |
+
'width:' . $x . 'px;' .
|
2191 |
+
'height:' . $y . 'px;' .
|
2192 |
+
'padding:1px;' .
|
2193 |
+
'margin:1px;' .
|
2194 |
+
'background-color:' . wppa_opt( 'bgcolor_img' ) . ';' .
|
2195 |
+
'float:left;' .
|
2196 |
+
'"' .
|
2197 |
+
' />' .
|
2198 |
+
'</a>'
|
2199 |
+
);
|
2200 |
+
}
|
2201 |
+
wppa_out( '</div>' );
|
2202 |
+
break;
|
2203 |
+
default:
|
2204 |
+
break;
|
2205 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2206 |
|
2207 |
+
// Go deeper for grandchildren
|
2208 |
+
if ( $is_recursive ) {
|
2209 |
+
wppa_subalbumlinks_html( $album['id'], false );
|
2210 |
+
}
|
2211 |
}
|
2212 |
}
|
2213 |
|
wppa-album-navigator-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display album names linking to content
|
6 |
-
* Version 8.2.04.
|
7 |
*/
|
8 |
|
9 |
class AlbumNavigatorWidget extends WP_Widget {
|
@@ -171,13 +171,6 @@ class AlbumNavigatorWidget extends WP_Widget {
|
|
171 |
global $wpdb;
|
172 |
static $level;
|
173 |
static $ca;
|
174 |
-
static $void;
|
175 |
-
static $void_looked_up;
|
176 |
-
|
177 |
-
if ( ! $void_looked_up ) {
|
178 |
-
$void = wppa_void_albums();
|
179 |
-
$void_looked_up = true;
|
180 |
-
}
|
181 |
|
182 |
if ( ! $level ) {
|
183 |
$level = '1';
|
@@ -204,9 +197,9 @@ class AlbumNavigatorWidget extends WP_Widget {
|
|
204 |
|
205 |
$albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
206 |
WHERE a_parent = %s " .
|
207 |
-
$void .
|
208 |
$extraclause .
|
209 |
wppa_get_album_order( max( '0', $parent ) ), $parent ), ARRAY_A );
|
|
|
210 |
|
211 |
if ( ! empty( $albums ) ) {
|
212 |
wppa_cache_album( 'add', $albums );
|
@@ -268,8 +261,8 @@ class AlbumNavigatorWidget extends WP_Widget {
|
|
268 |
$count = wppa_get_visible_photo_count( $a, true ); //$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $album['id'] ) );
|
269 |
if ( $count <= 1000 ) {
|
270 |
$thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %s " . wppa_get_photo_order( $album['id'] ), $album['id'] ), ARRAY_A );
|
271 |
-
|
272 |
-
|
273 |
}
|
274 |
else {
|
275 |
$thumbs = false;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display album names linking to content
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
class AlbumNavigatorWidget extends WP_Widget {
|
171 |
global $wpdb;
|
172 |
static $level;
|
173 |
static $ca;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
if ( ! $level ) {
|
176 |
$level = '1';
|
197 |
|
198 |
$albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
199 |
WHERE a_parent = %s " .
|
|
|
200 |
$extraclause .
|
201 |
wppa_get_album_order( max( '0', $parent ) ), $parent ), ARRAY_A );
|
202 |
+
$albums = wppa_strip_void_albums( $albums );
|
203 |
|
204 |
if ( ! empty( $albums ) ) {
|
205 |
wppa_cache_album( 'add', $albums );
|
261 |
$count = wppa_get_visible_photo_count( $a, true ); //$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $album['id'] ) );
|
262 |
if ( $count <= 1000 ) {
|
263 |
$thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %s " . wppa_get_photo_order( $album['id'] ), $album['id'] ), ARRAY_A );
|
264 |
+
wppa_cache_photo( 'invalidate' );
|
265 |
+
wppa_cache_photo( 'add', $thumbs );
|
266 |
}
|
267 |
else {
|
268 |
$thumbs = false;
|
wppa-album-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display thumbnail albums
|
6 |
-
* Version 8.2.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -30,7 +30,6 @@ class AlbumWidget extends WP_Widget {
|
|
30 |
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
31 |
$cache = wppa_cache_widget( $instance['cache'] );
|
32 |
$cachefile = wppa_get_widget_cache_path( $this->id );
|
33 |
-
$void = wppa_void_albums();
|
34 |
|
35 |
// Logged in only and logged out?
|
36 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
@@ -62,7 +61,6 @@ class AlbumWidget extends WP_Widget {
|
|
62 |
else {
|
63 |
$albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
|
64 |
WHERE id > 0 " .
|
65 |
-
$void .
|
66 |
wppa_get_album_order(), ARRAY_A );
|
67 |
}
|
68 |
break;
|
@@ -72,18 +70,18 @@ class AlbumWidget extends WP_Widget {
|
|
72 |
}
|
73 |
else {
|
74 |
$albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
|
75 |
-
WHERE id > 0
|
76 |
-
$void . "
|
77 |
ORDER BY timestamp DESC", ARRAY_A );
|
78 |
}
|
79 |
break;
|
80 |
default:
|
81 |
$albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
82 |
WHERE a_parent = %d " .
|
83 |
-
$void .
|
84 |
wppa_get_album_order( $parent ), $parent ), ARRAY_A );
|
85 |
}
|
86 |
|
|
|
|
|
87 |
// Add subalbums if required
|
88 |
if ( $parent != 'all' && ! empty( $albums ) && $subs ) {
|
89 |
$ids = '';
|
@@ -97,7 +95,7 @@ class AlbumWidget extends WP_Widget {
|
|
97 |
// Add (grand)childrens ids
|
98 |
$ids = wppa_alb_to_enum_children( $ids );
|
99 |
$ids_arr = explode( '.', $ids );
|
100 |
-
$ids_arr =
|
101 |
$ids = implode( ',', $ids_arr );
|
102 |
|
103 |
// Do the new query
|
@@ -123,7 +121,7 @@ class AlbumWidget extends WP_Widget {
|
|
123 |
|
124 |
$imageid = wppa_get_coverphoto_id( $album['id'] );
|
125 |
$photos_used .= '.' . $imageid;
|
126 |
-
$image = $imageid ?
|
127 |
$imgcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $album['id'] ) );
|
128 |
$subalbumcount = wppa_has_children( $album['id'] );
|
129 |
$thumb = $image;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display thumbnail albums
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
30 |
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
31 |
$cache = wppa_cache_widget( $instance['cache'] );
|
32 |
$cachefile = wppa_get_widget_cache_path( $this->id );
|
|
|
33 |
|
34 |
// Logged in only and logged out?
|
35 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
61 |
else {
|
62 |
$albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
|
63 |
WHERE id > 0 " .
|
|
|
64 |
wppa_get_album_order(), ARRAY_A );
|
65 |
}
|
66 |
break;
|
70 |
}
|
71 |
else {
|
72 |
$albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
|
73 |
+
WHERE id > 0
|
|
|
74 |
ORDER BY timestamp DESC", ARRAY_A );
|
75 |
}
|
76 |
break;
|
77 |
default:
|
78 |
$albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
79 |
WHERE a_parent = %d " .
|
|
|
80 |
wppa_get_album_order( $parent ), $parent ), ARRAY_A );
|
81 |
}
|
82 |
|
83 |
+
$albums = wppa_strip_void_albums( $albums );
|
84 |
+
|
85 |
// Add subalbums if required
|
86 |
if ( $parent != 'all' && ! empty( $albums ) && $subs ) {
|
87 |
$ids = '';
|
95 |
// Add (grand)childrens ids
|
96 |
$ids = wppa_alb_to_enum_children( $ids );
|
97 |
$ids_arr = explode( '.', $ids );
|
98 |
+
$ids_arr = wppa_strip_void_albums( $ids_arr );
|
99 |
$ids = implode( ',', $ids_arr );
|
100 |
|
101 |
// Do the new query
|
121 |
|
122 |
$imageid = wppa_get_coverphoto_id( $album['id'] );
|
123 |
$photos_used .= '.' . $imageid;
|
124 |
+
$image = $imageid ? wppa_cache_photo( $imageid ) : false;
|
125 |
$imgcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $album['id'] ) );
|
126 |
$subalbumcount = wppa_has_children( $album['id'] );
|
127 |
$thumb = $image;
|
wppa-boxes-html.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
-
* Version 8.2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -2994,7 +2994,7 @@ static $albums_granted;
|
|
2994 |
$alb = explode( '.', wppa_expand_enum( $alb ) );
|
2995 |
}
|
2996 |
|
2997 |
-
$alb =
|
2998 |
|
2999 |
// Can an selection box be displayed?
|
3000 |
if ( ! wppa_opt( 'fe_upload_max_albums' ) || // No limit on number of albums
|
@@ -4803,7 +4803,7 @@ global $wpdb;
|
|
4803 |
' >' );
|
4804 |
|
4805 |
$photo = wppa( 'single_photo' );
|
4806 |
-
$thumb =
|
4807 |
$album = $thumb['album'];
|
4808 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, page_id FROM $wpdb->wppa_photos
|
4809 |
WHERE album = %s
|
@@ -4918,7 +4918,7 @@ global $other_deps;
|
|
4918 |
|
4919 |
foreach ( array_keys( $data ) as $id ) {
|
4920 |
|
4921 |
-
$thumb =
|
4922 |
if ( $thumb ) {
|
4923 |
|
4924 |
if ( wppa_is_video( $id ) ) {
|
@@ -6376,7 +6376,7 @@ function wppa_grid_box() {
|
|
6376 |
}
|
6377 |
|
6378 |
// Find the photos to display
|
6379 |
-
$photos =
|
6380 |
|
6381 |
// Get the html
|
6382 |
if ( is_array( $photos ) && count( $photos ) ) {
|
@@ -6475,7 +6475,7 @@ function wppa_get_grid_box_html( $photos ) {
|
|
6475 |
function wppa_get_grid_image_html( $id ) {
|
6476 |
|
6477 |
// Get photo data
|
6478 |
-
$photo =
|
6479 |
|
6480 |
// Get link
|
6481 |
$link = wppa_get_imglnk_a( 'grid', $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
2994 |
$alb = explode( '.', wppa_expand_enum( $alb ) );
|
2995 |
}
|
2996 |
|
2997 |
+
$alb = wppa_strip_void_albums( $alb );
|
2998 |
|
2999 |
// Can an selection box be displayed?
|
3000 |
if ( ! wppa_opt( 'fe_upload_max_albums' ) || // No limit on number of albums
|
4803 |
' >' );
|
4804 |
|
4805 |
$photo = wppa( 'single_photo' );
|
4806 |
+
$thumb = wppa_cache_photo( $photo );
|
4807 |
$album = $thumb['album'];
|
4808 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, page_id FROM $wpdb->wppa_photos
|
4809 |
WHERE album = %s
|
4918 |
|
4919 |
foreach ( array_keys( $data ) as $id ) {
|
4920 |
|
4921 |
+
$thumb = wppa_cache_photo( $id );
|
4922 |
if ( $thumb ) {
|
4923 |
|
4924 |
if ( wppa_is_video( $id ) ) {
|
6376 |
}
|
6377 |
|
6378 |
// Find the photos to display
|
6379 |
+
$photos = wppa_get_photos();
|
6380 |
|
6381 |
// Get the html
|
6382 |
if ( is_array( $photos ) && count( $photos ) ) {
|
6475 |
function wppa_get_grid_image_html( $id ) {
|
6476 |
|
6477 |
// Get photo data
|
6478 |
+
$photo = wppa_cache_photo( $id );
|
6479 |
|
6480 |
// Get link
|
6481 |
$link = wppa_get_imglnk_a( 'grid', $id );
|
wppa-cloudinary.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/* Only loads when php version >= 5.3
|
3 |
*
|
4 |
-
* Version 8.
|
5 |
*
|
6 |
*/
|
7 |
|
@@ -166,7 +166,7 @@ global $wppa_cloudinary_api;
|
|
166 |
function wppa_get_cloudinary_url( $id, $test_only = false ) {
|
167 |
global $blog_id;
|
168 |
|
169 |
-
$thumb =
|
170 |
$ext = $thumb['ext'] == 'xxx' ? 'jpg' : $thumb['ext'];
|
171 |
$prefix = ( is_multisite() && ! WPPA_MULTISITE_GLOBAL ) ? $blog_id.'-' : '';
|
172 |
$size = $test_only ? 'h_32/' : '';
|
1 |
<?php
|
2 |
/* Only loads when php version >= 5.3
|
3 |
*
|
4 |
+
* Version 8.2.04.005
|
5 |
*
|
6 |
*/
|
7 |
|
166 |
function wppa_get_cloudinary_url( $id, $test_only = false ) {
|
167 |
global $blog_id;
|
168 |
|
169 |
+
$thumb = wppa_cache_photo( $id );
|
170 |
$ext = $thumb['ext'] == 'xxx' ? 'jpg' : $thumb['ext'];
|
171 |
$prefix = ( is_multisite() && ! WPPA_MULTISITE_GLOBAL ) ? $blog_id.'-' : '';
|
172 |
$size = $test_only ? 'h_32/' : '';
|
wppa-comment-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the recent commets on photos
|
6 |
-
* Version 8.2.04.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -73,7 +73,7 @@ class wppaCommentWidget extends WP_Widget {
|
|
73 |
style="width:' . $maxw . 'px;height:' . $maxh . 'px;margin:4px;display:inline;text-align:center;float:left"
|
74 |
data-wppa="yes">';
|
75 |
|
76 |
-
$image =
|
77 |
|
78 |
if ( $image ) {
|
79 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the recent commets on photos
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
73 |
style="width:' . $maxw . 'px;height:' . $maxh . 'px;margin:4px;display:inline;text-align:center;float:left"
|
74 |
data-wppa="yes">';
|
75 |
|
76 |
+
$image = wppa_cache_photo( $id );
|
77 |
|
78 |
if ( $image ) {
|
79 |
|
wppa-common-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-common-functions.php
|
3 |
*
|
4 |
* Functions used in admin and in themes
|
5 |
-
* Version 8.2.04.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -83,17 +83,15 @@ function wppa_reset_occurrance() {
|
|
83 |
global $wppa;
|
84 |
global $wppa_revno;
|
85 |
global $wppa_api_version;
|
86 |
-
global $thumbs;
|
87 |
static $first_pla = true;
|
88 |
global $wppa_current_shortcode;
|
89 |
global $wppa_current_shortcode_atts;
|
90 |
|
91 |
-
$thumbs = false;
|
92 |
$wppa_current_shortcode = false;
|
93 |
$wppa_current_shortcode_atts = false;
|
94 |
|
95 |
-
|
96 |
-
wppa_cache_album( 'invalidate' );
|
97 |
|
98 |
$mocc = isset( $wppa['mocc'] ) ? $wppa['mocc'] : '0';
|
99 |
|
@@ -1476,61 +1474,6 @@ function wppa_convert_bytes( $value ) {
|
|
1476 |
}
|
1477 |
}
|
1478 |
|
1479 |
-
function wppa_dbg_cachecounts( $what ) {
|
1480 |
-
static $counters;
|
1481 |
-
|
1482 |
-
// Init
|
1483 |
-
$indexes = array( 'albumhit', 'albummis', 'photohit', 'photomis' );
|
1484 |
-
foreach( $indexes as $i ) {
|
1485 |
-
if ( ! isset( $counters[$i] ) ) {
|
1486 |
-
$counters[$i] = 0;
|
1487 |
-
}
|
1488 |
-
}
|
1489 |
-
|
1490 |
-
if ( wppa( 'debug' ) ) {
|
1491 |
-
switch( $what ) {
|
1492 |
-
case 'albumhit':
|
1493 |
-
case 'albummis':
|
1494 |
-
case 'photohit':
|
1495 |
-
case 'photomis':
|
1496 |
-
$counters[$what]++;
|
1497 |
-
break;
|
1498 |
-
case 'print':
|
1499 |
-
if ( ( $counters['albumhit'] + $counters['albummis'] ) && ( $counters['photohit'] + $counters['photomis'] ) ) {
|
1500 |
-
wppa_dbg_msg(
|
1501 |
-
'Cache usage: ' .
|
1502 |
-
'Album hits: ' . $counters['albumhit'] . ', ' .
|
1503 |
-
'Album misses: ' . $counters['albummis'] .
|
1504 |
-
' = ' . sprintf( '%6.2f', ( 100 * $counters['albummis'] / ( $counters['albumhit'] + $counters['albummis'] ) ) ) . '%; ' .
|
1505 |
-
'Photo hits: ' . $counters['photohit'] . ', ' .
|
1506 |
-
'Photo misses: ' . $counters['photomis'] .
|
1507 |
-
' = ' . sprintf( '%6.2f', ( 100 * $counters['photomis'] / ( $counters['photohit'] + $counters['photomis'] ) ) ) . '%; '
|
1508 |
-
);
|
1509 |
-
wppa_dbg_msg(
|
1510 |
-
'2nd level cache entries: ' .
|
1511 |
-
'albums: ' . wppa_cache_album( 'count' ) . ', ' .
|
1512 |
-
'photos: ' . wppa_cache_photo( 'count' ) . '. ' .
|
1513 |
-
'NQ='.get_num_queries()
|
1514 |
-
);
|
1515 |
-
}
|
1516 |
-
else {
|
1517 |
-
wppa_dbg_msg(
|
1518 |
-
'Cache usage: ' .
|
1519 |
-
'Album hits: ' . $counters['albumhit'] . ', ' .
|
1520 |
-
'Album misses: ' . $counters['albummis'] . ', ' .
|
1521 |
-
'Photo hits: ' . $counters['photohit'] . ', ' .
|
1522 |
-
'Photo misses: ' . $counters['photomis'] . '.'
|
1523 |
-
);
|
1524 |
-
}
|
1525 |
-
break;
|
1526 |
-
default:
|
1527 |
-
wppa_log( 'err', 'Illegal $what in wppa_dbg_cachecounts(): '.$what );
|
1528 |
-
}
|
1529 |
-
}
|
1530 |
-
}
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
function wppa_format_geo( $lat, $lon ) {
|
1535 |
|
1536 |
if ( ! $lat && ! $lon ) return ''; // Both zero: clear
|
2 |
/* wppa-common-functions.php
|
3 |
*
|
4 |
* Functions used in admin and in themes
|
5 |
+
* Version 8.2.04.005
|
6 |
*
|
7 |
*/
|
8 |
|
83 |
global $wppa;
|
84 |
global $wppa_revno;
|
85 |
global $wppa_api_version;
|
|
|
86 |
static $first_pla = true;
|
87 |
global $wppa_current_shortcode;
|
88 |
global $wppa_current_shortcode_atts;
|
89 |
|
|
|
90 |
$wppa_current_shortcode = false;
|
91 |
$wppa_current_shortcode_atts = false;
|
92 |
|
93 |
+
// wppa_cache_photo( 'invalidate' );
|
94 |
+
// wppa_cache_album( 'invalidate' );
|
95 |
|
96 |
$mocc = isset( $wppa['mocc'] ) ? $wppa['mocc'] : '0';
|
97 |
|
1474 |
}
|
1475 |
}
|
1476 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1477 |
function wppa_format_geo( $lat, $lon ) {
|
1478 |
|
1479 |
if ( ! $lat && ! $lon ) return ''; // Both zero: clear
|
wppa-dashboard-widgets.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Contains dashboard widgets code
|
6 |
*
|
7 |
-
* Version 8.2.04.
|
8 |
*
|
9 |
*/
|
10 |
|
@@ -271,72 +271,66 @@ global $wpdb;
|
|
271 |
// Recently uploaded photos
|
272 |
wppa_echo( '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>' );
|
273 |
|
274 |
-
$
|
275 |
-
if ( count ( $void ) ) {
|
276 |
-
$void_clause = " WHERE id NOT IN (" . implode( ',', $void ) . ") ";
|
277 |
-
}
|
278 |
-
else {
|
279 |
-
$void_clause = "";
|
280 |
-
}
|
281 |
-
|
282 |
-
$photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos " .
|
283 |
-
$void_clause . "
|
284 |
ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
|
285 |
|
286 |
if ( ! empty( $photos ) ) {
|
287 |
wppa_echo( '<table>' );
|
288 |
foreach( $photos as $photo ) {
|
|
|
289 |
$id = $photo['id'];
|
290 |
-
if (
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
<
|
299 |
-
<
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
315 |
else {
|
316 |
-
|
317 |
-
<img src="' . esc_url( wppa_get_thumb_url( $id ) ) . '" style="max-width:100px;" /> ' );
|
318 |
}
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
$usr = sanitize_user( $photo['owner'] );
|
330 |
-
}
|
331 |
-
wppa_echo(
|
332 |
-
sprintf( __( 'by %s in album %s', 'wp-photo-album-plus' ),
|
333 |
-
'<b>' . $usr . '</b>',
|
334 |
-
'<b>' . sanitize_text_field( wppa_get_album_name( $photo['album'] ) ) . '</b> (' . strval( intval( $photo['album'] ) ) . ')'
|
335 |
-
) . '
|
336 |
-
<br>' .
|
337 |
-
wppa_local_date( '', $photo['timestamp'] ) . '
|
338 |
-
</td>
|
339 |
-
</tr>' );
|
340 |
}
|
341 |
wppa_echo( '</table>' );
|
342 |
}
|
4 |
*
|
5 |
* Contains dashboard widgets code
|
6 |
*
|
7 |
+
* Version 8.2.04.005
|
8 |
*
|
9 |
*/
|
10 |
|
271 |
// Recently uploaded photos
|
272 |
wppa_echo( '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>' );
|
273 |
|
274 |
+
$photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
|
276 |
|
277 |
if ( ! empty( $photos ) ) {
|
278 |
wppa_echo( '<table>' );
|
279 |
foreach( $photos as $photo ) {
|
280 |
+
|
281 |
$id = $photo['id'];
|
282 |
+
if ( wppa_is_photo_visible( $id ) ) {
|
283 |
+
if ( wppa_user_is( 'administrator' ) ) {
|
284 |
+
$href = get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit-id=single&photo=' . $photo['id'] . '&nonce=' . wp_create_nonce( 'wppa-nonce' );
|
285 |
+
}
|
286 |
+
else {
|
287 |
+
$href = wppa_get_photo_url( $id );
|
288 |
+
}
|
289 |
+
wppa_echo( '
|
290 |
+
<tr>
|
291 |
+
<td>
|
292 |
+
<a href="' . esc_url( $href ) . '" target="_blank" >' );
|
293 |
+
|
294 |
+
if ( wppa_is_video( $id ) ) {
|
295 |
+
$url = WPPA_UPLOAD_URL . '/icons/' . wppa_opt( 'video_icon' );
|
296 |
+
wppa_echo( '
|
297 |
+
<div style="position:relative">' .
|
298 |
+
wppa_get_video_html( array( 'id' => $id,
|
299 |
+
'width' => '100',
|
300 |
+
'controls' => false,
|
301 |
+
'preload' => 'metadata',
|
302 |
+
'use_thumb' => true,
|
303 |
+
'autoplay' => false
|
304 |
+
) ) . '
|
305 |
+
<img src="' . esc_url( $url ) . '" style="width:16px;height:16px;position:absolute;right:0;bottom:0;z-index:100;" />
|
306 |
+
</div>' );
|
307 |
+
}
|
308 |
+
else {
|
309 |
+
wppa_echo( '
|
310 |
+
<img src="' . esc_url( wppa_get_thumb_url( $id ) ) . '" style="max-width:100px;" /> ' );
|
311 |
+
}
|
312 |
+
|
313 |
+
wppa_echo( '
|
314 |
+
</a>
|
315 |
+
</td>
|
316 |
+
<td>' );
|
317 |
+
$usr = wppa_get_user_by( 'login', $photo['owner'] );
|
318 |
+
if ( $usr ) {
|
319 |
+
$usr = $usr -> display_name;
|
320 |
}
|
321 |
else {
|
322 |
+
$usr = sanitize_user( $photo['owner'] );
|
|
|
323 |
}
|
324 |
+
wppa_echo(
|
325 |
+
sprintf( __( 'by %s in album %s', 'wp-photo-album-plus' ),
|
326 |
+
'<b>' . $usr . '</b>',
|
327 |
+
'<b>' . sanitize_text_field( wppa_get_album_name( $photo['album'] ) ) . '</b> (' . strval( intval( $photo['album'] ) ) . ')'
|
328 |
+
) . '
|
329 |
+
<br>' .
|
330 |
+
wppa_local_date( '', $photo['timestamp'] ) . '
|
331 |
+
</td>
|
332 |
+
</tr>' );
|
333 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
}
|
335 |
wppa_echo( '</table>' );
|
336 |
}
|
wppa-date-time.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* date and time related functions
|
6 |
-
* Version 8.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -73,7 +73,7 @@ function wppa_get_date_time_select_html( $type, $id, $selectable = true ) {
|
|
73 |
$type = ucfirst( strtolower( $type ) );
|
74 |
|
75 |
if ( $type == 'Photo' || $type == 'Delphoto' ) {
|
76 |
-
$thumb =
|
77 |
}
|
78 |
elseif ( $type == 'Album' || $type = 'Delalbum' ) {
|
79 |
$album = wppa_cache_album( $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* date and time related functions
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
73 |
$type = ucfirst( strtolower( $type ) );
|
74 |
|
75 |
if ( $type == 'Photo' || $type == 'Delphoto' ) {
|
76 |
+
$thumb = wppa_cache_photo( $id );
|
77 |
}
|
78 |
elseif ( $type == 'Album' || $type = 'Delalbum' ) {
|
79 |
$album = wppa_cache_album( $id );
|
wppa-featen-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the featured photos
|
6 |
-
* Version 8.2.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -57,8 +57,7 @@ class FeaTenWidget extends WP_Widget {
|
|
57 |
// Owner/public
|
58 |
case '-3':
|
59 |
$temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
60 |
-
WHERE status = 'featured'
|
61 |
-
wppa_void_albums( 'photos' ) . "
|
62 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
|
63 |
if ( $temp ) {
|
64 |
$c = '0';
|
@@ -80,8 +79,7 @@ class FeaTenWidget extends WP_Widget {
|
|
80 |
// Generic
|
81 |
case '-2':
|
82 |
$temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
83 |
-
WHERE status = 'featured'
|
84 |
-
wppa_void_albums( 'photos' ) . "
|
85 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
|
86 |
if ( $temp ) {
|
87 |
$c = '0';
|
@@ -102,14 +100,13 @@ class FeaTenWidget extends WP_Widget {
|
|
102 |
// All
|
103 |
case '0':
|
104 |
$thumbs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
105 |
-
WHERE status = 'featured'
|
106 |
-
wppa_void_albums( 'photos' ) . "
|
107 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A );
|
108 |
break;
|
109 |
|
110 |
// Album spec
|
111 |
default:
|
112 |
-
if (
|
113 |
$thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status= 'featured' AND album = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album ), ARRAY_A );
|
114 |
}
|
115 |
else {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the featured photos
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
57 |
// Owner/public
|
58 |
case '-3':
|
59 |
$temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
60 |
+
WHERE status = 'featured'
|
|
|
61 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
|
62 |
if ( $temp ) {
|
63 |
$c = '0';
|
79 |
// Generic
|
80 |
case '-2':
|
81 |
$temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
82 |
+
WHERE status = 'featured'
|
|
|
83 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
|
84 |
if ( $temp ) {
|
85 |
$c = '0';
|
100 |
// All
|
101 |
case '0':
|
102 |
$thumbs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
|
103 |
+
WHERE status = 'featured'
|
|
|
104 |
ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A );
|
105 |
break;
|
106 |
|
107 |
// Album spec
|
108 |
default:
|
109 |
+
if ( wppa_is_album_visible( $album ) ) {
|
110 |
$thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status= 'featured' AND album = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album ), ARRAY_A );
|
111 |
}
|
112 |
else {
|
wppa-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -16,7 +16,6 @@ function wppa_albums( $id = '', $type = '', $size = '', $align = '' ) {
|
|
16 |
global $wppa_lang;
|
17 |
global $wppa_locale;
|
18 |
global $wpdb;
|
19 |
-
global $thumbs;
|
20 |
global $wppa_session;
|
21 |
global $wppa;
|
22 |
global $locale;
|
@@ -793,7 +792,7 @@ global $other_deps;
|
|
793 |
|
794 |
// Empty related shortcode?
|
795 |
if ( wppa( 'is_related' ) ) {
|
796 |
-
$thumbs =
|
797 |
if ( empty( $thumbs ) ) {
|
798 |
wppa_errorbox( __( 'No related photos found.', 'wp-photo-album-plus' ) );
|
799 |
$result = wppa( 'out' );
|
@@ -949,7 +948,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 |
}
|
@@ -1213,14 +1212,12 @@ global $albums_used;
|
|
1213 |
if ( wppa( 'last_albums_parent' ) ) {
|
1214 |
$q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
1215 |
WHERE a_parent = %s
|
1216 |
-
" . wppa_void_albums() . "
|
1217 |
ORDER BY timestamp DESC
|
1218 |
LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
|
1219 |
}
|
1220 |
else {
|
1221 |
$q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
1222 |
WHERE id > 0
|
1223 |
-
" . wppa_void_albums() . "
|
1224 |
ORDER BY timestamp DESC
|
1225 |
LIMIT %d", wppa( 'last_albums' ) );
|
1226 |
}
|
@@ -1266,7 +1263,7 @@ global $albums_used;
|
|
1266 |
}
|
1267 |
|
1268 |
// Check for album status
|
1269 |
-
$albums =
|
1270 |
|
1271 |
// Copy data into secondary cache
|
1272 |
if ( $albums ) {
|
@@ -1284,17 +1281,10 @@ global $albums_used;
|
|
1284 |
}
|
1285 |
|
1286 |
// loop thumbs
|
1287 |
-
function
|
1288 |
global $wpdb;
|
1289 |
-
global $thumbs;
|
1290 |
global $wppa_session;
|
1291 |
|
1292 |
-
// Done already this occ?
|
1293 |
-
if ( is_array( $thumbs ) ) {
|
1294 |
-
wppa_dbg_msg( 'Cached thumbs used' );
|
1295 |
-
return $thumbs;
|
1296 |
-
}
|
1297 |
-
|
1298 |
// A cover -> no thumbs
|
1299 |
if ( wppa( 'is_cover' ) ) {
|
1300 |
wppa_dbg_msg( 'Its cover, leave get_thumbs' );
|
@@ -1324,7 +1314,7 @@ global $wppa_session;
|
|
1324 |
|
1325 |
$photos = wppa_expand_enum( wppa( 'start_photos' ) );
|
1326 |
$ids = explode( '.', $photos );
|
1327 |
-
$ids =
|
1328 |
if ( count( $ids ) ) {
|
1329 |
$photos = implode( ',', $ids );
|
1330 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
@@ -1351,7 +1341,7 @@ global $wppa_session;
|
|
1351 |
// Enum albums
|
1352 |
else {
|
1353 |
$ids = wppa_series_to_array( $fullalb );
|
1354 |
-
$ids =
|
1355 |
$album_clause = " album IN ( " . implode( ',', $ids ) . " ) ";
|
1356 |
}
|
1357 |
}
|
@@ -1359,7 +1349,7 @@ global $wppa_session;
|
|
1359 |
// No album given, make sure trashed photos are not found
|
1360 |
else {
|
1361 |
$fullalb = '';
|
1362 |
-
$album_clause = " album > '0' "
|
1363 |
}
|
1364 |
|
1365 |
// For upload link on thumbarea: if startalbum is a single real album, put it in current album
|
@@ -2270,7 +2260,7 @@ global $photos_used;
|
|
2270 |
}
|
2271 |
|
2272 |
// Remove items because of status album
|
2273 |
-
$thumbs =
|
2274 |
|
2275 |
// Process extended duplicate removal
|
2276 |
if ( $exduprem ) {
|
@@ -2298,92 +2288,47 @@ global $photos_used;
|
|
2298 |
return $thumbs;
|
2299 |
}
|
2300 |
|
2301 |
-
//
|
2302 |
-
|
|
|
2303 |
global $wpdb;
|
2304 |
|
2305 |
-
|
2306 |
-
$void_albs = array();
|
2307 |
-
if ( ! wppa_user_is( 'administrator' ) ) {
|
2308 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
|
2309 |
-
}
|
2310 |
-
if ( ! is_user_logged_in() ) {
|
2311 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
|
2312 |
-
}
|
2313 |
-
|
2314 |
-
// Nothing found? return original
|
2315 |
-
if ( ! count( $void_albs ) ) {
|
2316 |
-
return $items;
|
2317 |
-
}
|
2318 |
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
unset( $items[$key] );
|
2324 |
}
|
2325 |
}
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
else {
|
2330 |
-
foreach ( array_keys( $items ) as $key ) {
|
2331 |
-
if ( in_array( $items[$key]['album'], $void_albs ) ) {
|
2332 |
-
unset( $items[$key] );
|
2333 |
}
|
2334 |
}
|
2335 |
}
|
2336 |
|
2337 |
-
// Done, return stripped data
|
2338 |
-
return $items;
|
2339 |
-
}
|
2340 |
-
|
2341 |
-
// Strip void albums from array
|
2342 |
-
function wppa_strip_void( $albarr ) {
|
2343 |
-
global $wpdb;
|
2344 |
-
|
2345 |
-
// Find voided albums
|
2346 |
-
$void_albs = array();
|
2347 |
-
if ( ! wppa_user_is( 'administrator' ) ) {
|
2348 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
|
2349 |
-
}
|
2350 |
-
if ( ! is_user_logged_in() ) {
|
2351 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
|
2352 |
-
}
|
2353 |
-
|
2354 |
-
$result = array_diff( $albarr, $void_albs );
|
2355 |
return $result;
|
2356 |
}
|
2357 |
|
2358 |
-
//
|
2359 |
-
|
|
|
2360 |
global $wpdb;
|
2361 |
|
2362 |
-
|
2363 |
-
$void_albs = array();
|
2364 |
-
if ( ! wppa_user_is( 'administrator' ) ) {
|
2365 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
|
2366 |
-
}
|
2367 |
-
if ( ! is_user_logged_in() ) {
|
2368 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
|
2369 |
-
}
|
2370 |
-
|
2371 |
-
// Anything found
|
2372 |
-
if ( count ( $void_albs ) ) {
|
2373 |
|
2374 |
-
|
2375 |
-
if ( $
|
2376 |
-
|
|
|
|
|
2377 |
}
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
}
|
2383 |
-
|
2384 |
-
}
|
2385 |
-
else {
|
2386 |
-
$result = "";
|
2387 |
}
|
2388 |
|
2389 |
return $result;
|
@@ -2610,7 +2555,7 @@ global $wpdb;
|
|
2610 |
static $user;
|
2611 |
|
2612 |
// Make sure $thumb contains our image data
|
2613 |
-
$thumb =
|
2614 |
$alb = $thumb['album'];
|
2615 |
|
2616 |
if ( ! $user ) $user = wppa_get_user( 'display' );
|
@@ -4254,11 +4199,11 @@ function wppa_popup() {
|
|
4254 |
'</div>' );
|
4255 |
}
|
4256 |
|
4257 |
-
|
4258 |
-
|
4259 |
|
4260 |
$c = is_array( $thumbs ) ? count( $thumbs ) : '0';
|
4261 |
-
wppa_dbg_msg( 'Running slidecontainer
|
4262 |
|
4263 |
if ( wppa( 'is_single' ) && is_feed() ) { // process feed for single image slideshow here, normal slideshow uses filmthumbs
|
4264 |
$style_a = wppa_get_fullimgstyle_a( wppa( 'start_photo' ) );
|
@@ -4276,7 +4221,7 @@ global $thumbs;
|
|
4276 |
</a>' );
|
4277 |
return;
|
4278 |
}
|
4279 |
-
|
4280 |
|
4281 |
// Find slideshow start method
|
4282 |
switch ( wppa_opt( 'start_slide' ) ) {
|
@@ -4323,47 +4268,42 @@ global $thumbs;
|
|
4323 |
wppa_js( $js );
|
4324 |
}
|
4325 |
|
4326 |
-
|
4327 |
-
|
4328 |
-
|
4329 |
-
|
4330 |
-
}
|
4331 |
-
else {
|
4332 |
-
$startindex = 0;
|
4333 |
-
}
|
4334 |
-
}
|
4335 |
-
|
4336 |
-
// Vertical align
|
4337 |
-
if ( wppa( 'in_widget' ) ) {
|
4338 |
-
$ali = wppa( 'ss_widget_valign' ) ? wppa( 'ss_widget_valign' ) : $ali = 'fit';
|
4339 |
-
wppa_js( 'wppaFullValign['.wppa( 'mocc' ).'] = "'.$ali.'";' );
|
4340 |
-
}
|
4341 |
-
elseif ( wppa( 'is_slideonly' ) ) {
|
4342 |
-
wppa_js( 'wppaFullValign['.wppa( 'mocc' ).'] = "'.wppa_opt( 'fullvalign_slideonly' ).'";' );
|
4343 |
}
|
4344 |
else {
|
4345 |
-
|
4346 |
}
|
|
|
4347 |
|
4348 |
-
|
4349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4350 |
|
4351 |
-
|
4352 |
-
|
4353 |
-
wppa_js( 'wppaPortraitOnly['.wppa( 'mocc' ).'] = true;' );
|
4354 |
-
}
|
4355 |
|
4356 |
-
|
4357 |
-
|
4358 |
-
|
4359 |
-
|
4360 |
-
|
4361 |
-
|
4362 |
-
|
4363 |
-
</span>' );
|
4364 |
}
|
4365 |
}
|
4366 |
|
|
|
4367 |
function wppa_is_pagination() {
|
4368 |
|
4369 |
// Pagination is off during search
|
@@ -4719,7 +4659,7 @@ function wppa_is_photo_new( $id ) {
|
|
4719 |
return false;
|
4720 |
}
|
4721 |
|
4722 |
-
$thumb =
|
4723 |
|
4724 |
$birthtime = $thumb['timestamp'];
|
4725 |
$timnow = time();
|
@@ -4735,7 +4675,7 @@ function wppa_is_photo_modified( $id ) {
|
|
4735 |
return false;
|
4736 |
}
|
4737 |
|
4738 |
-
$thumb =
|
4739 |
|
4740 |
$cretime = $thumb['timestamp'];
|
4741 |
$modtime = $thumb['modified'];
|
@@ -5791,7 +5731,7 @@ function wppa_get_lbtitle( $type, $id ) {
|
|
5791 |
|
5792 |
if ( ! is_numeric( $id ) || $id < '1' ) wppa_dbg_msg( 'Invalid arg wppa_get_lbtitle( '.$id.' )', 'red' );
|
5793 |
|
5794 |
-
$thumb =
|
5795 |
$alb = $thumb['album'];
|
5796 |
|
5797 |
$do_download = wppa_is_video( $id ) ? false : wppa_switch( 'art_monkey_on_lightbox' );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
16 |
global $wppa_lang;
|
17 |
global $wppa_locale;
|
18 |
global $wpdb;
|
|
|
19 |
global $wppa_session;
|
20 |
global $wppa;
|
21 |
global $locale;
|
792 |
|
793 |
// Empty related shortcode?
|
794 |
if ( wppa( 'is_related' ) ) {
|
795 |
+
$thumbs = wppa_get_photos();
|
796 |
if ( empty( $thumbs ) ) {
|
797 |
wppa_errorbox( __( 'No related photos found.', 'wp-photo-album-plus' ) );
|
798 |
$result = wppa( 'out' );
|
948 |
}
|
949 |
else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
|
950 |
global $wppa_version;
|
951 |
+
$expected_version = '8.2.04.005';
|
952 |
if ( $wppa_version != $expected_version ) {
|
953 |
wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
|
954 |
}
|
1212 |
if ( wppa( 'last_albums_parent' ) ) {
|
1213 |
$q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
1214 |
WHERE a_parent = %s
|
|
|
1215 |
ORDER BY timestamp DESC
|
1216 |
LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
|
1217 |
}
|
1218 |
else {
|
1219 |
$q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
|
1220 |
WHERE id > 0
|
|
|
1221 |
ORDER BY timestamp DESC
|
1222 |
LIMIT %d", wppa( 'last_albums' ) );
|
1223 |
}
|
1263 |
}
|
1264 |
|
1265 |
// Check for album status
|
1266 |
+
$albums = wppa_strip_void_albums( $albums );
|
1267 |
|
1268 |
// Copy data into secondary cache
|
1269 |
if ( $albums ) {
|
1281 |
}
|
1282 |
|
1283 |
// loop thumbs
|
1284 |
+
function wppa_get_photos() {
|
1285 |
global $wpdb;
|
|
|
1286 |
global $wppa_session;
|
1287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1288 |
// A cover -> no thumbs
|
1289 |
if ( wppa( 'is_cover' ) ) {
|
1290 |
wppa_dbg_msg( 'Its cover, leave get_thumbs' );
|
1314 |
|
1315 |
$photos = wppa_expand_enum( wppa( 'start_photos' ) );
|
1316 |
$ids = explode( '.', $photos );
|
1317 |
+
$ids = wppa_strip_void_photos( $ids );
|
1318 |
if ( count( $ids ) ) {
|
1319 |
$photos = implode( ',', $ids );
|
1320 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
1341 |
// Enum albums
|
1342 |
else {
|
1343 |
$ids = wppa_series_to_array( $fullalb );
|
1344 |
+
$ids = wppa_strip_void_albums( $ids );
|
1345 |
$album_clause = " album IN ( " . implode( ',', $ids ) . " ) ";
|
1346 |
}
|
1347 |
}
|
1349 |
// No album given, make sure trashed photos are not found
|
1350 |
else {
|
1351 |
$fullalb = '';
|
1352 |
+
$album_clause = " album > '0' ";
|
1353 |
}
|
1354 |
|
1355 |
// For upload link on thumbarea: if startalbum is a single real album, put it in current album
|
2260 |
}
|
2261 |
|
2262 |
// Remove items because of status album
|
2263 |
+
$thumbs = wppa_strip_void_photos( $thumbs );
|
2264 |
|
2265 |
// Process extended duplicate removal
|
2266 |
if ( $exduprem ) {
|
2288 |
return $thumbs;
|
2289 |
}
|
2290 |
|
2291 |
+
// Strip void albums from array
|
2292 |
+
// $albarr may contain ids only or full db rows
|
2293 |
+
function wppa_strip_void_albums( $albarr ) {
|
2294 |
global $wpdb;
|
2295 |
|
2296 |
+
$result = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2297 |
|
2298 |
+
foreach( $albarr as $album ) {
|
2299 |
+
if ( wppa_is_int( $album ) ) {
|
2300 |
+
if ( wppa_is_album_visible( $album ) ) {
|
2301 |
+
$result[] = $album;
|
|
|
2302 |
}
|
2303 |
}
|
2304 |
+
elseif ( is_array( $album ) ) {
|
2305 |
+
if ( wppa_is_album_visible( $album['id'] ) ) {
|
2306 |
+
$result[] = $album;
|
|
|
|
|
|
|
|
|
2307 |
}
|
2308 |
}
|
2309 |
}
|
2310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2311 |
return $result;
|
2312 |
}
|
2313 |
|
2314 |
+
// Strip void photos from array
|
2315 |
+
// $photoarr may contain ids only or full db rows
|
2316 |
+
function wppa_strip_void_photos( $photoarr ) {
|
2317 |
global $wpdb;
|
2318 |
|
2319 |
+
$result = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2320 |
|
2321 |
+
foreach( $photoarr as $photo ) {
|
2322 |
+
if ( wppa_is_int( $photo ) ) {
|
2323 |
+
if ( wppa_is_photo_visible( $photo ) ) {
|
2324 |
+
$result[] = $photo;
|
2325 |
+
}
|
2326 |
}
|
2327 |
+
elseif ( is_array( $photo ) ) {
|
2328 |
+
if ( wppa_is_photo_visible( $photo['id'] ) ) {
|
2329 |
+
$result[] = $photo;
|
2330 |
+
}
|
2331 |
}
|
|
|
|
|
|
|
|
|
2332 |
}
|
2333 |
|
2334 |
return $result;
|
2555 |
static $user;
|
2556 |
|
2557 |
// Make sure $thumb contains our image data
|
2558 |
+
$thumb = wppa_cache_photo( $id );
|
2559 |
$alb = $thumb['album'];
|
2560 |
|
2561 |
if ( ! $user ) $user = wppa_get_user( 'display' );
|
4199 |
'</div>' );
|
4200 |
}
|
4201 |
|
4202 |
+
|
4203 |
+
function wppa_run_slidecontainer( $thumbs ) {
|
4204 |
|
4205 |
$c = is_array( $thumbs ) ? count( $thumbs ) : '0';
|
4206 |
+
wppa_dbg_msg( 'Running slidecontainer with '.$c.' elements in thumbs, is_single=' . wppa( 'is_single' ) );
|
4207 |
|
4208 |
if ( wppa( 'is_single' ) && is_feed() ) { // process feed for single image slideshow here, normal slideshow uses filmthumbs
|
4209 |
$style_a = wppa_get_fullimgstyle_a( wppa( 'start_photo' ) );
|
4221 |
</a>' );
|
4222 |
return;
|
4223 |
}
|
4224 |
+
else {
|
4225 |
|
4226 |
// Find slideshow start method
|
4227 |
switch ( wppa_opt( 'start_slide' ) ) {
|
4268 |
wppa_js( $js );
|
4269 |
}
|
4270 |
|
4271 |
+
// How to start if slideonly
|
4272 |
+
if ( wppa( 'is_slideonly' ) ) {
|
4273 |
+
if ( wppa_switch( 'start_slideonly' ) ) {
|
4274 |
+
$startindex = -1; // There are no navigations, so start running, overrule everything
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4275 |
}
|
4276 |
else {
|
4277 |
+
$startindex = 0;
|
4278 |
}
|
4279 |
+
}
|
4280 |
|
4281 |
+
// Vertical align
|
4282 |
+
if ( wppa( 'in_widget' ) ) {
|
4283 |
+
$ali = wppa( 'ss_widget_valign' ) ? wppa( 'ss_widget_valign' ) : $ali = 'fit';
|
4284 |
+
wppa_js( 'wppaFullValign['.wppa( 'mocc' ).'] = "'.$ali.'";' );
|
4285 |
+
}
|
4286 |
+
elseif ( wppa( 'is_slideonly' ) ) {
|
4287 |
+
wppa_js( 'wppaFullValign['.wppa( 'mocc' ).'] = "'.wppa_opt( 'fullvalign_slideonly' ).'";' );
|
4288 |
+
}
|
4289 |
+
else {
|
4290 |
+
wppa_js( 'wppaFullValign['.wppa( 'mocc' ).'] = "'.wppa_opt( 'fullvalign' ).'";' );
|
4291 |
+
}
|
4292 |
|
4293 |
+
// Horizontal align
|
4294 |
+
wppa_js( 'wppaFullHalign['.wppa( 'mocc' ).'] = "'.wppa_opt( 'fullhalign' ).'";' );
|
|
|
|
|
4295 |
|
4296 |
+
// Portrait only ?
|
4297 |
+
if ( wppa( 'portrait_only' ) ) {
|
4298 |
+
wppa_js( 'wppaPortraitOnly['.wppa( 'mocc' ).'] = true;' );
|
4299 |
+
}
|
4300 |
+
|
4301 |
+
// Start command with appropriate $startindex: -2 = at norate, -1 run from first, >=0 still at index
|
4302 |
+
wppa_js( 'jQuery(document).ready( function() { setTimeout( function(){wppaStartStop( '.wppa( 'mocc' ).', '.$startindex.' );},2) } );' );
|
|
|
4303 |
}
|
4304 |
}
|
4305 |
|
4306 |
+
|
4307 |
function wppa_is_pagination() {
|
4308 |
|
4309 |
// Pagination is off during search
|
4659 |
return false;
|
4660 |
}
|
4661 |
|
4662 |
+
$thumb = wppa_cache_photo( $id );
|
4663 |
|
4664 |
$birthtime = $thumb['timestamp'];
|
4665 |
$timnow = time();
|
4675 |
return false;
|
4676 |
}
|
4677 |
|
4678 |
+
$thumb = wppa_cache_photo( $id );
|
4679 |
|
4680 |
$cretime = $thumb['timestamp'];
|
4681 |
$modtime = $thumb['modified'];
|
5731 |
|
5732 |
if ( ! is_numeric( $id ) || $id < '1' ) wppa_dbg_msg( 'Invalid arg wppa_get_lbtitle( '.$id.' )', 'red' );
|
5733 |
|
5734 |
+
$thumb = wppa_cache_photo( $id );
|
5735 |
$alb = $thumb['album'];
|
5736 |
|
5737 |
$do_download = wppa_is_video( $id ) ? false : wppa_switch( 'art_monkey_on_lightbox' );
|
wppa-index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all indexing functions
|
6 |
-
* Version
|
7 |
*
|
8 |
*
|
9 |
*/
|
@@ -519,7 +519,7 @@ function wppa_index_get_raw_album( $id ) {
|
|
519 |
function wppa_index_get_raw_photo( $id ) {
|
520 |
global $wpdb;
|
521 |
|
522 |
-
$thumb =
|
523 |
|
524 |
$words = wppa_get_photo_desc( $id, array( 'translate' => false ) ) . ' ' . wppa_get_photo_name( $id, array( 'translate' => false ) );
|
525 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all indexing functions
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*
|
9 |
*/
|
519 |
function wppa_index_get_raw_photo( $id ) {
|
520 |
global $wpdb;
|
521 |
|
522 |
+
$thumb = wppa_cache_photo( $id );
|
523 |
|
524 |
$words = wppa_get_photo_desc( $id, array( 'translate' => false ) ) . ' ' . wppa_get_photo_name( $id, array( 'translate' => false ) );
|
525 |
|
wppa-init.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* This file loads required php files and contains all functions used in init actions.
|
6 |
*
|
7 |
-
* Version 8.2.04.
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
@@ -482,6 +482,7 @@ global $_gallery;
|
|
482 |
__( 'Renew Album', 'wp-photo-album-plus' ),
|
483 |
__( 'renew album', 'wp-photo-album-plus' ),
|
484 |
__( 'A new album', 'wp-photo-album-plus' ),
|
|
|
485 |
__( 'this album', 'wp-photo-album-plus' ),
|
486 |
__( 'New albums', 'wp-photo-album-plus' ),
|
487 |
__( 'new albums', 'wp-photo-album-plus' ),
|
@@ -504,6 +505,7 @@ global $_gallery;
|
|
504 |
__( 'Renew Gallery', 'wp-photo-album-plus' ),
|
505 |
__( 'renew gallery', 'wp-photo-album-plus' ),
|
506 |
__( 'A new gallery', 'wp-photo-album-plus' ),
|
|
|
507 |
__( 'this gallery', 'wp-photo-album-plus' ),
|
508 |
__( 'New galleries', 'wp-photo-album-plus' ),
|
509 |
__( 'new galleries', 'wp-photo-album-plus' ),
|
4 |
*
|
5 |
* This file loads required php files and contains all functions used in init actions.
|
6 |
*
|
7 |
+
* Version 8.2.04.005
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
482 |
__( 'Renew Album', 'wp-photo-album-plus' ),
|
483 |
__( 'renew album', 'wp-photo-album-plus' ),
|
484 |
__( 'A new album', 'wp-photo-album-plus' ),
|
485 |
+
__( 'This album', 'wp-photo-album-plus' ),
|
486 |
__( 'this album', 'wp-photo-album-plus' ),
|
487 |
__( 'New albums', 'wp-photo-album-plus' ),
|
488 |
__( 'new albums', 'wp-photo-album-plus' ),
|
505 |
__( 'Renew Gallery', 'wp-photo-album-plus' ),
|
506 |
__( 'renew gallery', 'wp-photo-album-plus' ),
|
507 |
__( 'A new gallery', 'wp-photo-album-plus' ),
|
508 |
+
__( 'This gallery', 'wp-photo-album-plus' ),
|
509 |
__( 'this gallery', 'wp-photo-album-plus' ),
|
510 |
__( 'New galleries', 'wp-photo-album-plus' ),
|
511 |
__( 'new galleries', 'wp-photo-album-plus' ),
|
wppa-items.php
CHANGED
@@ -3,120 +3,100 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains functions to retrieve album and photo items
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
11 |
|
12 |
-
// Bring album into cache
|
13 |
-
// Returns album info and puts it also in global $album
|
14 |
function wppa_cache_album( $id, $data = '' ) {
|
15 |
global $wpdb;
|
16 |
-
static $
|
17 |
-
static $album_cache_2;
|
18 |
|
19 |
if ( $id <= '-9' ) {
|
20 |
return false;
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
23 |
// Init. If there are less than 1000 albums, cache them all on beforehand.
|
24 |
// This reduces the number of queries for albums to two.
|
25 |
// Only for front-end
|
26 |
-
if (
|
27 |
-
|
28 |
-
// Find # of albums
|
29 |
-
$n_albs = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums" );
|
30 |
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
foreach( $allalbs as $album ) { // Add multiple
|
38 |
-
if ( isset( $album['id'] ) ) { // Looks valid
|
39 |
-
$album_cache_2[$album['id']] = $album;
|
40 |
-
}
|
41 |
}
|
42 |
}
|
|
|
|
|
43 |
}
|
44 |
|
45 |
// Action?
|
46 |
if ( $id == 'invalidate' ) {
|
47 |
-
if (
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
if ( $id == 'add' ) {
|
52 |
-
if ( ! $data ) { // Nothing to add
|
53 |
-
return false;
|
54 |
-
}
|
55 |
-
elseif ( isset( $data['id'] ) ) { // Add a single album to 2nd level cache
|
56 |
-
$album_cache_2[$data['id']] = $data; // Looks valid
|
57 |
-
}
|
58 |
-
else foreach( $data as $album ) { // Add multiple
|
59 |
-
if ( isset( $album['id'] ) ) { // Looks valid
|
60 |
-
$album_cache_2[$album['id']] = $album;
|
61 |
}
|
62 |
-
|
63 |
-
return false;
|
64 |
-
}
|
65 |
-
if ( $id == 'count' ) {
|
66 |
-
if ( is_array( $album_cache_2 ) ) {
|
67 |
-
return count( $album_cache_2 );
|
68 |
}
|
69 |
else {
|
|
|
70 |
return false;
|
71 |
}
|
72 |
}
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
$
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
return false;
|
80 |
}
|
81 |
|
82 |
-
//
|
83 |
-
if (
|
84 |
-
|
85 |
-
return
|
86 |
}
|
87 |
|
88 |
-
// In
|
89 |
-
if (
|
90 |
-
|
91 |
-
$album = $album_cache_2[$id];
|
92 |
-
wppa_dbg_cachecounts( 'albumhit' );
|
93 |
-
return $album;
|
94 |
-
}
|
95 |
}
|
96 |
|
97 |
// Not in cache, do query
|
98 |
-
$
|
99 |
-
wppa_dbg_cachecounts( 'albummis' );
|
100 |
|
101 |
// Found one?
|
102 |
-
if ( $
|
103 |
-
|
104 |
-
$album_cache_2[$id] = $album;
|
105 |
-
return $album;
|
106 |
}
|
107 |
else {
|
108 |
-
|
109 |
-
wppa_log( 'dbg', 'Album '.$id.' does not exist (cache album)', true );
|
110 |
return false;
|
111 |
}
|
112 |
}
|
113 |
|
114 |
-
// Bring photo into cache
|
115 |
-
// Returns photo info and puts it also in global $thumb
|
116 |
function wppa_cache_photo( $id, $data = '' ) {
|
117 |
-
return wppa_cache_thumb( $id, $data );
|
118 |
-
}
|
119 |
-
function wppa_cache_thumb( $id, $data = '' ) {
|
120 |
global $wpdb;
|
121 |
static $cache;
|
122 |
|
@@ -130,12 +110,27 @@ static $cache;
|
|
130 |
$cache = array();
|
131 |
}
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
// Invalidate ?
|
134 |
if ( $id == 'invalidate' ) {
|
135 |
if ( $data ) {
|
136 |
if ( isset( $cache[$data] ) ) {
|
137 |
unset( $cache[$data] );
|
138 |
-
wppa_log('obs', "Cache invalidate in
|
139 |
}
|
140 |
return false;
|
141 |
}
|
@@ -153,7 +148,7 @@ static $cache;
|
|
153 |
$cache[$item['id']] = $item;
|
154 |
}
|
155 |
else {
|
156 |
-
wppa_log('err', 'Invalid data in
|
157 |
$cache = array();
|
158 |
return false;
|
159 |
}
|
@@ -163,7 +158,7 @@ static $cache;
|
|
163 |
|
164 |
// Error in arg?
|
165 |
if ( ! wppa_is_int( $id ) || $id < '1' ) {
|
166 |
-
wppa_log('err', 'Invalid arg
|
167 |
return false;
|
168 |
}
|
169 |
|
@@ -172,7 +167,7 @@ static $cache;
|
|
172 |
wppa( 'current_photo', $cache[$id] );
|
173 |
// $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
|
174 |
// $f = $stack[1]['function'] . ' - ' . $stack[2]['function'] . ' - ' . $stack[3]['function'];
|
175 |
-
// wppa_log('obs', "Cache hit in
|
176 |
return $cache[$id];
|
177 |
}
|
178 |
|
@@ -182,13 +177,13 @@ static $cache;
|
|
182 |
wppa( 'current_photo', $cache[$id] );
|
183 |
// $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
|
184 |
// $f = $stack[1]['function'] . ' - ' . $stack[2]['function'] . ' - ' . $stack[3]['function'];
|
185 |
-
// wppa_log('obs', "Cache miss in
|
186 |
return $cache[$id];
|
187 |
}
|
188 |
else {
|
189 |
unset( $cache[$id] );
|
190 |
wppa( 'current_photo', false );
|
191 |
-
wppa_log( 'war', 'Photo '.$id.' does not exist (
|
192 |
return false;
|
193 |
}
|
194 |
}
|
@@ -216,7 +211,7 @@ function wppa_get_photo_name( $id, $xargs = array() ) {
|
|
216 |
$args = wp_parse_args( $xargs, $defaults );
|
217 |
|
218 |
// Get data
|
219 |
-
$thumb =
|
220 |
if ( $args['showname'] ) {
|
221 |
$result .= __( stripslashes( $thumb['name'] ) , 'wp-photo-album-plus' );
|
222 |
}
|
@@ -303,7 +298,7 @@ function wppa_get_photo_desc( $id, $xargs = array() ) {
|
|
303 |
$args = wp_parse_args( $xargs, $defaults );
|
304 |
|
305 |
// Get data
|
306 |
-
$thumb =
|
307 |
$desc = $thumb['description']; // Raw data
|
308 |
$desc = stripslashes( $desc ); // Unescape
|
309 |
$desc = __( $desc , 'wp-photo-album-plus' ); // qTranslate
|
@@ -360,7 +355,7 @@ global $wpdb;
|
|
360 |
|
361 |
// Is there any 'w#' ?
|
362 |
if ( strpos( $result, 'w#' ) !== false ) {
|
363 |
-
$thumb =
|
364 |
|
365 |
// General keywords
|
366 |
if ( strpos( $result, 'w#albumname' ) !== false ) {
|
@@ -1002,13 +997,18 @@ function wppa_get_thumbphotoxy( $id, $key, $force = false ) {
|
|
1002 |
wppa_update_photo( array( 'id' => $id, 'photox' => $size[0], 'photoy' => $size[1] ) );
|
1003 |
}
|
1004 |
wppa_cache_photo( 'invalidate', $id );
|
1005 |
-
}
|
1006 |
|
1007 |
-
|
1008 |
-
|
|
|
|
|
|
|
|
|
1009 |
}
|
|
|
|
|
1010 |
else {
|
1011 |
-
return
|
1012 |
}
|
1013 |
}
|
1014 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains functions to retrieve album and photo items
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
11 |
|
12 |
+
// Bring album into cache and return album data
|
|
|
13 |
function wppa_cache_album( $id, $data = '' ) {
|
14 |
global $wpdb;
|
15 |
+
static $cache;
|
|
|
16 |
|
17 |
if ( $id <= '-9' ) {
|
18 |
return false;
|
19 |
}
|
20 |
|
21 |
+
if ( ! is_array( $cache ) ) {
|
22 |
+
$cache = array();
|
23 |
+
}
|
24 |
+
|
25 |
// Init. If there are less than 1000 albums, cache them all on beforehand.
|
26 |
// This reduces the number of queries for albums to two.
|
27 |
// Only for front-end
|
28 |
+
if ( ! count( $cache ) ) {
|
|
|
|
|
|
|
29 |
|
30 |
+
// Get max 1000 albums
|
31 |
+
$allalbs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums LIMIT 1000", ARRAY_A );
|
32 |
|
33 |
+
// Store in cache
|
34 |
+
foreach( $allalbs as $album ) { // Add multiple
|
35 |
+
if ( isset( $album['id'] ) ) { // Looks valid
|
36 |
+
$cache[$album['id']] = $album;
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
}
|
39 |
+
|
40 |
+
wppa_log('obs', 'Count in album cache is now '.count($cache));
|
41 |
}
|
42 |
|
43 |
// Action?
|
44 |
if ( $id == 'invalidate' ) {
|
45 |
+
if ( $data ) {
|
46 |
+
if ( isset( $cache[$data] ) ) {
|
47 |
+
unset( $cache[$data] );
|
48 |
+
// wppa_log('obs', "Cache invalidate in wppa_cache_album $data");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
else {
|
53 |
+
$cache = array();
|
54 |
return false;
|
55 |
}
|
56 |
}
|
57 |
+
|
58 |
+
// Add
|
59 |
+
if ( $id == 'add' ) {
|
60 |
+
if ( ! is_array( $data ) ) return;
|
61 |
+
foreach( $data as $item ) {
|
62 |
+
if ( is_array( $item ) && isset( $item['id'] ) ) {
|
63 |
+
$cache[$item['id']] = $item;
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
wppa_log('err', 'Invalid data in wppa_cache_album');
|
67 |
+
$cache = array();
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
}
|
71 |
return false;
|
72 |
}
|
73 |
|
74 |
+
// Valid id?
|
75 |
+
if ( ! wppa_is_int( $id ) || $id < '1' ) {
|
76 |
+
wppa_log( 'err', 'Invalid arg wppa_cache_album('.serialize($id).')', true);
|
77 |
+
return false;
|
78 |
}
|
79 |
|
80 |
+
// In cache?
|
81 |
+
if ( isset( $cache[$id] ) ) {
|
82 |
+
return $cache[$id];
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
|
85 |
// Not in cache, do query
|
86 |
+
$cache[$id] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %s", $id ), ARRAY_A );
|
|
|
87 |
|
88 |
// Found one?
|
89 |
+
if ( isset( $cache[$id] ) ) {
|
90 |
+
return $cache[$id];
|
|
|
|
|
91 |
}
|
92 |
else {
|
93 |
+
// wppa_log( 'dbg', 'Album '.$id.' does not exist (cache album)', true );
|
|
|
94 |
return false;
|
95 |
}
|
96 |
}
|
97 |
|
98 |
+
// Bring photo into cache and return photo data
|
|
|
99 |
function wppa_cache_photo( $id, $data = '' ) {
|
|
|
|
|
|
|
100 |
global $wpdb;
|
101 |
static $cache;
|
102 |
|
110 |
$cache = array();
|
111 |
}
|
112 |
|
113 |
+
// Load max 10000 photos order by id descending, so you have the most recent
|
114 |
+
if ( ! count( $cache ) ) {
|
115 |
+
|
116 |
+
// Get max 10000 photos
|
117 |
+
$allpho = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos ORDER BY id DESC LIMIT 10000", ARRAY_A );
|
118 |
+
|
119 |
+
// Store in cache
|
120 |
+
foreach( $allpho as $photo ) { // Add multiple
|
121 |
+
if ( isset( $photo['id'] ) ) { // Looks valid
|
122 |
+
$cache[$photo['id']] = $photo;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
wppa_log('obs', 'Count in photo cache is now '.count($cache));
|
126 |
+
}
|
127 |
+
|
128 |
// Invalidate ?
|
129 |
if ( $id == 'invalidate' ) {
|
130 |
if ( $data ) {
|
131 |
if ( isset( $cache[$data] ) ) {
|
132 |
unset( $cache[$data] );
|
133 |
+
// wppa_log('obs', "Cache invalidate in wppa_cache_photo $data");
|
134 |
}
|
135 |
return false;
|
136 |
}
|
148 |
$cache[$item['id']] = $item;
|
149 |
}
|
150 |
else {
|
151 |
+
wppa_log('err', 'Invalid data in wppa_cache_photo');
|
152 |
$cache = array();
|
153 |
return false;
|
154 |
}
|
158 |
|
159 |
// Error in arg?
|
160 |
if ( ! wppa_is_int( $id ) || $id < '1' ) {
|
161 |
+
wppa_log('err', 'Invalid arg wppa_cache_photo('.serialize($id).')', true);
|
162 |
return false;
|
163 |
}
|
164 |
|
167 |
wppa( 'current_photo', $cache[$id] );
|
168 |
// $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
|
169 |
// $f = $stack[1]['function'] . ' - ' . $stack[2]['function'] . ' - ' . $stack[3]['function'];
|
170 |
+
// wppa_log('obs', "Cache hit in wppa_cache_photo $id from $f");
|
171 |
return $cache[$id];
|
172 |
}
|
173 |
|
177 |
wppa( 'current_photo', $cache[$id] );
|
178 |
// $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
|
179 |
// $f = $stack[1]['function'] . ' - ' . $stack[2]['function'] . ' - ' . $stack[3]['function'];
|
180 |
+
// wppa_log('obs', "Cache miss in wppa_cache_photo $id from $f");
|
181 |
return $cache[$id];
|
182 |
}
|
183 |
else {
|
184 |
unset( $cache[$id] );
|
185 |
wppa( 'current_photo', false );
|
186 |
+
// wppa_log( 'war', 'Photo '.$id.' does not exist (wppa_cache_photo)' );
|
187 |
return false;
|
188 |
}
|
189 |
}
|
211 |
$args = wp_parse_args( $xargs, $defaults );
|
212 |
|
213 |
// Get data
|
214 |
+
$thumb = wppa_cache_photo( $id );
|
215 |
if ( $args['showname'] ) {
|
216 |
$result .= __( stripslashes( $thumb['name'] ) , 'wp-photo-album-plus' );
|
217 |
}
|
298 |
$args = wp_parse_args( $xargs, $defaults );
|
299 |
|
300 |
// Get data
|
301 |
+
$thumb = wppa_cache_photo( $id );
|
302 |
$desc = $thumb['description']; // Raw data
|
303 |
$desc = stripslashes( $desc ); // Unescape
|
304 |
$desc = __( $desc , 'wp-photo-album-plus' ); // qTranslate
|
355 |
|
356 |
// Is there any 'w#' ?
|
357 |
if ( strpos( $result, 'w#' ) !== false ) {
|
358 |
+
$thumb = wppa_cache_photo( $id );
|
359 |
|
360 |
// General keywords
|
361 |
if ( strpos( $result, 'w#albumname' ) !== false ) {
|
997 |
wppa_update_photo( array( 'id' => $id, 'photox' => $size[0], 'photoy' => $size[1] ) );
|
998 |
}
|
999 |
wppa_cache_photo( 'invalidate', $id );
|
|
|
1000 |
|
1001 |
+
if ( $key == 'thumbx' || $key == 'photox' ) {
|
1002 |
+
return $size[0];
|
1003 |
+
}
|
1004 |
+
else {
|
1005 |
+
return $size[1];
|
1006 |
+
}
|
1007 |
}
|
1008 |
+
|
1009 |
+
// No size found
|
1010 |
else {
|
1011 |
+
return wppa_opt( 'thumbsize' );
|
1012 |
}
|
1013 |
}
|
1014 |
|
wppa-lasten-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the last uploaded photos
|
6 |
-
* Version 8.2.
|
7 |
*/
|
8 |
|
9 |
class LasTenWidget extends WP_Widget {
|
@@ -84,18 +84,12 @@ class LasTenWidget extends WP_Widget {
|
|
84 |
}
|
85 |
$album = trim( $album, ',' );
|
86 |
$album_arr = explode( ',', $album );
|
87 |
-
$album_arr =
|
88 |
$album = implode( ',', $album_arr );
|
89 |
|
90 |
// Eiter look at timestamp or at date/time modified
|
91 |
$order_by = wppa_switch( 'lasten_use_modified' ) ? 'modified' : 'timestamp';
|
92 |
|
93 |
-
// Non private
|
94 |
-
$non_private = is_user_logged_in() ? "" : "AND status <> 'private' ";
|
95 |
-
|
96 |
-
// Non void
|
97 |
-
$non_void = wppa_void_albums( 'photos' );
|
98 |
-
|
99 |
// If you want only 'New' photos in the selection, the period must be <> 0;
|
100 |
if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
|
101 |
$newtime = " " . $order_by . " >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
|
@@ -103,21 +97,12 @@ class LasTenWidget extends WP_Widget {
|
|
103 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
104 |
WHERE (".$newtime.")
|
105 |
AND album IN ( ".$album." )
|
106 |
-
AND status <> 'pending'
|
107 |
-
AND status <> 'scheduled'
|
108 |
-
$non_private
|
109 |
-
$non_void
|
110 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
111 |
}
|
112 |
else {
|
113 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
114 |
WHERE (".$newtime.")
|
115 |
AND album > 0
|
116 |
-
AND status <> 'pending'
|
117 |
-
AND status <> 'scheduled'
|
118 |
-
wppa_album_void( 'photos')
|
119 |
-
$non_private
|
120 |
-
$non_void
|
121 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
122 |
}
|
123 |
}
|
@@ -125,24 +110,17 @@ class LasTenWidget extends WP_Widget {
|
|
125 |
if ( $album ) {
|
126 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
127 |
WHERE album IN ( ".$album." )
|
128 |
-
AND status <> 'pending'
|
129 |
-
AND status <> 'scheduled'
|
130 |
-
$non_private
|
131 |
-
$non_void
|
132 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
133 |
}
|
134 |
else {
|
135 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
136 |
WHERE album > 0
|
137 |
-
AND status <> 'pending'
|
138 |
-
AND status <> 'scheduled'
|
139 |
-
$non_private
|
140 |
-
$non_void
|
141 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
142 |
}
|
143 |
}
|
144 |
|
145 |
$thumbs = $wpdb->get_results( $q, ARRAY_A );
|
|
|
146 |
|
147 |
$widget_content = "\n".'<!-- WPPA+ LasTen Widget start -->';
|
148 |
$maxw = wppa_opt( 'lasten_size' );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the last uploaded photos
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
class LasTenWidget extends WP_Widget {
|
84 |
}
|
85 |
$album = trim( $album, ',' );
|
86 |
$album_arr = explode( ',', $album );
|
87 |
+
$album_arr = wppa_strip_void_albums( $album_arr );
|
88 |
$album = implode( ',', $album_arr );
|
89 |
|
90 |
// Eiter look at timestamp or at date/time modified
|
91 |
$order_by = wppa_switch( 'lasten_use_modified' ) ? 'modified' : 'timestamp';
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
// If you want only 'New' photos in the selection, the period must be <> 0;
|
94 |
if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
|
95 |
$newtime = " " . $order_by . " >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
|
97 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
98 |
WHERE (".$newtime.")
|
99 |
AND album IN ( ".$album." )
|
|
|
|
|
|
|
|
|
100 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
101 |
}
|
102 |
else {
|
103 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
104 |
WHERE (".$newtime.")
|
105 |
AND album > 0
|
|
|
|
|
|
|
|
|
|
|
106 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
107 |
}
|
108 |
}
|
110 |
if ( $album ) {
|
111 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
112 |
WHERE album IN ( ".$album." )
|
|
|
|
|
|
|
|
|
113 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
114 |
}
|
115 |
else {
|
116 |
$q = "SELECT * FROM $wpdb->wppa_photos
|
117 |
WHERE album > 0
|
|
|
|
|
|
|
|
|
118 |
ORDER BY " . $order_by . " DESC LIMIT " . $max;
|
119 |
}
|
120 |
}
|
121 |
|
122 |
$thumbs = $wpdb->get_results( $q, ARRAY_A );
|
123 |
+
$thumbs = wppa_strip_void_photos( $thumbs );
|
124 |
|
125 |
$widget_content = "\n".'<!-- WPPA+ LasTen Widget start -->';
|
126 |
$maxw = wppa_opt( 'lasten_size' );
|
wppa-links.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Frontend links
|
6 |
|
7 |
-
* Version 8.2.04.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -19,6 +19,7 @@ global $wppa_locale;
|
|
19 |
switch ( $key ) {
|
20 |
case '0':
|
21 |
case '': // normal permalink
|
|
|
22 |
if ( wppa_in_widget() ) {
|
23 |
$pl = get_permalink(); // home_url();
|
24 |
if ( $plain ) return $pl;
|
@@ -31,7 +32,7 @@ global $wppa_locale;
|
|
31 |
elseif ( wppa_get( 'p' ) ) $id = wppa_get( 'p' );
|
32 |
elseif ( wppa_get( 'fromp' ) ) $id = wppa_get( 'fromp' );
|
33 |
else $id = '';
|
34 |
-
$pl = get_permalink( intval( $id ) );
|
35 |
if ( $plain ) return $pl;
|
36 |
if ( strpos( $pl, '?' ) ) $pl .= '&';
|
37 |
else $pl .= '?';
|
@@ -57,7 +58,7 @@ global $wppa_locale;
|
|
57 |
elseif ( wppa_get( 'p' ) ) $id = wppa_get( 'p' );
|
58 |
elseif ( wppa_get( 'fromp' ) ) $id = wppa_get( 'fromp' );
|
59 |
else $id = '';
|
60 |
-
$pl = get_permalink( intval( $id ) );
|
61 |
if ( $plain ) return $pl;
|
62 |
if ( strpos( $pl, '?' ) ) $pl .= '&';
|
63 |
else $pl .= '?';
|
@@ -71,7 +72,9 @@ global $wppa_locale;
|
|
71 |
}
|
72 |
break;
|
73 |
default: // pagelink
|
74 |
-
$pl = get_permalink($key);
|
|
|
|
|
75 |
if ( $plain ) return $pl;
|
76 |
if (strpos($pl, '?')) $pl .= '&';
|
77 |
else $pl .= '?';
|
@@ -205,7 +208,7 @@ function wppa_get_image_page_url_by_id( $id, $single = false, $alb = false, $pag
|
|
205 |
|
206 |
if ( ! is_numeric( $id ) || $id < '1' ) wppa_dbg_msg( 'Invalid arg wppa_get_image_page_url_by_id(' . $id . ')', 'red' );
|
207 |
|
208 |
-
$thumb =
|
209 |
|
210 |
if ( ! $alb ) {
|
211 |
$alb = $thumb['album'];
|
@@ -227,7 +230,7 @@ function wppa_get_image_url_ajax_by_id($id) {
|
|
227 |
|
228 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_image_url_ajax_by_id('.$id.')', 'red');
|
229 |
|
230 |
-
$thumb =
|
231 |
|
232 |
$result = wppa_get_ajaxlink().'wppa-album='.$thumb['album'].'&wppa-photo='.$thumb['id'].'&wppa-cover=0&wppa-occur='.wppa('mocc');
|
233 |
|
@@ -821,7 +824,7 @@ global $wpdb;
|
|
821 |
// Moderate links
|
822 |
function wppa_moderate_links( $type, $id, $comid = '' ) {
|
823 |
|
824 |
-
$thumb =
|
825 |
$result = '';
|
826 |
|
827 |
if ( wppa_user_is( 'administrator' ) || current_user_can('wppa_moderate') || ( current_user_can('wppa_comments') && $type == 'comment' ) ) {
|
@@ -1341,7 +1344,7 @@ function wppa_get_imglnk_a( $wich, $id, $lnk = '', $tit = '', $onc = '', $noalb
|
|
1341 |
global $wpdb;
|
1342 |
|
1343 |
// make sure the photo data ia available
|
1344 |
-
$thumb =
|
1345 |
if ( ! $thumb ) {
|
1346 |
return false;
|
1347 |
}
|
@@ -1633,7 +1636,7 @@ global $wpdb;
|
|
1633 |
if ( $album == '' && ! wppa( 'is_upldr' ) ) { /**/
|
1634 |
$album = wppa_get_album_id_by_photo_id( $id );
|
1635 |
}
|
1636 |
-
if (
|
1637 |
$album_name = wppa_get_album_name( $album );
|
1638 |
}
|
1639 |
else $album_name = '';
|
@@ -2070,7 +2073,6 @@ static $trimmable;
|
|
2070 |
|
2071 |
// Get the link from slideshow to thumbnail view
|
2072 |
function wppa_get_ss_to_tn_link( $page = '0', $id = '0' ) {
|
2073 |
-
global $thumbs;
|
2074 |
global $thumbs_ids;
|
2075 |
|
2076 |
// Search ?
|
4 |
*
|
5 |
* Frontend links
|
6 |
|
7 |
+
* Version 8.2.04.005
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
19 |
switch ( $key ) {
|
20 |
case '0':
|
21 |
case '': // normal permalink
|
22 |
+
case '-1':
|
23 |
if ( wppa_in_widget() ) {
|
24 |
$pl = get_permalink(); // home_url();
|
25 |
if ( $plain ) return $pl;
|
32 |
elseif ( wppa_get( 'p' ) ) $id = wppa_get( 'p' );
|
33 |
elseif ( wppa_get( 'fromp' ) ) $id = wppa_get( 'fromp' );
|
34 |
else $id = '';
|
35 |
+
$pl = $id ? get_permalink( intval( $id ) ) : get_permalink();
|
36 |
if ( $plain ) return $pl;
|
37 |
if ( strpos( $pl, '?' ) ) $pl .= '&';
|
38 |
else $pl .= '?';
|
58 |
elseif ( wppa_get( 'p' ) ) $id = wppa_get( 'p' );
|
59 |
elseif ( wppa_get( 'fromp' ) ) $id = wppa_get( 'fromp' );
|
60 |
else $id = '';
|
61 |
+
$pl = $id ? get_permalink( intval( $id ) ) : get_permalink();
|
62 |
if ( $plain ) return $pl;
|
63 |
if ( strpos( $pl, '?' ) ) $pl .= '&';
|
64 |
else $pl .= '?';
|
72 |
}
|
73 |
break;
|
74 |
default: // pagelink
|
75 |
+
$pl = $key ? get_permalink($key) : get_permalink();
|
76 |
+
// if ( $key == '-1' ) wppa_log('obs', 'Key='.$key, true);
|
77 |
+
// else wppa_log('obs', 'Key='.$key);
|
78 |
if ( $plain ) return $pl;
|
79 |
if (strpos($pl, '?')) $pl .= '&';
|
80 |
else $pl .= '?';
|
208 |
|
209 |
if ( ! is_numeric( $id ) || $id < '1' ) wppa_dbg_msg( 'Invalid arg wppa_get_image_page_url_by_id(' . $id . ')', 'red' );
|
210 |
|
211 |
+
$thumb = wppa_cache_photo( $id );
|
212 |
|
213 |
if ( ! $alb ) {
|
214 |
$alb = $thumb['album'];
|
230 |
|
231 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_image_url_ajax_by_id('.$id.')', 'red');
|
232 |
|
233 |
+
$thumb = wppa_cache_photo( $id );
|
234 |
|
235 |
$result = wppa_get_ajaxlink().'wppa-album='.$thumb['album'].'&wppa-photo='.$thumb['id'].'&wppa-cover=0&wppa-occur='.wppa('mocc');
|
236 |
|
824 |
// Moderate links
|
825 |
function wppa_moderate_links( $type, $id, $comid = '' ) {
|
826 |
|
827 |
+
$thumb = wppa_cache_photo( $id );
|
828 |
$result = '';
|
829 |
|
830 |
if ( wppa_user_is( 'administrator' ) || current_user_can('wppa_moderate') || ( current_user_can('wppa_comments') && $type == 'comment' ) ) {
|
1344 |
global $wpdb;
|
1345 |
|
1346 |
// make sure the photo data ia available
|
1347 |
+
$thumb = wppa_cache_photo( $id );
|
1348 |
if ( ! $thumb ) {
|
1349 |
return false;
|
1350 |
}
|
1636 |
if ( $album == '' && ! wppa( 'is_upldr' ) ) { /**/
|
1637 |
$album = wppa_get_album_id_by_photo_id( $id );
|
1638 |
}
|
1639 |
+
if ( wppa_is_int( $album ) ) {
|
1640 |
$album_name = wppa_get_album_name( $album );
|
1641 |
}
|
1642 |
else $album_name = '';
|
2073 |
|
2074 |
// Get the link from slideshow to thumbnail view
|
2075 |
function wppa_get_ss_to_tn_link( $page = '0', $id = '0' ) {
|
|
|
2076 |
global $thumbs_ids;
|
2077 |
|
2078 |
// Search ?
|
wppa-maintenance.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains (not yet, but in the future maybe) all the maintenance routines
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1011,7 +1011,7 @@ global $wppa_endtime;
|
|
1011 |
if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
|
1012 |
unset( $photos[$pidx] );
|
1013 |
}
|
1014 |
-
|
1015 |
}
|
1016 |
}
|
1017 |
else {
|
@@ -1394,7 +1394,7 @@ global $wppa_log_file;
|
|
1394 |
<tbody>';
|
1395 |
|
1396 |
foreach ( $ratings as $rating ) {
|
1397 |
-
$thumb =
|
1398 |
$result .= '
|
1399 |
<tr>
|
1400 |
<td>' . htmlspecialchars( $rating['id'] ) . '</td>
|
@@ -1543,7 +1543,7 @@ global $wppa_log_file;
|
|
1543 |
<tbody>';
|
1544 |
|
1545 |
foreach ( $comments as $comment ) {
|
1546 |
-
$thumb =
|
1547 |
$result .= '
|
1548 |
<tr>
|
1549 |
<td>' . htmlspecialchars( $comment['id'] ) . '</td>
|
@@ -1590,7 +1590,7 @@ global $wppa_log_file;
|
|
1590 |
function wppa_recuperate( $id ) {
|
1591 |
global $wpdb;
|
1592 |
|
1593 |
-
$thumb =
|
1594 |
$iptcfix = false;
|
1595 |
$exiffix = false;
|
1596 |
$file = wppa_get_source_path( $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains (not yet, but in the future maybe) all the maintenance routines
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
1011 |
if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
|
1012 |
unset( $photos[$pidx] );
|
1013 |
}
|
1014 |
+
wppa_cache_photo( 'invalidate' ); // Prevent cache overflow
|
1015 |
}
|
1016 |
}
|
1017 |
else {
|
1394 |
<tbody>';
|
1395 |
|
1396 |
foreach ( $ratings as $rating ) {
|
1397 |
+
$thumb = wppa_cache_photo( $rating['photo'] );
|
1398 |
$result .= '
|
1399 |
<tr>
|
1400 |
<td>' . htmlspecialchars( $rating['id'] ) . '</td>
|
1543 |
<tbody>';
|
1544 |
|
1545 |
foreach ( $comments as $comment ) {
|
1546 |
+
$thumb = wppa_cache_photo( $comment['photo'] );
|
1547 |
$result .= '
|
1548 |
<tr>
|
1549 |
<td>' . htmlspecialchars( $comment['id'] ) . '</td>
|
1590 |
function wppa_recuperate( $id ) {
|
1591 |
global $wpdb;
|
1592 |
|
1593 |
+
$thumb = wppa_cache_photo( $id );
|
1594 |
$iptcfix = false;
|
1595 |
$exiffix = false;
|
1596 |
$file = wppa_get_source_path( $id );
|
wppa-non-admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the non admin stuff
|
6 |
-
* Version 8.2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -91,7 +91,7 @@ global $wpdb;
|
|
91 |
if ( $id ) {
|
92 |
|
93 |
if ( wppa_switch( 'share_twitter' ) ) {
|
94 |
-
$thumb =
|
95 |
|
96 |
// Twitter wants at least 280px in width, and at least 150px in height
|
97 |
if ( $thumb ) {
|
@@ -127,7 +127,7 @@ wppa_echo( '
|
|
127 |
}
|
128 |
|
129 |
if ( wppa_switch( 'og_tags_on' ) ) {
|
130 |
-
$thumb =
|
131 |
if ( $thumb ) {
|
132 |
$title = wppa_get_photo_name( $id );
|
133 |
$desc = wppa_get_og_desc( $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the non admin stuff
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
91 |
if ( $id ) {
|
92 |
|
93 |
if ( wppa_switch( 'share_twitter' ) ) {
|
94 |
+
$thumb = wppa_cache_photo( $id );
|
95 |
|
96 |
// Twitter wants at least 280px in width, and at least 150px in height
|
97 |
if ( $thumb ) {
|
127 |
}
|
128 |
|
129 |
if ( wppa_switch( 'og_tags_on' ) ) {
|
130 |
+
$thumb = wppa_cache_photo( $id );
|
131 |
if ( $thumb ) {
|
132 |
$title = wppa_get_photo_name( $id );
|
133 |
$desc = wppa_get_og_desc( $id );
|
wppa-photo-admin-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -18,7 +18,7 @@ function _wppa_edit_photo() {
|
|
18 |
// Edit one Photo
|
19 |
if ( wppa_get( 'photo', '0', 'int' ) ) {
|
20 |
$photo = wppa_get( 'photo', '0', 'int' );
|
21 |
-
$thumb =
|
22 |
if ( $thumb['owner'] == wppa_get_user() ) {
|
23 |
wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Edit photo', 'wp-photo-album-plus' ) . '</h2>' );
|
24 |
wppa_album_photos( '', $photo );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
18 |
// Edit one Photo
|
19 |
if ( wppa_get( 'photo', '0', 'int' ) ) {
|
20 |
$photo = wppa_get( 'photo', '0', 'int' );
|
21 |
+
$thumb = wppa_cache_photo( $photo );
|
22 |
if ( $thumb['owner'] == wppa_get_user() ) {
|
23 |
wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Edit photo', 'wp-photo-album-plus' ) . '</h2>' );
|
24 |
wppa_album_photos( '', $photo );
|
wppa-photo-files.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-photo-files.php
|
3 |
*
|
4 |
* Functions used to create/manipulate photofiles
|
5 |
-
* Version 8.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -145,7 +145,7 @@ function wppa_orientate_image_file( $file, $ori ) {
|
|
145 |
function wppa_make_the_photo_files( $file, $id, $ext, $do_thumb = true ) {
|
146 |
global $wpdb;
|
147 |
// wppa_log('dbg', 'make called with'.$file.' '.$id.' '.$ext.' '.$do_thumb. ' exists=' . is_file($file), true);
|
148 |
-
$thumb =
|
149 |
|
150 |
$documentstub = WPPA_UPLOAD_PATH . '/documentstub.png';
|
151 |
|
@@ -227,8 +227,8 @@ global $wpdb;
|
|
227 |
|
228 |
// Hoesekeeping
|
229 |
clearstatcache();
|
230 |
-
|
231 |
-
$thumb =
|
232 |
}
|
233 |
|
234 |
$src_size = @getimagesize( $file, $info );
|
@@ -778,7 +778,7 @@ function wppa_create_thumbnail( $id, $use_source = true ) {
|
|
778 |
wppa_get_thumbx( $id, 'force' ); // forces recalc x and y
|
779 |
|
780 |
// Invalidate cache
|
781 |
-
|
782 |
|
783 |
// If existing file not updated, return false
|
784 |
if ( wppa_is_file( $thumbpath ) ) {
|
2 |
/* wppa-photo-files.php
|
3 |
*
|
4 |
* Functions used to create/manipulate photofiles
|
5 |
+
* Version 8.2.04.005
|
6 |
*
|
7 |
*/
|
8 |
|
145 |
function wppa_make_the_photo_files( $file, $id, $ext, $do_thumb = true ) {
|
146 |
global $wpdb;
|
147 |
// wppa_log('dbg', 'make called with'.$file.' '.$id.' '.$ext.' '.$do_thumb. ' exists=' . is_file($file), true);
|
148 |
+
$thumb = wppa_cache_photo( $id );
|
149 |
|
150 |
$documentstub = WPPA_UPLOAD_PATH . '/documentstub.png';
|
151 |
|
227 |
|
228 |
// Hoesekeeping
|
229 |
clearstatcache();
|
230 |
+
wppa_cache_photo( 'invalidate', $id );
|
231 |
+
$thumb = wppa_cache_photo( $id );
|
232 |
}
|
233 |
|
234 |
$src_size = @getimagesize( $file, $info );
|
778 |
wppa_get_thumbx( $id, 'force' ); // forces recalc x and y
|
779 |
|
780 |
// Invalidate cache
|
781 |
+
wppa_cache_photo( 'invalidate', $id );
|
782 |
|
783 |
// If existing file not updated, return false
|
784 |
if ( wppa_is_file( $thumbpath ) ) {
|
wppa-picture.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Make the picture html
|
6 |
-
* Version 8.2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -37,7 +37,19 @@ function wppa_get_picture_html( $args ) {
|
|
37 |
);
|
38 |
$args = wp_parse_args( $args, $defaults );
|
39 |
|
40 |
-
$id = strval( intval
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
$type = $args['type'];
|
42 |
$class = $args['class'];
|
43 |
$mocc = wppa( 'mocc' );
|
@@ -59,11 +71,6 @@ function wppa_get_picture_html( $args ) {
|
|
59 |
}
|
60 |
|
61 |
// Check validity of args
|
62 |
-
if ( ! wppa_photo_exists( $id ) ) {
|
63 |
-
wppa_dbg_msg( 'Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type, 'red', 'force' );
|
64 |
-
return false;
|
65 |
-
}
|
66 |
-
|
67 |
$types = array( 'sphoto', // Single image with optional border like slideshow border
|
68 |
'mphoto', // Media type like single image. Caption should be provided in wrappping div
|
69 |
'xphoto', // Like xphoto with extended features
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Make the picture html
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
37 |
);
|
38 |
$args = wp_parse_args( $args, $defaults );
|
39 |
|
40 |
+
$id = strval( intval( $args['id'] ) );
|
41 |
+
|
42 |
+
// Does the photo exist?
|
43 |
+
if ( ! wppa_photo_exists( $id ) ) {
|
44 |
+
wppa_dbg_msg( 'Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type, 'red', 'force' );
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
// May the current user see this photo?
|
49 |
+
if ( ! wppa_is_photo_visible( $id ) ) {
|
50 |
+
return '';
|
51 |
+
}
|
52 |
+
|
53 |
$type = $args['type'];
|
54 |
$class = $args['class'];
|
55 |
$mocc = wppa( 'mocc' );
|
71 |
}
|
72 |
|
73 |
// Check validity of args
|
|
|
|
|
|
|
|
|
|
|
74 |
$types = array( 'sphoto', // Single image with optional border like slideshow border
|
75 |
'mphoto', // Media type like single image. Caption should be provided in wrappping div
|
76 |
'xphoto', // Like xphoto with extended features
|
wppa-slideshow-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display a slideshow in the sidebar
|
6 |
-
* Version 8.2.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -95,7 +95,7 @@ class SlideshowWidget extends WP_Widget {
|
|
95 |
elseif ( $album == '-2' ) {
|
96 |
$album = wppa_alb_to_enum_children( '0' );
|
97 |
}
|
98 |
-
$album = implode( '.',
|
99 |
|
100 |
if ( $album ) {
|
101 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display a slideshow in the sidebar
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
95 |
elseif ( $album == '-2' ) {
|
96 |
$album = wppa_alb_to_enum_children( '0' );
|
97 |
}
|
98 |
+
$album = implode( '.', wppa_strip_void_albums( explode( '.', $album ) ) );
|
99 |
|
100 |
if ( $album ) {
|
101 |
|
wppa-slideshow.php
CHANGED
@@ -4,15 +4,15 @@
|
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
*
|
7 |
-
* Version 8.
|
8 |
*
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
12 |
|
13 |
-
function wppa_the_slideshow() {
|
14 |
|
15 |
-
wppa_prepare_slideshow_pagination();
|
16 |
|
17 |
if ( wppa_opt( 'pagelink_pos' ) == 'top' || wppa_opt( 'pagelink_pos' ) == 'both' ) wppa_slide_page_links();
|
18 |
|
@@ -110,8 +110,7 @@ function wppa_the_slideshow() {
|
|
110 |
if ( wppa_opt( 'pagelink_pos' ) == 'bottom' || wppa_opt( 'pagelink_pos' ) == 'both' ) wppa_slide_page_links();
|
111 |
}
|
112 |
|
113 |
-
function wppa_prepare_slideshow_pagination() {
|
114 |
-
global $thumbs;
|
115 |
global $thumbs_ids;
|
116 |
global $previous_page_last_id;
|
117 |
|
@@ -216,7 +215,6 @@ global $previous_page_last_id;
|
|
216 |
}
|
217 |
|
218 |
function wppa_slide_page_links() {
|
219 |
-
global $thumbs;
|
220 |
|
221 |
if ( ! wppa( 'ss_pag' ) ) return; // No pagination
|
222 |
if ( wppa( 'is_slideonly' ) || wppa( 'is_slideonlyf' ) ) return; // Not on slideonly
|
@@ -1293,7 +1291,7 @@ function wppa_slide_filmstrip( $opt = '' ) {
|
|
1293 |
|
1294 |
$alb = wppa_get( 'album' );
|
1295 |
|
1296 |
-
$thumbs =
|
1297 |
if ( ! $thumbs || count( $thumbs ) < 1 ) return;
|
1298 |
|
1299 |
$preambule = wppa_get_preambule();
|
@@ -1484,7 +1482,7 @@ function wppa_numberbar( $opt = '' ) {
|
|
1484 |
if( ! $do_it ) return;
|
1485 |
|
1486 |
// get the data
|
1487 |
-
$thumbs =
|
1488 |
if ( empty( $thumbs ) ) return;
|
1489 |
|
1490 |
// get the sizes
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
*
|
7 |
+
* Version 8.2.04.005
|
8 |
*
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
12 |
|
13 |
+
function wppa_the_slideshow( $thumbs ) {
|
14 |
|
15 |
+
wppa_prepare_slideshow_pagination( $thumbs );
|
16 |
|
17 |
if ( wppa_opt( 'pagelink_pos' ) == 'top' || wppa_opt( 'pagelink_pos' ) == 'both' ) wppa_slide_page_links();
|
18 |
|
110 |
if ( wppa_opt( 'pagelink_pos' ) == 'bottom' || wppa_opt( 'pagelink_pos' ) == 'both' ) wppa_slide_page_links();
|
111 |
}
|
112 |
|
113 |
+
function wppa_prepare_slideshow_pagination( $thumbs ) {
|
|
|
114 |
global $thumbs_ids;
|
115 |
global $previous_page_last_id;
|
116 |
|
215 |
}
|
216 |
|
217 |
function wppa_slide_page_links() {
|
|
|
218 |
|
219 |
if ( ! wppa( 'ss_pag' ) ) return; // No pagination
|
220 |
if ( wppa( 'is_slideonly' ) || wppa( 'is_slideonlyf' ) ) return; // Not on slideonly
|
1291 |
|
1292 |
$alb = wppa_get( 'album' );
|
1293 |
|
1294 |
+
$thumbs = wppa_get_photos();
|
1295 |
if ( ! $thumbs || count( $thumbs ) < 1 ) return;
|
1296 |
|
1297 |
$preambule = wppa_get_preambule();
|
1482 |
if( ! $do_it ) return;
|
1483 |
|
1484 |
// get the data
|
1485 |
+
$thumbs = wppa_get_photos();
|
1486 |
if ( empty( $thumbs ) ) return;
|
1487 |
|
1488 |
// get the sizes
|
wppa-statistics.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Functions for counts etc
|
6 |
* Common use front and admin
|
7 |
-
* Version 8.2.04.
|
8 |
*
|
9 |
*/
|
10 |
|
@@ -428,10 +428,6 @@ global $wpdb;
|
|
428 |
'scheduledtreephotos',
|
429 |
'selfphotoviews',
|
430 |
'treephotoviews',
|
431 |
-
'privatealbums',
|
432 |
-
'hiddenalbums',
|
433 |
-
'privatetreealbums',
|
434 |
-
'hiddentreealbums'
|
435 |
*/
|
436 |
|
437 |
// Do the dirty work
|
@@ -517,39 +513,6 @@ global $wpdb;
|
|
517 |
$result['treephotoviews'] += $child_treecounts['treephotoviews'];
|
518 |
}
|
519 |
|
520 |
-
// Private albums
|
521 |
-
$result['privatealbums'] = $wpdb->get_var( "SELECT COUNT(*)
|
522 |
-
FROM $wpdb->wppa_albums
|
523 |
-
WHERE a_parent = $alb
|
524 |
-
AND status = 'private'"
|
525 |
-
);
|
526 |
-
|
527 |
-
// Hidden albums
|
528 |
-
$result['hiddenalbums'] = $wpdb->get_var( "SELECT COUNT(*)
|
529 |
-
FROM $wpdb->wppa_albums
|
530 |
-
WHERE a_parent = $alb
|
531 |
-
AND status = 'hidden'"
|
532 |
-
);
|
533 |
-
|
534 |
-
// Private tree albums
|
535 |
-
$result['privatetreealbums'] = $result['privatealbums'];
|
536 |
-
foreach( $child_ids as $child ) {
|
537 |
-
|
538 |
-
// Recursively get childrens private albums and add it
|
539 |
-
$child_treecounts = wppa_verify_treecounts_a( $child );
|
540 |
-
$result['privatetreealbums'] += $child_treecounts['privatealbums'];
|
541 |
-
}
|
542 |
-
|
543 |
-
// Hidden tree albums
|
544 |
-
$result['hiddentreealbums'] = $result['hiddenalbums'];
|
545 |
-
foreach( $child_ids as $child ) {
|
546 |
-
|
547 |
-
// Recursively get childrens private albums and add it
|
548 |
-
$child_treecounts = wppa_verify_treecounts_a( $child );
|
549 |
-
$result['hiddentreealbums'] += $child_treecounts['hiddenalbums'];
|
550 |
-
}
|
551 |
-
|
552 |
-
|
553 |
// Save result
|
554 |
wppa_save_treecount_a( $alb, $result );
|
555 |
|
@@ -611,7 +574,7 @@ global $wpdb;
|
|
611 |
// Do it
|
612 |
if ( $alb && is_array( $treecounts ) ) {
|
613 |
|
614 |
-
$keys = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'
|
615 |
$result = array_combine( $keys, $treecounts );
|
616 |
$result = serialize( $result );
|
617 |
|
@@ -637,10 +600,6 @@ global $wpdb;
|
|
637 |
$scheduledtreephotos = '8';
|
638 |
$selfphotoviews = '9';
|
639 |
$treephotoviews = '10';
|
640 |
-
$privatealbums = '11';
|
641 |
-
$hiddenalbums = '12';
|
642 |
-
$privatetreealbums = '13';
|
643 |
-
$hiddentreealbums = '14';
|
644 |
|
645 |
// Sanitize arg
|
646 |
if ( $alb ) {
|
@@ -662,7 +621,7 @@ global $wpdb;
|
|
662 |
}
|
663 |
|
664 |
// Fill in missing elements
|
665 |
-
$defaults = array( 1,0,0,0,0,0,0,0,0,0,0
|
666 |
$i = 0;
|
667 |
$n = count( $defaults );
|
668 |
while ( $i < $n ) {
|
@@ -684,10 +643,6 @@ global $wpdb;
|
|
684 |
'scheduledtreephotos',
|
685 |
'selfphotoviews',
|
686 |
'treephotoviews',
|
687 |
-
'privatealbums',
|
688 |
-
'hiddenalbums',
|
689 |
-
'privatetreealbums',
|
690 |
-
'hiddentreealbums'
|
691 |
);
|
692 |
|
693 |
$result = array_combine( $keys, $treecount_array );
|
@@ -729,28 +684,55 @@ global $wpdb;
|
|
729 |
}
|
730 |
|
731 |
// See if an album is visible to the current user. This takes 'skip empty albums' into account.
|
732 |
-
function wppa_is_album_visible( $id ) {
|
733 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
|
735 |
// Everything is visible for admin and superusers
|
736 |
if ( wppa_user_is( 'administrator' ) ) {
|
|
|
737 |
return true;
|
738 |
}
|
739 |
|
740 |
// Album is alwaus visible for the owner
|
741 |
$user = wppa_get_user();
|
742 |
$album = wppa_cache_album( $id );
|
743 |
-
if (
|
744 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
}
|
746 |
|
747 |
// Look at album status
|
748 |
switch( $album['status'] ) {
|
749 |
case 'hidden':
|
|
|
750 |
return false;
|
751 |
break;
|
752 |
case 'private':
|
753 |
if ( ! is_user_logged_in() ) {
|
|
|
754 |
return false;
|
755 |
}
|
756 |
break;
|
@@ -761,18 +743,19 @@ global $wpdb;
|
|
761 |
|
762 |
// Look at skip switch
|
763 |
if ( ! wppa_switch( 'skip_empty_albums' ) ) {
|
|
|
764 |
return true;
|
765 |
}
|
766 |
|
767 |
-
// Look at
|
768 |
-
|
|
|
|
|
769 |
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
if ( wppa_is_photo_visible( $p ) ) {
|
775 |
-
return true;
|
776 |
}
|
777 |
}
|
778 |
|
@@ -781,10 +764,12 @@ global $wpdb;
|
|
781 |
foreach( $albs as $alb ) {
|
782 |
|
783 |
if ( wppa_is_album_visible( $alb['id'] ) ) {
|
|
|
784 |
return true;
|
785 |
}
|
786 |
}
|
787 |
|
|
|
788 |
return false; // This album is not visible for the current user
|
789 |
}
|
790 |
|
@@ -831,35 +816,52 @@ static $cache;
|
|
831 |
}
|
832 |
|
833 |
// Find out if a given photo is visible for the current user
|
834 |
-
function wppa_is_photo_visible( $id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
|
|
|
836 |
$p = wppa_cache_photo( $id );
|
837 |
-
if ( $p ) {
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
break;
|
846 |
-
case 'private':
|
847 |
-
if ( is_user_logged_in() ) { // A logged in user may see private photos
|
848 |
-
return true;
|
849 |
-
}
|
850 |
-
break;
|
851 |
-
case 'pending': // Pending and scheduled may be seen by owner
|
852 |
-
case 'scheduled':
|
853 |
-
$user = wppa_get_user();
|
854 |
-
if ( $user == $p['owner'] ) {
|
855 |
-
return true;
|
856 |
-
}
|
857 |
-
break;
|
858 |
-
default:
|
859 |
-
break;
|
860 |
}
|
861 |
}
|
862 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
863 |
return false; // This photo is not visible for the current user
|
864 |
}
|
865 |
|
4 |
*
|
5 |
* Functions for counts etc
|
6 |
* Common use front and admin
|
7 |
+
* Version 8.2.04.005
|
8 |
*
|
9 |
*/
|
10 |
|
428 |
'scheduledtreephotos',
|
429 |
'selfphotoviews',
|
430 |
'treephotoviews',
|
|
|
|
|
|
|
|
|
431 |
*/
|
432 |
|
433 |
// Do the dirty work
|
513 |
$result['treephotoviews'] += $child_treecounts['treephotoviews'];
|
514 |
}
|
515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
// Save result
|
517 |
wppa_save_treecount_a( $alb, $result );
|
518 |
|
574 |
// Do it
|
575 |
if ( $alb && is_array( $treecounts ) ) {
|
576 |
|
577 |
+
$keys = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' );
|
578 |
$result = array_combine( $keys, $treecounts );
|
579 |
$result = serialize( $result );
|
580 |
|
600 |
$scheduledtreephotos = '8';
|
601 |
$selfphotoviews = '9';
|
602 |
$treephotoviews = '10';
|
|
|
|
|
|
|
|
|
603 |
|
604 |
// Sanitize arg
|
605 |
if ( $alb ) {
|
621 |
}
|
622 |
|
623 |
// Fill in missing elements
|
624 |
+
$defaults = array( 1,0,0,0,0,0,0,0,0,0,0 );
|
625 |
$i = 0;
|
626 |
$n = count( $defaults );
|
627 |
while ( $i < $n ) {
|
643 |
'scheduledtreephotos',
|
644 |
'selfphotoviews',
|
645 |
'treephotoviews',
|
|
|
|
|
|
|
|
|
646 |
);
|
647 |
|
648 |
$result = array_combine( $keys, $treecount_array );
|
684 |
}
|
685 |
|
686 |
// See if an album is visible to the current user. This takes 'skip empty albums' into account.
|
687 |
+
function wppa_is_album_visible( $id, $strict = false ) {
|
688 |
global $wpdb;
|
689 |
+
static $cache;
|
690 |
+
|
691 |
+
// Validate arg
|
692 |
+
if ( ! wppa_is_int( $id ) ) {
|
693 |
+
wppa_log( 'err', 'Invalid arg in wppa_is_album_visible: '.serialize($id) );
|
694 |
+
return false;
|
695 |
+
}
|
696 |
+
|
697 |
+
// Init cache
|
698 |
+
if ( ! is_array( $cache ) ) {
|
699 |
+
$cache = array();
|
700 |
+
}
|
701 |
+
|
702 |
+
// In cache?
|
703 |
+
if ( isset( $cache[$id] ) ) {
|
704 |
+
return $cache[$id];
|
705 |
+
}
|
706 |
|
707 |
// Everything is visible for admin and superusers
|
708 |
if ( wppa_user_is( 'administrator' ) ) {
|
709 |
+
$cache[$id] = true;
|
710 |
return true;
|
711 |
}
|
712 |
|
713 |
// Album is alwaus visible for the owner
|
714 |
$user = wppa_get_user();
|
715 |
$album = wppa_cache_album( $id );
|
716 |
+
if ( is_array( $album ) ) { // Album exists
|
717 |
+
if ( $user == $album['owner'] ) {
|
718 |
+
$cache[$id] = true;
|
719 |
+
return true;
|
720 |
+
}
|
721 |
+
}
|
722 |
+
else { // Album does not exist
|
723 |
+
$cache[$id] = false;
|
724 |
+
return false;
|
725 |
}
|
726 |
|
727 |
// Look at album status
|
728 |
switch( $album['status'] ) {
|
729 |
case 'hidden':
|
730 |
+
$cache[$id] = false;
|
731 |
return false;
|
732 |
break;
|
733 |
case 'private':
|
734 |
if ( ! is_user_logged_in() ) {
|
735 |
+
$cache[$id] = false;
|
736 |
return false;
|
737 |
}
|
738 |
break;
|
743 |
|
744 |
// Look at skip switch
|
745 |
if ( ! wppa_switch( 'skip_empty_albums' ) ) {
|
746 |
+
$cache[$id] = true;
|
747 |
return true;
|
748 |
}
|
749 |
|
750 |
+
// Look at photos, only if not strict to prevent endless loop
|
751 |
+
if ( ! $strict ) {
|
752 |
+
$photos = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos WHERE album = %s", $id ) );
|
753 |
+
foreach( $photos as $p ) {
|
754 |
|
755 |
+
if ( wppa_is_photo_visible( $p, 'strict' ) ) {
|
756 |
+
$cache[$id] = true;
|
757 |
+
return true;
|
758 |
+
}
|
|
|
|
|
759 |
}
|
760 |
}
|
761 |
|
764 |
foreach( $albs as $alb ) {
|
765 |
|
766 |
if ( wppa_is_album_visible( $alb['id'] ) ) {
|
767 |
+
$cache[$id] = true;
|
768 |
return true;
|
769 |
}
|
770 |
}
|
771 |
|
772 |
+
$cache[$id] = false;
|
773 |
return false; // This album is not visible for the current user
|
774 |
}
|
775 |
|
816 |
}
|
817 |
|
818 |
// Find out if a given photo is visible for the current user
|
819 |
+
function wppa_is_photo_visible( $id, $strict = false ) {
|
820 |
+
|
821 |
+
// Validate arg
|
822 |
+
if ( ! wppa_is_int( $id ) ) {
|
823 |
+
wppa_log( 'err', 'Invalid arg in wppa_is_photo_visible: '.serialize($id) );
|
824 |
+
return false;
|
825 |
+
}
|
826 |
|
827 |
+
// Get the photo data
|
828 |
$p = wppa_cache_photo( $id );
|
829 |
+
if ( ! $p ) {
|
830 |
+
return false; // Photo does not exist
|
831 |
+
}
|
832 |
+
|
833 |
+
// Photo can only be visible when in a visible album
|
834 |
+
if ( ! $strict ) {
|
835 |
+
if ( ! wppa_is_album_visible( $p['album'], 'strict' ) ) {
|
836 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
837 |
}
|
838 |
}
|
839 |
|
840 |
+
// Dispatch on photo status
|
841 |
+
switch( $p['status'] ) {
|
842 |
+
case 'publish': // A published photo found, visible to every one
|
843 |
+
case 'featured':
|
844 |
+
case 'gold':
|
845 |
+
case 'silver':
|
846 |
+
case 'bronze':
|
847 |
+
return true;
|
848 |
+
break;
|
849 |
+
case 'private':
|
850 |
+
if ( is_user_logged_in() ) { // A logged in user may see private photos
|
851 |
+
return true;
|
852 |
+
}
|
853 |
+
break;
|
854 |
+
case 'pending': // Pending and scheduled may be seen by owner
|
855 |
+
case 'scheduled':
|
856 |
+
$user = wppa_get_user();
|
857 |
+
if ( $user == $p['owner'] ) {
|
858 |
+
return true;
|
859 |
+
}
|
860 |
+
break;
|
861 |
+
default:
|
862 |
+
break;
|
863 |
+
}
|
864 |
+
|
865 |
return false; // This photo is not visible for the current user
|
866 |
}
|
867 |
|
wppa-styles.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
/* Various style computation routines
|
6 |
-
/* Version 8.2.
|
7 |
/*
|
8 |
*/
|
9 |
|
@@ -120,7 +120,7 @@ function wppa_get_imgstyle_a( $id, $file, $xmax_size, $xvalign = '', $type = ''
|
|
120 |
'margin-bottom' => ''
|
121 |
); // Init
|
122 |
|
123 |
-
|
124 |
|
125 |
if ( ! $id ) return $result; // no image: no dimensions
|
126 |
if ( $file == '' ) return $result; // no image: no dimensions
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
/* Various style computation routines
|
6 |
+
/* Version 8.2.04.005
|
7 |
/*
|
8 |
*/
|
9 |
|
120 |
'margin-bottom' => ''
|
121 |
); // Init
|
122 |
|
123 |
+
wppa_cache_photo( $id );
|
124 |
|
125 |
if ( ! $id ) return $result; // no image: no dimensions
|
126 |
if ( $file == '' ) return $result; // no image: no dimensions
|
wppa-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Various funcions to display a thumbnail image
|
6 |
* Contains all possible frontend thumbnail types
|
7 |
*
|
8 |
-
* Version 8.2.04.
|
9 |
*
|
10 |
*/
|
11 |
|
@@ -33,7 +33,7 @@ global $wpdb;
|
|
33 |
$xid = wppa_encrypt_photo( $id );
|
34 |
|
35 |
// Get the photo info
|
36 |
-
$thumb =
|
37 |
|
38 |
// Get the album info
|
39 |
$alb = $thumb['album'];
|
@@ -833,7 +833,7 @@ global $thlinkmsggiven;
|
|
833 |
$xid = wppa_encrypt_photo( $id );
|
834 |
|
835 |
// Get the photo info
|
836 |
-
$thumb =
|
837 |
|
838 |
// Get the album info
|
839 |
$album = wppa_cache_album( $thumb['album'] );
|
@@ -1118,7 +1118,7 @@ global $wpdb;
|
|
1118 |
$count_cols = ceil( $cont_width / wppa_opt( 'thumbsize' ) );
|
1119 |
|
1120 |
// Get the photo info
|
1121 |
-
$thumb =
|
1122 |
|
1123 |
// Get the album info
|
1124 |
$album = wppa_cache_album( $thumb['album'] );
|
@@ -1557,7 +1557,7 @@ global $wpdb;
|
|
1557 |
function wppa_get_masonry_title( $id ) {
|
1558 |
|
1559 |
$result = '';
|
1560 |
-
$thumb =
|
1561 |
$alb = $thumb['album'];
|
1562 |
|
1563 |
// Name
|
@@ -1822,7 +1822,7 @@ function wppa_get_the_widget_thumb( $type, $image, $album, $display, $link, $tit
|
|
1822 |
// $glue = bool, Set to true only at thumbs where the right border should be the glue line.
|
1823 |
function wppa_do_filmthumb( $id, $idx, $do_for_feed = false, $glue = false ) {
|
1824 |
|
1825 |
-
$thumb =
|
1826 |
$mocc = wppa( 'mocc' );
|
1827 |
$result = '';
|
1828 |
$src = wppa_get_thumb_path( $thumb['id'] );
|
5 |
* Various funcions to display a thumbnail image
|
6 |
* Contains all possible frontend thumbnail types
|
7 |
*
|
8 |
+
* Version 8.2.04.005
|
9 |
*
|
10 |
*/
|
11 |
|
33 |
$xid = wppa_encrypt_photo( $id );
|
34 |
|
35 |
// Get the photo info
|
36 |
+
$thumb = wppa_cache_photo( $id );
|
37 |
|
38 |
// Get the album info
|
39 |
$alb = $thumb['album'];
|
833 |
$xid = wppa_encrypt_photo( $id );
|
834 |
|
835 |
// Get the photo info
|
836 |
+
$thumb = wppa_cache_photo( $id );
|
837 |
|
838 |
// Get the album info
|
839 |
$album = wppa_cache_album( $thumb['album'] );
|
1118 |
$count_cols = ceil( $cont_width / wppa_opt( 'thumbsize' ) );
|
1119 |
|
1120 |
// Get the photo info
|
1121 |
+
$thumb = wppa_cache_photo( $id );
|
1122 |
|
1123 |
// Get the album info
|
1124 |
$album = wppa_cache_album( $thumb['album'] );
|
1557 |
function wppa_get_masonry_title( $id ) {
|
1558 |
|
1559 |
$result = '';
|
1560 |
+
$thumb = wppa_cache_photo( $id );
|
1561 |
$alb = $thumb['album'];
|
1562 |
|
1563 |
// Name
|
1822 |
// $glue = bool, Set to true only at thumbs where the right border should be the glue line.
|
1823 |
function wppa_do_filmthumb( $id, $idx, $do_for_feed = false, $glue = false ) {
|
1824 |
|
1825 |
+
$thumb = wppa_cache_photo( $id );
|
1826 |
$mocc = wppa( 'mocc' );
|
1827 |
$result = '';
|
1828 |
$src = wppa_get_thumb_path( $thumb['id'] );
|
wppa-topten-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
-
* Version 8.2.
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
@@ -116,7 +116,7 @@ class TopTenWidget extends WP_Widget {
|
|
116 |
$album = str_replace( '.', ',', $albenum );
|
117 |
}
|
118 |
|
119 |
-
$album = implode( ',',
|
120 |
|
121 |
// Doit
|
122 |
if ( $medalsonly ) {
|
@@ -161,7 +161,6 @@ class TopTenWidget extends WP_Widget {
|
|
161 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
162 |
WHERE album IN ( aaaa )
|
163 |
$non_zero
|
164 |
-
$non_private
|
165 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
166 |
LIMIT %d";
|
167 |
break;
|
@@ -170,7 +169,6 @@ class TopTenWidget extends WP_Widget {
|
|
170 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
171 |
WHERE album IN ( aaaa )
|
172 |
$non_zero
|
173 |
-
$non_private
|
174 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
175 |
LIMIT %d";
|
176 |
break;
|
@@ -179,7 +177,6 @@ class TopTenWidget extends WP_Widget {
|
|
179 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
180 |
WHERE album IN ( aaaa )
|
181 |
$non_zero
|
182 |
-
$non_private
|
183 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
184 |
LIMIT %d";
|
185 |
break;
|
@@ -189,7 +186,6 @@ class TopTenWidget extends WP_Widget {
|
|
189 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
190 |
WHERE album IN ( aaa )
|
191 |
$non_zero
|
192 |
-
$non_private
|
193 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
194 |
LIMIT %d";
|
195 |
break;
|
@@ -201,8 +197,6 @@ class TopTenWidget extends WP_Widget {
|
|
201 |
// No album specified
|
202 |
else {
|
203 |
|
204 |
-
$non_void = wppa_void_albums( 'photos' );
|
205 |
-
|
206 |
if ( $medalsonly ) {
|
207 |
switch ( $instance['sortby'] ) {
|
208 |
|
@@ -211,7 +205,6 @@ class TopTenWidget extends WP_Widget {
|
|
211 |
WHERE album > 0
|
212 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
213 |
$non_zero
|
214 |
-
$non_void
|
215 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
216 |
LIMIT %d";
|
217 |
break;
|
@@ -221,7 +214,6 @@ class TopTenWidget extends WP_Widget {
|
|
221 |
WHERE album > 0
|
222 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
223 |
$non_zero
|
224 |
-
$non_void
|
225 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
226 |
LIMIT %d";
|
227 |
break;
|
@@ -231,7 +223,6 @@ class TopTenWidget extends WP_Widget {
|
|
231 |
WHERE album > 0
|
232 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
233 |
$non_zero
|
234 |
-
$non_void
|
235 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
236 |
LIMIT %d";
|
237 |
break;
|
@@ -242,7 +233,6 @@ class TopTenWidget extends WP_Widget {
|
|
242 |
WHERE album > 0
|
243 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
244 |
$non_zero
|
245 |
-
$non_void
|
246 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
247 |
LIMIT %d";
|
248 |
break;
|
@@ -257,8 +247,6 @@ class TopTenWidget extends WP_Widget {
|
|
257 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
258 |
WHERE album > 0
|
259 |
$non_zero
|
260 |
-
$non_private
|
261 |
-
$non_void
|
262 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
263 |
LIMIT %d";
|
264 |
break;
|
@@ -267,8 +255,6 @@ class TopTenWidget extends WP_Widget {
|
|
267 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
268 |
WHERE album > 0
|
269 |
$non_zero
|
270 |
-
$non_private
|
271 |
-
$non_void
|
272 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
273 |
LIMIT %d";
|
274 |
break;
|
@@ -277,8 +263,6 @@ class TopTenWidget extends WP_Widget {
|
|
277 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
278 |
WHERE album > 0
|
279 |
$non_zero
|
280 |
-
$non_private
|
281 |
-
$non_void
|
282 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
283 |
LIMIT %d";
|
284 |
break;
|
@@ -288,8 +272,6 @@ class TopTenWidget extends WP_Widget {
|
|
288 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
289 |
WHERE album > 0
|
290 |
$non_zero
|
291 |
-
$non_private
|
292 |
-
$non_void
|
293 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
294 |
LIMIT %d";
|
295 |
break;
|
@@ -300,6 +282,8 @@ class TopTenWidget extends WP_Widget {
|
|
300 |
}
|
301 |
}
|
302 |
|
|
|
|
|
303 |
$widget_content = "\n".'<!-- WPPA+ TopTen Widget start -->';
|
304 |
$maxw = wppa_opt( 'topten_size' );
|
305 |
$maxh = $maxw;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
+
* Version 8.2.04.005
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
116 |
$album = str_replace( '.', ',', $albenum );
|
117 |
}
|
118 |
|
119 |
+
$album = implode( ',', wppa_strip_void_albums( explode( ',', $album ) ) );
|
120 |
|
121 |
// Doit
|
122 |
if ( $medalsonly ) {
|
161 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
162 |
WHERE album IN ( aaaa )
|
163 |
$non_zero
|
|
|
164 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
165 |
LIMIT %d";
|
166 |
break;
|
169 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
170 |
WHERE album IN ( aaaa )
|
171 |
$non_zero
|
|
|
172 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
173 |
LIMIT %d";
|
174 |
break;
|
177 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
178 |
WHERE album IN ( aaaa )
|
179 |
$non_zero
|
|
|
180 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
181 |
LIMIT %d";
|
182 |
break;
|
186 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
187 |
WHERE album IN ( aaa )
|
188 |
$non_zero
|
|
|
189 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
190 |
LIMIT %d";
|
191 |
break;
|
197 |
// No album specified
|
198 |
else {
|
199 |
|
|
|
|
|
200 |
if ( $medalsonly ) {
|
201 |
switch ( $instance['sortby'] ) {
|
202 |
|
205 |
WHERE album > 0
|
206 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
207 |
$non_zero
|
|
|
208 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
209 |
LIMIT %d";
|
210 |
break;
|
214 |
WHERE album > 0
|
215 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
216 |
$non_zero
|
|
|
217 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
218 |
LIMIT %d";
|
219 |
break;
|
223 |
WHERE album > 0
|
224 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
225 |
$non_zero
|
|
|
226 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
227 |
LIMIT %d";
|
228 |
break;
|
233 |
WHERE album > 0
|
234 |
AND status IN ( 'gold', 'silver', 'bronze' )
|
235 |
$non_zero
|
|
|
236 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
237 |
LIMIT %d";
|
238 |
break;
|
247 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
248 |
WHERE album > 0
|
249 |
$non_zero
|
|
|
|
|
250 |
ORDER BY rating_count DESC, mean_rating DESC, views DESC
|
251 |
LIMIT %d";
|
252 |
break;
|
255 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
256 |
WHERE album > 0
|
257 |
$non_zero
|
|
|
|
|
258 |
ORDER BY views DESC, mean_rating DESC, rating_count DESC
|
259 |
LIMIT %d";
|
260 |
break;
|
263 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
264 |
WHERE album > 0
|
265 |
$non_zero
|
|
|
|
|
266 |
ORDER BY mean_rating DESC, rating_count DESC, views DESC
|
267 |
LIMIT %d";
|
268 |
break;
|
272 |
$query = "SELECT * FROM $wpdb->wppa_photos
|
273 |
WHERE album > 0
|
274 |
$non_zero
|
|
|
|
|
275 |
ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
|
276 |
LIMIT %d";
|
277 |
break;
|
282 |
}
|
283 |
}
|
284 |
|
285 |
+
$thumbs = wppa_strip_void_photos( $thumbs );
|
286 |
+
|
287 |
$widget_content = "\n".'<!-- WPPA+ TopTen Widget start -->';
|
288 |
$maxw = wppa_opt( 'topten_size' );
|
289 |
$maxh = $maxw;
|
wppa-utils.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
-
* Version 8.2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -25,13 +25,13 @@ function wppa_get_thumb_url( $id, $fix_poster_ext = true, $system = 'flat', $x =
|
|
25 |
global $blog_id;
|
26 |
|
27 |
// Does photo exist?
|
28 |
-
$thumb =
|
29 |
if ( ! $thumb ) return '';
|
30 |
|
31 |
// Set owner if required
|
32 |
wppa_set_owner_to_name( $id );
|
33 |
|
34 |
-
$thumb =
|
35 |
|
36 |
// If thumbratio not default, do not use the cdn version
|
37 |
if ( wppa_opt( 'thumb_aspect' ) != '0:0:none' ) {
|
@@ -114,7 +114,7 @@ function wppa_bump_thumb_rev() {
|
|
114 |
// get path of thumb
|
115 |
function wppa_get_thumb_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
|
116 |
|
117 |
-
$thumb =
|
118 |
if ( ! $thumb ) {
|
119 |
return false;
|
120 |
}
|
@@ -142,14 +142,14 @@ global $blog_id;
|
|
142 |
global $wppa_supported_stereo_types;
|
143 |
|
144 |
// Does photo exist?
|
145 |
-
$thumb =
|
146 |
if ( ! $thumb ) return '';
|
147 |
|
148 |
// Set owner if required
|
149 |
wppa_set_owner_to_name( $id );
|
150 |
|
151 |
// Must re-get cached thumb
|
152 |
-
$thumb =
|
153 |
|
154 |
// Feed returns thumb
|
155 |
if ( is_feed() ) {
|
@@ -250,7 +250,7 @@ function wppa_bump_dlcount( $id ) {
|
|
250 |
// get path of a full sized image
|
251 |
function wppa_get_photo_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
|
252 |
|
253 |
-
$thumb =
|
254 |
if ( ! $thumb ) {
|
255 |
return false;
|
256 |
}
|
@@ -380,14 +380,14 @@ function wppa_html( $str ) {
|
|
380 |
function wppa_get_album_id_by_photo_id( $id ) {
|
381 |
|
382 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_album_id_by_photo_id('.$id.')', 'red');
|
383 |
-
$thumb =
|
384 |
return $thumb['album'];
|
385 |
}
|
386 |
|
387 |
function wppa_get_rating_count_by_id($id) {
|
388 |
|
389 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_rating_count_by_id('.$id.')', 'red');
|
390 |
-
$thumb =
|
391 |
return $thumb['rating_count'];
|
392 |
}
|
393 |
|
@@ -395,7 +395,7 @@ function wppa_get_rating_by_id($id, $opt = '') {
|
|
395 |
global $wpdb;
|
396 |
|
397 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_rating_by_id('.$id.', '.$opt.')', 'red');
|
398 |
-
$thumb =
|
399 |
$rating = $thumb['mean_rating'];
|
400 |
if ( $rating ) {
|
401 |
$i = wppa_opt( 'rating_prec' );
|
@@ -967,7 +967,7 @@ global $wpdb;
|
|
967 |
function wppa_get_imgalt( $id, $lb = false ) {
|
968 |
|
969 |
// Get photo data
|
970 |
-
$thumb =
|
971 |
|
972 |
// Get raw image alt data
|
973 |
switch ( wppa_opt( 'alt_type' ) ) {
|
@@ -1883,7 +1883,7 @@ function wppa_get_the_id() {
|
|
1883 |
function wppa_get_artmonkey_size_a( $photo ) {
|
1884 |
global $wpdb;
|
1885 |
|
1886 |
-
$data =
|
1887 |
if ( $data ) {
|
1888 |
if ( wppa_switch( 'artmonkey_use_source' ) ) {
|
1889 |
if ( is_file( wppa_get_source_path( $photo ) ) ) {
|
@@ -1942,7 +1942,7 @@ global $wpdb;
|
|
1942 |
if ( ! $photo ) return '0'; // No photo id, no page
|
1943 |
if ( ! wppa_is_int( $photo ) ) return '0'; // $photo not numeric
|
1944 |
|
1945 |
-
$thumb =
|
1946 |
|
1947 |
// Page exists ?
|
1948 |
if ( wppa_page_exists( $thumb['page_id'] ) ) {
|
@@ -1966,7 +1966,7 @@ function wppa_remove_the_auto_page( $photo ) {
|
|
1966 |
if ( ! $photo ) return '0'; // No photo id, no page
|
1967 |
if ( ! wppa_is_int( $photo ) ) return '0'; // $photo not numeric
|
1968 |
|
1969 |
-
$thumb =
|
1970 |
|
1971 |
// Page exists ?
|
1972 |
if ( wppa_page_exists( $thumb['page_id'] ) ) {
|
@@ -2016,7 +2016,7 @@ global $wpdb;
|
|
2016 |
|
2017 |
function wppa_get_photo_owner( $id ) {
|
2018 |
|
2019 |
-
$thumb =
|
2020 |
return $thumb['owner'];
|
2021 |
}
|
2022 |
|
@@ -2071,7 +2071,7 @@ global $wppa_supported_photo_extensions;
|
|
2071 |
}
|
2072 |
$supext = array_merge( $wppa_supported_photo_extensions, $temp );
|
2073 |
|
2074 |
-
$thumb =
|
2075 |
$album = $thumb['album'];
|
2076 |
|
2077 |
// Trashed?
|
@@ -2241,8 +2241,8 @@ global $wpdb;
|
|
2241 |
return;
|
2242 |
}
|
2243 |
|
2244 |
-
|
2245 |
-
$thumb =
|
2246 |
|
2247 |
$method = wppa_opt( 'newphoto_name_method' );
|
2248 |
$name = $thumb['filename']; // The default default
|
@@ -2302,7 +2302,7 @@ global $wpdb;
|
|
2302 |
// SET name = %s
|
2303 |
// WHERE id = %d", $name, $id ) );
|
2304 |
|
2305 |
-
|
2306 |
}
|
2307 |
if ( ! wppa_switch( 'save_iptc') ) { // He doesn't want to keep the iptc data, so...
|
2308 |
$wpdb->query($wpdb->prepare( "DELETE FROM $wpdb->wppa_iptc
|
@@ -2316,7 +2316,7 @@ global $wpdb;
|
|
2316 |
function wppa_set_default_tags( $id ) {
|
2317 |
global $wpdb;
|
2318 |
|
2319 |
-
$thumb =
|
2320 |
$album = wppa_cache_album( $thumb['album'] );
|
2321 |
$tags = wppa_sanitize_tags( str_replace( array( '\'', '"'), ',', wppa_filter_iptc( wppa_filter_exif( $album['default_tags'], $id ), $id ) ) );
|
2322 |
|
@@ -2333,7 +2333,7 @@ global $wpdb;
|
|
2333 |
if ( $tags ) {
|
2334 |
wppa_update_photo( array( 'id' => $id, 'tags' => $tags ) );
|
2335 |
wppa_clear_taglist();
|
2336 |
-
|
2337 |
}
|
2338 |
}
|
2339 |
|
@@ -2373,7 +2373,7 @@ function wppa_set_default_custom( $id, $force = false ) {
|
|
2373 |
function wppa_test_for_medal( $id ) {
|
2374 |
global $wpdb;
|
2375 |
|
2376 |
-
$thumb =
|
2377 |
$status = $thumb['status'];
|
2378 |
|
2379 |
if ( wppa_opt( 'medal_bronze_when' ) || wppa_opt( 'medal_silver_when' ) || wppa_opt( 'medal_gold_when' ) ) {
|
@@ -2430,19 +2430,21 @@ global $wpdb;
|
|
2430 |
|
2431 |
// Phase 2, get the ratings of the period
|
2432 |
// find $ratings, ordered by photo id
|
2433 |
-
$void = wppa_get_void_pids();
|
2434 |
-
if ( count ( $void ) ) {
|
2435 |
-
$void_clause = " AND photo NOT IN (" . implode( ',', $void ) . ") ";
|
2436 |
-
}
|
2437 |
-
else {
|
2438 |
-
$void_clause = "";
|
2439 |
-
}
|
2440 |
$ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
|
2441 |
WHERE timestamp >= %s
|
2442 |
AND timestamp < %s" .
|
2443 |
$void_clause .
|
2444 |
"ORDER BY photo", $start, $end ), ARRAY_A );
|
2445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2446 |
// Phase 3, set up an array with data we need
|
2447 |
// There are two methods: photo oriented and owner oriented, depending on
|
2448 |
|
@@ -2465,7 +2467,7 @@ global $wpdb;
|
|
2465 |
}
|
2466 |
|
2467 |
foreach ( array_keys( $data ) as $key ) {
|
2468 |
-
$thumb =
|
2469 |
$data[$key]['meanrating'] = $data[$key]['totvalue'] / $data[$key]['ratingcount'];
|
2470 |
$user = wppa_get_user_by( 'login', sanitize_user( $thumb['owner'] ) );
|
2471 |
if ( $user ) {
|
@@ -3010,8 +3012,8 @@ global $wpdb;
|
|
3010 |
}
|
3011 |
}
|
3012 |
|
3013 |
-
// Remove void
|
3014 |
-
$result =
|
3015 |
|
3016 |
// Clip to max count
|
3017 |
if ( count( $result ) > $max_count ) {
|
@@ -3021,35 +3023,6 @@ global $wpdb;
|
|
3021 |
return $result;
|
3022 |
}
|
3023 |
|
3024 |
-
// Get array of void album ids
|
3025 |
-
function wppa_get_void_aids() {
|
3026 |
-
global $wpdb;
|
3027 |
-
|
3028 |
-
// Find voided albums
|
3029 |
-
$void_albs = array();
|
3030 |
-
if ( ! wppa_user_is( 'administrator' ) ) {
|
3031 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
|
3032 |
-
}
|
3033 |
-
if ( ! is_user_logged_in() ) {
|
3034 |
-
$void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
|
3035 |
-
}
|
3036 |
-
|
3037 |
-
return $void_albs;
|
3038 |
-
}
|
3039 |
-
|
3040 |
-
// Get array of photo ids that reside in void albums
|
3041 |
-
function wppa_get_void_pids() {
|
3042 |
-
global $wpdb;
|
3043 |
-
|
3044 |
-
$void_albs = wppa_get_void_aids();
|
3045 |
-
if ( ! count( $void_albs ) ) {
|
3046 |
-
return array();
|
3047 |
-
}
|
3048 |
-
|
3049 |
-
$void_photos = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album IN (" . implode( ',', $void_albs ) . ")" );
|
3050 |
-
return $void_photos;
|
3051 |
-
}
|
3052 |
-
|
3053 |
// Filter for Plugin CM Tooltip Glossary
|
3054 |
function wppa_filter_glossary( $desc ) {
|
3055 |
static $wppa_cmt;
|
@@ -3389,7 +3362,7 @@ function wppa_is_virtual() {
|
|
3389 |
|
3390 |
function wppa_too_old_for_cloud( $id ) {
|
3391 |
|
3392 |
-
$thumb =
|
3393 |
|
3394 |
$is_old = wppa_cdn( 'admin' ) && wppa_opt( 'max_cloud_life' ) && ( time() > ( $thumb['timestamp'] + wppa_opt( 'max_cloud_life' ) ) );
|
3395 |
|
@@ -3462,7 +3435,7 @@ global $wpdb;
|
|
3462 |
}
|
3463 |
|
3464 |
// Find the photo data
|
3465 |
-
$data =
|
3466 |
$photo_file = wppa_fix_poster_ext( $data['filename'], $id );
|
3467 |
|
3468 |
// Open zip
|
@@ -3533,7 +3506,7 @@ static $usercache;
|
|
3533 |
if ( wppa_switch( 'owner_to_name' ) ) {
|
3534 |
|
3535 |
// Get photo data.
|
3536 |
-
$p =
|
3537 |
|
3538 |
// Find user of whose display name equals photoname
|
3539 |
if ( isset( $usercache[$p['name']] ) ) {
|
@@ -3552,7 +3525,7 @@ static $usercache;
|
|
3552 |
|
3553 |
if ( $p['owner'] != $user ) {
|
3554 |
wppa_update_photo( array( 'id' => $id, 'owner' => $user ) );
|
3555 |
-
|
3556 |
return true;
|
3557 |
}
|
3558 |
else {
|
@@ -4846,6 +4819,11 @@ function wppa_is_pdf( $id ) {
|
|
4846 |
|
4847 |
function wppa_get_pdf_html( $id ) {
|
4848 |
|
|
|
|
|
|
|
|
|
|
|
4849 |
if ( wppa_is_mobile() || ! wppa_is_pdf( $id ) ) {
|
4850 |
$result = '';
|
4851 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
25 |
global $blog_id;
|
26 |
|
27 |
// Does photo exist?
|
28 |
+
$thumb = wppa_cache_photo( $id );
|
29 |
if ( ! $thumb ) return '';
|
30 |
|
31 |
// Set owner if required
|
32 |
wppa_set_owner_to_name( $id );
|
33 |
|
34 |
+
$thumb = wppa_cache_photo( $id );
|
35 |
|
36 |
// If thumbratio not default, do not use the cdn version
|
37 |
if ( wppa_opt( 'thumb_aspect' ) != '0:0:none' ) {
|
114 |
// get path of thumb
|
115 |
function wppa_get_thumb_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
|
116 |
|
117 |
+
$thumb = wppa_cache_photo( $id );
|
118 |
if ( ! $thumb ) {
|
119 |
return false;
|
120 |
}
|
142 |
global $wppa_supported_stereo_types;
|
143 |
|
144 |
// Does photo exist?
|
145 |
+
$thumb = wppa_cache_photo( $id );
|
146 |
if ( ! $thumb ) return '';
|
147 |
|
148 |
// Set owner if required
|
149 |
wppa_set_owner_to_name( $id );
|
150 |
|
151 |
// Must re-get cached thumb
|
152 |
+
$thumb = wppa_cache_photo( $id );
|
153 |
|
154 |
// Feed returns thumb
|
155 |
if ( is_feed() ) {
|
250 |
// get path of a full sized image
|
251 |
function wppa_get_photo_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
|
252 |
|
253 |
+
$thumb = wppa_cache_photo( $id );
|
254 |
if ( ! $thumb ) {
|
255 |
return false;
|
256 |
}
|
380 |
function wppa_get_album_id_by_photo_id( $id ) {
|
381 |
|
382 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_album_id_by_photo_id('.$id.')', 'red');
|
383 |
+
$thumb = wppa_cache_photo($id);
|
384 |
return $thumb['album'];
|
385 |
}
|
386 |
|
387 |
function wppa_get_rating_count_by_id($id) {
|
388 |
|
389 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_rating_count_by_id('.$id.')', 'red');
|
390 |
+
$thumb = wppa_cache_photo($id);
|
391 |
return $thumb['rating_count'];
|
392 |
}
|
393 |
|
395 |
global $wpdb;
|
396 |
|
397 |
if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_rating_by_id('.$id.', '.$opt.')', 'red');
|
398 |
+
$thumb = wppa_cache_photo( $id );
|
399 |
$rating = $thumb['mean_rating'];
|
400 |
if ( $rating ) {
|
401 |
$i = wppa_opt( 'rating_prec' );
|
967 |
function wppa_get_imgalt( $id, $lb = false ) {
|
968 |
|
969 |
// Get photo data
|
970 |
+
$thumb = wppa_cache_photo( $id );
|
971 |
|
972 |
// Get raw image alt data
|
973 |
switch ( wppa_opt( 'alt_type' ) ) {
|
1883 |
function wppa_get_artmonkey_size_a( $photo ) {
|
1884 |
global $wpdb;
|
1885 |
|
1886 |
+
$data = wppa_cache_photo( $photo );
|
1887 |
if ( $data ) {
|
1888 |
if ( wppa_switch( 'artmonkey_use_source' ) ) {
|
1889 |
if ( is_file( wppa_get_source_path( $photo ) ) ) {
|
1942 |
if ( ! $photo ) return '0'; // No photo id, no page
|
1943 |
if ( ! wppa_is_int( $photo ) ) return '0'; // $photo not numeric
|
1944 |
|
1945 |
+
$thumb = wppa_cache_photo( $photo ); // Get photo info
|
1946 |
|
1947 |
// Page exists ?
|
1948 |
if ( wppa_page_exists( $thumb['page_id'] ) ) {
|
1966 |
if ( ! $photo ) return '0'; // No photo id, no page
|
1967 |
if ( ! wppa_is_int( $photo ) ) return '0'; // $photo not numeric
|
1968 |
|
1969 |
+
$thumb = wppa_cache_photo( $photo ); // Get photo info
|
1970 |
|
1971 |
// Page exists ?
|
1972 |
if ( wppa_page_exists( $thumb['page_id'] ) ) {
|
2016 |
|
2017 |
function wppa_get_photo_owner( $id ) {
|
2018 |
|
2019 |
+
$thumb = wppa_cache_photo( $id );
|
2020 |
return $thumb['owner'];
|
2021 |
}
|
2022 |
|
2071 |
}
|
2072 |
$supext = array_merge( $wppa_supported_photo_extensions, $temp );
|
2073 |
|
2074 |
+
$thumb = wppa_cache_photo( $id );
|
2075 |
$album = $thumb['album'];
|
2076 |
|
2077 |
// Trashed?
|
2241 |
return;
|
2242 |
}
|
2243 |
|
2244 |
+
wppa_cache_photo( 'invalidate', $id );
|
2245 |
+
$thumb = wppa_cache_photo( $id );
|
2246 |
|
2247 |
$method = wppa_opt( 'newphoto_name_method' );
|
2248 |
$name = $thumb['filename']; // The default default
|
2302 |
// SET name = %s
|
2303 |
// WHERE id = %d", $name, $id ) );
|
2304 |
|
2305 |
+
wppa_cache_photo( 'invalidate', $id ); // Invalidate cache
|
2306 |
}
|
2307 |
if ( ! wppa_switch( 'save_iptc') ) { // He doesn't want to keep the iptc data, so...
|
2308 |
$wpdb->query($wpdb->prepare( "DELETE FROM $wpdb->wppa_iptc
|
2316 |
function wppa_set_default_tags( $id ) {
|
2317 |
global $wpdb;
|
2318 |
|
2319 |
+
$thumb = wppa_cache_photo( $id );
|
2320 |
$album = wppa_cache_album( $thumb['album'] );
|
2321 |
$tags = wppa_sanitize_tags( str_replace( array( '\'', '"'), ',', wppa_filter_iptc( wppa_filter_exif( $album['default_tags'], $id ), $id ) ) );
|
2322 |
|
2333 |
if ( $tags ) {
|
2334 |
wppa_update_photo( array( 'id' => $id, 'tags' => $tags ) );
|
2335 |
wppa_clear_taglist();
|
2336 |
+
wppa_cache_photo( 'invalidate', $id );
|
2337 |
}
|
2338 |
}
|
2339 |
|
2373 |
function wppa_test_for_medal( $id ) {
|
2374 |
global $wpdb;
|
2375 |
|
2376 |
+
$thumb = wppa_cache_photo( $id );
|
2377 |
$status = $thumb['status'];
|
2378 |
|
2379 |
if ( wppa_opt( 'medal_bronze_when' ) || wppa_opt( 'medal_silver_when' ) || wppa_opt( 'medal_gold_when' ) ) {
|
2430 |
|
2431 |
// Phase 2, get the ratings of the period
|
2432 |
// find $ratings, ordered by photo id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2433 |
$ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
|
2434 |
WHERE timestamp >= %s
|
2435 |
AND timestamp < %s" .
|
2436 |
$void_clause .
|
2437 |
"ORDER BY photo", $start, $end ), ARRAY_A );
|
2438 |
|
2439 |
+
// Strip the ratings of non visible items
|
2440 |
+
$new_ratings = array();
|
2441 |
+
foreach( $ratings as $rating ) {
|
2442 |
+
if ( wppa_is_photo_visible( $rating['photo'] ) ) {
|
2443 |
+
$new_ratings[] = $rating;
|
2444 |
+
}
|
2445 |
+
}
|
2446 |
+
$ratings = $new_ratings;
|
2447 |
+
|
2448 |
// Phase 3, set up an array with data we need
|
2449 |
// There are two methods: photo oriented and owner oriented, depending on
|
2450 |
|
2467 |
}
|
2468 |
|
2469 |
foreach ( array_keys( $data ) as $key ) {
|
2470 |
+
$thumb = wppa_cache_photo( $key );
|
2471 |
$data[$key]['meanrating'] = $data[$key]['totvalue'] / $data[$key]['ratingcount'];
|
2472 |
$user = wppa_get_user_by( 'login', sanitize_user( $thumb['owner'] ) );
|
2473 |
if ( $user ) {
|
3012 |
}
|
3013 |
}
|
3014 |
|
3015 |
+
// Remove void photo items
|
3016 |
+
$result = wppa_strip_void_photos( $result );
|
3017 |
|
3018 |
// Clip to max count
|
3019 |
if ( count( $result ) > $max_count ) {
|
3023 |
return $result;
|
3024 |
}
|
3025 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3026 |
// Filter for Plugin CM Tooltip Glossary
|
3027 |
function wppa_filter_glossary( $desc ) {
|
3028 |
static $wppa_cmt;
|
3362 |
|
3363 |
function wppa_too_old_for_cloud( $id ) {
|
3364 |
|
3365 |
+
$thumb = wppa_cache_photo( $id );
|
3366 |
|
3367 |
$is_old = wppa_cdn( 'admin' ) && wppa_opt( 'max_cloud_life' ) && ( time() > ( $thumb['timestamp'] + wppa_opt( 'max_cloud_life' ) ) );
|
3368 |
|
3435 |
}
|
3436 |
|
3437 |
// Find the photo data
|
3438 |
+
$data = wppa_cache_photo( $id );
|
3439 |
$photo_file = wppa_fix_poster_ext( $data['filename'], $id );
|
3440 |
|
3441 |
// Open zip
|
3506 |
if ( wppa_switch( 'owner_to_name' ) ) {
|
3507 |
|
3508 |
// Get photo data.
|
3509 |
+
$p = wppa_cache_photo( $id );
|
3510 |
|
3511 |
// Find user of whose display name equals photoname
|
3512 |
if ( isset( $usercache[$p['name']] ) ) {
|
3525 |
|
3526 |
if ( $p['owner'] != $user ) {
|
3527 |
wppa_update_photo( array( 'id' => $id, 'owner' => $user ) );
|
3528 |
+
wppa_cache_photo( 'invalidate', $id );
|
3529 |
return true;
|
3530 |
}
|
3531 |
else {
|
4819 |
|
4820 |
function wppa_get_pdf_html( $id ) {
|
4821 |
|
4822 |
+
// May the current user see this document?
|
4823 |
+
if ( ! wppa_is_photo_visible( $id ) ) {
|
4824 |
+
$result = '';
|
4825 |
+
}
|
4826 |
+
|
4827 |
if ( wppa_is_mobile() || ! wppa_is_pdf( $id ) ) {
|
4828 |
$result = '';
|
4829 |
}
|
wppa-video.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all video routines
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -64,6 +64,11 @@ function wppa_get_video_html( $args ) {
|
|
64 |
|
65 |
// No id? no go
|
66 |
if ( ! $id ) return '';
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
// Not a video? no go
|
69 |
if ( ! wppa_is_video( $id ) ) return '';
|
@@ -226,7 +231,7 @@ global $wppa_supported_video_extensions;
|
|
226 |
|
227 |
function wppa_get_videox( $id, $where = 'prod' ) {
|
228 |
|
229 |
-
$thumb =
|
230 |
|
231 |
if ( $where == 'prod' && $thumb['videox'] ) {
|
232 |
return $thumb['videox'];
|
@@ -245,7 +250,7 @@ function wppa_get_videox( $id, $where = 'prod' ) {
|
|
245 |
return strval( intval( $thumb['videox'] ) );
|
246 |
}
|
247 |
|
248 |
-
$thumb =
|
249 |
if ( $thumb['videox'] ) {
|
250 |
$result = $thumb['videox'];
|
251 |
}
|
@@ -257,7 +262,7 @@ function wppa_get_videox( $id, $where = 'prod' ) {
|
|
257 |
|
258 |
function wppa_get_videoy( $id, $where = 'prod' ) {
|
259 |
|
260 |
-
$thumb =
|
261 |
|
262 |
if ( $where == 'prod' && $thumb['videoy'] ) {
|
263 |
return $thumb['videoy'];
|
@@ -276,7 +281,7 @@ function wppa_get_videoy( $id, $where = 'prod' ) {
|
|
276 |
return strval( intval( $thumb['videoy'] ) );
|
277 |
}
|
278 |
|
279 |
-
$thumb =
|
280 |
if ( $thumb['videoy'] ) {
|
281 |
$result = $thumb['videoy'];
|
282 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all video routines
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
64 |
|
65 |
// No id? no go
|
66 |
if ( ! $id ) return '';
|
67 |
+
|
68 |
+
// May the current user see this video?
|
69 |
+
if ( ! wppa_is_photo_visible( $id ) ) {
|
70 |
+
return '';
|
71 |
+
}
|
72 |
|
73 |
// Not a video? no go
|
74 |
if ( ! wppa_is_video( $id ) ) return '';
|
231 |
|
232 |
function wppa_get_videox( $id, $where = 'prod' ) {
|
233 |
|
234 |
+
$thumb = wppa_cache_photo( $id );
|
235 |
|
236 |
if ( $where == 'prod' && $thumb['videox'] ) {
|
237 |
return $thumb['videox'];
|
250 |
return strval( intval( $thumb['videox'] ) );
|
251 |
}
|
252 |
|
253 |
+
$thumb = wppa_cache_photo( $id );
|
254 |
if ( $thumb['videox'] ) {
|
255 |
$result = $thumb['videox'];
|
256 |
}
|
262 |
|
263 |
function wppa_get_videoy( $id, $where = 'prod' ) {
|
264 |
|
265 |
+
$thumb = wppa_cache_photo( $id );
|
266 |
|
267 |
if ( $where == 'prod' && $thumb['videoy'] ) {
|
268 |
return $thumb['videoy'];
|
281 |
return strval( intval( $thumb['videoy'] ) );
|
282 |
}
|
283 |
|
284 |
+
$thumb = wppa_cache_photo( $id );
|
285 |
if ( $thumb['videoy'] ) {
|
286 |
$result = $thumb['videoy'];
|
287 |
}
|
wppa-widget-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-widget-functions.php
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
-
/* Version 8.2.
|
6 |
/*
|
7 |
*/
|
8 |
|
@@ -162,12 +162,7 @@ global $wpdb;
|
|
162 |
wppa_dbg_msg( 'Potd query: '.$query );
|
163 |
|
164 |
// Strip void photos
|
165 |
-
$
|
166 |
-
if ( count ( $void ) ) foreach( array_keys( $photos ) as $key ) {
|
167 |
-
if ( in_array( $photos[$key]['id'], $void ) ) {
|
168 |
-
unset( $photos[$key] );
|
169 |
-
}
|
170 |
-
}
|
171 |
}
|
172 |
else {
|
173 |
$photos = array();
|
2 |
/* wppa-widget-functions.php
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
+
/* Version 8.2.04.005
|
6 |
/*
|
7 |
*/
|
8 |
|
162 |
wppa_dbg_msg( 'Potd query: '.$query );
|
163 |
|
164 |
// Strip void photos
|
165 |
+
$photos = wppa_strip_void_photos( $photos );
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
else {
|
168 |
$photos = array();
|
wppa-wpdb-insert.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level wpdb routines that add new records
|
6 |
-
* Version 8.2.04.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -313,7 +313,7 @@ global $wpdb;
|
|
313 |
'indexdtm' => '',
|
314 |
'panorama' => '0',
|
315 |
'angle' => '0',
|
316 |
-
'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : '' ),
|
317 |
'dlcount' => '0',
|
318 |
'thumblock' => '0',
|
319 |
'duration' => '',
|
@@ -467,7 +467,7 @@ global $wpdb;
|
|
467 |
'wmfile' => '',
|
468 |
'wmpos' => '',
|
469 |
'indexdtm' => '',
|
470 |
-
'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : __( 'New Album', 'wp-photo-album-plus' ) ),
|
471 |
'zoomable' => '',
|
472 |
'displayopts' => '0,0,0,0',
|
473 |
'upload_limit_tree' => '0',
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level wpdb routines that add new records
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
313 |
'indexdtm' => '',
|
314 |
'panorama' => '0',
|
315 |
'angle' => '0',
|
316 |
+
'sname' => strtolower( wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : '' ) ),
|
317 |
'dlcount' => '0',
|
318 |
'thumblock' => '0',
|
319 |
'duration' => '',
|
467 |
'wmfile' => '',
|
468 |
'wmpos' => '',
|
469 |
'indexdtm' => '',
|
470 |
+
'sname' => strtolower( wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : __( 'New Album', 'wp-photo-album-plus' ) ) ),
|
471 |
'zoomable' => '',
|
472 |
'displayopts' => '0,0,0,0',
|
473 |
'upload_limit_tree' => '0',
|
wppa-wpdb-update.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level wpdb routines that update records
|
6 |
-
* Version 8.2.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -27,7 +27,7 @@ global $wpdb;
|
|
27 |
|
28 |
// If name update, also update sname
|
29 |
if ( isset( $args['name'] ) ) {
|
30 |
-
$args['sname'] = wppa_sanitize_album_photo_name( wppa_strip_tags( $args['name'] ) );
|
31 |
}
|
32 |
|
33 |
$need_re_index = false;
|
@@ -184,7 +184,7 @@ global $wpdb;
|
|
184 |
}
|
185 |
}
|
186 |
if ( ! isset( $args['id'] ) ) return false;
|
187 |
-
$thumb =
|
188 |
if ( ! $thumb ) return false;
|
189 |
$id = $args['id'];
|
190 |
|
@@ -195,7 +195,7 @@ global $wpdb;
|
|
195 |
|
196 |
// If name update, also update sname
|
197 |
if ( isset( $args['name'] ) ) {
|
198 |
-
$args['sname'] = wppa_sanitize_album_photo_name( wppa_strip_tags( $args['name'] ) );
|
199 |
}
|
200 |
|
201 |
// Init switches
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level wpdb routines that update records
|
6 |
+
* Version 8.2.04.005
|
7 |
*
|
8 |
*/
|
9 |
|
27 |
|
28 |
// If name update, also update sname
|
29 |
if ( isset( $args['name'] ) ) {
|
30 |
+
$args['sname'] = strtolower( wppa_sanitize_album_photo_name( wppa_strip_tags( $args['name'] ) ) );
|
31 |
}
|
32 |
|
33 |
$need_re_index = false;
|
184 |
}
|
185 |
}
|
186 |
if ( ! isset( $args['id'] ) ) return false;
|
187 |
+
$thumb = wppa_cache_photo( $args['id'] );
|
188 |
if ( ! $thumb ) return false;
|
189 |
$id = $args['id'];
|
190 |
|
195 |
|
196 |
// If name update, also update sname
|
197 |
if ( isset( $args['name'] ) ) {
|
198 |
+
$args['sname'] = strtolower( wppa_sanitize_album_photo_name( wppa_strip_tags( $args['name'] ) ) );
|
199 |
}
|
200 |
|
201 |
// Init switches
|
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.2.04.
|
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.2.04.
|
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.2.04.005
|
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.2.04.005'; // WPPA software version
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|