WP Photo Album Plus - Version 7.5.10.001

Version Description

= 7.5.09 =

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

Release Info

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

Code changes from version 7.5.09.010 to 7.5.10.001

Files changed (4) hide show
  1. changelog.txt +5 -1
  2. readme.txt +1 -1
  3. wppa-photo-admin-autosave.php +70 -113
  4. wppa.php +3 -3
changelog.txt CHANGED
@@ -1,8 +1,12 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
3
  = 7.5.09 =
4
 
5
- * On zoomable images: sincee panning by touch now works, swipe has been removed.
6
  * Spheric panoramas on fullscreen lightbox now cover the entire screen; performsnce improved.
7
 
8
  = 7.5.08 =
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.5.10 =
4
+
5
+ * Searching on numbers on the album admin screen now also returns real search results besides the already implemented list of ids.
6
+
7
  = 7.5.09 =
8
 
9
+ * On zoomable images: since panning by touch now works, swipe has been removed.
10
  * Spheric panoramas on fullscreen lightbox now cover the entire screen; performsnce improved.
11
 
12
  = 7.5.08 =
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.5
7
  Requires PHP: 5.5
8
- Stable tag: 7.5.08.006
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.5
7
  Requires PHP: 5.5
8
+ Stable tag: 7.5.09.010
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
wppa-photo-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
- * Version 7.5.02
7
  *
8
  */
9
 
@@ -92,6 +92,7 @@ global $wpdb;
92
  if ( $album == 'search' ) {
93
  $count = wppa_get_edit_search_photos( '', '', 'count_only' );
94
  $photos = wppa_get_edit_search_photos( $skip, $pagesize );
 
95
  $link = wppa_dbg_url( get_admin_url() . 'admin.php' .
96
  '?page=wppa_admin_menu' .
97
  '&tab=edit' .
@@ -3377,7 +3378,7 @@ global $wpdb;
3377
  }
3378
  }
3379
 
