WP Photo Album Plus - Version 8.0.08.006

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

Code changes from version 8.0.08.005 to 8.0.08.006

changelog.txt CHANGED
@@ -6,6 +6,9 @@ WP Photo Album Plus Changelog
6
  * Fixed film thumbnail titles.
7
  * Calendars (non real) did no longer work. Fixed.
8
  * Fixed erroneously stripped tags in descriptions.
 
 
 
9
 
10
  = 8.0.07 =
11
 
6
  * Fixed film thumbnail titles.
7
  * Calendars (non real) did no longer work. Fixed.
8
  * Fixed erroneously stripped tags in descriptions.
9
+ * New settings Advanced settings -> System -> Items 41: Caching overrule and 42: Delay overrule.
10
+ To globally overrule the shortcode and widget settings.
11
+ There are 3 options: 1. do not overrule, 2. always as possible and 3. never.
12
 
13
  = 8.0.07 =
14
 
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.001
7
  *
8
  */
9
 
@@ -287,7 +287,7 @@ function wppa_clear_wppa_cache() {
287
  </table>';
288
 
289
  if ( wppa_get( 'delete' ) ) {
290
- wppa_clear_cache( array( 'force' => true ) );
291
  echo '<br><b>' . sprintf( __( '%d cachefiles deleted', 'wp-photo-album-plus' ), $count ) . '</br>';
292
  }
293
  else {
@@ -425,7 +425,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( array( '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.006
7
  *
8
  */
9
 
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 {
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' );
wppa-admins-choice-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the admins-choice widget
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -27,37 +27,12 @@ class AdminsChoice extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = $instance['cache'];
31
- $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
34
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
35
  return;
36
  }
37
 
38
- // Cache?
39
- if ( $cache ) {
40
-
41
- if ( wppa_is_file( $cachefile ) ) {
42
-
43
- // Cache expired?
44
- if ( $cache != 'inf' && wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
45
- wppa_remove_widget_cache( $this->id );
46
- }
47
-
48
- // No, use it
49
- else {
50
- echo wppa_get_contents( $cachefile );
51
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
52
- echo wppa_widget_timer( 'show', $widget_title, true );
53
- wppa( 'in_widget', false );
54
- return;
55
- }
56
- }
57
- }
58
-
59
- // Other inits
60
-
61
  // Make the widget content
62
  if ( ! wppa_opt( 'admins_choice' ) == 'none' ) {
63
  $widget_content = __( 'This feature is not enabled', 'wp-photo-album-plus' );
@@ -81,11 +56,6 @@ class AdminsChoice extends WP_Widget {
81
  echo wppa_compress_html( $result );
82
  echo wppa_widget_timer( 'show', $widget_title );
83
 
84
- // Cache?
85
- if ( $cache ) {
86
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
87
- }
88
-
89
  wppa( 'in_widget', false );
90
  }
91
 
@@ -124,12 +94,6 @@ class AdminsChoice extends WP_Widget {
124
  // Loggedin only
125
  echo
126
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
127
-
128
- // Cache
129
- // Do not cache this widget
130
- // echo
131
- // wppa_widget_cache( $this, $instance['cache'] );
132
-
133
  }
134
 
135
  // Set defaults
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the admins-choice widget
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
30
 
31
  // Logged in only and logged out?
32
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
33
  return;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  // Make the widget content
37
  if ( ! wppa_opt( 'admins_choice' ) == 'none' ) {
38
  $widget_content = __( 'This feature is not enabled', 'wp-photo-album-plus' );
56
  echo wppa_compress_html( $result );
57
  echo wppa_widget_timer( 'show', $widget_title );
58
 
 
 
 
 
 
59
  wppa( 'in_widget', false );
60
  }
61
 
94
  // Loggedin only
95
  echo
96
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
 
 
 
 
 
 
97
  }
98
 
99
  // Set defaults
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 8.0.08.002
6
  *
7
  */
8
 
@@ -1374,7 +1374,7 @@ global $wppa;
1374
  AND user = %s
1375
  LIMIT 1", $rating, $photo, $user ) );
1376
 
1377
- wppa_clear_cache( array( 'photo' => $photo, 'other' => 'R' ) );
1378
 
1379
  if ( $iret === false ) {
1380
  echo '0||103||' . $errtxt;
@@ -1484,7 +1484,7 @@ global $wppa;
1484
  wppa_test_for_medal( $photo );
1485
 
1486
  // Success!
1487
- wppa_clear_cache( array( 'photo' => $photo ) );
1488
 
1489
  if ( wppa_switch( 'vote_needs_comment' ) && ! $hascommented ) {
1490
  $message = __( "Please explain your vote in a comment.\nYour vote will be discarded if you don't.\n\nAfter completing your comment,\nyou can refresh the page to see\nyour vote became effective." , 'wp-photo-album-plus');
@@ -1541,8 +1541,8 @@ global $wppa;
1541
  $album = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM $wpdb->wppa_photos
1542
  WHERE id = %d", $photo ) );
1543
  wppa_delete_photo( $photo );
1544
- wppa_clear_cache( array( 'photo' => $photo ) );
1545
- wppa_clear_cache( array( 'album' => $album ) );
1546
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photo;
1547
  echo '||1||<span style="color:red" >' . sprintf( __( 'Photo %s has been deleted' , 'wp-photo-album-plus'), '<a href="'.$edit_link.'" target="_blank" >' . $photo . '</a>' ) . '</span>';
1548
  echo '||';
@@ -1601,7 +1601,7 @@ global $wppa;
1601
  echo '||1||<span style="color:red" >'.sprintf( __( 'Could not undelete photo %s' , 'wp-photo-album-plus'), $photo ).'</span>';
1602
  }
1603
  }
1604
- wppa_clear_cache( array( 'force' => true ) );
1605
  wppa_clear_taglist();
1606
  break;
1607
 
@@ -1953,7 +1953,7 @@ global $wppa;
1953
  echo '||2||'.sprintf( __( 'An error occurred while trying to update %s of album %s' , 'wp-photo-album-plus'), $itemname, htmlentities( $album ) );
1954
  echo '<br>'.__( 'Press CTRL+F5 and try again.' , 'wp-photo-album-plus');
1955
  }
1956
- wppa_clear_cache( array( 'album' => $album ) );
1957
  wppa_exit();
1958
  break;
1959
  /* The next 2 items should be recoded to update photo items. See wppa-photo-admin.php */
@@ -3178,7 +3178,7 @@ global $wppa;
3178
  $output = '||0||'.esc_attr( $title ).'||';
3179
 
3180
  echo $output;
3181
- wppa_clear_cache( array( 'qr' => true ) );
3182
  wppa_exit();
3183
  break; // End update qr setting
3184
  }
@@ -3911,7 +3911,7 @@ global $wppa;
3911
  if ( $option != 'wppa_heartbeat' &&
3912
  $option != 'wppa_errorlog_purge' &&
3913
  substr( $option, 0, 9 ) != 'wppa_log_' ) {
3914
- wppa_clear_cache( array( 'force' => true ) );
3915
  }
3916
  wppa_exit();
3917
  break; // End update-option
@@ -4130,7 +4130,7 @@ function wppa_json_photo_update( $id, $txt, $err = '0', $thumbmod = false, $phot
4130
  }
4131
 
4132
  // Clear cache
4133
- wppa_clear_cache( array( 'photo' => $id ) );
4134
 
4135
  // Build JSON data
4136
  $data = array();
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 8.0.08.006
6
  *
7
  */
8
 
1374
  AND user = %s
1375
  LIMIT 1", $rating, $photo, $user ) );
1376
 
1377
+ wppa_clear_cache( ['photo' => $photo, 'other' => 'R'] );
1378
 
1379
  if ( $iret === false ) {
1380
  echo '0||103||' . $errtxt;
1484
  wppa_test_for_medal( $photo );
1485
 
1486
  // Success!
1487
+ wppa_clear_cache( ['photo' => $photo] );
1488
 
1489
  if ( wppa_switch( 'vote_needs_comment' ) && ! $hascommented ) {
1490
  $message = __( "Please explain your vote in a comment.\nYour vote will be discarded if you don't.\n\nAfter completing your comment,\nyou can refresh the page to see\nyour vote became effective." , 'wp-photo-album-plus');
1541
  $album = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM $wpdb->wppa_photos
1542
  WHERE id = %d", $photo ) );
1543
  wppa_delete_photo( $photo );
1544
+ wppa_clear_cache( ['photo' => $photo] );
1545
+ wppa_clear_cache( ['album' => $album] );
1546
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photo;
1547
  echo '||1||<span style="color:red" >' . sprintf( __( 'Photo %s has been deleted' , 'wp-photo-album-plus'), '<a href="'.$edit_link.'" target="_blank" >' . $photo . '</a>' ) . '</span>';
1548
  echo '||';
1601
  echo '||1||<span style="color:red" >'.sprintf( __( 'Could not undelete photo %s' , 'wp-photo-album-plus'), $photo ).'</span>';
1602
  }
1603
  }
1604
+ wppa_clear_cache( ['force' => true] );
1605
  wppa_clear_taglist();
1606
  break;
1607
 
1953
  echo '||2||'.sprintf( __( 'An error occurred while trying to update %s of album %s' , 'wp-photo-album-plus'), $itemname, htmlentities( $album ) );
1954
  echo '<br>'.__( 'Press CTRL+F5 and try again.' , 'wp-photo-album-plus');
1955
  }
1956
+ wppa_clear_cache( ['album' => $album] );
1957
  wppa_exit();
1958
  break;
1959
  /* The next 2 items should be recoded to update photo items. See wppa-photo-admin.php */
3178
  $output = '||0||'.esc_attr( $title ).'||';
3179
 
3180
  echo $output;
3181
+ wppa_clear_cache( ['qr' => true] );
3182
  wppa_exit();
3183
  break; // End update qr setting
3184
  }
