WP Photo Album Plus - Version 7.6.07.001

Version Description

= 7.6.06 =

  • Security release.
Download this release

Release Info

Developer opajaap
Plugin Icon wp plugin WP Photo Album Plus
Version 7.6.07.001
Comparing to
See all releases

Code changes from version 7.6.06.001 to 7.6.07.001

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
3
  = 7.6.06 =
4
 
5
  * Fixed Cloudinary interface.
@@ -10,7 +15,7 @@ WP Photo Album Plus Changelog
10
  * Changes for compatibility with PHP 8
11
  * Changes for compatibility with plugin Tabby
12
  * Portrait only sidebar slideshows stopped working. Fixed.
13
- * New shortcode type: [wppa type="lasupdate"] with optional attribute album="id", where id is the album id.
14
  Prints the timestamp of the most recently uploaded item in the supplied album, or systemwide in the format as specified on the wp general settings page.
15
 
16
  = 7.6.04 =
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.6.07 =
4
+
5
+ * Speeded up by caching the list of sub(sub...)albums of any album.
6
+ This reduces the number of db queries in certain circumstances e.g. when the coverimage selection method is set to random or most recent from subalbums.
7
+
8
  = 7.6.06 =
9
 
10
  * Fixed Cloudinary interface.
15
  * Changes for compatibility with PHP 8
16
  * Changes for compatibility with plugin Tabby
17
  * Portrait only sidebar slideshows stopped working. Fixed.
18
+ * New shortcode type: [wppa type="lasupdate"] with optional attribute album="id", where id is the album id.
19
  Prints the timestamp of the most recently uploaded item in the supplied album, or systemwide in the format as specified on the wp general settings page.
20
 
21
  = 7.6.04 =
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, f
5
  Requires at least: 3.9
6
  Tested up to: 5.6
7
  Requires PHP: 5.5
8
- Stable tag: 7.6.05.009
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
5
  Requires at least: 3.9
6
  Tested up to: 5.6
7
  Requires PHP: 5.5
8
+ Stable tag: 7.6.06.001
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 7.6.05.009
6
  *
7
  */
8
 
@@ -1691,7 +1691,9 @@ global $wppa;
1691
  $value = '-1';
1692
  }
1693
  wppa_invalidate_treecounts( $album ); // Myself and my parents
 
1694
  wppa_invalidate_treecounts( $value ); // My new parent
 
1695
  break;
1696
  case 'p_order_by':
1697
  $itemname = __( 'Photo order' , 'wp-photo-album-plus');
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 7.6.07.001
6
  *
7
  */
8
 
1691
  $value = '-1';
1692
  }
1693
  wppa_invalidate_treecounts( $album ); // Myself and my parents
1694
+ wppa_childlist_remove( $album );
1695
  wppa_invalidate_treecounts( $value ); // My new parent
1696
+ wppa_childlist_remove( $value );
1697
  break;
1698
  case 'p_order_by':
1699
  $itemname = __( 'Photo order' , 'wp-photo-album-plus');
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 7.6.05.003
7
  *
8
  */
9
 
