WP Photo Album Plus - Version 8.0.08.007

Version Description

= 8.0.07 =

  • 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.0.08.007
Comparing to
See all releases

Code changes from version 8.0.08.006 to 8.0.08.007

wppa-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
- * Version 8.0.08.006
7
  *
8
  */
9
 
@@ -76,7 +76,7 @@ function wppa_add_admin() {
76
  $hits = get_option( 'wppa_cache_hits', '0' );
77
  $miss = get_option( 'wppa_cache_misses', '1' );
78
  $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
79
- add_submenu_page( 'wppa_admin_menu', __('Clear cache', 'wp-photo-album-plus'), __('Cache', 'wp-photo-album-plus').' '. $perc . '%', 'wppa_admin', 'wppa_clear_cache', 'wppa_clear_wppa_cache' );
80
  }
81
 
82
  /* ADMIN STYLES */
@@ -226,102 +226,6 @@ function wppa_page_help() {
226
  require_once 'wppa-help.php';
227
  _wppa_page_help();
228
  }
229
- // Clear cache
230
- function wppa_clear_wppa_cache() {
231
-
232
- if ( ! current_user_can( 'administrator' ) && ! current_user_can( 'edit_posts' ) ) {
233
- wp_die( 'You have no rights to do this' );
234
- }
235
-
236
- echo '<h1>' . __( 'Clear WPPA Cache', 'wp-photo-album-plus' ) . '</h1>';
237
-
238
- $sc_files = array();
239
- $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
240
- if ( wppa_is_dir( $root ) ) {
241
- $sc_files = wppa_glob( $root . '/*' );
242
- }
243
-
244
- $wg_files = array();
245
- $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-widget';
246
- if ( wppa_is_dir( $root ) ) {
247
- $wg_files = wppa_glob( $root . '/*' );
248
- }
249
-
250
- $files = array_merge( $sc_files, $wg_files );
251
- $count = count( $files );
252
- if ( $count ) {
253
- echo '
254
- <div class="wrap" >
255
- <table class="wppa-table widefat wppa-setting-table" style="margin-top:12px;width: 800px;" >
256
- <thead style="font-weight:bold;" >
257
- <tr>
258
- <td style="width:600px;" >' . __( 'Name', 'wp-photo-album-plus' ) . '</td>
259
- <td style="width:75px; text-align:center;" >' . __( 'Size', 'wp-photo-album-plus' ) . '</td>
260
- <td style="width:100px; text-align:center;" >' . __( 'Age', 'wp-photo-album-plus' ) . '</td>
261
- </tr>
262
- </thead>
263
- <tbody>';
264
- foreach( $files as $file ) {
265
- $pfile = '...' . str_replace( dirname( dirname( dirname( dirname( $file ) ) ) ), '', $file );
266
- $size = wppa_filesize( $file );
267
- $a = time() - wppa_filetime( $file );
268
- $d = floor( $a / ( 24 * 3600 ) ) ;
269
- $a -= $d * 24 * 3600;
270
- $h = floor( $a / 3600 );
271
- $a -= $h * 3600;
272
- $m = floor( $a / 60 );
273
- $s = $a - $m * 60;
274
- $age = sprintf( '%2dd %2dh %2dm %2ds', $d, $h, $m, $s );
275
- if ( wppa_get( 'delete' ) ) {
276
- wppa_unlink( $file, false );
277
- }
278
- echo '
279
- <tr>
280
- <td style="width:600px;" >' . $pfile . '</td>
281
- <td style="width:75px;" ><span style="float:right;" >' . $size . '</span></td>
282
- <td style="width:100px;" >' . $age . '</td>
283
- </tr>';
284
- }
285
- echo '
286
- </tbody>
287
- </table>';
288
-
289
- if ( wppa_get( 'delete' ) ) {
290
- wppa_clear_cache( ['force' => true] );
291
- echo '<br><b>' . sprintf( __( '%d cachefiles deleted', 'wp-photo-album-plus' ), $count ) . '</br>';
292
- }
293
- else {
294
- $hits = get_option( 'wppa_cache_hits', '0' );
295
- $miss = get_option( 'wppa_cache_misses', '1' );
296
- $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
297
- echo '
298
- <p>' .
299
- __( 'Caching is \'smart\'. This means that cache files are cleared when the display of a wppa widget or shortcode will change due to adding albums, photos comments or ratings.', 'wp-photo-album-plus' ) . '
300
- <br />' .
301
- __( 'You will need to clear the cachefiles only when you change the layout outside the WPPA settings, i.e. change theme or custom CSS.', 'wp-photo-album-plus' ) . '
302
- </p>
303
-
304
- <input
305
- type="button"
306
- class="button-primary"
307
- onclick="document.location.href=\'' . admin_url( 'admin.php?page=wppa_clear_cache&delete=1' ) . '\'"
308
- value="' . __( 'Delete', 'wp-photo-album-plus' ) . '"
309
- /><br />
310
-
311
- <p>' .
312
- __( 'Hits', 'wp-photo-album-plus' ) . ': ' . $perc . '% ' .
313
- '</p>';
314
- }
315
- echo '
316
- </div>';
317
- }
318
- else {
319
- echo '
320
- <div class="wrap" >' .
321
- __( 'No cachefiles to remove.', 'wp-photo-album-plus' ) . '
322
- </div>';
323
- }
324
- }
325
 