3911
  if ( $option != 'wppa_heartbeat' &&
3912
  $option != 'wppa_errorlog_purge' &&
3913
  substr( $option, 0, 9 ) != 'wppa_log_' ) {
3914
+ wppa_clear_cache( ['force' => true] );
3915
  }
3916
  wppa_exit();
3917
  break; // End update-option
4130
  }
4131
 
4132
  // Clear cache
4133
+ wppa_clear_cache( ['photo' => $id] );
4134
 
4135
  // Build JSON data
4136
  $data = array();
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.0.08.001
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
@@ -27,7 +27,7 @@ class AlbumNavigatorWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
@@ -85,7 +85,7 @@ class AlbumNavigatorWidget extends WP_Widget {
85
  if ( $cache ) {
86
  global $albums_used;
87
  $albums_used = '*';
88
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
89
  }
90
 
91
  wppa( 'in_widget', false );
@@ -164,7 +164,6 @@ class AlbumNavigatorWidget extends WP_Widget {
164
  // Cache
165
  echo
166
  wppa_widget_checkbox( $this, 'cache', $instance['cache'], __( 'Cache this widget', 'wp-photo-album-plus' ) );
167
-
168
  }
169
 
170
  function get_widget_id() {
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
+ * Version 8.0.08.006
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
85
  if ( $cache ) {
86
  global $albums_used;
87
  $albums_used = '*';
88
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
89
  }
90
 
91
  wppa( 'in_widget', false );
164
  // Cache
165
  echo
166
  wppa_widget_checkbox( $this, 'cache', $instance['cache'], __( 'Cache this widget', 'wp-photo-album-plus' ) );
 
167
  }
168
 
169
  function get_widget_id() {
wppa-album-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
- * Version 8.0.08.005
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -28,7 +28,7 @@ class AlbumWidget extends WP_Widget {
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
- $cache = ! is_admin() && $instance['cache'];
32
  $cachefile = wppa_get_widget_cache_path( $this->id );
33
  $void = wppa_void_albums();
34
 
@@ -383,8 +383,8 @@ class AlbumWidget extends WP_Widget {
383
  echo wppa_compress_html( $result );
384
 
385
  // Cache?
386
- if ( wppa_checked( $instance['cache'] ) ) {
387
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
388
  }
389
 
390
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
+ * Version 8.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
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
 
383
  echo wppa_compress_html( $result );
384
 
385
  // Cache?
386
+ if ( $cache ) {
387
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
388
  }
389
 
390
  wppa( 'in_widget', false );
wppa-bestof-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the best rated photos
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -29,7 +29,7 @@ class BestOfWidget extends WP_Widget {
29
  extract( $args );
30
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
- $cache = ! is_admin() && $instance['cache'];
33
  $cachefile = wppa_get_widget_cache_path( $this->id );
34
 
35
  // Logged in only and logged out?
@@ -92,7 +92,7 @@ class BestOfWidget extends WP_Widget {
92
 
93
  // Cache?
94
  if ( $cache ) {
95
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
96
  }
97
 
98
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the best rated photos
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
29
  extract( $args );
30
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
+ $cache = wppa_cache_widget( $instance['cache'] );
33
  $cachefile = wppa_get_widget_cache_path( $this->id );
34
 
35
  // Logged in only and logged out?
92
 
93
  // Cache?
94
  if ( $cache ) {
95
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'other' => 'R'] );
96
  }
97
 
98
  wppa( 'in_widget', false );
wppa-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
- /* Version 8.0.08.004
7
  */
8
 
9
  // Test for caching
@@ -57,7 +57,17 @@ global $wppa_lang;
57
  if ( ! wppa_is_dir ( $root ) ) {
58
  wppa_mktree( $root );
59
  }
60
- $cache_file = $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . ( wppa_user_is( 'administrator' ) ? 'admin-' : '' ) . ( wppa_is_mobile() ? 'mobile-' : '' ) . $cache_id;
 
 
 
 
 
 
 
 
 
 
61
 
62
  // Cachefile present?
63
  if ( wppa_is_file( $cache_file ) ) {
@@ -94,6 +104,12 @@ global $albums_used;
94
  global $photos_used;
95
  global $other_deps;
96
 
 
 
 
 
 
 
97
  // Fill in defaults
98
  $defaults = array( 'file' => '',
99
  'data' => '',
@@ -223,7 +239,7 @@ global $wpdb;
223
  // Album based
224
  if ( $album != '' ) {
225
 
226
- $query = "SELECT filename FROM $wpdb->wppa_caches WHERE albums LIKE '%.$album.%' OR albums = '*'";
227
  $files = $wpdb->get_col( $query );
228
  foreach( $files as $file ) {
229
  $path = str_replace( '...', WPPA_CONTENT_PATH, $file );
@@ -231,13 +247,13 @@ global $wpdb;
231
  wppa_unlink( $path, true );
232
  }
233
  }
234
- $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE albums LIKE '%.$album.%' OR albums = '*'" );
235
  }
236
 
237
  // Photo based
238
  if ( $photo != '' ) {
239
 
240
- $query = "SELECT filename FROM $wpdb->wppa_caches WHERE photos LIKE '%.$photo.%' OR photos = '*'";
241
  $files = $wpdb->get_col( $query );
242
  foreach( $files as $file ) {
243
  $path = str_replace( '...', WPPA_CONTENT_PATH, $file );
@@ -245,7 +261,7 @@ global $wpdb;
245
  wppa_unlink( $path, true );
246
  }
247
  }
248
- $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE photos LIKE '%.$photo.%' OR photos = '*'" );
249
  }
250
 
251
  // All albums
@@ -376,8 +392,20 @@ global $wppa_lang;
376
  if ( ! wppa_is_dir( $root ) ) {
377
  wppa_mktree( $root );
378
  }
 
 
 
 
 
379
 
380
- return $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . ( wppa_user_is( 'administrator' ) ? 'admin-' : '' ) . $widget_id;
 
 
 
 
 
 
 
381
  }
382
 
383
  // Remove cache files for a certrain widget
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
+ /* Version 8.0.08.006
7
  */
8
 
9
  // Test for caching
57
  if ( ! wppa_is_dir ( $root ) ) {
58
  wppa_mktree( $root );
59
  }
60
+ $login = ( is_user_logged_in() ? 'log-' : '' );
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?
73
  if ( wppa_is_file( $cache_file ) ) {
104
  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' => '',
115
  'data' => '',
239
  // Album based
240
  if ( $album != '' ) {
241
 
242
+ $query = "SELECT filename FROM $wpdb->wppa_caches WHERE albums LIKE '%.$album.%' OR albums = '.*.'";
243
  $files = $wpdb->get_col( $query );
244
  foreach( $files as $file ) {
245
  $path = str_replace( '...', WPPA_CONTENT_PATH, $file );
247
  wppa_unlink( $path, true );
248
  }
249
  }
250
+ $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE albums LIKE '%.$album.%' OR albums = '.*.'" );
251
  }
252
 
253
  // Photo based
254
  if ( $photo != '' ) {
255
 
256
+ $query = "SELECT filename FROM $wpdb->wppa_caches WHERE photos LIKE '%.$photo.%' OR photos = '.*.'";
257
  $files = $wpdb->get_col( $query );
258
  foreach( $files as $file ) {
259
  $path = str_replace( '...', WPPA_CONTENT_PATH, $file );
261
  wppa_unlink( $path, true );
262
  }
263
  }
264
+ $wpdb->query( "DELETE FROM $wpdb->wppa_caches WHERE photos LIKE '%.$photo.%' OR photos = '.*.'" );
265
  }
266
 
267
  // All albums
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
 
411
  // Remove cache files for a certrain widget
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.0.08.005
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -28,7 +28,7 @@ class wppaCommentWidget extends WP_Widget {
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
- $cache = ! is_admin() && $instance['cache'];
32
  $cachefile = wppa_get_widget_cache_path( $this->id );
33
 
34
  // Logged in only and logged out?
@@ -130,7 +130,7 @@ class wppaCommentWidget extends WP_Widget {
130
 
131
  // Cache?
132
  if ( $cache ) {
133
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'other' => 'C' ) );
134
  }
135
 
136
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the recent commets on photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
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?
130
 
131
  // Cache?
132
  if ( $cache ) {
133
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'other' => 'C'] );
134
  }
