WP Photo Album Plus - Version 7.3.02.007

Version Description

= 7.3.02 =

  • This version addresses various bug fixes and feature requests.

= 7.3.01 =

  • This version addresses various bug fixes, feature requests and performance enhancements.

= 7.3.00 =

  • This version addresses various bug fixes and performance enhancements.

= 7.2.14 =

  • This version addresses various bug fixes and feature requests.

= 7.2.13 =

  • This version addresses various bug fixes and feature requests.

= 7.2.12 =

  • This version addresses various bug fixes and feature requests.

= 7.2.11 =

  • This version addresses various bug fixes and feature requests.

= 7.2.10 =

  • This version addresses various bug fixes and feature requests.

= 7.2.09 =

  • This version addresses various bug fixes and feature requests.

= 7.2.08 =

  • This version addresses various bug fixes.

= 7.2.07 =

  • This version addresses various bug fixes.

= 7.2.06 =

  • This version addresses various bug fixes and feature requests.
  • This version addresses various security issues.

= 7.2.05 =

  • This version addresses various bug fixes and feature requests.
  • This version addresses various security issues.

= 7.2.04 =

  • This version addresses various bug fixes and feature requests.

= 7.2.03 =

  • This version addresses various bug fixes and feature requests.

= 7.2.02 =

  • This version addresses various bug fixes and feature requests.

= 7.2.01 =

  • This version addresses various bug fixes and feature requests.

= 7.2.00 =

  • This version addresses various bug fixes and feature requests.

= 7.1.11 =

  • This version addresses various bug fixes and feature requests.

= 7.1.10 =

  • This version addresses various bug fixes and feature requests.

= 7.1.09 =

  • This version addresses various bug fixes and feature requests.

= 7.1.08 =

  • This version addresses various bug fixes and feature requests.

= 7.1.07 =

  • This version addresses various bug fixes and feature requests.

= 7.1.06 =

  • This version addresses various bug fixes and feature requests.

= 7.1.05 =

  • This version addresses various security issues.
  • This version addresses various bug fixes.

= 7.1.04 =

  • This version addresses various bug fixes.

= 7.1.03 =

  • This version addresses various security issues.
  • This version addresses various bug fixes.

= 7.1.02 =

  • This version addresses various security issues.
  • This version addresses various bug fixes and feature requests.

= 7.1.01 =

  • This version addresses various bug fixes and feature requests.

= 7.1.00 =

  • This version addresses various bug fixes and feature requests.
  • The Photo Album -> Upload Photos and Import Photos admin pages have been substantially improved. Read the changelog for details.

= 7.0.11 =

  • This version addresses various bug fixes and feature requests.

= 7.0.11 =

  • This version addresses various bug fixes

= 7.0.10 =

  • This version addresses various bug fixes

= 7.0.09 =

  • This version addresses various security issues.
  • This version addresses various bug fixes and feature requests.

= 7.0.08 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.07 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.06 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.05 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 7.0.04 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.03 =

  • This version addresses various minor bug fixes and feature requests.

= 7.0.02 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.01 =

  • This version addresses various minor bug fixes and feature requests.

= 7.0.00 =

  • Shortcode generators for Gutenberg added.
  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.
  • To prevent spamming and give the users the opportunity to decide when they want us to email them, the mailing system has been revised. Configure Table IX-M to enable various mailing lists, and use the WPPA+ Notify widget for full user flexibility.

= 6.9.21 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 6.9.20 =

  • This version addresses various bug fixes

= 6.9.19 =

  • This version addresses various minor bug fixes

= 6.9.18 =

  • This version addresses various minor bug fixes

= 6.9.17 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.16 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.15 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.14 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.13 =

  • Security release.

= 6.9.12 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.11 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.10 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.09 =

  • Panorama support phase III.

= 6.9.08 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase II.

= 6.9.07 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase I.

= 6.9.06 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.05 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.04 =

  • This version addresses various minor bug fixes and feature requests.
  • Local CDN functionality has been added.

= 6.9.03 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.02 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.01 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.00 =

  • This version includes the code for the privacy policy requirements.

= 6.8.09

  • This version addresses various bug fixes and code edits.

= 6.8.08 =

  • This version addresses various minor bug fixes and feature requests.
  • This version offers substantial performance improvements when the box in Table IV-A13: Defer Javascript is ticked. This setting is now recommended and set ticked as the default.
  • For more info on performance improvements and compatibility with optimizers: see the changelog.txt

= 6.8.07 =

  • This version addresses various minor bug fixes and enhancements, and a new widget: Statistics.

= 6.8.06 =

  • This version addresses various minor bug fixes and improved cache handling.

= 6.8.05 =

  • This version addresses various minor bug fixes and feture requests.

= 6.8.04 =

  • This version addresses various display issues and a few fixes of bugs that seldom affected the plugins behaviour.
Download this release

Release Info

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

Code changes from version 7.3.01.007 to 7.3.02.007

changelog.txt CHANGED
@@ -1,5 +1,20 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 7.3.01 =
4
 
5
  * New setting: Table II-B1.2 Renew on Filmonly. Adds a renew link to the start/stop navigationbar on the slideonly display. Requires Table II-B1.1 (Start/Stop on filmonly) and Table IV-A1.0 (use Ajax) being checked.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.3.02 =
4
+
5
+ * New setting: Table IX-A11.1: Show minimum tags only. Shows only the tags defined in Table IX-A11 in the selection box on the photo admin page.
6
+ Note that it is recommended to tick Table VII-C9: New tags restricted, if you want to prevent the creation of new tags by non-adminstrators.
7
+ * New feature: Smartt caching.
8
+ 1. The widgets have an extra option on the activation screen to enable caching of the widget content.
9
+ The cache expiration time can be selected between 5 and 60 minutes at widget activation.
10
+ The widgets QR, Notify, Stereo, Admins choice have no caching option because it is unwanted or useless.
11
+ 2. Shortcode caching. All wppa shortcodes except type="landing" can have an extra attribumte: cache="".
12
+ The value betweeen the double quotes may be a number between 5 and 60, meaning the expiration time of the cache file.
13
+ Both types of cache files will be 'smart' cleared prior to the expiration time when needed.
14
+ On top of this, the Photo Albums admin menu has an extra option to clear all wppa cache instantaneously.
15
+ * New setting: Table IX-A9.7: Log Timings. Logs a.o. widget genberation times and no of queries.
16
+ * The default state of all checkboxes in widget activation dialogs is now unchecked.
17
+
18
  = 7.3.01 =
19
 
20
  * New setting: Table II-B1.2 Renew on Filmonly. Adds a renew link to the start/stop navigationbar on the slideonly display. Requires Table II-B1.1 (Start/Stop on filmonly) and Table IV-A1.0 (use Ajax) being checked.
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 7.3.01.007
6
- Stable tag: 7.3.00.004
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
140
  = 7.3.01 =
141
 
142
  * This version addresses various bug fixes, feature requests and performance enhancements.
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 7.3.02.007
6
+ Stable tag: 7.3.01.007
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
137
 
138
  == Upgrade Notice ==
139
 
140
+ = 7.3.02 =
141
+
142
+ * This version addresses various bug fixes and feature requests.
143
+
144
  = 7.3.01 =
145
 
146
  * This version addresses various bug fixes, feature requests and performance enhancements.
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 7.3.00
7
  *
8
  */
9
 