326
  /* GENERAL ADMIN */
327
 
@@ -425,7 +329,7 @@ global $wpdb;
425
  // If wppa content, clear wppa cache
426
  if ( strpos( $post_content, '[wppa' ) !== false ||
427
  strpos( $post_content, '[photo' ) !== false ) {
428
- wppa_clear_cache( ['shortcodes' => true] );
429
  }
430
  }
431
  add_action( 'save_post', 'wppa_fix_gutenberg_shortcodes' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
76
  $hits = get_option( 'wppa_cache_hits', '0' );
77
  $miss = get_option( 'wppa_cache_misses', '1' );
78
  $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
79
+ add_submenu_page( 'wppa_admin_menu', __('Cache', 'wp-photo-album-plus'), __('Cache', 'wp-photo-album-plus').' '. $perc . '%', 'wppa_admin', 'wppa_cache', 'wppa_page_cache' );
80
  }
81
 
82
  /* ADMIN STYLES */
226
  require_once 'wppa-help.php';
227
  _wppa_page_help();
228
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
  /* GENERAL ADMIN */
231
 
329
  // If wppa content, clear wppa cache
330
  if ( strpos( $post_content, '[wppa' ) !== false ||
331
  strpos( $post_content, '[photo' ) !== false ) {
332
+ wppa_clear_cache( ['page' => $post] );
333
  }
334
  }
335
  add_action( 'save_post', 'wppa_fix_gutenberg_shortcodes' );
wppa-adminbar.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * enhances the admin bar with wppa+ menu
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -121,7 +121,7 @@ function wppa_admin_bar_menu() {
121
  $menu_items['cache'] = array(
122
  'parent' => $wppaplus,
123
  'title' => __( 'Cache', 'wp-photo-album-plus' ) . ' ' . $perc . '%',
124
- 'href' => admin_url( 'admin.php?page=wppa_clear_cache' )
125
  );
126
  }
127
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * enhances the admin bar with wppa+ menu
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
121
  $menu_items['cache'] = array(
122
  'parent' => $wppaplus,
123
  'title' => __( 'Cache', 'wp-photo-album-plus' ) . ' ' . $perc . '%',
124
+ 'href' => admin_url( 'admin.php?page=wppa_cache' )
125
  );
126
  }
127
 
wppa-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
- /* Version 8.0.08.006
7
  */
8
 
9
  // Test for caching