@@ -232,6 +232,7 @@ global $wppa_revno;
232
  else {
233
  wppa_set_last_album( $id );
234
  wppa_invalidate_treecounts( $id );
 
235
  wppa_index_add( 'album', $id );
236
  if ( isset( $_REQUEST['is_sibling_of'] ) && is_numeric( $_REQUEST['is_sibling_of'] ) ) {
237
  $sib_id = strval( intval( $_REQUEST['is_sibling_of'] ) );
@@ -2791,6 +2792,7 @@ global $wpdb;
2791
  wppa_index_remove( 'album', $id );
2792
  wppa_clear_catlist();
2793
  wppa_clear_cache();
 
2794
 
2795
  $msg = __( 'Album Deleted.' , 'wp-photo-album-plus');
2796
  if ( wppa( 'ajax' ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 7.6.07.001
7
  *
8
  */
9
 
232
  else {
233
  wppa_set_last_album( $id );
234
  wppa_invalidate_treecounts( $id );
235
+ wppa_childlist_remove( $parent );
236
  wppa_index_add( 'album', $id );
237
  if ( isset( $_REQUEST['is_sibling_of'] ) && is_numeric( $_REQUEST['is_sibling_of'] ) ) {
238
  $sib_id = strval( intval( $_REQUEST['is_sibling_of'] ) );
2792
  wppa_index_remove( 'album', $id );
2793
  wppa_clear_catlist();
2794
  wppa_clear_cache();
2795
+ wppa_childlist_remove( $id );
2796
 
2797
  $msg = __( 'Album Deleted.' , 'wp-photo-album-plus');
2798
  if ( wppa( 'ajax' ) ) {
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 7.6.06.001
7
  *
8
  */
9
 
@@ -327,6 +327,7 @@ global $wppa_endtime;
327
  wppa_invalidate_treecounts( $id );
328
  wppa_index_remove( 'album', $id );
329
  wppa_clear_catlist();
 
330
  }
331
  break;
332
 
@@ -857,16 +858,16 @@ global $wppa_endtime;
857
  break;
858
 
859
  case 'wppa_fix_userids':
860
- $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
861
  WHERE photo = %d", $id ), ARRAY_A );
862
  foreach ( $ratings as $rating ) {
863
  $username = $rating['user'];
864
- $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID
865
- FROM $wpdb->users
866
  WHERE user_login = %s", $username ) ); // try login name
867
  if ( ! $userid ) {
868
- $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
869
- FROM $wpdb->users
870
  WHERE display_name = %s", $username ) ); // try display name
871
  if ( count( $usrs ) == 1 ) {
872
  $userid = $usrs[0];
@@ -877,7 +878,7 @@ global $wppa_endtime;
877
  }
878
  // Update
879
  $rid = $rating['id'];
880
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_rating
881
  SET userid = %d WHERE id = %d", $userid, $rid ) );
882
  }
883
 
@@ -885,20 +886,20 @@ global $wppa_endtime;
885
  foreach ( $comments as $comment ) {
886
  $username = $comment['user'];
887
  $useremail = $comment['email'];
888
- $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID
889
- FROM $wpdb->users
890
  WHERE user_login = %s", $username ) ); // try login name
891
  if ( ! $userid ) {
892
- $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
893
- FROM $wpdb->users
894
  WHERE user_email = %s", $useremail ) ); // try email address
895
  if ( count( $usrs ) == 1 ) {
896
  $userid = $usrs[0];
897
  }
898
  }
899
  if ( ! $userid ) {
900
- $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
901
- FROM $wpdb->users
902
  WHERE display_name = %s", $username ) ); // try display name
903
  if ( count( $usrs ) == 1 ) {
904
  $userid = $usrs[0];
@@ -909,7 +910,7 @@ global $wppa_endtime;
909
  }
910
  // Update
911
  $cid = $comment['id'];
912
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_comments
913
  SET userid = %d WHERE id = %d", $userid, $cid ) );
914
  }
915
  break;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 7.6.07.001
7
  *
8
  */
9
 
327
  wppa_invalidate_treecounts( $id );
328
  wppa_index_remove( 'album', $id );
329
  wppa_clear_catlist();
330
+ wppa_childlist_remove( $id );
331
  }
332
  break;
333
 
858
  break;
859
 
860
  case 'wppa_fix_userids':
861
+ $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
862
  WHERE photo = %d", $id ), ARRAY_A );
863
  foreach ( $ratings as $rating ) {
864
  $username = $rating['user'];
865
+ $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID
866
+ FROM $wpdb->users
867
  WHERE user_login = %s", $username ) ); // try login name
868
  if ( ! $userid ) {
869
+ $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
870
+ FROM $wpdb->users
871
  WHERE display_name = %s", $username ) ); // try display name
872
  if ( count( $usrs ) == 1 ) {
873
  $userid = $usrs[0];
878
  }
879
  // Update
880
  $rid = $rating['id'];
881
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_rating
882
  SET userid = %d WHERE id = %d", $userid, $rid ) );
883
  }
884
 
886
  foreach ( $comments as $comment ) {
887
  $username = $comment['user'];
888
  $useremail = $comment['email'];
889
+ $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID
890
+ FROM $wpdb->users
891
  WHERE user_login = %s", $username ) ); // try login name
892
  if ( ! $userid ) {
893
+ $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
894
+ FROM $wpdb->users
895
  WHERE user_email = %s", $useremail ) ); // try email address
896
  if ( count( $usrs ) == 1 ) {
897
  $userid = $usrs[0];
898
  }
899
  }
900
  if ( ! $userid ) {
901
+ $usrs = $wpdb->get_col( $wpdb->prepare( "SELECT ID
902
+ FROM $wpdb->users
903
  WHERE display_name = %s", $username ) ); // try display name
904
  if ( count( $usrs ) == 1 ) {
905
  $userid = $usrs[0];
910
  }
911
  // Update
912
  $cid = $comment['id'];
913
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_comments
914
  SET userid = %d WHERE id = %d", $userid, $cid ) );
915
  }
916
  break;
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.6.04.001
7
  *
8
  */
9
 
@@ -2495,11 +2495,17 @@ function wppa_alb_to_enum_children( $xparents ) {
2495
 
2496
  function _wppa_alb_to_enum_children( $alb ) {
2497
  global $wpdb;
2498
- static $child_cache;
 
 
 
 
 
2499
 
2500
  // Done this one before?
2501
- if ( isset( $child_cache[$alb] ) ) {
2502
- return $child_cache[$alb];
 
2503
  }
2504
 
2505
  // Get the data
@@ -2511,11 +2517,39 @@ static $child_cache;
2511
  $result = trim( $result, '.' );
2512
  }
2513
 
 
 
 
 
 
 
 
2514
  // Store in cache
2515
- $child_cache[$alb] = $result;
 
 
2516
 
2517
  // Return requested data
2518
- return $child_cache[$alb];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2519
  }
2520
 
2521
  function wppa_compress_enum( $enum ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.6.07.001
7
  *
8
  */
9
 
2495
 
2496
  function _wppa_alb_to_enum_children( $alb ) {
2497
  global $wpdb;
2498
+ static $child_list;
2499
+
2500
+ // Init child list
2501
+ if ( ! $child_list ) {
2502
+ $child_list = get_option( 'wppa_child_list', array() );
2503
+ }
2504
 
2505
  // Done this one before?
2506
+ if ( isset( $child_list[$alb] ) ) {
2507
+ // wppa_log('obs','ENUM SEARCHED FOR '.$alb.' FOUND '.$child_list[$alb].' CACHED');
2508
+ return $child_list[$alb];
2509
  }
2510
 
2511
  // Get the data
2517
  $result = trim( $result, '.' );
2518
  }
2519
 
2520
+ // Sequentialize
2521
+ if ( strpos( $result, '.' ) !== false ) {
2522
+ $r = explode( '.', $result );
2523
+ sort( $r );
2524
+ $result = implode( '.', $r );
2525
+ }
2526
+
2527
  // Store in cache
2528
+ $child_list[$alb] = $result;
2529
+ update_option( 'wppa_child_list', $child_list );
2530
+ // wppa_log('obs','ENUM SEARCHED FOR '.$alb.' FOUND '.$result);
2531
 
2532
  // Return requested data
2533
+ return $child_list[$alb];
2534
+ }
2535
+
2536
+ // Remove from childlist
2537
+ function wppa_childlist_remove( $alb ) {
2538
+
2539
+ $any = false;
2540
+
2541
+ $child_list = get_option( 'wppa_child_list', array() );
2542
+ foreach( array_keys( $child_list ) as $key ) {
2543
+ $line = '.'.$child_list[$key].'.';
2544
+ if ( strpos( $line, '.'.$alb.'.' ) !== false ) {
2545
+
2546
+ unset( $child_list[$key] );
2547
+ $any = true;
2548
+ }
2549
+ }
2550
+ if ( $any ) {
2551
+ update_option( 'wppa_child_list', $child_list );
2552
+ }
2553
  }
2554
 
2555
  function wppa_compress_enum( $enum ) {
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: 7.6.06.001
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/
@@ -23,8 +23,8 @@ global $wpdb;
23
  global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
- global $wppa_revno; $wppa_revno = '7606'; // WPPA db version
27
- global $wppa_api_version; $wppa_api_version = '7.6.06.001'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';
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: 7.6.07.001
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/
23
  global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
+ global $wppa_revno; $wppa_revno = '7607'; // WPPA db version
27
+ global $wppa_api_version; $wppa_api_version = '7.6.07.001'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';