WP Photo Album Plus - Version 8.2.04.006

Version Description

= 8.1.08 =

  • This version addresses various bug fixes, feature requests and security fixes.
Download this release

Release Info

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

Code changes from version 8.2.04.005 to 8.2.04.006

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.005
7
  *
8
  */
9
 
@@ -228,6 +228,7 @@ global $wppa_revno;
228
  wppa_set_last_album( $id );
229
  wppa_invalidate_treecounts( $id );
230
  wppa_index_add( 'album', $id );
 
231
 
232
  if ( $sib_id > 0 ) {
233
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 8.2.04.006
7
  *
8
  */
9
 
228
  wppa_set_last_album( $id );
229
  wppa_invalidate_treecounts( $id );
230
  wppa_index_add( 'album', $id );
231
+ $sib_id = wppa_get( 'is-sibling-of', '0' );
232
 
233
  if ( $sib_id > 0 ) {
234
 
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.005
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
@@ -542,10 +542,15 @@ add_action( 'plugins_loaded', 'wppa_activate_albtogal_conversion', 20 );
542
 
543
  // Do the actual conversion from album to gallery
544
  function wppa_album_to_gallery( $text = '' ) {
 
545
  global $wppa_album_gallery_texts_albums;
546
  global $wppa_album_gallery_texts_gallery;
547
  global $_gallery;
548
 
 
 
 
 
549
  $text = str_replace( $wppa_album_gallery_texts_albums,
550
  $wppa_album_gallery_texts_gallery,
551
  $text );
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
+ * Version 8.2.04.006
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
542
 
543
  // Do the actual conversion from album to gallery
544
  function wppa_album_to_gallery( $text = '' ) {
545
+ global $wppa_skip_alb_to_gal;
546
  global $wppa_album_gallery_texts_albums;
547
  global $wppa_album_gallery_texts_gallery;
548
  global $_gallery;
549
 
550
+ if ( $wppa_skip_alb_to_gal ) {
551
+ return $text;
552
+ }
553
+
554
  $text = str_replace( $wppa_album_gallery_texts_albums,
555
  $wppa_album_gallery_texts_gallery,
556
  $text );
wppa-items.php CHANGED
@@ -3,7 +3,7 @@
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
 
@@ -37,7 +37,7 @@ static $cache;
37
  }
38
  }
39
 
40
- wppa_log('obs', 'Count in album cache is now '.count($cache));
41
  }
42
 
43
  // Action?
@@ -122,7 +122,7 @@ static $cache;
122
  $cache[$photo['id']] = $photo;
123
  }
124
  }
125
- wppa_log('obs', 'Count in photo cache is now '.count($cache));
126
  }
127
 
128
  // Invalidate ?
@@ -190,16 +190,19 @@ static $cache;
190
 
191
  // get the name of a full sized image