@@ -61,12 +61,12 @@ global $wppa_lang;
61
  if ( $login && ( wppa_switch( 'user_upload_on' ) ) ) {
62
  $login .= get_current_user_id() . '-';
63
  }
64
- $cache_file =
65
- $root . '/' .
66
- $wppa_lang . '-' .
67
- $login .
68
- ( wppa_user_is( 'administrator' ) ? 'adm-' : '' ) .
69
- ( wppa_is_mobile() ? 'mob-' : '' ) .
70
  $cache_id;
71
 
72
  // Cachefile present?
@@ -105,10 +105,10 @@ global $photos_used;
105
  global $other_deps;
106
 
107
  // A delayed shortcode does not need to be cached
108
- if ( wppa( 'delay' ) ) {
109
- wppa_log( 'obs', 'Delayed shortcode '.$wppa_current_shortcode.' not cached' );
110
- return;
111
- }
112
 
113
  // Fill in defaults
114
  $defaults = array( 'file' => '',
@@ -117,6 +117,7 @@ global $other_deps;
117
  'photos' => $photos_used,
118
  'other' => $other_deps,
119
  'remark' => $wppa_current_shortcode,
 
120
  );
121
  $args = wp_parse_args( (array) $xargs, $defaults );
122
 
@@ -127,6 +128,7 @@ global $other_deps;
127
  $photos = $args['photos'];
128
  $other = $args['other'];
129
  $remark = $args['remark'];
 
130
 
131
  // Check for missing refs
132
  if ( ! $albums && ! $photos && ! $other ) {
@@ -187,6 +189,7 @@ global $other_deps;
187
  'albums' => $albums,
188
  'photos' => $photos,
189
  'other' => $other,
 
190
  ) );
191
  // Cleanup
192
  $albums_used = '';
@@ -222,6 +225,7 @@ global $wpdb;
222
  'albums' => false,
223
  'photos' => false,
224
  'qr' => false,
 
225
  'other' => '',
226
  );
227
  $args = wp_parse_args( (array) $args, $defaults );
@@ -234,6 +238,7 @@ global $wpdb;
234
  $albums = $args['albums'] || $force;
235
  $photos = $args['photos'] || $force;
236
  $qr = $args['qr'] || $force;
 
237
  $other = $args['other'];
238
 
239
  // Album based
@@ -302,6 +307,21 @@ global $wpdb;
302
  }
303
  }
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  // Clear all shortcode caches
306
  if ( $shortcodes ) {
307
 
@@ -392,19 +412,19 @@ global $wppa_lang;
392
  if ( ! wppa_is_dir( $root ) ) {
393
  wppa_mktree( $root );
394
  }
395
-
396
  $login = ( is_user_logged_in() ? 'log-' : '' );
397
  if ( $login && ( wppa_switch( 'user_upload_on' ) ) ) {
398
  $login .= get_current_user_id() . '-';
399
  }
400
 
401
  $result =
402
- $root . '/' .
403
  $wppa_lang . '-' .
404
  $login .
405
- ( wppa_user_is( 'administrator' ) ? 'adm-' : '' ) .
406
  $widget_id;
407
-
408
  return $result;
409
  }
410
 
@@ -422,4 +442,160 @@ global $wpdb;
422
  }
423
  }
424
  $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE filename LIKE '%$widget_id%'" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  }
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
+ /* Version 8.0.08.007
7
  */
8
 
9
  // Test for caching
61
  if ( $login && ( wppa_switch( 'user_upload_on' ) ) ) {
62
  $login .= get_current_user_id() . '-';
63
  }
64
+ $cache_file =
65
+ $root . '/' .
66
+ $wppa_lang . '-' .
67
+ $login .
68
+ ( wppa_user_is( 'administrator' ) ? 'adm-' : '' ) .
69
+ ( wppa_is_mobile() ? 'mob-' : '' ) .
70
  $cache_id;
71
 
72
  // Cachefile present?
105
  global $other_deps;
106
 
107
  // A delayed shortcode does not need to be cached