135
 
136
  wppa( 'in_widget', false );
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 8.0.07.004
7
  *
8
  */
9
 
@@ -521,6 +521,8 @@ horizrailenabled:false,";
521
  'wppa_album_use_gallery' => 'no',
522
  'wppa_zoom_on' => 'no',
523
  'wppa_fs_policy' => 'lightbox',
 
 
524
 
525
  // B Full size and Slideshow
526
  'wppa_fullvalign' => 'center',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
521
  'wppa_album_use_gallery' => 'no',
522
  'wppa_zoom_on' => 'no',
523
  'wppa_fs_policy' => 'lightbox',
524
+ 'wppa_cache_overrule' => 'default',
525
+ 'wppa_delay_overrule' => 'default',
526
 
527
  // B Full size and Slideshow
528
  'wppa_fullvalign' => 'center',
wppa-featen-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
- * Version 8.0.08.005
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -29,7 +29,7 @@ class FeaTenWidget extends WP_Widget {
29
  extract( $args );
30
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
- $cache = ! is_admin() && $instance['cache'];
33
  $cachefile = wppa_get_widget_cache_path( $this->id );
34
 
35
  // Logged in only and logged out?
@@ -200,7 +200,7 @@ class FeaTenWidget extends WP_Widget {
200
 
201
  // Cache?
202
  if ( $cache ) {
203
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'photos' => '*' ) );
204
  }
205
 
206
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
29
  extract( $args );
30
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
+ $cache = wppa_cache_widget( $instance['cache'] );
33
  $cachefile = wppa_get_widget_cache_path( $this->id );