@@ -56,22 +56,23 @@ function wppa_add_admin() {
56
  add_menu_page( 'WP Photo Album', __('Photo&thinsp;Albums', 'wp-photo-album-plus').$tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url ); //,'10' );
57
 
58
  // parent_slug page_title menu_title capability menu_slug function
59
- add_submenu_page( 'wppa_admin_menu', __('Album Admin', 'wp-photo-album-plus'), __('Album Admin', 'wp-photo-album-plus').$upl_pending,'wppa_admin', 'wppa_admin_menu', 'wppa_admin' );
60
- add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus'), __('Upload Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload' );
61
  // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
62
  if ( ! current_user_can('wppa_admin') && wppa_opt( 'upload_edit') != '-none-' ) {
63
- add_submenu_page( 'wppa_admin_menu', __('Edit Photos', 'wp-photo-album-plus'), __('Edit Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_edit_photo', 'wppa_edit_photo' );
64
  }
65
  add_submenu_page( 'wppa_admin_menu', __('Import Photos', 'wp-photo-album-plus'), __('Import Photos', 'wp-photo-album-plus'), 'wppa_import', 'wppa_import_photos', 'wppa_page_import' );
66
  add_submenu_page( 'wppa_admin_menu', __('Moderate Photos', 'wp-photo-album-plus'), __('Moderate Photos', 'wp-photo-album-plus').(wppa_switch('moderate_bulk')?$upl_pending:$tot_pending), 'wppa_moderate', 'wppa_moderate_photos', 'wppa_page_moderate' );
67
- add_submenu_page( 'wppa_admin_menu', __('Export Photos', 'wp-photo-album-plus'), __('Export Photos', 'wp-photo-album-plus'), 'wppa_export', 'wppa_export_photos', 'wppa_page_export' );
68
- add_submenu_page( 'wppa_admin_menu', __('Settings', 'wp-photo-album-plus'), __('Settings', 'wp-photo-album-plus'), 'wppa_settings', 'wppa_options', 'wppa_page_options' );
69
- add_submenu_page( 'wppa_admin_menu', __('Photo of the day Widget', 'wp-photo-album-plus'), __('Photo of the day', 'wp-photo-album-plus'), 'wppa_potd', 'wppa_photo_of_the_day', 'wppa_sidebar_page_options' );
70
- add_submenu_page( 'wppa_admin_menu', __('Manage comments', 'wp-photo-album-plus'), __('Comments', 'wp-photo-album-plus').$com_pending, 'wppa_comments', 'wppa_manage_comments', 'wppa_comment_admin' );
71
- add_submenu_page( 'wppa_admin_menu', __('Help &amp; Info', 'wp-photo-album-plus'), __('Documentation', 'wp-photo-album-plus'), 'wppa_help', 'wppa_help', 'wppa_page_help' );
72
  if ( wppa_get_option( 'wppa_logfile_on_menu' ) == 'yes' ) {
73
- add_submenu_page( 'wppa_admin_menu', __('Logfile', 'wp-photo-album-plus'), __('Logfile', 'wp-photo-album-plus'), 'administrator', 'wppa_log', 'wppa_log_page' );
74
  }
 
75
  }
76
 
77
  /* ADMIN STYLES */
@@ -189,21 +190,11 @@ function wppa_page_options() {
189
  require_once 'wppa-settings-autosave.php';
190
 
191
  // jQuery Easing for Nicescroller
192
- $easing_url = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js';
193
- $easing_cdn = wp_remote_get( $easing_url );
194
- if ( (int) wp_remote_retrieve_response_code( $easing_cdn ) !== 200 ) {
195
-
196
- $easing_url = WPPA_URL . '/vendor/jquery-easing/jquery.easing.min.js';
197
- }
198
  wp_enqueue_script( 'nicescrollr-easing-min-js', $easing_url, array( 'jquery' ), 'all', true );
199
 
200
  // Nicescroll Library
201
- $nice_url = 'https://cdnjs.cloudflare.com/ajax/libs/jquery.nicescroll/3.7.6/jquery.nicescroll.min.js';
202
- $nice_cdn = wp_remote_get( $nice_url );
203
- if( (int) wp_remote_retrieve_response_code( $nice_cdn ) !== 200 ) {
204
-
205
- $nice_url = WPPA_URL . '/vendor/nicescroll/jquery.nicescroll.min.js';
206
- }
207
  wp_enqueue_script( 'nicescrollr-inc-nicescroll-min-js', $nice_url, array( 'jquery', 'nicescrollr-easing-min-js' ), 'all', true );
208
 
209
  _wppa_page_options();
@@ -224,6 +215,36 @@ function wppa_page_help() {
224
  require_once 'wppa-help.php';
225
  _wppa_page_help();
226
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
  /* GENERAL ADMIN */
229
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 7.3.02
7
  *
8
  */
9
 
56
  add_menu_page( 'WP Photo Album', __('Photo&thinsp;Albums', 'wp-photo-album-plus').$tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url ); //,'10' );
57
 
58
  // parent_slug page_title menu_title capability menu_slug function
59
+ add_submenu_page( 'wppa_admin_menu', __('Album Admin', 'wp-photo-album-plus'), __('Album Admin', 'wp-photo-album-plus').$upl_pending,'wppa_admin', 'wppa_admin_menu', 'wppa_admin' );
60
+ add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus'), __('Upload Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload' );
61
  // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
62
  if ( ! current_user_can('wppa_admin') && wppa_opt( 'upload_edit') != '-none-' ) {
63
+ add_submenu_page( 'wppa_admin_menu', __('Edit Photos', 'wp-photo-album-plus'), __('Edit Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_edit_photo', 'wppa_edit_photo' );
64
  }
65
  add_submenu_page( 'wppa_admin_menu', __('Import Photos', 'wp-photo-album-plus'), __('Import Photos', 'wp-photo-album-plus'), 'wppa_import', 'wppa_import_photos', 'wppa_page_import' );
66
  add_submenu_page( 'wppa_admin_menu', __('Moderate Photos', 'wp-photo-album-plus'), __('Moderate Photos', 'wp-photo-album-plus').(wppa_switch('moderate_bulk')?$upl_pending:$tot_pending), 'wppa_moderate', 'wppa_moderate_photos', 'wppa_page_moderate' );
67
+ add_submenu_page( 'wppa_admin_menu', __('Export Photos', 'wp-photo-album-plus'), __('Export Photos', 'wp-photo-album-plus'), 'wppa_export', 'wppa_export_photos', 'wppa_page_export' );
68
+ add_submenu_page( 'wppa_admin_menu', __('Settings', 'wp-photo-album-plus'), __('Settings', 'wp-photo-album-plus'), 'wppa_settings', 'wppa_options', 'wppa_page_options' );
69
+ add_submenu_page( 'wppa_admin_menu', __('Photo of the day Widget', 'wp-photo-album-plus'), __('Photo of the day', 'wp-photo-album-plus'), 'wppa_potd', 'wppa_photo_of_the_day', 'wppa_sidebar_page_options' );
70
+ add_submenu_page( 'wppa_admin_menu', __('Manage comments', 'wp-photo-album-plus'), __('Comments', 'wp-photo-album-plus').$com_pending, 'wppa_comments', 'wppa_manage_comments', 'wppa_comment_admin' );
71
+ add_submenu_page( 'wppa_admin_menu', __('Help &amp; Info', 'wp-photo-album-plus'), __('Documentation', 'wp-photo-album-plus'), 'wppa_help', 'wppa_help', 'wppa_page_help' );
72
  if ( wppa_get_option( 'wppa_logfile_on_menu' ) == 'yes' ) {
73
+ add_submenu_page( 'wppa_admin_menu', __('Logfile', 'wp-photo-album-plus'), __('Logfile', 'wp-photo-album-plus'), 'administrator', 'wppa_log', 'wppa_log_page' );
74
  }
75
+ add_submenu_page( 'wppa_admin_menu', __('Clear cache', 'wp-photo-album-plus'), __('Clear cache', 'wp-photo-album-plus'), 'wppa_admin', 'wppa_clear_cache', 'wppa_clear_wppa_cache' );
76
  }
77
 
78
  /* ADMIN STYLES */
190
  require_once 'wppa-settings-autosave.php';
191
 
192
  // jQuery Easing for Nicescroller
193
+ $easing_url = WPPA_URL . '/vendor/jquery-easing/jquery.easing.min.js';
 
 
 
 
 
194
  wp_enqueue_script( 'nicescrollr-easing-min-js', $easing_url, array( 'jquery' ), 'all', true );
195
 
196
  // Nicescroll Library
197
+ $nice_url = WPPA_URL . '/vendor/nicescroll/jquery.nicescroll.min.js';
 
 
 
 
 
198
  wp_enqueue_script( 'nicescrollr-inc-nicescroll-min-js', $nice_url, array( 'jquery', 'nicescrollr-easing-min-js' ), 'all', true );
199
 
200
  _wppa_page_options();
215
  require_once 'wppa-help.php';
216
  _wppa_page_help();
217
  }
218
+ // Clear cache
219
+ function wppa_clear_wppa_cache() {
220
+
221
+ echo '<h1>' . __( 'Clear WPPA Cache', 'wp-photo-album-plus' ) . '</h1>';
222
+
223
+ $sc_files = array();
224
+ $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
225
+ if ( wppa_is_dir( $root ) ) {
226
+ $sc_files = wppa_glob( $root . '/*' );
227
+ }
228
+
229
+ $wg_files = array();
230
+ $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-widget';
231
+ if ( wppa_is_dir( $root ) ) {
232
+ $wg_files = wppa_glob( $root . '/*' );
233
+ }
234
+
235
+ $files = array_merge( $sc_files, $wg_files );
236
+ if ( count( $files ) ) {
237
+ foreach( $files as $file ) {
238
+ $pfile = '...' . str_replace( dirname( dirname( dirname( dirname( $file ) ) ) ), '', $file );
239
+ $dtm = wppa_local_date( '', wppa_filetime( $file ) );
240
+ echo sprintf( __( 'Removing cachefile %s, created at %s', 'wp-photo-album-plus' ), $pfile, $dtm ) . '<br />';
241
+ wppa_unlink( $file );
242
+ }
243
+ }
244
+ else {
245
+ _e( 'No cachefiles to remove.', 'wp-photo-album-plus' );
246
+ }
247
+ }
248
 
249
  /* GENERAL ADMIN */
250
 
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 7.3.00
7
  *
8
  */
9
 
@@ -114,6 +114,14 @@ function wppa_admin_bar_menu() {
114
  }
115
  }
116
 
 
 
 
 
 
 
 
 
117
  // Add top-level item
118
  $wp_admin_bar->add_menu( array(
119
  'id' => $wppaplus,
3
  * Package: wp-photo-album-plus
4
  *
5
  * enhances the admin bar with wppa+ menu
6
+ * Version 7.3.02
7
  *
8
  */
9
 
114
  }
115
  }
116
 
117
+ if ( current_user_can( 'administrator' ) ) {
118
+ $menu_items['cache'] = array(
119
+ 'parent' => $wppaplus,
120
+ 'title' => __( 'Clear cache', 'wp-photo-album-plus' ),
121
+ 'href' => admin_url( 'admin.php?page=wppa_clear_cache' )
122
+ );
123
+ }
124
+
125
  // Add top-level item
126
  $wp_admin_bar->add_menu( array(
127
  'id' => $wppaplus,
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 7.0.00
7
  *
8
  */
9
 
@@ -19,56 +19,86 @@ class AdminsChoice extends WP_Widget {
19
  function widget($args, $instance) {
20
  global $widget_content;
21
 
22
- wppa_initialize_runtime();
23
-
24
- wppa( 'in_widget', 'admins-choice' );
 
25
  wppa_bump_mocc();
26
-
27
  extract( $args );
28
-
29
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Admins Choice', 'wp-photo-album-plus' ), 'logonly' => 'no' ) );
 
 
30
 
31
  // Logged in only and logged out?
32
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
33
  return;
34
  }
35
 
36
- $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
37
 
38
- // Display the widget
39
- echo $before_widget;
40
 
41
- if ( ! empty( $widget_title ) ) {
42
- echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
 
 
 
43
  }
44
 
 
 
 
45
  if ( ! wppa_switch( 'enable_admins_choice' ) ) {
46
- echo
47
- __( 'This feature is not enabled', 'wp-photo-album-plus' );
48
  }
49
  else {
50
- echo
51
  '<div class="wppa-admins-choice-widget" data-wppa="yes" >' .
52
  wppa_get_admins_choice_html( false ) .
53
  '</div>';
54
  }
55
 
56
- echo '<div style="clear:both"></div>';
57
- echo $after_widget;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  wppa( 'in_widget', false );
60
- }
61
 
62
  /** @see WP_Widget::update */
63
  function update( $new_instance, $old_instance ) {
64
 
65
- $instance = $old_instance;
 
66
 
67
- // Defaults
68
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Admins Choice', 'wp-photo-album-plus' ), 'logonly' => 'no' ) );
 
 
69
 
70
- $instance['title'] = strip_tags( $new_instance['title'] );
71
- $instance['logonly'] = $new_instance['logonly'];
72
  return $instance;
73
  }
74
 
@@ -84,7 +114,7 @@ class AdminsChoice extends WP_Widget {
84
  }
85
 
86
  // Defaults
87
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Admins Choice', 'wp-photo-album-plus' ), 'logonly' => 'no' ) );
88
 
89
  // Title
90
  echo
@@ -94,7 +124,23 @@ class AdminsChoice extends WP_Widget {
94
  echo
95
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
96
 
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  } // class AdminsChoice
100
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the admins-choice widget
6
+ * Version 7.3.02
7
  *
8
  */
9
 
19
  function widget($args, $instance) {
20
  global $widget_content;
21
 
22
+ // Initialize
23
+ wppa_widget_timer( 'init' );
24
+ wppa_reset_occurrance();
25
+ wppa( 'in_widget', 'adminchoice' );
26
  wppa_bump_mocc();
 
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 ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
45
+ wppa_remove_widget_cache_path( $this->id );
46
+ }
47
+
48
+ // No, use it
49
+ else {
50
+ echo wppa_get_contents( $cachefile );
51
+ echo wppa_widget_timer( 'show', $widget_title, true );
52
+ wppa( 'in_widget', false );
53
+ return;
54
+ }
55
+ }
56
  }
57
 
58
+ // Other inits
59
+
60
+ // Make the widget content
61
  if ( ! wppa_switch( 'enable_admins_choice' ) ) {
62
+ $widget_content = __( 'This feature is not enabled', 'wp-photo-album-plus' );
 
63
  }
64
  else {
65
+ $widget_content =
66
  '<div class="wppa-admins-choice-widget" data-wppa="yes" >' .
67
  wppa_get_admins_choice_html( false ) .
68
  '</div>';
69
  }
70
 
71
+ $widget_content .= '<div style="clear:both"></div>';
72
+
73
+ // Output
74
+ $result = "\n" . $before_widget;
75
+ if ( ! empty( $widget_title ) ) {
76
+ $result .= $before_title . $widget_title . $after_title;
77
+ }
78
+ $result .= $widget_content . $after_widget;
79
+
80
+ echo $result;
81
+ echo wppa_widget_timer( 'show', $widget_title );
82
+
83
+ // Cache?
84
+ if ( $cache ) {
85
+ wppa_put_contents( $cachefile, $result );
86
+ }
87
 
88
  wppa( 'in_widget', false );
89
+ }
90
 