108
+ // if ( wppa( 'delay' ) ) {
109
+ // wppa_log( 'obs', 'Delayed shortcode '.$wppa_current_shortcode.' not cached' );
110
+ // return;
111
+ // }
112
 
113
  // Fill in defaults
114
  $defaults = array( 'file' => '',
117
  'photos' => $photos_used,
118
  'other' => $other_deps,
119
  'remark' => $wppa_current_shortcode,
120
+ 'page' => ( wppa( 'in_widget' ) ? '' : get_the_ID() ),
121
  );
122
  $args = wp_parse_args( (array) $xargs, $defaults );
123
 
128
  $photos = $args['photos'];
129
  $other = $args['other'];
130
  $remark = $args['remark'];
131
+ $page = $args['page'];
132
 
133
  // Check for missing refs
134
  if ( ! $albums && ! $photos && ! $other ) {
189
  'albums' => $albums,
190
  'photos' => $photos,
191
  'other' => $other,
192
+ 'page' => $page,
193
  ) );
194
  // Cleanup
195
  $albums_used = '';
225
  'albums' => false,
226
  'photos' => false,
227
  'qr' => false,
228
+ 'page' => '',
229
  'other' => '',
230
  );
231
  $args = wp_parse_args( (array) $args, $defaults );
238
  $albums = $args['albums'] || $force;
239
  $photos = $args['photos'] || $force;
240
  $qr = $args['qr'] || $force;
241
+ $page = $args['page'];
242
  $other = $args['other'];
243
 
244
  // Album based
307
  }
308
  }
309
 
310
+ // Page based
311
+ if ( $page ) {
312
+
313
+ $p = strval( intval( $page ) );
314
+ $query = "SELECT filename FROM $wpdb->wppa_caches WHERE page = $p";
315
+ $files = $wpdb->get_col( $query );
316
+ foreach( $files as $file ) {
317
+ $path = str_replace( '...', WPPA_CONTENT_PATH, $file );
318
+ if ( wppa_is_file( $path ) ) {
319
+ wppa_unlink( $path, true );
320
+ }
321
+ }
322
+ $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE page = $p" );
323
+ }
324
+
325
  // Clear all shortcode caches
326
  if ( $shortcodes ) {
327
 
412
  if ( ! wppa_is_dir( $root ) ) {
413
  wppa_mktree( $root );
414
  }
415
+
416
  $login = ( is_user_logged_in() ? 'log-' : '' );
417
  if ( $login && ( wppa_switch( 'user_upload_on' ) ) ) {
418
  $login .= get_current_user_id() . '-';
419
  }
420
 
421
  $result =
422
+ $root . '/' .
423
  $wppa_lang . '-' .
424
  $login .
425
+ ( wppa_user_is( 'administrator' ) ? 'adm-' : '' ) .
426
  $widget_id;
427
+
428
  return $result;
429
  }
430
 
442
  }
443
  }
444
  $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE filename LIKE '%$widget_id%'" );