192
  function wppa_get_photo_name( $id, $xargs = array() ) {
 
193
 
194
  // Init
195
  $result = '';
196
 
197
  // Verify args
198
  if ( ! is_numeric( $id ) || $id < '1' ) {
199
- wppa_dbg_msg( 'Invalid arg wppa_get_photo_name( '.$id.' )', 'red' );
200
- return '';
201
  }
202
 
 
 
 
203
  // Fill in the optional args
204
  $defaults = array( 'translate' => true,
205
  'addowner' => false,
@@ -277,19 +280,23 @@ function wppa_get_photo_name( $id, $xargs = array() ) {
277
 
278
  // Translate keywords
279
  $result = str_replace( 'w#id', $id, $result );
 
280
 
281
  return wppa_utf8( $result );
282
  }
283
 
284
  // get the description of an image
285
  function wppa_get_photo_desc( $id, $xargs = array() ) {
 
286
 
287
  // Verify args
288
  if ( ! is_numeric( $id ) || $id < '1' ) {
289
- wppa_dbg_msg( 'Invalid arg wppa_get_photo_desc( '.$id.' )', 'red' );
290
  return '';
291
  }
292
 
 
 
 
293
  // Fill in the optional args
294
  $defaults = array( 'translate' => true,
295
  'doshortcodes' => false,
@@ -344,6 +351,8 @@ function wppa_get_photo_desc( $id, $xargs = array() ) {
344
  }
345
  $desc = wppa_echo( $desc, '', '', true );
346
 
 
 
347
  return wppa_utf8( $desc );
348
  }
349
 
@@ -550,11 +559,10 @@ global $wpdb;
550
 
551
  // get album name
552
  function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
 
553
 
554
  // Sanitize args
555
  if ( ! is_numeric( $id ) ) {
556
- wppa_dbg_msg( 'Invalid arg wppa_get_album_name(' . $id . ')', 'red' );
557
- wppa_log( 'Err', 'Invalid arg wppa_get_album_name(' . $id . ')', true );
558
  return '';
559
  }
560
 
@@ -577,7 +585,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
577
  else {
578
  $name = '--- none ---';
579
  }
580
- return $name;
581
  }
582
  if ( $id == '-1' ) {
583
  if ( $args['translate'] ) {
@@ -586,7 +593,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
586
  else {
587
  $name = '--- separate ---';
588
  }
589
- return $name;
590
  }
591
  if ( $id == '-2' ) {
592
  if ( $args['translate'] ) {
@@ -595,7 +601,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
595
  else {
596
  $name = '--- all ---';
597
  }
598
- return $name;
599
  }
600
  if ( $id == '-3' ) {
601
  if ( $args['translate'] ) {
@@ -604,7 +609,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
604
  else {
605
  $name = '--- owner/public ---';
606
  }
607
- return $name;
608
  }
609
  if ( $id <= '-9' ) {
610
  if ( $args['translate'] ) {
@@ -613,11 +617,9 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
613
  else {
614
  $name = '--- deleted ---';
615
  }
616
- return $name;
617
  }
618
  if ( $args['raw'] ) {
619
  $name = $album['name'];
620
- return $name;
621
  }
622
  }
623
  else {
@@ -628,7 +630,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
628
  else {
629
  $name = 'All albums';
630
  }
631
- return $name;
632
  }
633
  if ( $id == '-3' ) {
634
  if ( $args['translate'] ) {
@@ -645,7 +646,6 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
645
  return '';
646
  }
647
  elseif ( ! is_numeric( $id ) || $id < '1' ) {
648
- wppa_dbg_msg( 'Invalid arg wppa_get_album_name( '.$id.', ' . $args['extended'] . ' )', 'red' );
649
  return '';
650
  }
651
  else {
@@ -659,7 +659,9 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
659
  }
660
  else {
661
  if ( $args['translate'] ) {
 
662
  $name = __( stripslashes( $album['name'] ) );
 
663
  }
664
  else {
665
  $name = stripslashes( $album['name'] );
@@ -681,10 +683,10 @@ function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
681
 
682
  // get album description
683
  function wppa_get_album_desc( $id, $xargs = array() ) {
 
684
 
685
  // Sanitize args
686
  if ( ! is_numeric( $id ) || $id < '1' ) {
687
- wppa_log( 'dbg', 'Invalid arg wppa_get_album_desc(' . $id . ')' );
688
  return '';
689
  }
690
 
@@ -714,7 +716,9 @@ function wppa_get_album_desc( $id, $xargs = array() ) {
714
  if ( $args['translate'] ) {
715
 
716
  // qTranslate, wpGlobus
 
717
  $desc = __( $desc );
 
718
  }
719
 
720
  // Enable or strip html
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
+ * Version 8.2.04.006
7
  *
8
  */
9
 
37
  }
38
  }
39
 
40
+ // wppa_log('obs', 'Count in album cache is now '.count($cache));
41
  }
42
 
43
  // Action?
122
  $cache[$photo['id']] = $photo;
123
  }
124
  }
125
+ // wppa_log('obs', 'Count in photo cache is now '.count($cache));
126
  }
127
 
128
  // Invalidate ?
190
 
191
  // get the name of a full sized image
192
  function wppa_get_photo_name( $id, $xargs = array() ) {
193
+ global $wppa_skip_alb_to_gal;
194
 
195
  // Init
196
  $result = '';
197
 
198
  // Verify args
199
  if ( ! is_numeric( $id ) || $id < '1' ) {
200
+ return $result;
 
201
  }
202
 
203
+ // Prevent album to gallery 'translation'
204
+ $wppa_skip_alb_to_gal = true;
205
+
206
  // Fill in the optional args
207
  $defaults = array( 'translate' => true,
208
  'addowner' => false,
280
 
281
  // Translate keywords
282
  $result = str_replace( 'w#id', $id, $result );
283
+ $wppa_skip_alb_to_gal = false;
284
 
285
  return wppa_utf8( $result );
286
  }
287
 
288
  // get the description of an image
289
  function wppa_get_photo_desc( $id, $xargs = array() ) {
290
+ global $wppa_skip_alb_to_gal;
291
 
292
  // Verify args
293
  if ( ! is_numeric( $id ) || $id < '1' ) {
 
294
  return '';
295
  }
296
 
297
+ // Prevent album to gallery 'translation'
298
+ $wppa_skip_alb_to_gal = true;
299
+
300
  // Fill in the optional args
301
  $defaults = array( 'translate' => true,
302
  'doshortcodes' => false,
351
  }
352
  $desc = wppa_echo( $desc, '', '', true );
353
 
354
+ $wppa_skip_alb_to_gal = false;
355
+
356
  return wppa_utf8( $desc );
357
  }
358
 
559
 
560
  // get album name
561
  function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
562
+ global $wppa_skip_alb_to_gal;
563
 
564
  // Sanitize args
565
  if ( ! is_numeric( $id ) ) {
 
 
566
  return '';
567
  }
568
 
585
  else {
586
  $name = '--- none ---';
587
  }
 
588
  }
589
  if ( $id == '-1' ) {
590
  if ( $args['translate'] ) {
593
  else {
594
  $name = '--- separate ---';
595
  }
 
596
  }
597
  if ( $id == '-2' ) {
598
  if ( $args['translate'] ) {
601
  else {
602
  $name = '--- all ---';
603
  }
 
604
  }
605
  if ( $id == '-3' ) {
606
  if ( $args['translate'] ) {
609
  else {
610
  $name = '--- owner/public ---';
611
  }
 
612
  }
613
  if ( $id <= '-9' ) {
614
  if ( $args['translate'] ) {
617
  else {
618
  $name = '--- deleted ---';
619
  }
 
620
  }
621
  if ( $args['raw'] ) {
622
  $name = $album['name'];
 
623
  }
624
  }
625
  else {
630
  else {
631
  $name = 'All albums';
632
  }
 
633
  }
634
  if ( $id == '-3' ) {
635
  if ( $args['translate'] ) {
646
  return '';
647
  }
648
  elseif ( ! is_numeric( $id ) || $id < '1' ) {
 
649
  return '';
650
  }
651
  else {
659
  }
660
  else {
661
  if ( $args['translate'] ) {
662
+ $wppa_skip_alb_to_gal = true;
663
  $name = __( stripslashes( $album['name'] ) );
664
+ $wppa_skip_alb_to_gal = false;
665
  }
666
  else {
667
  $name = stripslashes( $album['name'] );
683
 
684
  // get album description
685
  function wppa_get_album_desc( $id, $xargs = array() ) {
686
+ global $wppa_skip_alb_to_gal;
687
 
688
  // Sanitize args
689
  if ( ! is_numeric( $id ) || $id < '1' ) {
 
690
  return '';
691
  }
692
 
716
  if ( $args['translate'] ) {
717
 
718
  // qTranslate, wpGlobus
719
+ $wppa_skip_alb_to_gal = true;
720
  $desc = __( $desc );
721
+ $wppa_skip_alb_to_gal = false;
722
  }
723
 
724
  // Enable or strip html
wppa-setup.php CHANGED
@@ -331,6 +331,10 @@ global $wppa_error;
331
  }
332
  }
333
 
 
 
 
 
334
  }
335
 
336
  // Sanitize nicescroll opts
331
  }
332
  }
333
 
334
+ if ( $old_rev <= '8204006' ) {
335
+ wppa_invalidate_treecounts();
336
+ }
337
+
338
  }
339
 
340
  // Sanitize nicescroll opts
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.005
8
  *
9
  */
10
 
@@ -575,8 +575,13 @@ global $wpdb;
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
 
581
  // Manually update. If used wppa_update_album, remake index would be triggered
582
  $iret = $wpdb->query( "UPDATE $wpdb->wppa_albums SET treecounts = '$result' WHERE id = $alb" );
@@ -620,15 +625,24 @@ global $wpdb;
620
  $treecount_array = array();
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 ) {
628
- if ( ! isset( $treecount_array[$i] ) ) {
629
- $treecount_array[$i] = $defaults[$i];
 
 
 
 
 
 
 
 
 
 
630
  }
631
- $i++;
632
  }
633
 
634
  // Convert numeric keys to alphabetic keys
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
+ * Version 8.2.04.006
8
  *
9
  */
10
 
575
  if ( $alb && is_array( $treecounts ) ) {
576
 
577
  $keys = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' );
578
+ if ( count( $keys ) == count( $treecounts ) ) {
579
+ $result = array_combine( $keys, $treecounts );
580
+ $result = serialize( $result );
581
+ }
582
+ else {
583
+ $result = '';
584
+ }
585
 
586
  // Manually update. If used wppa_update_album, remake index would be triggered
587
  $iret = $wpdb->query( "UPDATE $wpdb->wppa_albums SET treecounts = '$result' WHERE id = $alb" );
625
  $treecount_array = array();
626
  }
627
 
628
+ // Set up defaults
629
  $defaults = array( 1,0,0,0,0,0,0,0,0,0,0 );
630
+
631
+ // If array is too big, trim it down to the currrent size
632
+ if ( count( $treecount_array ) > count( $defaults ) ) {
633
+ $treecount_array = array_slice( $treecount_array, 0, count( $defaults ) );
634
+ }
635
+
636
+ // If array is too small, fill in missing elements wiuth default values
637
+ if ( count( $treecount_array ) < count( $defaults ) ) {
638
+ $i = 0;
639
+ $n = count( $defaults );
640
+ while ( $i < $n ) {
641
+ if ( ! isset( $treecount_array[$i] ) ) {
642
+ $treecount_array[$i] = $defaults[$i];
643
+ }
644
+ $i++;
645
  }
 
646
  }
647
 
648
  // Convert numeric keys to alphabetic keys
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.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,7 +24,7 @@ global $wp_version;
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
 
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.006
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.006'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30