34
 
35
  // Logged in only and logged out?
200
 
201
  // Cache?
202
  if ( $cache ) {
203
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'photos' => '*'] );
204
  }
205
 
206
  wppa( 'in_widget', false );
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.004
7
  *
8
  */
9
 
@@ -135,7 +135,7 @@ global $other_deps;
135
  $wppa_current_shortcode = wppa_get_shortcode( 'wppa', $xatts );
136
  $wppa_no_timer = false;
137
 
138
- $atts = shortcode_atts( array(
139
  'type' => 'generic',
140
  'album' => '',
141
  'photo' => '',
@@ -159,7 +159,7 @@ global $other_deps;
159
  'month' => '',
160
  'cache' => '',
161
  'login' => '',
162
- ), $xatts );
163
 
164
  // Login requested?
165
  if ( $atts['login'] == 'yes' && ! is_user_logged_in() ) {
@@ -177,17 +177,36 @@ global $other_deps;
177
  }
178
 
179
  // Caching?
180
- $wppa['cache'] = ! in_array( $atts['cache'], array( '', '0', 'off', 'no' ) );
181
- if ( $wppa['cache'] && $atts['type'] == 'generic' ) {
182
- $temp = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE a_parent = 0 ORDER BY id" );
183
- $albums_used = implode( '.', $temp );
 
 
 
 
 
184
  }
185
 
186
- // Never use caching on a landing page
187
- if ( $atts['type'] == 'landing' ) {
 
 
188
  $wppa['cache'] = '0';
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  // Find occur
192
  if ( wppa_get_the_ID() != $wppa_postid ) { // New post
193
  $wppa['mocc'] = '0'; // Init this occurance
@@ -217,21 +236,38 @@ global $other_deps;
217
  // Find type
218
  $type = $atts['type'];
219
 
220
- // Delay and delay not possible?
221
- if ( $atts['delay'] ) {
222
- if ( in_array( $type, array( 'upload',
223
- 'tagcloud',
224
- 'multitag',
225
- 'bestof',
226
- 'superview',
227
- 'search',
228
- 'supersearch',
229
- 'choice',
230
- 'stereo',
231
- ) ) ) {
232
- wppa_you_can_not( 'delay', $type );
 
 
 
 
 
 
 
 
 
233
  $atts['delay'] = '';
234
- }
 
 
 
 
 
 
 
 
235
  }
236
 
237
  // Displatch on type
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
135
  $wppa_current_shortcode = wppa_get_shortcode( 'wppa', $xatts );
136
  $wppa_no_timer = false;
137
 
138
+ $atts = shortcode_atts( [
139
  'type' => 'generic',
140
  'album' => '',
141
  'photo' => '',
159
  'month' => '',
160
  'cache' => '',
161
  'login' => '',
162
+ ], $xatts );
163
 
164
  // Login requested?
165
  if ( $atts['login'] == 'yes' && ! is_user_logged_in() ) {
177
  }
178
 
179
  // Caching?
180
+ switch( wppa_opt( 'cache_overrule' ) ) {
181
+ case 'always':
182
+ $wppa['cache'] = true;
183
+ break;
184
+ case 'never':
185
+ $wppa['cache'] = false;
186
+ break;
187
+ default:
188
+ $wppa['cache'] = ! in_array( $atts['cache'], array( '', '0', 'off', 'no' ) );
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
 
198
+ // Void caching virtual albums / photos
199
+ if ( strpos( $atts['album'], '#me' ) !== false ) $wppa['cache'] = '0';
200
+ if ( strpos( $atts['album'], '#owner' ) !== false ) $wppa['cache'] = '0';
201
+ if ( strpos( $atts['album'], '#upldr' ) !== false ) $wppa['cache'] = '0';
202
+ if ( strpos( $atts['photo'], '#potd' ) !== false ) $wppa['cache'] = '0';
203
+
204
+ // Assume all toplevel albums used when generic
205
+ if ( $wppa['cache'] && $atts['type'] == 'generic' ) {
206
+ $temp = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE a_parent = 0 ORDER BY id" );
207
+ $albums_used = implode( '.', $temp );
208
+ }
209
+
210
  // Find occur
211
  if ( wppa_get_the_ID() != $wppa_postid ) { // New post
212
  $wppa['mocc'] = '0'; // Init this occurance
236
  // Find type
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;
271
  }
272
 
273
  // Displatch on type
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.0.08.004
7
  *
8
  */
9
 
@@ -278,7 +278,7 @@ global $other_deps;
278
 
279
  // Cache?
280
  if ( $caching ) {
281
- wppa_save_cache_file( array( 'file' => $cache_file, 'data' => $out ) );
282
  }
283
 
284
  // Done
@@ -971,7 +971,7 @@ global $other_deps;
971
 
972
  // Cache?
973
  if ( $caching ) {
974
- wppa_save_cache_file( array( 'file' => $cache_file, 'data' => $out ) );
975
  }
976
 
977
  // Reset
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
278
 
279
  // Cache?
280
  if ( $caching ) {
281
+ wppa_save_cache_file( ['file' => $cache_file, 'data' => $out] );
282
  }
283
 
284
  // Done
971
 
972
  // Cache?
973
  if ( $caching ) {
974
+ wppa_save_cache_file( ['file' => $cache_file, 'data' => $out] );
975
  }
976
 
977
  // Reset
wppa-gp-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * A text widget that interpretes wppa shortcodes
6
  *
7
- * Version 8.0.08.001
8
  */
9
 
10
  class WppaGpWidget extends WP_Widget {
@@ -24,7 +24,7 @@ class WppaGpWidget extends WP_Widget {
24
  extract( $args );
25
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
26
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
27
- $cache = ! is_admin() && $instance['cache'];
28
  $cachefile = wppa_get_widget_cache_path( $this->id );
29
 
30
  // Logged in only and logged out?
@@ -74,7 +74,7 @@ class WppaGpWidget extends WP_Widget {
74
 
75
  // Cache?
76
  if ( $cache ) {
77
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
78
  }
79
 
80
  wppa( 'in_widget', false );
4
  *
5
  * A text widget that interpretes wppa shortcodes
6
  *
7
+ * Version 8.0.08.006
8
  */
9
 
10
  class WppaGpWidget extends WP_Widget {
24
  extract( $args );
25
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
26
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
27
+ $cache = wppa_cache_widget( $instance['cache'] );
28
  $cachefile = wppa_get_widget_cache_path( $this->id );
29
 
30
  // Logged in only and logged out?
74
 
75
  // Cache?
76
  if ( $cache ) {
77
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
78
  }
79
 
80
  wppa( 'in_widget', false );
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.005
7
  *
8
  */
9
 
@@ -210,6 +210,7 @@ function wppa_get_get_filter( $name ) {
210
  case 'update-check':
211
  case 'import-ajax-file':
212
  case 'import-submit':
 
213
  $result = 'text';
214
  break;
215
 
@@ -367,15 +368,6 @@ global $wpdb;
367
  break;
368
  }
369
 
370
- /*
371
- // Start debug
372
- $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 );
373
- $from = 'From : '.basename( $stack[0]['file'] ).' line: '.$stack[0]['line'].' in function '.$stack[1]['function'];
374
- $text = 'Query arg '.$oxname.' requested. Raw data = '.var_export($value, true).', filtered by '.$filter.', returned '.var_export( $result, true );//.' '.$from;
375
- wppa_dbg_msg( $text, 'purple' );
376
- wppa_dump( $text );
377
- // End debug
378
- */
379
  return $result;
380
  }
381
 
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
 
210
  case 'update-check':
211
  case 'import-ajax-file':
212
  case 'import-submit':
213
+ case 'delete':
214
  $result = 'text';
215
  break;
216
 
368
  break;
369
  }
370
 
 
 
 
 
 
 
 
 
 
371
  return $result;
372
  }
373
 
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.0.08.005
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
@@ -27,7 +27,7 @@ class LasTenWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
@@ -211,7 +211,7 @@ class LasTenWidget extends WP_Widget {
211
 
212
  // Cache?
213
  if ( $cache ) {
214
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'albums' => '*', 'photos' => '*' ) );
215
  }
216
 
217
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the last uploaded photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
211
 
212
  // Cache?
213
  if ( $cache ) {
214
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'albums' => '*', 'photos' => '*'] );
215
  }
216
 
217
  wppa( 'in_widget', false );
wppa-links.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Frontend links
6
 
7
- * Version 8.0.07.017
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -101,6 +101,11 @@ global $wppa_locale;
101
  else $pl .= 'debug='.wppa( 'debug' ).'&amp;';
102
  }