445
+ }
446
+
447
+ // Cache admin page
448
+ function wppa_page_cache() {
449
+ global $wpdb;
450
+
451
+ if ( ! current_user_can( 'administrator' ) && ! current_user_can( 'edit_posts' ) ) {
452
+ wp_die( 'You have no rights to do this' );
453
+ }
454
+
455
+ echo '<h1>' . __( 'WPPA Cache', 'wp-photo-album-plus' ) . '</h1>';
456
+
457
+ $sc_files = array();
458
+ $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
459
+ if ( wppa_is_dir( $root ) ) {
460
+ $sc_files = wppa_glob( $root . '/*' );
461
+ }
462
+
463
+ $wg_files = array();
464
+ $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-widget';
465
+ if ( wppa_is_dir( $root ) ) {
466
+ $wg_files = wppa_glob( $root . '/*' );
467
+ }
468
+
469
+ $files = array_merge( $sc_files, $wg_files );
470
+ $count = count( $files );
471
+ if ( $count ) {
472
+ echo '
473
+ <div class="wrap" >
474
+ <table class="wppa-table widefat wppa-setting-table striped" style="margin-top:12px;" >
475
+ <thead style="font-weight:bold;" >
476
+ <tr>
477
+ <td colspan="3" ><h3 style="margin:0.1em;" >' . __( 'File data', 'wp-photo-album-plus' ) . '</h3></td>
478
+ <td colspan="4" style="border-left:1px solid #c3c4c7;" ><h3 style="margin:0.1em;" >' . __( 'Dependancies', 'wp-photo-album-plus' ) . '</h3></td>
479
+ </tr>
480
+ <tr>
481
+ <td><b>' . __( 'Name', 'wp-photo-album-plus' ) . '</b></td>
482
+ <td><b>' . __( 'Size', 'wp-photo-album-plus' ) . '</b></td>
483
+ <td><b>' . __( 'Age', 'wp-photo-album-plus' ) . '</b></td>
484
+ <td style="border-left:1px solid #c3c4c7;" ><b>' . __( 'Albums', 'wp-photo-album-plus' ) . '</b></td>
485
+ <td><b>' . __( 'Photos', 'wp-photo-album-plus' ) . '</b></td>
486
+ <td><b>' . __( 'Page', 'wp-photo-album-plus' ) . '</b></td>
487
+ <td><b>' . __( 'Other', 'wp-photo-album-plus' ) . '</b></td>
488
+ </tr>
489
+ </thead>
490
+ <tbody>';
491
+ foreach( $files as $file ) {
492
+ $pfile = '...' . str_replace( dirname( dirname( dirname( dirname( $file ) ) ) ), '', $file );
493
+
494
+ $size = wppa_filesize( $file );
495
+ if ( $size > 1024*1024 ) {
496
+ $size = sprintf( '%5.1fMb', $size / ( 1024 * 1024 ) );
497
+ }
498
+ elseif ( $size > 1024 ) {
499
+ $size = sprintf( '%5.1fkb', $size / 1024 );
500
+ }
501
+ else {
502
+ $size = $size . 'bytes';
503
+ }
504
+
505
+ $a = time() - wppa_filetime( $file );
506
+ $d = floor( $a / ( 24 * 3600 ) ) ;
507
+ $a -= $d * 24 * 3600;
508
+ $h = floor( $a / 3600 );
509
+ $a -= $h * 3600;
510
+ $m = floor( $a / 60 );
511
+ $s = $a - $m * 60;
512
+ $age = sprintf( '%2dd %2dh %2dm %2ds', $d, $h, $m, $s );
513
+ if ( wppa_get( 'delete' ) ) {
514
+ wppa_unlink( $file, false );
515
+ }
516
+ $meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_caches
517
+ where filename = %s",
518
+ str_replace( WPPA_CONTENT_PATH, '...', $file ) ), ARRAY_A );
519
+ if ( ! $meta ) {
520
+ $meta['albums'] = '';
521
+ $meta['photos'] = '';
522
+ $meta['other'] = '';
523
+ $meta['page'] = '';
524
+ }
525
+ else {
526
+ $meta['albums'] = wppa_cache_display_format( $meta['albums'] );
527
+ if ( $meta['albums'] == '*' ) $meta['albums'] = __( 'All', 'wp-photo-album-plus' );
528
+ $meta['photos'] = wppa_cache_display_format( $meta['photos'] );
529
+ if ( $meta['photos'] == '*' ) $meta['photos'] = __( 'All', 'wp-photo-album-plus' );
530
+ if ( $meta['other'] == 'R' ) $meta['other'] = __( 'Any rating', 'wp-photo-album-plus' );
531
+ if ( $meta['other'] == 'C' ) $meta['other'] = __( 'Any comment', 'wp-photo-album-plus' );
532
+ if ( $meta['page'] == '0' ) $meta['page'] = '';
533
+ }
534
+ echo '
535
+ <tr>
536
+ <td style="width:600px;" >' . $pfile . '</td>
537
+ <td style="width:75px;" >' . $size . '</td>
538
+ <td style="width:100px;" >' . $age . '</td>
539
+ <td style="border-left:1px solid #c3c4c7;" >' . $meta['albums'] . '</td>
540
+ <td >' . $meta['photos'] . '</td>
541
+ <td >' . $meta['page'] . '</td>
542
+ <td >' . $meta['other'] . '</td>
543
+ </tr>';
544
+ }
545
+ echo '
546
+ </tbody>
547
+ </table>';
548
+
549
+ if ( wppa_get( 'delete' ) ) {
550
+ wppa_clear_cache( ['force' => true] );
551
+ echo '<br><b>' . sprintf( __( '%d cachefiles deleted', 'wp-photo-album-plus' ), $count ) . '</br>';
552
+ }
553
+ else {
554
+ $hits = get_option( 'wppa_cache_hits', '0' );
555
+ $miss = get_option( 'wppa_cache_misses', '1' );
556
+ $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
557
+ echo '
558
+ <p>' .
559
+ __( 'Caching is \'smart\'. This means that cache files are cleared when the display of a wppa widget or shortcode will change due to adding albums, photos comments or ratings.', 'wp-photo-album-plus' ) . '
560
+ <br />' .
561
+ __( 'You will need to clear the cachefiles only when you change the layout outside the WPPA settings, i.e. change theme or custom CSS.', 'wp-photo-album-plus' ) . '
562
+ </p>
563
+
564
+ <input
565
+ type="button"
566
+ class="button-primary"
567
+ onclick="document.location.href=\'' . admin_url( 'admin.php?page=wppa_cache&delete=1' ) . '\'"
568
+ value="' . __( 'Clear cache', 'wp-photo-album-plus' ) . '"
569
+ /><br />
570
+
571
+ <p>' .
572
+ sprintf(
573
+ __( 'Since last install / update of the plugin, there were %d cache hits, %d cache misses, i.e. a hitrate of %5.2f%%', 'wp-photo-album-plus'),
574
+ $hits, $miss, $perc ) .
575
+ // __( 'Hits', 'wp-photo-album-plus' ) . ': ' . $perc . '% ' .
576
+ '</p>';
577
+ }
578
+ echo '
579
+ </div>';
580
+ }
581
+ else {
582
+ echo '
583
+ <div class="wrap" >' .
584
+ __( 'No cachefiles to remove.', 'wp-photo-album-plus' ) . '
585
+ </div>';
586
+ }
587
+ }
588
+
589
+ function wppa_cache_display_format( $text ) {
590
+
591
+ $text = trim( $text, '.' );
592
+ if ( ! wppa_is_enum( $text ) ) {
593
+ return $text;
594
+ }
595
+
596
+ $text = wppa_compress_enum( $text );
597
+ $text = str_replace( '..', '-', $text );
598
+ $text = str_replace( '.', ' ', $text );
599
+ $text = str_replace( '-', '..', $text );
600
+ return $text;
601
  }
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version 8.0.08.006
7
  *