3380
- function wppa_get_edit_search_photos( $skip = '', $pagesize = '', $count_only = false ) {
3381
  global $wpdb;
3382
  global $wppa_search_stats;
3383
 
@@ -3393,10 +3394,9 @@ global $wppa_search_stats;
3393
 
3394
  $wppa_search_stats = array();
3395
 
3396
- $first = true;
3397
  $photo_array = array();
3398
 
3399
- // See if only ids given
3400
  if ( wppa_user_is( 'administrator' ) ) {
3401
  foreach ( $words as $word ) {
3402
  if ( wppa_is_int( $word ) ) {
@@ -3406,137 +3406,92 @@ global $wppa_search_stats;
3406
  }
3407
  }
3408
  asort( $photo_array );
 
 
 
 
3409
  }
3410
 
3411
- // Nothing? Process normal serch
3412
- if ( ! count( $photo_array ) ) {
3413
-
3414
- foreach( $words as $word ) {
3415
-
3416
- // Find lines in index db table
3417
- if ( wppa_switch( 'wild_front' ) ) {
3418
- $pword = '%' . $wpdb->esc_like( $word ) . '%';
3419
- }
3420
- else {
3421
- $pword = $wpdb->esc_like( $word ) . '%';
3422
- }
3423
- $pidxs = $wpdb->get_results( $wpdb->prepare( "SELECT slug, photos
3424
- FROM $wpdb->wppa_index
3425
- WHERE slug LIKE %s", $pword ), ARRAY_A );
3426
- $photos = array();
3427
-
3428
- // Accumulate photo ids
3429
- foreach ( $pidxs as $pi ) {
3430
 
3431
- $delta_arr = wppa_index_string_to_array( trim( $pi['photos'], ',' ) );
3432
- $photos = array_merge( $photos, $delta_arr );
3433
-
3434
- }
3435
- $photos = array_unique( $photos, SORT_NUMERIC );
3436
-
3437
- if ( $first ) {
3438
- $photo_array = $photos;
3439
- $count = empty( $photo_array ) ? '0' : count( $photo_array );
3440
-
3441
- // If not admin, remove not owned photos from array
3442
- if ( ! current_user_can( 'wppa_admin' ) || ! current_user_can( 'wppa_moderate' ) ) {
3443
- $u = wppa_get_user();
3444
- foreach( array_keys( $photo_array ) as $k ) {
3445
- $id = $photo_array[$k];
3446
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3447
- unset( $photo_array[$k] );
3448
- }
3449
- }
3450
- }
3451
- $real_count = count( $photo_array );
3452
 
3453
- if ( current_user_can( 'wppa_admin' ) && current_user_can( 'wppa_moderate' ) ) {
3454
- if ( $count != $real_count ) {
3455
- update_option( 'wppa_remake_index_photos_status', __('Required', 'wp-photo-album-plus') );
3456
- }
3457
- }
3458
 
3459
- $wppa_search_stats[] = array( 'word' => $word, 'count' => $real_count );
3460
- $first = false;
3461
- }
3462
- else {
3463
- $temp_array = $photos;
3464
- $count = empty( $temp_array ) ? '0' : count( $temp_array );
3465
- $list = implode( ',', $temp_array );
3466
-
3467
- // If not admin, remove not owned photos from array
3468
- if ( ! current_user_can( 'wppa_admin' ) || ! current_user_can( 'wppa_moderate' ) ) {
3469
- $u = wppa_get_user();
3470
- foreach( array_keys( $temp_array ) as $k ) {
3471
- $id = $temp_array[$k];
3472
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3473
- unset( $temp_array[$k] );
3474
- }
3475
- }
3476
- }
3477
- $real_count = count( $temp_array );
3478
 
3479
- if ( current_user_can( 'wppa_admin' ) && current_user_can( 'wppa_moderate' ) ) {
3480
- if ( $count != $real_count ) {
3481
- update_option( 'wppa_remake_index_photos_status', __('Required', 'wp-photo-album-plus') );
3482
- }
3483
- }
3484
-
3485
- $wppa_search_stats[] = array( 'word' => $word, 'count' => $real_count );
3486
- $photo_array = array_intersect( $photo_array, $temp_array );
3487
- }
3488
  }
3489
- }
3490
-
3491
- if ( ! empty( $photo_array ) ) {
3492
 
3493
  // If not admin, remove not owned photos from array
3494
  if ( ! current_user_can( 'wppa_admin' ) || ! current_user_can( 'wppa_moderate' ) ) {
3495
  $u = wppa_get_user();
3496
- foreach( array_keys( $photo_array ) as $k ) {
3497
- $id = $photo_array[$k];
3498
  if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3499
- unset( $photo_array[$k] );
3500
  }
3501
  }
3502
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3503
  $totcount = count( $photo_array );
3504
 
3505
- $wppa_search_stats[] = array( 'word' => __( 'Combined', 'wp-photo-album-plus'), 'count' => $totcount );
 
 
 
 
 
 
3506
 
3507
  $photos = array();
3508
  sort( $photo_array, SORT_NUMERIC );
3509
 
3510
  $photo_array = array_reverse( $photo_array );
 
 
3511
  $s = $skip;
3512
  $l = $pagesize;
3513
- if ( ! $l ) $l = 1000;
3514
- foreach( $photo_array as $id ) {
3515
- if ( $s ) {
3516
- $s--;
3517
- }
3518
- elseif( $l ) {
3519
- $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE id = %d", $id ), ARRAY_A );
3520
- $l--;
3521
- }
3522
- }
3523
- }
3524
- else {
3525
- $photos = false;
3526
- }
3527
-
3528
 
3529
- if ( $count_only ) {
3530
- if ( is_array( $photos ) ) {
3531
- return count( $photos );
3532
  }
3533
  else {
3534
- return '0';
3535
  }
3536
  }
3537
  else {
3538
- return $photos;
3539
  }
 
3540
  }
3541
 