103
 
 
 
 
 
 
104
  return $pl;
105
  }
106
 
@@ -185,6 +190,10 @@ global $wppa_runtime_settings;
185
  if ( wppa( 'debug' ) ) {
186
  $al .= '&amp;debug=' . wppa( 'debug' );
187
  }
 
 
 
 
188
 
189
  if ( is_array( $wppa_runtime_settings ) ) {
190
  foreach( array_keys( $wppa_runtime_settings ) as $key ) {
4
  *
5
  * Frontend links
6
 
7
+ * Version 8.0.06.006
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
101
  else $pl .= 'debug='.wppa( 'debug' ).'&amp;';
102
  }
103
 
104
+ if ( wppa( 'cache' ) ) {
105
+ if ( $key == 'js' ) $pl .= 'cache=1&';
106
+ else $pl .= '&amp;cache=1';
107
+ }
108
+
109
  return $pl;
110
  }
111
 
190
  if ( wppa( 'debug' ) ) {
191
  $al .= '&amp;debug=' . wppa( 'debug' );
192
  }
193
+
194
+ if ( wppa( 'cache' ) ) {
195
+ $al .= '&amp;cache=1';
196
+ }
197
 
198
  if ( is_array( $wppa_runtime_settings ) ) {
199
  foreach( array_keys( $wppa_runtime_settings ) as $key ) {
wppa-multitag-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the multitag widget
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -27,7 +27,7 @@ class MultitagPhotos extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the multitag widget
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
wppa-potd-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the photo of the day widget
6
- * Version 8.0.08.001
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -28,23 +28,12 @@ class PhotoOfTheDay extends WP_Widget {
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
- $cache = ! is_admin() && $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() ) {
36
  return;
37
  }
38
 
39
- // Cache?
40
- if ( $cache && wppa_is_file( $cachefile ) ) {
41
- echo wppa_get_contents( $cachefile );
42
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
43
- echo wppa_widget_timer( 'show', $widget_title, true );
44
- wppa( 'in_widget', false );
45
- return;
46
- }
47
-
48
  // get the photo ($image)
49
  $image = wppa_get_potd();
50
 
@@ -229,11 +218,6 @@ class PhotoOfTheDay extends WP_Widget {
229
  }
230
  echo wppa_widget_timer( 'show', $widget_title );
231
 
232
- // Cache?
233
- if ( $image && $cache ) {
234
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
235
- }
236
-
237
  wppa( 'in_widget', false );
238
  }
239
 
@@ -265,10 +249,6 @@ class PhotoOfTheDay extends WP_Widget {
265
  echo
266
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
267
 
268
- // Cache
269
- echo
270
- wppa_widget_checkbox( $this, 'cache', $instance['cache'], __( 'Cache this widget', 'wp-photo-album-plus' ) );
271
-
272
  // Explanation
273
  echo
274
  '<p>' .
@@ -281,7 +261,6 @@ class PhotoOfTheDay extends WP_Widget {
281
 
282
  $defaults = array( 'title' => __('Photo of the day', 'wp-photo-album-plus'),
283
  'logonly' => 'no',
284
- 'cache' => '0',
285
  );
286
  return $defaults;
287
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the photo of the day widget
6
+ * Version 8.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
31
 
32
  // Logged in only and logged out?
33
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
34
  return;
35
  }
36
 
 
 
 
 
 
 
 
 
 
37
  // get the photo ($image)
38
  $image = wppa_get_potd();
39
 
218
  }
219
  echo wppa_widget_timer( 'show', $widget_title );
220
 
 
 
 
 
 
221
  wppa( 'in_widget', false );
222
  }
223
 
249
  echo
250
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
251
 
 
 
 
 
252
  // Explanation
253
  echo
254
  '<p>' .
261
 
262
  $defaults = array( 'title' => __('Photo of the day', 'wp-photo-album-plus'),
263
  'logonly' => 'no',
 
264
  );
265
  return $defaults;
266
  }
wppa-qr-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display qr code
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -27,31 +27,12 @@ class wppaQRWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
- $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
34
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
35
  return;
36
  }
37
 
38
- // Cache?
39
- if ( $cache && wppa_is_file( $cachefile ) ) {
40
- echo wppa_get_contents( $cachefile );
41
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
42
- echo wppa_widget_timer( 'show', $widget_title, true );
43
- wppa( 'in_widget', false );
44
- return;
45
- }
46
-
47
- // Other inits
48
- $qrsrc = 'http' . ( is_ssl() ? 's' : '' ) . '://api.qrserver.com/v1/create-qr-code/' .
49
- '?format=svg' .
50
- '&size='. wppa_opt( 'qr_size' ).'x'.wppa_opt( 'qr_size' ) .
51
- '&color='.trim( wppa_opt( 'qr_color' ), '#' ) .
52
- '&bgcolor='.trim( wppa_opt( 'qr_bgcolor' ), '#' ) .
53
- '&data=' . urlencode( $_SERVER['SCRIPT_URI'] );
54
-
55
  // Get the qrcode