8
  */
9
 
@@ -189,9 +189,9 @@ global $other_deps;
189
  }
190
 
191
  // Void caching types
192
- $void_cache = array( 'landing',
193
- 'upload' );
194
- if ( in_array( $atts['type'], $void_cache ) ) {
195
  $wppa['cache'] = '0';
196
  }
197
 
@@ -237,34 +237,50 @@ global $other_deps;
237
  $type = $atts['type'];
238
 
239
  // Delay?
240
- $void_delay = array( 'upload',
241
- 'tagcloud',
242
- 'multitag',
243
- 'bestof',
244
- 'superview',
245
- 'search',
246
- 'supersearch',
247
- 'choice',
248
- 'stereo',
249
- );
 
 
 
 
 
 
 
250
  switch( wppa_opt( 'delay_overrule' ) ) {
251
 
252
  case 'always':
253
- if ( ! in_array( $type, $void_delay ) ) {
254
- $atts['delay'] = 'yes';
255
- }
256
- else {
257
  $atts['delay'] = '';
258
  }
 
 
 
 
 
259
  break;
260
  case 'never':
261
  $atts['delay'] = '';
262
  break;
263
  default:
264
  if ( $atts['delay'] ) {
265
- if ( in_array( $type, $void_delay ) ) {
266
  wppa_you_can_not( 'delay', $type );
267
- $atts['delay'] = '';
 
 
 
 
 
 
268
  }
269
  }
270
  break;
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
189
  }