3542
  function wppa_show_search_statistics() {
@@ -3565,19 +3520,21 @@ global $wppa_search_stats;
3565
  $s = '';
3566
  foreach( $wppa_search_stats as $search_item ) {
3567
  $c++;
3568
- if ( $c == $count ) {
3569
  echo '<tr><td><hr /></td><td><hr /></td></tr>';
3570
  $s = 'style="font-weight:bold;"';
3571
  }
 
3572
  echo '
3573
- <tr>
3574
- <td '.$s.'>' .
3575
- $search_item['word'] . '
3576
- </td>
3577
- <td '.$s.'>' .
3578
- $search_item['count'] . '
3579
- </td>
3580
- </tr>';
 
3581
  }
3582
  echo '
3583
  </table>';
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 7.5.10
7
  *
8
  */
9
 
92
  if ( $album == 'search' ) {
93
  $count = wppa_get_edit_search_photos( '', '', 'count_only' );
94
  $photos = wppa_get_edit_search_photos( $skip, $pagesize );
95
+
96
  $link = wppa_dbg_url( get_admin_url() . 'admin.php' .
97
  '?page=wppa_admin_menu' .
98
  '&tab=edit' .
3378
  }
3379
  }
3380
 
3381
+ function wppa_get_edit_search_photos( $skip = '0', $pagesize = '1000', $count_only = false ) {
3382
  global $wpdb;
3383
  global $wppa_search_stats;
3384
 
3394
 
3395
  $wppa_search_stats = array();
3396
 
 
3397
  $photo_array = array();
3398
 
3399
+ // First find the id if numeric
3400
  if ( wppa_user_is( 'administrator' ) ) {
3401
  foreach ( $words as $word ) {
3402
  if ( wppa_is_int( $word ) ) {
3406
  }
3407
  }
3408
  asort( $photo_array );
3409
+ if ( ! empty ( $photo_array ) ) {
3410
+ $ids = count( $photo_array ) == 1 ? 'ID' : 'IDs';
3411
+ $wppa_search_stats[] = array( 'word' => $ids, 'count' => count( $photo_array ) );
3412
+ }
3413
  }
3414
 
3415
+ // Process normal serch
3416
+ foreach( $words as $word ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3417
 
3418
+ // Find lines in index db table
3419
+ if ( wppa_switch( 'wild_front' ) ) {
3420
+ $pword = '%' . $wpdb->esc_like( $word ) . '%';
3421
+ }
3422
+ else {
3423
+ $pword = $wpdb->esc_like( $word ) . '%';
3424
+ }
3425
+ $pidxs = $wpdb->get_results( $wpdb->prepare( "SELECT slug, photos
3426
+ FROM $wpdb->wppa_index
3427
+ WHERE slug LIKE %s", $pword ), ARRAY_A );
3428
+ $photos = array();
 
 
 
 
 
 
 
 
 
 
3429
 
3430
+ // Accumulate photo ids
3431
+ foreach ( $pidxs as $pi ) {
 
 
 
3432
 
3433
+ $delta_arr = wppa_index_string_to_array( trim( $pi['photos'], ',' ) );
3434
+ $photos = array_merge( $photos, $delta_arr );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3435
 
 
 
 
 
 
 
 
 
 
3436
  }
3437
+ $photos = array_unique( $photos, SORT_NUMERIC );
 
 
3438
 
3439
  // If not admin, remove not owned photos from array
3440
  if ( ! current_user_can( 'wppa_admin' ) || ! current_user_can( 'wppa_moderate' ) ) {
3441
  $u = wppa_get_user();
3442
+ foreach( array_keys( $photos ) as $k ) {
3443
+ $id = $photos[$k];
3444
  if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3445
+ unset( $photos[$k] );
3446
  }
3447
  }
3448
  }
3449
+ $count = count( $photos );
3450
+
3451
+ $wppa_search_stats[] = array( 'word' => $word, 'count' => $count );
3452
+
3453
+ // Accumulate found ids
3454
+ $photo_array = array_merge( $photo_array, $photos );
3455
+ }
3456
+
3457
+ // Compute total
3458
+ if ( ! empty( $photo_array ) ) {
3459
+
3460
+ $c1 = count( $photo_array );
3461
+ $photo_array = array_unique( $photo_array );
3462
+ $c2 = count( $photo_array );
3463
+ $dups = $c1 - $c2;
3464
+
3465
  $totcount = count( $photo_array );
3466
 
3467
+ $wppa_search_stats[] = array( 'word' => __( 'Combined', 'wp-photo-album-plus' ), 'count' => $totcount );
3468
+ if ( $dups ) {
3469
+ $wppa_search_stats[] = array( 'word' => __( 'Duplicates', 'wp-photo-album-plus' ), 'count' => $dups );
3470
+ }
3471
+ else {
3472
+ $wppa_search_stats[] = array( 'word' => '', 'count' => '' );
3473
+ }
3474
 
3475
  $photos = array();
3476
  sort( $photo_array, SORT_NUMERIC );
3477
 
3478
  $photo_array = array_reverse( $photo_array );
3479
+
3480
+ // Find the photo data
3481
  $s = $skip;
3482
  $l = $pagesize;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3483
 
3484
+ if ( $count_only ) {
3485
+ $photos = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE id IN (".implode(',',$photo_array).") " );
 
3486
  }
3487
  else {
3488
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE id IN (".implode(',',$photo_array).") LIMIT $skip, $pagesize", ARRAY_A );
3489
  }
3490
  }
3491
  else {
3492
+ $photos = false;
3493
  }
3494
+ return $photos;
3495
  }
3496
 
3497
  function wppa_show_search_statistics() {
3520
  $s = '';
3521
  foreach( $wppa_search_stats as $search_item ) {
3522
  $c++;
3523
+ if ( $c == ( $count - 1 ) ) {
3524
  echo '<tr><td><hr /></td><td><hr /></td></tr>';
3525
  $s = 'style="font-weight:bold;"';
3526
  }
3527
+ if ( $search_item['word'] ) {
3528
  echo '
3529
+ <tr>
3530
+ <td '.$s.'>' .
3531
+ $search_item['word'] . '
3532
+ </td>
3533
+ <td '.$s.'>' .
3534
+ $search_item['count'] . '
3535
+ </td>
3536
+ </tr>';
3537
+ }
3538
  }
3539
  echo '
3540
  </table>';
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.5.09.010
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 = '7509'; // WPPA db version
27
- global $wppa_api_version; $wppa_api_version = '7.5.09.010'; // 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.5.10.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 = '7510'; // WPPA db version
27
+ global $wppa_api_version; $wppa_api_version = '7.5.10.001'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';