56
  $qrsrc = wppa_create_qrcode_cache( $_SERVER['SCRIPT_URI'], wppa_opt( 'qr_size' ) );
57
 
@@ -96,11 +77,6 @@ class wppaQRWidget extends WP_Widget {
96
  echo wppa_compress_html( $result );
97
  echo wppa_widget_timer( 'show', $widget_title );
98
 
99
- // Cache?
100
- if ( $cache ) {
101
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
102
- }
103
-
104
  wppa( 'in_widget', false );
105
 
106
  }
@@ -114,8 +90,6 @@ class wppaQRWidget extends WP_Widget {
114
  // Sanitize certain args
115
  $instance['title'] = strip_tags( $instance['title'] );
116
 
117
- wppa_remove_widget_cache( $this->id );
118
-
119
  return $instance;
120
  }
121
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display qr code
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
30
 
31
  // Logged in only and logged out?
32
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
33
  return;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  // Get the qrcode
37
  $qrsrc = wppa_create_qrcode_cache( $_SERVER['SCRIPT_URI'], wppa_opt( 'qr_size' ) );
38
 
77
  echo wppa_compress_html( $result );
78
  echo wppa_widget_timer( 'show', $widget_title );
79
 
 
 
 
 
 
80
  wppa( 'in_widget', false );
81
 
82
  }
90
  // Sanitize certain args
91
  $instance['title'] = strip_tags( $instance['title'] );
92
 
 
 
93
  return $instance;
94
  }
95
 
wppa-search-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the search widget
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -30,7 +30,7 @@ class SearchPhotos extends WP_Widget {
30
  extract( $args );
31
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
32
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
33
- $cache = ! is_admin() && $instance['cache'];
34
  $cachefile = wppa_get_widget_cache_path( $this->id );
35
 
36
  // Logged in only and logged out?
@@ -71,7 +71,7 @@ class SearchPhotos extends WP_Widget {
71
 
72
  // Cache?
73
  if ( $cache ) {
74
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'albums' => '*' ) );
75
  }
76
 
77
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the search widget
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
30
  extract( $args );
31
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
32
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
33
+ $cache = wppa_cache_widget( $instance['cache'] );
34
  $cachefile = wppa_get_widget_cache_path( $this->id );
35
 
36
  // Logged in only and logged out?
71
 
72
  // Cache?
73
  if ( $cache ) {
74
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'albums' => '*'] );
75
  }
76
 
77
  wppa( 'in_widget', false );
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.0.08.005
7
  *
8
  */
9
 
@@ -6827,6 +6827,30 @@ global $wppa_subtab_names;
6827
  $html = wppa_select($slug, $opts, $vals, '');
6828
  wppa_setting_new($slug, '40', $name, $desc, $html, $help);
6829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6830
  wppa_setting_box_footer_new();
6831
  }
6832
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
6827
  $html = wppa_select($slug, $opts, $vals, '');
6828
  wppa_setting_new($slug, '40', $name, $desc, $html, $help);
6829
 
6830
+ $name = __('Caching overrule', 'wp-photo-album-plus');
6831
+ $desc = __('Overrule caching settings in shortcodes and widgets', 'wp-photo-album-plus');
6832
+ $help = '';
6833
+ $slug = 'wppa_cache_overrule';
6834
+ $opts = array(__('Do not overrule', 'wp-photo-album-plus'),
6835
+ __('Cache whenever possible', 'wp-photo-album-plus'),
6836
+ __('Never cache', 'wp-photo-album-plus'),
6837
+ );
6838
+ $vals = array('default', 'always', 'never');
6839
+ $html = wppa_select($slug, $opts, $vals, '');
6840
+ wppa_setting_new($slug, '41', $name, $desc, $html, $help);
6841
+
6842
+ $name = __('Delay overrule', 'wp-photo-album-plus');
6843
+ $desc = __('Overrule delay settings in shortcodes', 'wp-photo-album-plus');
6844
+ $help = '';
6845
+ $slug = 'wppa_delay_overrule';
6846
+ $opts = array(__('Do not overrule', 'wp-photo-album-plus'),
6847
+ __('Delay whenever possible', 'wp-photo-album-plus'),
6848
+ __('Never delay', 'wp-photo-album-plus'),
6849
+ );
6850
+ $vals = array('default', 'always', 'never');
6851
+ $html = wppa_select($slug, $opts, $vals, '');
6852
+ wppa_setting_new($slug, '42', $name, $desc, $html, $help);
6853
+
6854
  wppa_setting_box_footer_new();
6855
  }