190
 
191
  // Void caching types
192
+ $void_cache_types = array( 'landing',
193
+ 'upload' );
194
+ if ( in_array( $atts['type'], $void_cache_types ) ) {
195
  $wppa['cache'] = '0';
196
  }
197
 
237
  $type = $atts['type'];
238
 
239
  // Delay?
240
+ $void_delay_types = array( 'upload',
241
+ 'tagcloud',
242
+ 'multitag',
243
+ 'bestof',
244
+ 'superview',
245
+ 'search',
246
+ 'supersearch',
247
+ 'choice',
248
+ 'stereo',
249
+ 'grid',
250
+ );
251
+ $void_delay_albums = array( '#me',
252
+ '#upldr',
253
+ '#owner',
254
+ '#potd',
255
+ );
256
+
257
  switch( wppa_opt( 'delay_overrule' ) ) {
258
 
259
  case 'always':
260
+ $atts['delay'] = 'yes';
261
+ if ( in_array( $type, $void_delay_types ) ) {
 
 
262
  $atts['delay'] = '';
263
  }
264
+ foreach( $void_delay_albums as $va ) {
265
+ if ( strpos( $atts['album'], $va ) !== false ) {
266
+ $atts['delay'] = false;
267
+ }
268
+ }
269
  break;
270
  case 'never':
271
  $atts['delay'] = '';
272
  break;
273
  default:
274
  if ( $atts['delay'] ) {
275
+ if ( in_array( $type, $void_delay_types ) ) {
276
  wppa_you_can_not( 'delay', $type );
277
+ $atts['delay'] = false;
278
+ }
279
+ foreach( $void_delay_albums as $va ) {
280
+ if ( strpos( $atts['album'], $va ) !== false ) {
281
+ wppa_you_can_not( 'delay', $va );
282
+ $atts['delay'] = false;
283
+ }
284
  }
285
  }
286
  break;
wppa-input.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
- * Version 8.0.08.006
7
  *
8
  */
9
 
@@ -211,6 +211,7 @@ function wppa_get_get_filter( $name ) {
211
  case 'import-ajax-file':
212
  case 'import-submit':
213
  case 'delete':
 
214
  $result = 'text';
215
  break;
216
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
211
  case 'import-ajax-file':
212
  case 'import-submit':
213
  case 'delete':
214
+ case 'cache':
215
  $result = 'text';
216
  break;
217
 
wppa-multitag-widget.php CHANGED
@@ -66,7 +66,7 @@ class MultitagPhotos extends WP_Widget {
66
 
67
  // Cache?
68
  if ( $cache ) {
69
- wppa_put_contents( $cachefile, $result );
70
  update_option( 'wppa_cache_misses', get_option( 'wppa_cache_misses', 0 ) +1 );
71
  }
72
 
66
 
67
  // Cache?
68
  if ( $cache ) {
69
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'photos' => '*'] );
70
  update_option( 'wppa_cache_misses', get_option( 'wppa_cache_misses', 0 ) +1 );
71
  }
72
 
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -75,7 +75,8 @@ global $wppa_error;
75
  upload_limit_tree tinytext NOT NULL,
76
  scheduledel tinytext NOT NULL,
77
  status tinytext NOT NULL,
78
- PRIMARY KEY (id)
 
79
  ) DEFAULT CHARACTER SET utf8;";