91
  /** @see WP_Widget::update */
92
  function update( $new_instance, $old_instance ) {
93
 
94
+ // Completize all parms
95
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
96
 
97
+ // Sanitize certain args
98
+ $instance['title'] = strip_tags( $instance['title'] );
99
+
100
+ wppa_remove_widget_cache_path( $this->id );
101
 
 
 
102
  return $instance;
103
  }
104
 
114
  }
115
 
116
  // Defaults
117
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
118
 
119
  // Title
120
  echo
124
  echo
125
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
126
 
127
+ // Cache
128
+ // Do not cache this widget
129
+ // echo
130
+ // wppa_widget_cache( $this, $instance['cache'] );
131
+
132
+ }
133
+
134
+ // Set defaults
135
+ function get_defaults() {
136
+
137
+ $defaults = array( 'title' => __( 'Admins Choice', 'wp-photo-album-plus' ),
138
+ 'logonly' => 'no',
139
+ 'cache' => '0',
140
+ );
141
+ return $defaults;
142
+ }
143
+
144
 
145
  } // class AdminsChoice
146
 
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 7.2.13
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
@@ -11,46 +11,54 @@ class AlbumNavigatorWidget extends WP_Widget {
11
  /** constructor */
12
  function __construct() {
13
 
14
- $widget_ops = array(
15
- 'classname' => 'wppa_album_navigator_widget',
16
- 'description' => __( 'Display hierarchical album navigator', 'wp-photo-album-plus' ),
17
- );
18
-
19
- parent::__construct(
20
- 'wppa_album_navigator_widget',
21
- __( 'WPPA+ Album Navigator', 'wp-photo-album-plus' ),
22
- $widget_ops
23
- );
24
  }
25
 
26
  /** @see WP_Widget::widget */
27
  function widget($args, $instance) {
28
-
29
  global $wpdb;
30
 
31
- wppa_initialize_runtime();
32
- wppa( 'in_widget', 'albnav' );
 
 
33
  wppa_bump_mocc();
34
-
35
  extract( $args );
36
-
37
- $instance = wp_parse_args( (array) $instance, array(
38
- 'title' => __( 'Album Navigator', 'wp-photo-album-plus' ), // Widget title
39
- 'parent' => '0', // Parent album
40
- 'skip' => 'yes', // Skip empty albums
41
- 'logonly' => 'no', // Logged in only?
42
- ) );
43
 
44
  // Logged in only and logged out?
45
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
46
  return;
47
  }
48
 
49
- $widget_title = apply_filters('widget_title', $instance['title']);
 
50
 
51
- $page = wppa_get_the_landing_page('album_navigator_widget_linkpage', __('Photo Albums', 'wp-photo-album-plus'));
52
- $parent = $instance['parent'];
53
- $skip = wppa_checked( $instance['skip'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  // Start widget content
56
  $widget_content = "\n".'<!-- WPPA+ Album Navigator Widget start -->';
@@ -74,34 +82,36 @@ class AlbumNavigatorWidget extends WP_Widget {
74
  $widget_content .= '<div style="clear:both" data-wppa="yes" ></div>';
75
  }
76
 
77
- // End widget content
78
- $widget_content .= "\n".'<!-- WPPA+ Album Navigator Widget end -->';
79
-
80
- echo "\n" . $before_widget;
81
  if ( ! empty( $widget_title ) ) {
82
- echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
 
83
  }
84
- echo $widget_content . $after_widget;
85
 
86
  wppa( 'in_widget', false );
 
87
  }
88
 
89
  /** @see WP_Widget::update */
90
  function update( $new_instance, $old_instance ) {
91
- $instance = $old_instance;
92
-
93
- //Defaults
94
- $instance = wp_parse_args( (array) $instance, array(
95
- 'title' => __( 'Album Navigator', 'wp-photo-album-plus' ),
96
- 'parent' => '0',
97
- 'skip' => 'yes',
98
- 'logonly' => 'no',
99
- ) );
100
-
101
- $instance['title'] = strip_tags( $new_instance['title'] );
102
- $instance['parent'] = $new_instance['parent'];
103
- $instance['skip'] = $new_instance['skip'];
104
- $instance['logonly'] = $new_instance['logonly'];
105
  return $instance;
106
  }
107
 
@@ -109,16 +119,8 @@ class AlbumNavigatorWidget extends WP_Widget {
109
  function form( $instance ) {
110
  global $wpdb;
111
 
112
- //Defaults
113
- $instance = wp_parse_args( (array) $instance, array(
114
- 'title' => __( 'Album Navigator', 'wp-photo-album-plus' ),
115
- 'parent' => '0',
116
- 'skip' => 'yes',
117
- 'logonly' => 'no',
118
- ) );
119
- $parent = $instance['parent'];
120
- $skip = $instance['skip'];
121
- $widget_title = $instance['title'];
122
 
123
  // Title
124
  echo
@@ -147,6 +149,8 @@ class AlbumNavigatorWidget extends WP_Widget {
147
  false,
148
  );
149
  $albs = $wpdb->get_results( "SELECT name, id FROM $wpdb->wppa_albums ORDER BY name", ARRAY_A );
 
 
150
 
151
  if ( $albs ) foreach( $albs as $alb ) {
152
  $options[] = __( stripslashes( $alb['name'] ) );
@@ -166,6 +170,10 @@ class AlbumNavigatorWidget extends WP_Widget {
166
  echo
167
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
168
 
 
 
 
 
169
  }
170
 
171
  function get_widget_id() {
@@ -285,6 +293,18 @@ class AlbumNavigatorWidget extends WP_Widget {
285
  return str_replace( '<ul></ul>', '', $result );
286
  }
287
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  } // class AlbumNavigatorWidget
289
  // register AlbumNavigatorWidget widget
290
  add_action('widgets_init', 'wppa_register_AlbumNavigatorWidget' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
+ * Version 7.3.02
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
11
  /** constructor */
12
  function __construct() {
13
 
14
+ $widget_ops = array( 'classname' => 'wppa_album_navigator_widget', 'description' => __( 'Display hierarchical album navigator', 'wp-photo-album-plus' ), );
15
+ parent::__construct( 'wppa_album_navigator_widget', __( 'WPPA+ Album Navigator', 'wp-photo-album-plus' ), $widget_ops );
 
 
 
 
 
 
 
 
16
  }
17
 
18
  /** @see WP_Widget::widget */
19
  function widget($args, $instance) {
 
20
  global $wpdb;
21
 
22
+ // Initialize
23
+ wppa_widget_timer( 'init' );
24
+ wppa_reset_occurrance();
25
+ wppa( 'in_widget', 'albnav' );
26
  wppa_bump_mocc();
 
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 ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
45
+ wppa_remove_widget_cache_path( $this->id );
46
+ }
47
+
48
+ // No, use it
49
+ else {
50
+ echo wppa_get_contents( $cachefile );
51
+ echo wppa_widget_timer( 'show', $widget_title, true );
52
+ wppa( 'in_widget', false );
53
+ return;
54
+ }
55
+ }
56
+ }
57
+
58
+ // Other inits
59
+ $page = wppa_get_the_landing_page( 'album_navigator_widget_linkpage', __( 'Photo Albums', 'wp-photo-album-plus' ) );
60
+ $parent = $instance['parent'];
61
+ $skip = wppa_checked( $instance['skip'] );
62
 
63
  // Start widget content
64
  $widget_content = "\n".'<!-- WPPA+ Album Navigator Widget start -->';
82
  $widget_content .= '<div style="clear:both" data-wppa="yes" ></div>';
83
  }
84
 
85
+ // Output
86
+ $result = "\n" . $before_widget;
 
 
87
  if ( ! empty( $widget_title ) ) {
88
+ $result .= $before_title . $widget_title . $after_title;
89
+ }
90
+ $result .= $widget_content . $after_widget;
91
+
92
+ echo $result;
93
+ echo wppa_widget_timer( 'show', $widget_title );
94
+
95
+ // Cache?
96
+ if ( $cache ) {
97
+ wppa_put_contents( $cachefile, $result );
98
  }
 
99
 
100
  wppa( 'in_widget', false );
101
+
102
  }
103
 
104
  /** @see WP_Widget::update */
105
  function update( $new_instance, $old_instance ) {
106
+
107
+ // Completize all parms
108
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
109
+
110
+ // Sanitize certain args
111
+ $instance['title'] = strip_tags( $instance['title'] );
112
+
113
+ wppa_remove_widget_cache_path( $this->id );
114
+
 
 
 
 
 
115
  return $instance;
116
  }
117
 
119
  function form( $instance ) {
120
  global $wpdb;
121
 
122
+ // Defaults
123
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
 
 
 
 
 
 
 
 
124
 
125
  // Title
126
  echo
149
  false,
150
  );
151
  $albs = $wpdb->get_results( "SELECT name, id FROM $wpdb->wppa_albums ORDER BY name", ARRAY_A );
152
+ $albs = wppa_add_paths( $albs );
153
+ $albs = wppa_array_sort( $albs, 'name' );
154
 
155
  if ( $albs ) foreach( $albs as $alb ) {
156
  $options[] = __( stripslashes( $alb['name'] ) );
170
  echo
171
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
172
 
173
+ // Cache
174
+ echo
175
+ wppa_widget_cache( $this, $instance['cache'] );
176
+
177
  }
178
 
179
  function get_widget_id() {
293
  return str_replace( '<ul></ul>', '', $result );
294
  }
295
 
296
+ // Set defaults
297
+ function get_defaults() {
298
+
299
+ $defaults = array( 'title' => __( 'Album Navigator', 'wp-photo-album-plus' ),
300
+ 'parent' => '0', // Parent album
301
+ 'skip' => 'no', // Skip empty albums
302
+ 'logonly' => 'no',
303
+ 'cache' => '0',
304
+ );
305
+ return $defaults;
306
+ }
307
+
308
  } // class AlbumNavigatorWidget
309
  // register AlbumNavigatorWidget widget
310
  add_action('widgets_init', 'wppa_register_AlbumNavigatorWidget' );
wppa-album-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
- * Version 7.2.06
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -20,38 +20,64 @@ class AlbumWidget extends WP_Widget {
20
  function widget( $args, $instance ) {
21
  global $wpdb;
22
 
23
- // For widget display at backend: wppa_get_coverphoto_id()
24
- require_once( dirname( __FILE__ ) . '/wppa-album-covers.php' );
 
 
 
 
 
 
 
 
25
 
26
- wppa_initialize_runtime();
 
 
 
27
 
28
- wppa( 'in_widget', 'alb' );
29
- wppa_bump_mocc();
30
 
31
- extract( $args );
 
 
 
 
 
32
 
33
- $instance = wp_parse_args( (array) $instance, array(
34
- 'title' => __( 'Photo Albums' , 'wp-photo-album-plus'), // Widget title
35
- 'parent' => 'none', // Parent album
36
- 'subs' => 'no', // Include subalbums
37
- 'name' => 'no', // Display album name?
38
- 'skip' => 'yes', // Skip empty albums
39
- 'logonly' => 'no',
40
- ) );
 
 
 
 
 
 
 
 
 
41
 
42
  // Logged in only and logged out?
43
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
44
  return;
45
  }
46
 
47
- $widget_title = apply_filters( 'widget_title', $instance['title'] );
48
-
49
- $page = in_array( wppa_opt( 'album_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'album_widget_linkpage', __( 'Photo Albums', 'wp-photo-album-plus' ) );
50
- $max = wppa_opt( 'album_widget_count' ) ? wppa_opt( 'album_widget_count' ) : '10';
51
- $maxw = wppa_opt( 'album_widget_size' );
52
- $maxh = wppa_checked( $instance['name'] ) ? $maxw + 14 + wppa_opt( 'fontsize_widget_thumb' ) : $maxw;
53
- $parent = $instance['parent'];
54
- $subs = wppa_checked( $instance['subs'] );
 
55
 
56
  switch ( $parent ) {
57
  case 'all':
@@ -354,38 +380,35 @@ class AlbumWidget extends WP_Widget {
354
 
355
  $widget_content .= '<div style="clear:both"></div>';
356
 
357
- $widget_content .= '
358
- <!-- WPPA+ thumbnail Widget end -->';
359
 
360
- echo "\n" . $before_widget;
361
  if ( ! empty( $widget_title ) ) {
362
- echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
363
  }
364
- echo $widget_content . $after_widget;
365
 
366
  wppa( 'in_widget', false );
367
  }
368
 
369
  /** @see WP_Widget::update */
370
  function update( $new_instance, $old_instance ) {
371
- $instance = $old_instance;
372
-
373
- //Defaults
374
- $instance = wp_parse_args( (array) $instance, array(
375
- 'title' => __( 'Thumbnail Albums', 'wp-photo-album-plus' ),
376
- 'parent' => '0',
377
- 'subs' => 'no',
378
- 'name' => 'no',
379
- 'skip' => 'yes',
380
- 'logonly' => 'no',
381
- ) );
382
-
383
- $instance['title'] = strip_tags( $new_instance['title'] );
384
- $instance['parent'] = $new_instance['parent'];
385
- $instance['subs'] = $new_instance['subs'];
386
- $instance['name'] = $new_instance['name'];
387
- $instance['skip'] = $new_instance['skip'];
388
- $instance['logonly'] = $new_instance['logonly'];
389
 
390
  return $instance;
391
  }
@@ -394,15 +417,8 @@ class AlbumWidget extends WP_Widget {
394
  function form( $instance ) {
395
  global $wpdb;
396
 
397
- //Defaults
398
- $instance = wp_parse_args( (array) $instance, array(
399
- 'title' => __( 'Thumbnail Albums', 'wp-photo-album-plus' ),
400
- 'parent' => '0',
401
- 'subs' => 'no',
402
- 'name' => 'no',
403
- 'skip' => 'yes',
404
- 'logonly' => 'no',
405
- ) );
406
 
407
  // Widget title
408
  echo
@@ -410,6 +426,9 @@ class AlbumWidget extends WP_Widget {
410
 
411
  // Parent album selection
412
  $albs = $wpdb->get_results( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY name", ARRAY_A );
 
 
 
413
 
414
  $options = array(
415
  __( '--- all albums ---', 'wp-photo-album-plus' ),
@@ -456,12 +475,29 @@ class AlbumWidget extends WP_Widget {
456
  // Loggedin only
457
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) ) .
458
 
 
 
 
459
  '<p>' .
460
  __( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus') .
461
  ' ' . __( 'Table I-F9 and 10', 'wp-photo-album-plus' ) .
462
  '</p>';
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  } // class AlbumWidget
466
 
467
  // register AlbumWidget widget
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
+ * Version 7.3.02
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
20
  function widget( $args, $instance ) {
21
  global $wpdb;
22
 
23
+ // Initialize
24
+ wppa_widget_timer( 'init' );
25
+ wppa_reset_occurrance();
26
+ wppa( 'in_widget', 'alb' );
27
+ wppa_bump_mocc();
28
+ extract( $args );
29
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
+ $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
+ $cache = $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 ) {
41
 
42
+ if ( wppa_is_file( $cachefile ) ) {
43
+
44
+ // Cache expired?
45
+ if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
46
+ wppa_remove_widget_cache_path( $this->id );
47
+ }
48
 
49
+ // No, use it
50
+ else {
51
+ echo wppa_get_contents( $cachefile );
52
+ echo wppa_widget_timer( 'show', $widget_title, true );
53
+ wppa( 'in_widget', false );
54
+ return;
55
+ }
56
+ }
57
+ }
58
+
59
+ // Other inits
60
+ $page = in_array( wppa_opt( 'album_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'album_widget_linkpage', __( 'Photo Albums', 'wp-photo-album-plus' ) );
61
+ $max = wppa_opt( 'album_widget_count' ) ? wppa_opt( 'album_widget_count' ) : '10';
62
+ $maxw = wppa_opt( 'album_widget_size' );
63
+ $maxh = wppa_checked( $instance['name'] ) ? $maxw + 14 + wppa_opt( 'fontsize_widget_thumb' ) : $maxw;
64
+ $parent = $instance['parent'];
65
+ $subs = wppa_checked( $instance['subs'] );
66
 
67
  // Logged in only and logged out?
68
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
69
  return;
70
  }
71
 
72
+ // Cache?
73
+ if ( $cache ) {
74
+ if ( wppa_is_file( $cachefile ) ) {
75
+ echo wppa_get_contents( $cachefile );
76
+ echo wppa_widget_timer( 'show', $widget_title );
77
+ wppa( 'in_widget', false );
78
+ return;
79
+ }
80
+ }
81
 
82
  switch ( $parent ) {
83
  case 'all':
380
 
381
  $widget_content .= '<div style="clear:both"></div>';
382
 
383
+ // End widget content
384
+ if ( ! $cache ) $widget_content .= wppa_widget_timer( 'show', $widget_title );
385
 
386
+ $result = "\n" . $before_widget;
387
  if ( ! empty( $widget_title ) ) {
388
+ $result .= $before_title . $widget_title . $after_title;
389
+ }
390
+ $result .= $widget_content . $after_widget;
391
+
392
+ echo $result;
393
+
394
+ // Cache?
395
+ if ( wppa_checked( $instance['cache'] ) ) {
396
+ wppa_put_contents( $cachefile, $result );
397
  }
 
398
 
399
  wppa( 'in_widget', false );
400
  }
401
 
402
  /** @see WP_Widget::update */
403
  function update( $new_instance, $old_instance ) {
404
+
405
+ // Completize all parms
406
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
407
+
408
+ // Sanitize certain args
409
+ $instance['title'] = strip_tags( $instance['title'] );
410
+
411
+ wppa_remove_widget_cache_path( $this->id );
 
 
 
 
 
 
 
 
 
 
412
 
413
  return $instance;
414
  }
417
  function form( $instance ) {
418
  global $wpdb;
419
 
420
+ // Defaults
421
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
 
 
 
 
 
 
 
422
 
423
  // Widget title
424
  echo
426
 
427
  // Parent album selection
428
  $albs = $wpdb->get_results( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY name", ARRAY_A );
429
+ $albs = wppa_add_paths( $albs );
430
+ $albs = wppa_array_sort( $albs, 'name' );
431
+
432
 
433
  $options = array(
434
  __( '--- all albums ---', 'wp-photo-album-plus' ),
475
  // Loggedin only
476
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) ) .
477
 
478
+ // Cache
479
+ wppa_widget_cache( $this, $instance['cache'] ) .
480
+
481
  '<p>' .
482
  __( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus') .
483
  ' ' . __( 'Table I-F9 and 10', 'wp-photo-album-plus' ) .
484
  '</p>';
485
  }
486
 
487
+ // Set defaults
488
+ function get_defaults() {
489
+
490
+ $defaults = array( 'title' => __( 'Thumbnail Albums', 'wp-photo-album-plus' ),
491
+ 'parent' => '0',
492
+ 'subs' => 'no',
493
+ 'name' => 'no',
494
+ 'skip' => 'no',
495
+ 'logonly' => 'no',
496
+ 'cache' => '0',
497
+ );
498
+ return $defaults;
499
+ }
500
+
501
  } // class AlbumWidget
502
 
503
  // register AlbumWidget widget
wppa-bestof-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the best rated photos
6
- * Version 6.9.12
7
  *
8
  */
9
 
@@ -21,32 +21,44 @@ class BestOfWidget extends WP_Widget {
21
  function widget( $args, $instance ) {
22
  global $wpdb;
23
 
24
- wppa_initialize_runtime();
 
 
25
  wppa( 'in_widget', 'bestof' );
26
  wppa_bump_mocc();
27
-
28
- extract( $args );
29
-
30
- $instance = wp_parse_args( (array) $instance, array(
31
- 'title' => __( 'Best Of Photos', 'wp-photo-album-plus' ),
32
- 'count' => '10',
33
- 'sortby' => 'maxratingcount',
34
- 'display' => 'photo',
35
- 'period' => 'thisweek',
36
- 'maxratings'=> 'yes',
37
- 'meanrat' => 'yes',
38
- 'ratcount' => 'yes',
39
- 'linktype' => 'none',
40
- 'totvalue' => '',
41
- 'logonly' => 'no',
42
- ) );
43
 
44
  // Logged in only and logged out?
45
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
46
  return;
47
  }
48
 
49
- $widget_title = apply_filters( 'widget_title', $instance['title'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  $page = in_array( $instance['linktype'], wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'bestof_widget_linkpage', __( 'Best Of Photos', 'wp-photo-album-plus' ) );
51
  $count = $instance['count'] ? $instance['count'] : '10';
52
  $sortby = $instance['sortby'];
@@ -74,16 +86,25 @@ class BestOfWidget extends WP_Widget {
74
  'size' => $size,
75
  'lineheight' => $lineheight,
76
  'totvalue' => $total,
 
77
  ) );
78
 
79
  $widget_content .= '<div style="clear:both" data-wppa="yes" ></div>';
80
- $widget_content .= "\n".'<!-- WPPA+ BestOf Widget end -->';
81
 
82
- echo "\n" . $before_widget;
 
83
  if ( ! empty( $widget_title ) ) {
84
- echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
 
85
  }
86
- echo $widget_content . $after_widget;
87
 
88
  wppa( 'in_widget', false );
89
  }
@@ -91,60 +112,23 @@ class BestOfWidget extends WP_Widget {
91
  /** @see WP_Widget::update */
92
  function update( $new_instance, $old_instance ) {
93
 
94
- $instance = $old_instance;
 
95
 
96
- // Defaults
97
- $instance = wp_parse_args( (array) $instance, array(
98
- 'title' => __( 'Best Of Photos', 'wp-photo-album-plus' ),
99
- 'count' => '10',
100
- 'sortby' => 'maxratingcount',
101
- 'display' => 'photo',
102
- 'period' => 'thisweek',
103
- 'maxratings'=> 'yes',
104
- 'meanrat' => 'yes',
105
- 'ratcount' => 'yes',
106
- 'linktype' => 'none',
107
- 'totvalue' => '',
108
- 'logonly' => 'no',
109
- ) );
110
 
111
- $instance['title'] = strip_tags( $new_instance['title'] );
112
- $instance['count'] = $new_instance['count'];
113
- $instance['sortby'] = $new_instance['sortby'];
114
- $instance['display'] = $new_instance['display'];
115
- $instance['period'] = $new_instance['period'];
116
- $instance['maxratings'] = $new_instance['maxratings'];
117
- $instance['meanrat'] = $new_instance['meanrat'];
118
- $instance['ratcount'] = $new_instance['ratcount'];
119
- $instance['linktype'] = $new_instance['linktype'];
120
- $instance['totvalue'] = $new_instance['totvalue'];
121
- $instance['logonly'] = $new_instance['logonly'];
122
 
123
  return $instance;
 
124
  }
125
 
126
  /** @see WP_Widget::form */
127
  function form( $instance ) {
128
 
129
  // Defaults
130
- $instance = wp_parse_args( (array) $instance, array(
131
- 'title' => __( 'Best Of Photos', 'wp-photo-album-plus' ),
132
- 'count' => '10',
133
- 'sortby' => 'maxratingcount',
134
- 'display' => 'photo',
135
- 'period' => 'thisweek',
136
- 'maxratings'=> 'yes',
137
- 'meanrat' => 'yes',
138
- 'ratcount' => 'yes',
139
- 'linktype' => 'none',
140
- 'totvalue' => '',
141
- 'logonly' => 'no',
142
- ) );
143
-
144
- // WP Bug?
145
- if ( ! $instance['count'] ) {
146
- $instance['count'] = '10';
147
- }
148
 
149
  // Widget Title
150
  echo
@@ -231,8 +215,32 @@ class BestOfWidget extends WP_Widget {
231
  // Loggedin only
232
  echo
233
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
 
 
 
 
 
234
  }
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  } // class BestOfWidget
237
 
238
  // register BestOfWidget widget
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the best rated photos
6
+ * Version 7.3.02
7
  *
8
  */
9
 
21
  function widget( $args, $instance ) {
22
  global $wpdb;
23
 
24
+ // Initialize
25
+ wppa_widget_timer( 'init' );
26
+ wppa_reset_occurrance();
27
  wppa( 'in_widget', 'bestof' );
28
  wppa_bump_mocc();
29
+ extract( $args );
30
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
+ $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
+ $cache = $instance['cache'];
33
+ $cachefile = wppa_get_widget_cache_path( $this->id );
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  // Logged in only and logged out?
36
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
37
  return;
38
  }
39
 
40
+ // Cache?
41
+ if ( $cache ) {
42
+
43
+ if ( wppa_is_file( $cachefile ) ) {
44
+
45
+ // Cache expired?
46
+ if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
47
+ wppa_remove_widget_cache_path( $this->id );
48
+ }
49
+
50
+ // No, use it
51
+ else {
52
+ echo wppa_get_contents( $cachefile );
53
+ echo wppa_widget_timer( 'show', $widget_title, true );
54
+ wppa( 'in_widget', false );
55
+ return;
56
+ }
57
+ }
58
+ }
59
+
60
+ // Other inits
61
+ $widget_content = '';
62
  $page = in_array( $instance['linktype'], wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'bestof_widget_linkpage', __( 'Best Of Photos', 'wp-photo-album-plus' ) );
63
  $count = $instance['count'] ? $instance['count'] : '10';
64
  $sortby = $instance['sortby'];
86
  'size' => $size,
87
  'lineheight' => $lineheight,
88
  'totvalue' => $total,
89
+ 'cache' => 'no',
90
  ) );
91
 
92
  $widget_content .= '<div style="clear:both" data-wppa="yes" ></div>';
 
93
 
94
+ // Output
95
+ $result = "\n" . $before_widget;
96
  if ( ! empty( $widget_title ) ) {
97
+ $result .= $before_title . $widget_title . $after_title;
98
+ }
99
+ $result .= $widget_content . $after_widget;
100
+
101
+ echo $result;
102
+ echo wppa_widget_timer( 'show', $widget_title );
103
+
104
+ // Cache?
105
+ if ( $cache ) {
106
+ wppa_put_contents( $cachefile, $result );
107
  }
 
108
 
109
  wppa( 'in_widget', false );
110
  }
112
  /** @see WP_Widget::update */
113
  function update( $new_instance, $old_instance ) {
114
 
115
+ // Completize all parms
116
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
117
 
118
+ // Sanitize certain args
119
+ $instance['title'] = strip_tags( $instance['title'] );
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
+ wppa_remove_widget_cache_path( $this->id );
 
 
 
 
 
 
 
 
 
 
122
 
123
  return $instance;
124
+
125
  }
126
 
127
  /** @see WP_Widget::form */
128
  function form( $instance ) {
129
 
130
  // Defaults
131
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  // Widget Title
134
  echo
215
  // Loggedin only
216
  echo
217
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
218
+
219
+ // Cache
220
+ echo
221
+ wppa_widget_cache( $this, $instance['cache'] );
222
+
223
  }
224
 
225
+ // Set defaults
226
+ function get_defaults() {
227
+
228
+ $defaults = array( 'title' => __( 'Best Of Photos', 'wp-photo-album-plus' ),
229
+ 'count' => '10',
230
+ 'sortby' => 'maxratingcount',
231
+ 'display' => 'photo',
232
+ 'period' => 'thisweek',
233
+ 'maxratings'=> 'no',
234
+ 'meanrat' => 'no',
235
+ 'ratcount' => 'no',
236
+ 'linktype' => 'none',
237
+ 'totvalue' => '',
238
+ 'logonly' => 'no',
239
+ 'cache' => '0',
240
+ );
241
+ return $defaults;
242
+ }
243
+
244
  } // class BestOfWidget
245
 
246
  // register BestOfWidget 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 7.0.02
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -20,35 +20,57 @@ class wppaCommentWidget extends WP_Widget {
20
  function widget($args, $instance) {
21
  global $wpdb;
22
 
23
- wppa_initialize_runtime();
 
 
 
 
 
 
 
 
 
24
 
 
 
 
 
25
  // Hide widget if not logged in and login required to see comments
26
  if ( wppa_switch( 'comment_view_login' ) && ! is_user_logged_in() ) {
27
  return;
28
  }
29
 
30
- extract( $args );
31
- wppa( 'in_widget', 'com' );
32
- wppa_bump_mocc();
33
 
34
- $instance = wp_parse_args( (array) $instance,
35
- array( 'title' => __( 'Comments on photos', 'wp-photo-album-plus' ),
36
- 'logonly' => 'no',
37
- ) );
38
 
39
- // Logged in only and logged out?
40
- if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
41
- return;
 
 
 
 
 
 
 
 
 
 
42
  }
43
 
 
44
  $page = in_array( wppa_opt( 'comment_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'comment_widget_linkpage', __( 'Recently commented photos', 'wp-photo-album-plus' ) );
45
  $max = wppa_opt( 'comten_count' );
46
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
47
  $photo_ids = wppa_get_comten_ids( $max );
48
- $widget_content = "\n".'<!-- WPPA+ Comment Widget start -->';
49
  $maxw = strval( intval( wppa_opt( 'comten_size' ) ) );
50
  $maxh = $maxw + 18;
51
 
 
 
 
52
  if ( $photo_ids ) foreach( $photo_ids as $id ) {
53
 
54
  // Make the HTML for current comment
@@ -102,11 +124,21 @@ class wppaCommentWidget extends WP_Widget {
102
  else $widget_content .= __( 'There are no commented photos (yet)', 'wp-photo-album-plus' );
103
 
104
  $widget_content .= '<div style="clear:both"></div>';
105
- $widget_content .= "\n".'<!-- WPPA+ comment Widget end -->';
106
 
107
- echo "\n" . $before_widget;
108
- if ( ! empty( $widget_title ) ) { echo $before_title . $widget_title . $after_title; }
109
- echo $widget_content . $after_widget;
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  wppa( 'in_widget', false );
112
  }
@@ -114,13 +146,13 @@ class wppaCommentWidget extends WP_Widget {
114
  /** @see WP_Widget::update */
115
  function update( $new_instance, $old_instance ) {
116
 
117
- $instance = $old_instance;
 
118
 
119
- //Defaults
120
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Comments on Photos', 'wp-photo-album-plus' ), 'logonly' => 'no' ) );
121
 
122
- $instance['title'] = strip_tags( $new_instance['title'] );
123
- $instance['logonly'] = $new_instance['logonly'];
124
 
125
  return $instance;
126
  }
@@ -128,8 +160,8 @@ class wppaCommentWidget extends WP_Widget {
128
  /** @see WP_Widget::form */
129
  function form( $instance ) {
130
 
131
- //Defaults
132
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Comments on Photos', 'wp-photo-album-plus' ), 'logonly' => 'no' ) );
133
 
134
  // Title
135
  echo
@@ -139,6 +171,10 @@ class wppaCommentWidget extends WP_Widget {
139
  echo
140
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
141
 
 
 
 
 
142
  echo
143
  '<p>' .
144
  __( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
@@ -146,6 +182,16 @@ class wppaCommentWidget extends WP_Widget {
146
  '</p>';
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
149
  } // class wppaCommentWidget
150
 
151
  // register wppaCommentWidget widget
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the recent commets on photos
6
+ * Version 7.3.02
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
20
  function widget($args, $instance) {
21
  global $wpdb;
22
 
23
+ // Initialize
24
+ wppa_widget_timer( 'init' );
25
+ wppa_reset_occurrance();
26
+ wppa( 'in_widget', 'com' );
27
+ wppa_bump_mocc();
28
+ extract( $args );
29
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
30
+ $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
+ $cache = $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
  // Hide widget if not logged in and login required to see comments
39
  if ( wppa_switch( 'comment_view_login' ) && ! is_user_logged_in() ) {
40
  return;
41
  }
42
 
43
+ // Cache?
44
+ if ( $cache ) {
 
45
 
46
+ if ( wppa_is_file( $cachefile ) ) {
 
 
 
47
 
48
+ // Cache expired?
49
+ if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
50
+ wppa_remove_widget_cache_path( $this->id );
51
+ }
52
+
53
+ // No, use it
54
+ else {
55
+ echo wppa_get_contents( $cachefile );
56
+ echo wppa_widget_timer( 'show', $widget_title, true );
57
+ wppa( 'in_widget', false );
58
+ return;
59
+ }
60
+ }
61
  }
62
 
63
+ // Other inits
64
  $page = in_array( wppa_opt( 'comment_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'comment_widget_linkpage', __( 'Recently commented photos', 'wp-photo-album-plus' ) );
65
  $max = wppa_opt( 'comten_count' );
66
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
67
  $photo_ids = wppa_get_comten_ids( $max );
 
68
  $maxw = strval( intval( wppa_opt( 'comten_size' ) ) );
69
  $maxh = $maxw + 18;
70
 
71
+ // Make the widget content
72
+ $widget_content = "\n".'<!-- WPPA+ Comment Widget start -->';
73
+
74
  if ( $photo_ids ) foreach( $photo_ids as $id ) {
75
 
76
  // Make the HTML for current comment
124
  else $widget_content .= __( 'There are no commented photos (yet)', 'wp-photo-album-plus' );
125
 
126
  $widget_content .= '<div style="clear:both"></div>';
 
127
 
128
+ // Output
129
+ $result = "\n" . $before_widget;
130
+ if ( ! empty( $widget_title ) ) {
131
+ $result .= $before_title . $widget_title . $after_title;
132
+ }
133
+ $result .= $widget_content . $after_widget;
134
+
135
+ echo $result;
136
+ echo wppa_widget_timer( 'show', $widget_title );
137
+
138
+ // Cache?
139
+ if ( $cache ) {
140
+ wppa_put_contents( $cachefile, $result );
141
+ }
142
 
143
  wppa( 'in_widget', false );
144
  }
146
  /** @see WP_Widget::update */
147
  function update( $new_instance, $old_instance ) {
148
 
149
+ // Completize all parms
150
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
151
 
152
+ // Sanitize certain args
153
+ $instance['title'] = strip_tags( $instance['title'] );
154
 
155
+ wppa_remove_widget_cache_path( $this->id );
 
156
 
157
  return $instance;
158
  }
160
  /** @see WP_Widget::form */
161
  function form( $instance ) {
162
 
163
+ // Defaults
164
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
165
 
166
  // Title
167
  echo
171
  echo
172
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
173
 
174
+ // Cache
175
+ echo
176
+ wppa_widget_cache( $this, $instance['cache'] );
177
+
178
  echo
179
  '<p>' .
180
  __( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
182
  '</p>';
183
  }
184
 
185
+ // Set defaults
186
+ function get_defaults() {
187
+
188
+ $defaults = array( 'title' => __( 'Comments on photos', 'wp-photo-album-plus' ),
189
+ 'logonly' => 'no',
190
+ 'cache' => '0',
191
+ );
192
+ return $defaults;
193
+ }
194
+
195
  } // class wppaCommentWidget
196
 
197
  // register wppaCommentWidget widget
wppa-common-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
- * Version 7.3.00
6
  *
7
  */
8
 
@@ -239,6 +239,7 @@ global $thumbs;
239
  'comneedsvote' => false,
240
  'yesr' => '',
241
  'month' => '',
 
242
 
243
  );
244
  }
@@ -516,7 +517,7 @@ global $wppa;
516
  $result = " ORDER BY RAND(" . time() % 4711 . ")";
517
  return $result;
518
  }
519
-
520
  // Filmonly random?
521
  if ( wppa( 'is_filmonly' ) && wppa_switch( 'filmonly_random' ) ) {
522
  $result = " ORDER BY RAND()";
@@ -1063,6 +1064,12 @@ static $tables;
1063
  function wppa_clear_cache( $force = false ) {
1064
  global $cache_path;
1065
 
 
 
 
 
 
 
1066
  // Schedule a cron job. This is the normal operation
1067
  if ( ! $force && ! wppa_is_cron() ) {
1068
  wppa_schedule_clear_cache();
@@ -1117,6 +1124,20 @@ global $cache_path;
1117
  // wppa_delete_obsolete_tempfiles( true );
1118
  }
1119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1120
  // Removes the content of $dir, ignore errors
1121
  function wppa_tree_empty( $dir ) {
1122
  $files = wppa_glob( $dir.'/*' );
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.3.02
6
  *
7
  */
8
 
239
  'comneedsvote' => false,
240
  'yesr' => '',
241
  'month' => '',
242
+ 'cache' => '0',
243
 
244
  );
245
  }
517
  $result = " ORDER BY RAND(" . time() % 4711 . ")";
518
  return $result;
519
  }
520
+
521
  // Filmonly random?
522
  if ( wppa( 'is_filmonly' ) && wppa_switch( 'filmonly_random' ) ) {
523
  $result = " ORDER BY RAND()";
1064
  function wppa_clear_cache( $force = false ) {
1065
  global $cache_path;
1066
 
1067
+ // Clear wppa shortcode cache has priority
1068
+ wppa_remove_shortcode_cache_path();
1069
+
1070
+ // Clear wppa widget cache has priority
1071
+ wppa_remove_widget_cache_path();
1072
+
1073
  // Schedule a cron job. This is the normal operation
1074
  if ( ! $force && ! wppa_is_cron() ) {
1075
  wppa_schedule_clear_cache();
1124
  // wppa_delete_obsolete_tempfiles( true );
1125
  }
1126
 
1127
+ function wppa_remove_shortcode_cache_path() {
1128
+
1129
+ $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
1130
+ if ( wppa_is_dir( $root ) ) {
1131
+ $files = wppa_glob( $root . '/*' );
1132
+ if ( $files ) {
1133
+ $nfiles = count( $files );
1134
+ foreach( $files as $file ) {
1135
+ wppa_unlink( $file );
1136
+ }
1137
+ }
1138
+ }
1139
+ }
1140
+
1141
  // Removes the content of $dir, ignore errors
1142
  function wppa_tree_empty( $dir ) {
1143
  $files = wppa_glob( $dir.'/*' );
wppa-cron.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
- * Version 7.3.00
7
  *
8
  *
9
  */
@@ -343,9 +343,14 @@ global $wppa_endtime;
343
  wppa_rmdir( $dir, true ); // when empty
344
  }
345
 
346
- // Done?
347
  wppa_log( 'Cron', 'Phase 14, time left = '.($wppa_endtime-time()) );
348
 
 
 
 
 
 
 
349
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
350
 
351
  $outbuf = ob_get_clean();
@@ -413,29 +418,40 @@ static $did_tempfiles;
413
  $needle = 'data-wppa="yes"';
414
  $fsos = wppa_glob( $dir . '/*' );
415
  if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
416
- $name = basename( $fso );
417
- if ( $name != '.' && $name != '..' ) {
418
- if ( wppa_is_dir( $fso ) ) {
419
- _wppa_do_clear_cache( $fso );
 
 
 
420
  }
421
- else {
422
- $file = wppa_fopen( $fso, 'rb' );
423
- if ( $file ) {
424
- $size = filesize( $fso );
425
- if ( $size ) {
426
- $haystack = fread( $file, $size );
427
- if ( strpos( $haystack, $needle ) !== false ) {
428
- fclose( $file );
429
- unlink( $fso );
430
- wppa_log( 'fso', 'Cron removed cachefile: {b}' . str_replace( WPPA_CONTENT_PATH, '', $fso ) . '{/b}' );
 
 
 
 
 
 
 
 
 
 
 
431
  }
432
  else {
433
  fclose( $file );
434
  }
435
  }
436
- else {
437
- fclose( $file );
438
- }
439
  }
440
  }
441
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
+ * Version 7.3.02
7
  *
8
  *
9
  */
343
  wppa_rmdir( $dir, true ); // when empty
344
  }
345
 
 
346
  wppa_log( 'Cron', 'Phase 14, time left = '.($wppa_endtime-time()) );
347
 
348
+ // Clear widget cache
349
+ wppa_remove_widget_cache_path();
350
+
351
+ // Done?
352
+ wppa_log( 'Cron', 'Phase 15, time left = '.($wppa_endtime-time()) );
353
+
354
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
355
 
356
  $outbuf = ob_get_clean();
418
  $needle = 'data-wppa="yes"';
419
  $fsos = wppa_glob( $dir . '/*' );
420
  if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
421
+
422
+ // If it is in ../wppa-widget_cache/, wait until older than 2 hours
423
+ $is_widget_cache = ( strpos( $fso, '/wppa-widget/' ) != false );
424
+ if ( $is_widget_cache ) {
425
+ if ( wppa_filetime( $fso ) < ( time() - 7200 ) ) {
426
+ unlink ( $fso );
427
+ wppa_log( 'fso', 'Cron removed obsolete widget cachefile: {b}' . basename( $fso ) . '{/b}' );
428
  }
429
+ }
430
+ else {
431
+ $name = basename( $fso );
432
+ if ( $name != '.' && $name != '..' ) {
433
+ if ( wppa_is_dir( $fso ) ) {
434
+ _wppa_do_clear_cache( $fso );
435
+ }
436
+ else {
437
+ $file = wppa_fopen( $fso, 'rb' );
438
+ if ( $file ) {
439
+ $size = filesize( $fso );
440
+ if ( $size ) {
441
+ $haystack = fread( $file, $size );
442
+ if ( strpos( $haystack, $needle ) !== false ) {
443
+ fclose( $file );
444
+ unlink( $fso );
445
+ wppa_log( 'fso', 'Cron removed cachefile: {b}' . str_replace( WPPA_CONTENT_PATH, '', $fso ) . '{/b}' );
446
+ }
447
+ else {
448
+ fclose( $file );
449
+ }
450
  }
451
  else {
452
  fclose( $file );
453
  }
454
  }
 
 
 
455
  }
456
  }
457
  }
wppa-date-time.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * date and time related functions
6
- * Version 7.3.00
7
  *
8
  */
9
 
@@ -191,6 +191,11 @@ function wppa_local_date( $format, $timestamp = false ) {
191
  $time = time();
192
  }
193
 
 
 
 
 
 
194
  // Find timezonestring
195
  $tzstring = wppa_get_option( 'timezone_string' );
196
  if ( empty( $tzstring ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * date and time related functions
6
+ * Version 7.3.02
7
  *
8
  */
9
 
191
  $time = time();
192
  }
193
 
194
+ // wp >= 5.3 ?
195
+ if ( function_exists( 'wp_date' ) ) {
196
+ return wp_date( $format, $time );
197
+ }
198
+
199
  // Find timezonestring
200
  $tzstring = wppa_get_option( 'timezone_string' );
201
  if ( empty( $tzstring ) ) {
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 7.3.01
7
  *
8
  */
9
 
@@ -999,9 +999,11 @@ horizrailenabled:false,";
999
  'wppa_log_fso' => 'no', // A9.4
1000
  'wppa_log_debug' => 'no', // A9.5
1001
  'wppa_log_email' => 'no',
 
1002
  'wppa_moderate_bulk' => 'no', // B20
1003
  'wppa_retry_mails' => '0', // A10
1004
  'wppa_minimum_tags' => '', // A11
 
1005
 
1006
  'wppa_login_url' => site_url( 'wp-login.php', 'login' ), // A
1007
  'wppa_cache_root' => 'cache',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 7.3.02
7
  *
8
  */
9
 
999
  'wppa_log_fso' => 'no', // A9.4
1000
  'wppa_log_debug' => 'no', // A9.5
1001
  'wppa_log_email' => 'no',
1002
+ 'wppa_log_tim' => 'no',
1003
  'wppa_moderate_bulk' => 'no', // B20
1004
  'wppa_retry_mails' => '0', // A10
1005
  'wppa_minimum_tags' => '', // A11
1006
+ 'wppa_predef_tags_only' => 'no',
1007
 
1008
  'wppa_login_url' => site_url( 'wp-login.php', 'login' ), // A
1009
  'wppa_cache_root' => 'cache',
wppa-featen-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
- * Version 7.0.04
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -21,23 +21,44 @@ class FeaTenWidget extends WP_Widget {
21
  global $wpdb;
22
  global $wppa_opt;
23
 
24
- wppa_initialize_runtime();
25
-
26
- extract( $args );
27
- wppa( 'in_widget', 'featen' );
28
  wppa_bump_mocc();
29
-
30
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Featured photos', 'wp-photo-album-plus' ), 'album' => '', 'logonly' => 'no' ) );
 
 
 
31
 
32
  // Logged in only and logged out?
33
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
34
  return;
35
  }
36
 
37
- $widget_title = apply_filters( 'widget_title', $instance['title'] );
38
- $page = in_array( wppa_opt( 'featen_widget_linktype' ), wppa( 'links_no_page' ) ) ?
39
- '' :
40
- wppa_get_the_landing_page( 'featen_widget_linkpage', __( 'Featured photos', 'wp-photo-album-plus' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $max = wppa_opt( 'featen_count' );
42
  $album = $instance['album'];
43
  $generic = ( $album == '-2' );
@@ -163,28 +184,36 @@ class FeaTenWidget extends WP_Widget {
163
  else $widget_content .= __( 'There are no featured photos (yet)', 'wp-photo-album-plus' );
164
 
165
  $widget_content .= '<div style="clear:both"></div>';
166
- $widget_content .= "\n".'<!-- WPPA+ FeaTen Widget end -->';
167
 
168
- echo "\n" . $before_widget;
 
169
  if ( ! empty( $widget_title ) ) {
170
- echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
 
171
  }
172
- echo $widget_content . $after_widget;
173
 
174
  wppa( 'in_widget', false );
 
175
  }
176
 
177
  // @see WP_Widget::update
178
  function update( $new_instance, $old_instance ) {
179
 
180
- $instance = $old_instance;
 
181
 
182
- //Defaults
183
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Featured Photos', 'wp-photo-album-plus' ), 'album' => '0', 'logonly' => 'no' ) );
184
 
185
- $instance['title'] = strip_tags( $new_instance['title'] );
186
- $instance['album'] = $new_instance['album'];
187
- $instance['logonly'] = $new_instance['logonly'];
188
 
189
  return $instance;
190
  }
@@ -192,8 +221,8 @@ class FeaTenWidget extends WP_Widget {
192
  // @see WP_Widget::form
193
  function form( $instance ) {
194
 
195
- //Defaults
196
- $instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Featured Photos', 'wp-photo-album-plus' ), 'album' => '0', 'logonly' => 'no' ) );
197
 
198
  $album = $instance['album'];
199
 
@@ -205,7 +234,9 @@ class FeaTenWidget extends WP_Widget {
205
  $body = wppa_album_select_a( array( 'selected' => $album,
206
  'addall' => true,
207
  'addowner' => true,
208
- 'path' => wppa_switch( 'hier_albsel' ) ) );
 
 
209
  echo
210
  wppa_widget_selection_frame( $this, 'album', $body, __( 'Album', 'wp-photo-album-plus' ) );
211
 
@@ -213,6 +244,10 @@ class FeaTenWidget extends WP_Widget {
213
  echo
214
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
215
 
 
 
 
 
216
  // Explanation
217
  echo
218
  '<p>' .
@@ -220,7 +255,18 @@ class FeaTenWidget extends WP_Widget {
220
  ' ' . __( 'Table I-F11 and 12', 'wp-photo-album-plus' ) .
221
  '</p>';
222
 
223
- }
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  } // class FeaTenWidget
226
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
+ * Version 7.3.02
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
21
  global $wpdb;
22
  global $wppa_opt;
23
 
24
+ // Initialize
25
+ wppa_widget_timer( 'init' );
26
+ wppa_reset_occurrance();
27
+ wppa( 'in_widget', 'featen' );
28
  wppa_bump_mocc();
29
+ extract( $args );
30
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
31
+ $widget_title = apply_filters( 'widget_title', $instance['title'] );
32
+ $cache = $instance['cache'];
33
+ $cachefile = wppa_get_widget_cache_path( $this->id );
34
 
35
  // Logged in only and logged out?
36
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
37
  return;
38
  }
39
 
40
+ // Cache?
41
+ if ( $cache ) {
42
+
43
+ if ( wppa_is_file( $cachefile ) ) {
44
+
45
+ // Cache expired?
46
+ if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
47
+ wppa_remove_widget_cache_path( $this->id );
48
+ }
49
+
50
+ // No, use it
51
+ else {
52
+ echo wppa_get_contents( $cachefile );
53
+ echo wppa_widget_timer( 'show', $widget_title, true );
54
+ wppa( 'in_widget', false );
55
+ return;
56
+ }
57
+ }
58
+ }
59
+
60
+ // Other inits
61
+ $page = in_array( wppa_opt( 'featen_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'featen_widget_linkpage', __( 'Featured photos', 'wp-photo-album-plus' ) );
62
  $max = wppa_opt( 'featen_count' );
63
  $album = $instance['album'];
64
  $generic = ( $album == '-2' );
184
  else $widget_content .= __( 'There are no featured photos (yet)', 'wp-photo-album-plus' );
185
 
186
  $widget_content .= '<div style="clear:both"></div>';
 
187
 
188
+ // Output
189
+ $result = "\n" . $before_widget;
190
  if ( ! empty( $widget_title ) ) {
191
+ $result .= $before_title . $widget_title . $after_title;
192
+ }
193
+ $result .= $widget_content . $after_widget;
194
+
195
+ echo $result;
196
+ echo wppa_widget_timer( 'show', $widget_title );
197
+
198
+ // Cache?
199
+ if ( $cache ) {
200
+ wppa_put_contents( $cachefile, $result );
201
  }
 
202
 
203
  wppa( 'in_widget', false );
204
+
205
  }
206
 
207
  // @see WP_Widget::update
208
  function update( $new_instance, $old_instance ) {
209
 
210
+ // Completize all parms
211
+ $instance = wppa_parse_args( $new_instance, $this->get_defaults() );
212
 
213
+ // Sanitize certain args
214
+ $instance['title'] = strip_tags( $instance['title'] );
215
 
216
+ wppa_remove_widget_cache_path( $this->id );
 
 
217
 
218
  return $instance;
219
  }
221
  // @see WP_Widget::form
222
  function form( $instance ) {
223
 
224
+ // Defaults
225
+ $instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
226
 
227
  $album = $instance['album'];
228
 
234
  $body = wppa_album_select_a( array( 'selected' => $album,
235
  'addall' => true,
236
  'addowner' => true,
237
+ 'path' => true,
238
+ 'sort' => true,
239
+ ) );
240
  echo
241
  wppa_widget_selection_frame( $this, 'album', $body, __( 'Album', 'wp-photo-album-plus' ) );
242
 
244
  echo
245
  wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
246
 
247
+ // Cache
248
+ echo
249
+ wppa_widget_cache( $this, $instance['cache'] );
250
+
251
  // Explanation
252
  echo
253
  '<p>' .
255
  ' ' . __( 'Table I-F11 and 12', 'wp-photo-album-plus' ) .
256
  '</p>';
257
 
258
+ }
259
+
260
+ // Set defaults
261
+ function get_defaults() {
262
+
263
+ $defaults = array( 'title' => __( 'Featured Photos', 'wp-photo-album-plus' ),
264
+ 'album' => '0',
265
+ 'logonly' => 'no',
266
+ 'cache' => '0',
267
+ );
268
+ return $defaults;
269
+ }
270
 
271
  } // class FeaTenWidget
272
 
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version 7.3.00
7
  *
8
  */
9
 
@@ -128,6 +128,7 @@ global $wppa_revno;
128
  'delay' => '',
129
  'year' => '',
130
  'month' => '',
 
131
  ), $xatts );
132
 
133
  // Sanitize input
@@ -135,10 +136,23 @@ global $wppa_revno;
135
  foreach ( array_keys( $atts ) as $key ) {
136
  $atts[$key] = strip_tags( $atts[$key] ); // NOT htmlspecialchars because of album="$cat,René" has allowed funny chars
137
  }
 
138
 
139
  // Init
140
  wppa_reset_occurrance();
141
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  // Find occur
143
  if ( wppa_get_the_ID() != $wppa_postid ) { // New post
144
  $wppa['occur'] = '0'; // Init this occurance
@@ -562,7 +576,7 @@ global $wppa_opt;
562
  }
563
  else {
564
  if ( isset( $wppa[$atts['name']] ) ) {
565
- $wppa[$atts['name']] = $value;
566
  }
567
  else {
568
  wppa_dbg_msg( $atts['name'] . ' is not a runtime value.', 'red', 'force' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 7.3.02
7
  *
8
  */
9
 
128
  'delay' => '',
129
  'year' => '',
130
  'month' => '',
131
+ 'cache' => '',
132
  ), $xatts );
133
 
134
  // Sanitize input
136
  foreach ( array_keys( $atts ) as $key ) {
137
  $atts[$key] = strip_tags( $atts[$key] ); // NOT htmlspecialchars because of album="$cat,René" has allowed funny chars
138
  }
139
+ $atts['cache'] = ( $atts['cache'] ? strval( intval( $atts['cache'] ) ) : '0' );
140
 
141
  // Init
142
  wppa_reset_occurrance();
143
 
144
+ // Caching?
145
+ $wppa['cache'] = $atts['cache'];
146
+ if ( wppa_switch( 'defer_javascript' ) ) { // When defer js: can not cache slideshows
147
+ if ( in_array( $atts['type'], array( 'slide', 'slideonly', 'slideonlyf' ) ) && $wppa['cache'] ) {
148
+ wppa_log( 'war', 'Can not cache shortcode type ' . $atts['type'] . 'when defer javascript is enabled' );
149
+ }
150
+ $wppa['cache'] = '0';
151
+ }
152
+ if ( $wppa['cache'] ) { // Must be zero or 5 <= x <= 60
153
+ $wppa['cache'] = max( min( '60', $wppa['cache'] ), '5' );
154
+ }
155
+
156
  // Find occur
157
  if ( wppa_get_the_ID() != $wppa_postid ) { // New post
158
  $wppa['occur'] = '0'; // Init this occurance
576
  }
577
  else {
578
  if ( isset( $wppa[$atts['name']] ) ) {
579
+ $wppa[$atts['name']] = $atts['value'];
580
  }
581
  else {
582
  wppa_dbg_msg( $atts['name'] . ' is not a runtime value.', 'red', 'force' );
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.3.01
7
  *
8
  */
9
 
@@ -18,6 +18,9 @@ global $wppa_locale;
18
  global $wpdb;
19
  global $thumbs;
20
  global $wppa_session;
 
 
 
21
 
22
  // Diagnostics
23