6856
  }
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.001
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -34,7 +34,7 @@ class SlideshowWidget extends WP_Widget {
34
  $album = $instance['album'];
35
  $page = in_array( wppa_opt( 'slideonly_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' :
36
  wppa_get_the_landing_page( 'slideonly_widget_linkpage', __( 'Widget landing page', 'wp-photo-album-plus' ) );
37
- $cache = $instance['cache'];
38
  $cachefile = wppa_get_widget_cache_path( $this->id );
39
  $widget_content = '';
40
 
@@ -150,7 +150,7 @@ class SlideshowWidget extends WP_Widget {
150
 
151
  // Cache?
152
  if ( $cache ) {
153
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
154
  }
155
 
156
  wppa( 'in_widget', false );
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" );
34
  $album = $instance['album'];
35
  $page = in_array( wppa_opt( 'slideonly_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' :
36
  wppa_get_the_landing_page( 'slideonly_widget_linkpage', __( 'Widget landing page', 'wp-photo-album-plus' ) );
37
+ $cache = wppa_cache_widget( $instance['cache'] );
38
  $cachefile = wppa_get_widget_cache_path( $this->id );
39
  $widget_content = '';
40
 
150
 
151
  // Cache?
152
  if ( $cache ) {
153
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
154
  }
155
 
156
  wppa( 'in_widget', false );
wppa-stats-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the stats widget
6
- * Version 8.0.08.001
7
  *
8
  */
9
  class WppaStatsWidget extends WP_Widget {
@@ -26,8 +26,6 @@ class WppaStatsWidget extends WP_Widget {
26
  extract( $args );
27
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
28
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
29
- $cache = ! is_admin() && $instance['cache'];
30
- $cachefile = wppa_get_widget_cache_path( $this->id );
31
  $widget_content = '';
32
 
33
  // Logged in only and logged out?
@@ -35,18 +33,6 @@ class WppaStatsWidget extends WP_Widget {
35
  return;
36
  }
37
 
38
- /* Can not cache this widget */
39
- /*
40
- // Cache?
41
- if ( $cache && wppa_is_file( $cachefile ) ) {
42
- echo wppa_get_contents( $cachefile );
43
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
44
- echo wppa_widget_timer( 'show', $widget_title, true );
45
- wppa( 'in_widget', false );
46
- return;
47
- }
48
- */
49
-
50
  // Make the widget content
51
  if ( wppa_checked( $instance['ip'] ) ) {
52
  $widget_content .= __('Your ip is', 'wp-photo-album-plus') . ': <b>'.$_SERVER['REMOTE_ADDR'].'</b><br />';
@@ -147,13 +133,6 @@ class WppaStatsWidget extends WP_Widget {
147
  echo wppa_compress_html( $result );
148
  echo wppa_widget_timer( 'show', $widget_title );
149
 
150
- /*
151
- // Cache?
152
- if ( $cache ) {
153
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
154
- }
155
- */
156
-
157
  wppa( 'in_widget', false );
158
  }
159
 
@@ -305,11 +284,6 @@ class WppaStatsWidget extends WP_Widget {
305
  $instance['logonly'],
306
  __( 'Show to logged in visitors only', 'wp-photo-album-plus' )
307
  );
308
-
309
- // Cache
310
- // echo
311
- // wppa_widget_checkbox( $this, 'cache', $instance['cache'], __( 'Cache this widget', 'wp-photo-album-plus' ) );
312
-
313
  }
314
 
315
  // Set defaults
@@ -331,7 +305,6 @@ class WppaStatsWidget extends WP_Widget {
331
  'comments' => 'no',
332
  'rating' => 'no',
333
  'logonly' => 'no',
334
- 'cache' => '0',
335
  );
336
  return $defaults;
337
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the stats widget
6
+ * Version 8.0.08.006
7
  *
8
  */
9
  class WppaStatsWidget extends WP_Widget {
26
  extract( $args );
27
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
28
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
29
  $widget_content = '';
30
 
31
  // Logged in only and logged out?
33
  return;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  // Make the widget content
37
  if ( wppa_checked( $instance['ip'] ) ) {
38
  $widget_content .= __('Your ip is', 'wp-photo-album-plus') . ': <b>'.$_SERVER['REMOTE_ADDR'].'</b><br />';
133
  echo wppa_compress_html( $result );
134
  echo wppa_widget_timer( 'show', $widget_title );
135
 
 
 
 
 
 
 
 
136
  wppa( 'in_widget', false );
137
  }
138
 
284
  $instance['logonly'],
285
  __( 'Show to logged in visitors only', 'wp-photo-album-plus' )
286
  );
 
 
 
 
 
287
  }
288
 
289
  // Set defaults
305
  'comments' => 'no',
306
  'rating' => 'no',
307
  'logonly' => 'no',
 
308
  );
309
  return $defaults;
310
  }
wppa-super-view-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * ask the album / display you want
6
- * Version 8.0.08.001
7
  */
8
 
9
 
@@ -27,7 +27,7 @@ class WppaSuperView extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
@@ -63,7 +63,7 @@ class WppaSuperView extends WP_Widget {
63
 
64
  // Cache?
65
  if ( $cache ) {
66
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'albums' => '*' ) );
67
  }
68
 
69
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * ask the album / display you want
6
+ * Version 8.0.08.006
7
  */
8
 
9
 
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
63
 
64
  // Cache?
65
  if ( $cache ) {
66
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'albums' => '*'] );
67
  }
68
 
69
  wppa( 'in_widget', false );
wppa-tagcloud-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the tagcloud widget
6
- * Version 8.0.08.001
7
  *
8
  */
9
 
@@ -27,7 +27,7 @@ class TagcloudPhotos extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
@@ -69,7 +69,7 @@ class TagcloudPhotos extends WP_Widget {
69
 
70
  // Cache?
71
  if ( $cache ) {
72
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'photos' => '*' ) );
73
  }
74
 
75
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the tagcloud widget
6
+ * Version 8.0.08.006
7
  *
8
  */
9
 
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
69
 
70
  // Cache?
71
  if ( $cache ) {
72
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'photos' => '*'] );
73
  }
74
 
75
  wppa( 'in_widget', false );
wppa-thumbnail-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail photos
6
- * Version 8.0.08.003
7
  */
8
 
9
  class ThumbnailWidget extends WP_Widget {
@@ -27,7 +27,7 @@ class ThumbnailWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
- $cache = ! is_admin() && $instance['cache'];
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
@@ -160,7 +160,7 @@ class ThumbnailWidget extends WP_Widget {
160
 
161
  // Cache?
162
  if ( $cache ) {
163
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
164
  }
165
 
166
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  class ThumbnailWidget extends WP_Widget {
27
  extract( $args );
28
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
29
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
30
+ $cache = wppa_cache_widget( $instance['cache'] );
31
  $cachefile = wppa_get_widget_cache_path( $this->id );
32
 
33
  // Logged in only and logged out?
160
 
161
  // Cache?
162
  if ( $cache ) {
163
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result] );
164
  }
165
 
166
  wppa( 'in_widget', false );
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.0.08.004
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
@@ -41,7 +41,7 @@ class TopTenWidget extends WP_Widget {
41
  $medalsonly = wppa_checked( $instance['medalsonly'] ) ? 'yes' : false;
42
  $showowner = wppa_checked( $instance['showowner'] ) ? 'yes' : false;
43
  $showalbum = wppa_checked( $instance['showalbum'] ) ? 'yes' : false;
44
- $cache = ! is_admin() && $instance['cache'];
45
  $cachefile = wppa_get_widget_cache_path( $this->id );
46
 
47
  // Logged in only and logged out?
@@ -50,24 +50,12 @@ class TopTenWidget extends WP_Widget {
50
  }
51
 
52
  // Cache?
53
- if ( $cache ) {
54
-
55
- if ( wppa_is_file( $cachefile ) ) {
56
-
57
- // Cache expired?
58
- if ( $cache != 'inf' && wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
59
- wppa_remove_widget_cache( $this->id );
60
- }
61
-
62
- // No, use it
63
- else {
64
- echo wppa_get_contents( $cachefile );
65
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
66
- echo wppa_widget_timer( 'show', $widget_title, true );
67
- wppa( 'in_widget', false );
68
- return;
69
- }
70
- }
71
  }
72
 
73
  // Make the widget content
@@ -543,7 +531,7 @@ class TopTenWidget extends WP_Widget {
543
  // Cache?
544
  if ( $cache ) {
545
 
546
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'other' => 'R' ) );
547
  }
548
 
549
  wppa( 'in_widget', false );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
41
  $medalsonly = wppa_checked( $instance['medalsonly'] ) ? 'yes' : false;
42
  $showowner = wppa_checked( $instance['showowner'] ) ? 'yes' : false;
43
  $showalbum = wppa_checked( $instance['showalbum'] ) ? 'yes' : false;
44
+ $cache = wppa_cache_widget( $instance['cache'] );
45
  $cachefile = wppa_get_widget_cache_path( $this->id );
46
 
47
  // Logged in only and logged out?
50
  }