80
 
81
  $create_photos = "CREATE TABLE $wpdb->wppa_photos (
@@ -202,6 +203,7 @@ global $wppa_error;
202
  filename tinytext NOT NULL,
203
  albums text NOT NULL,
204
  photos text NOT NULL,
 
205
  other tinytext NOT NULL,
206
  PRIMARY KEY (id)
207
  ) DEFAULT CHARACTER SET utf8;";
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
75
  upload_limit_tree tinytext NOT NULL,
76
  scheduledel tinytext NOT NULL,
77
  status tinytext NOT NULL,
78
+ PRIMARY KEY (id),
79
+ KEY parentkey (a_parent)
80
  ) DEFAULT CHARACTER SET utf8;";
81
 
82
  $create_photos = "CREATE TABLE $wpdb->wppa_photos (
203
  filename tinytext NOT NULL,
204
  albums text NOT NULL,
205
  photos text NOT NULL,
206
+ page bigint(20) NOT NULL,
207
  other tinytext NOT NULL,
208
  PRIMARY KEY (id)
209
  ) DEFAULT CHARACTER SET utf8;";
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.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -121,9 +121,6 @@ class SlideshowWidget extends WP_Widget {
121
  return;
122
  }
123
 
124
- // Reset runtime parameters
125
- wppa_reset_occurrance();
126
-
127
  // Show text below the slideshow
128
  if ( __( $instance['subtext'] ) ) {
129
  $widget_content .=
@@ -150,9 +147,13 @@ class SlideshowWidget extends WP_Widget {
150
 
151
  // Cache?
152
  if ( $cache ) {
 
153
  wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
154
  }
155
 
 
 
 
156
  wppa( 'in_widget', false );
157
  }
158
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a slideshow in the sidebar
6
+ * Version 8.0.08.007
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
121
  return;
122
  }
123
 
 
 
 
124
  // Show text below the slideshow
125
  if ( __( $instance['subtext'] ) ) {
126
  $widget_content .=
147
 
148
  // Cache?
149
  if ( $cache ) {
150
+ wppa('in_widget', 'slide');
151
  wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
152
  }
153
 
154
+ // Reset runtime parameters
155
+ wppa_reset_occurrance();
156
+
157
  wppa( 'in_widget', false );
158
  }
159
 
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.0.08.004
7
  *
8
  */
9
 
@@ -574,6 +574,7 @@ global $wpdb;
574
  'albums' => '',
575
  'photos' => '',
576
  'other' => '',
 
577
  ));
578
 
579
  // Sanitize args
@@ -584,9 +585,10 @@ global $wpdb;
584
  if ( $other != 'C' && $other != 'R' ) {
585
  $other = '';
586
  }
 
587
 
588
  // Insert into db
589
- $query = $wpdb->prepare( "INSERT INTO $wpdb->wppa_caches (filename, albums, photos, other) VALUES(%s, %s, %s, %s)", $filename, $albums, $photos, $other );
590
  $iret = $wpdb->query( $query );
591
  }
592
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 8.0.08.007
7
  *
8
  */
9
 
574
  'albums' => '',
575
  'photos' => '',
576
  'other' => '',
577
+ 'page' => '0',
578
  ));
579
 
580
  // Sanitize args
585
  if ( $other != 'C' && $other != 'R' ) {
586
  $other = '';
587
  }
588
+ $page = $args['page'];
589
 
590
  // Insert into db
591
+ $query = $wpdb->prepare( "INSERT INTO $wpdb->wppa_caches (filename, albums, photos, other, page) VALUES(%s, %s, %s, %s, %d)", $filename, $albums, $photos, $other, $page );
592
  $iret = $wpdb->query( $query );
593
  }
594
 
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.0.08.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,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '8.0.08.006'; // 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.0.08.007
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.0.08.007'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30