51
 
52
  // Cache?
53
+ if ( $cache && wppa_is_file( $cachefile ) ) {
54
+ echo wppa_get_contents( $cachefile );
55
+ update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
56
+ echo wppa_widget_timer( 'show', $widget_title, true );
57
+ wppa( 'in_widget', false );
58
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
  // Make the widget content
531
  // Cache?
532
  if ( $cache ) {
533
 
534
+ wppa_save_cache_file( ['file' => $cachefile, 'data' => $result, 'other' => 'R'] );
535
  }
536
 
537
  wppa( 'in_widget', false );
wppa-upldr-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
- * Version 8.0.08.003
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -28,23 +28,12 @@ class UpldrWidget extends WP_Widget {
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
- $cache = ! is_admin() && $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() ) {
36
  return;
37
  }
38
 
39
- // Cache?
40
- if ( $cache && wppa_is_file( $cachefile ) ) {
41
- echo wppa_get_contents( $cachefile );
42
- update_option( 'wppa_cache_hits', get_option( 'wppa_cache_hits', 0 ) +1 );
43
- echo wppa_widget_timer( 'show', $widget_title, true );
44
- wppa( 'in_widget', false );
45
- return;
46
- }
47
-
48
  $page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus'));
49
  $ignorelist = explode(',', $instance['ignore']);
50
  $upldrcache = wppa_get_upldr_cache();
@@ -187,11 +176,6 @@ class UpldrWidget extends WP_Widget {
187
  echo wppa_compress_html( $result );
188
  echo wppa_widget_timer( 'show', $widget_title );
189
 
190
- // Cache?
191
- if ( $cache ) {
192
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result, 'photos' => '*', 'albums' => '*' ) );
193
- }
194
-
195
  wppa( 'in_widget', false );
196
 
197
  }
@@ -291,10 +275,6 @@ class UpldrWidget extends WP_Widget {
291
  // Loggedin only
292
  echo
293
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
294
-
295
- // Cache
296
- echo
297
- wppa_widget_checkbox( $this, 'cache', $instance['cache'], __( 'Cache this widget', 'wp-photo-album-plus' ) );
298
  }
299
 
300
  function get_widget_id() {
@@ -313,7 +293,6 @@ class UpldrWidget extends WP_Widget {
313
  'showownercount' => '',
314
  'showphotocount' => '',
315
  'logonly' => 'no',
316
- 'cache' => '0',
317
  );
318
  return $defaults;
319
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
+ * Version 8.0.08.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
28
  extract( $args );
29
  $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
31
 
32
  // Logged in only and logged out?
33
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
34
  return;
35
  }
36
 
 
 
 
 
 
 
 
 
 
37
  $page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus'));
38
  $ignorelist = explode(',', $instance['ignore']);
39
  $upldrcache = wppa_get_upldr_cache();
176
  echo wppa_compress_html( $result );
177
  echo wppa_widget_timer( 'show', $widget_title );
178
 
 
 
 
 
 
179
  wppa( 'in_widget', false );
180
 
181
  }
275
  // Loggedin only
276
  echo
277
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
 
 
 
 
278
  }
279
 
280
  function get_widget_id() {
293
  'showownercount' => '',
294
  'showphotocount' => '',
295
  'logonly' => 'no',
 
296
  );
297
  return $defaults;
298
  }
wppa-upload-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * A wppa widget to upload photos
6
  *
7
- * Version 8.0.08.001
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
@@ -97,9 +97,8 @@ class WppaUploadWidget extends WP_Widget {
97
 
98
  // Cache?
99
  if ( $cache ) {
100
- global $albums_used;
101
- $albums_used = $album ? $album : '*';
102
- wppa_save_cache_file( array( 'file' => $cachefile, 'data' => $result ) );
103
  }
104
 
105
  wppa( 'in_widget', false );
@@ -148,7 +147,7 @@ class WppaUploadWidget extends WP_Widget {
148
  $defaults = array( 'title' => __( 'Upload Photos', 'wp-photo-album-plus' ),
149
  'album' => '0',
150
  'logonly' => 'no',
151
- 'cache' => '0',
152
  );
153
  return $defaults;
154
  }
4
  *
5
  * A wppa widget to upload photos
6
  *
7
+ * Version 8.0.08.006
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
97
 
98
  // Cache?
99
  if ( $cache ) {
100
+ wppa_put_contents( $cachefile, $result );
101
+ update_option( 'wppa_cache_misses', get_option( 'wppa_cache_misses', 0 ) +1 );
 
102
  }
103
 
104
  wppa( 'in_widget', false );
147
  $defaults = array( 'title' => __( 'Upload Photos', 'wp-photo-album-plus' ),
148
  'album' => '0',
149
  'logonly' => 'no',
150
+ 'cache' => '0',
151
  );
152
  return $defaults;
153
  }
wppa-widget-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
- /* Version 8.0.08.001
6
  /*
7
  */
8
 
@@ -609,4 +609,21 @@ static $time;
609
  wppa_log( 'err', 'Unimplemented key in wppa_widget_timer (' . $key . ')' );
610
  break;
611
  }
612
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
+ /* Version 8.0.08.006
6
  /*
7
  */
8
 
609
  wppa_log( 'err', 'Unimplemented key in wppa_widget_timer (' . $key . ')' );
610
  break;
611
  }
612
+ }
613
+
614
+ // Cache this widget?
615
+ function wppa_cache_widget( $instance_cache ) {
616
+
617
+ if ( is_admin() ) return false;
618
+
619
+ switch( wppa_opt( 'cache_overrule' ) ) {
620
+ case 'always':
621
+ return true;
622
+ break;
623
+ case 'never':
624
+ return false;
625
+ break;
626
+ default:
627
+ return $instance_cache;
628
+ }
629
+ }
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.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.0.08.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.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
 
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