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 | 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 +15 -0
- readme.txt +6 -2
- wppa-admin.php +43 -22
- wppa-adminbar.php +9 -1
- wppa-admins-choice-widget.php +71 -25
- wppa-album-navigator-widget.php +76 -56
- wppa-album-widget.php +91 -55
- wppa-bestof-widget.php +75 -67
- wppa-comment-widget.php +70 -24
- wppa-common-functions.php +23 -2
- wppa-cron.php +35 -19
- wppa-date-time.php +6 -1
- wppa-defaults.php +3 -1
- wppa-featen-widget.php +71 -25
- wppa-filter.php +16 -2
- wppa-functions.php +91 -2
- wppa-gp-widget.php +88 -34
- wppa-lasten-widget.php +75 -53
- wppa-multitag-widget.php +72 -31
- wppa-notify-widget.php +71 -21
- wppa-photo-admin-autosave.php +13 -2
- wppa-potd-widget.php +66 -24
- wppa-qr-widget.php +80 -22
- wppa-search-widget.php +78 -69
- wppa-settings-autosave.php +19 -1
- wppa-slideshow-widget.php +101 -66
- wppa-slideshow.php +7 -6
- wppa-stats-widget.php +85 -37
- wppa-stereo-widget.php +70 -20
- wppa-super-view-widget.php +81 -31
- wppa-tagcloud-widget.php +69 -28
- wppa-thumbnail-widget.php +78 -68
- wppa-topten-widget.php +90 -59
- wppa-upldr-widget.php +71 -50
- wppa-upload-widget.php +68 -24
- wppa-utils.php +8 -1
- wppa-widget-functions.php +90 -1
- wppa-wrappers.php +11 -1
- wppa.php +3 -3
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¤cy_code=USD&lc=US
|
4 |
Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
|
5 |
-
Version: 7.3.
|
6 |
-
Stable tag: 7.3.
|
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¤cy_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.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -56,22 +56,23 @@ function wppa_add_admin() {
|
|
56 |
add_menu_page( 'WP Photo Album', __('Photo 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',
|
60 |
-
add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus'), __('Upload Photos', 'wp-photo-album-plus'), 'wppa_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',
|
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',
|
68 |
-
add_submenu_page( 'wppa_admin_menu', __('Settings', 'wp-photo-album-plus'), __('Settings', 'wp-photo-album-plus'), 'wppa_settings',
|
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',
|
70 |
-
add_submenu_page( 'wppa_admin_menu', __('Manage comments', 'wp-photo-album-plus'), __('Comments', 'wp-photo-album-plus').$com_pending, 'wppa_comments',
|
71 |
-
add_submenu_page( 'wppa_admin_menu', __('Help & Info', 'wp-photo-album-plus'), __('Documentation', 'wp-photo-album-plus'),
|
72 |
if ( wppa_get_option( 'wppa_logfile_on_menu' ) == 'yes' ) {
|
73 |
-
add_submenu_page( 'wppa_admin_menu', __('Logfile', 'wp-photo-album-plus'),
|
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 = '
|
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 = '
|
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 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 & 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.
|
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.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -19,56 +19,86 @@ class AdminsChoice extends WP_Widget {
|
|
19 |
function widget($args, $instance) {
|
20 |
global $widget_content;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
wppa_bump_mocc();
|
26 |
-
|
27 |
extract( $args );
|
28 |
-
|
29 |
-
$
|
|
|
|
|
30 |
|
31 |
// Logged in only and logged out?
|
32 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
-
|
|
|
37 |
|
38 |
-
|
39 |
-
echo $before_widget;
|
40 |
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
|
|
|
|
|
|
45 |
if ( ! wppa_switch( 'enable_admins_choice' ) ) {
|
46 |
-
|
47 |
-
__( 'This feature is not enabled', 'wp-photo-album-plus' );
|
48 |
}
|
49 |
else {
|
50 |
-
|
51 |
'<div class="wppa-admins-choice-widget" data-wppa="yes" >' .
|
52 |
wppa_get_admins_choice_html( false ) .
|
53 |
'</div>';
|
54 |
}
|
55 |
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
wppa( 'in_widget', false );
|
60 |
-
|
61 |
|
62 |
/** @see WP_Widget::update */
|
63 |
function update( $new_instance, $old_instance ) {
|
64 |
|
65 |
-
|
|
|
66 |
|
67 |
-
//
|
68 |
-
$instance
|
|
|
|
|
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 =
|
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.
|
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 |
-
|
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 |
-
|
32 |
-
|
|
|
|
|
33 |
wppa_bump_mocc();
|
34 |
-
|
35 |
extract( $args );
|
36 |
-
|
37 |
-
$
|
38 |
-
|
39 |
-
|
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 |
-
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
//
|
78 |
-
$
|
79 |
-
|
80 |
-
echo "\n" . $before_widget;
|
81 |
if ( ! empty( $widget_title ) ) {
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
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 =
|
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.
|
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 |
-
//
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
// Logged in only and logged out?
|
43 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
44 |
return;
|
45 |
}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
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 |
-
|
358 |
-
|
359 |
|
360 |
-
|
361 |
if ( ! empty( $widget_title ) ) {
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
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 =
|
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
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -21,32 +21,44 @@ class BestOfWidget extends WP_Widget {
|
|
21 |
function widget( $args, $instance ) {
|
22 |
global $wpdb;
|
23 |
|
24 |
-
|
|
|
|
|
25 |
wppa( 'in_widget', 'bestof' );
|
26 |
wppa_bump_mocc();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
83 |
if ( ! empty( $widget_title ) ) {
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
95 |
|
96 |
-
//
|
97 |
-
$instance =
|
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 |
-
|
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
|
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.
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
31 |
-
|
32 |
-
wppa_bump_mocc();
|
33 |
|
34 |
-
|
35 |
-
array( 'title' => __( 'Comments on photos', 'wp-photo-album-plus' ),
|
36 |
-
'logonly' => 'no',
|
37 |
-
) );
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
118 |
|
119 |
-
//
|
120 |
-
$instance
|
121 |
|
122 |
-
|
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 =
|
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.
|
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.
|
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 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
|
|
|
|
|
|
420 |
}
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
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.
|
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.
|
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 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
wppa_bump_mocc();
|
29 |
-
|
30 |
-
$instance =
|
|
|
|
|
|
|
31 |
|
32 |
// Logged in only and logged out?
|
33 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
169 |
if ( ! empty( $widget_title ) ) {
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
181 |
|
182 |
-
//
|
183 |
-
$instance
|
184 |
|
185 |
-
|
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 =
|
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' =>
|
|
|
|
|
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.
|
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.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -18,6 +18,9 @@ global $wppa_locale;
|
|
18 |
global $wpdb;
|
19 |
global $thumbs;
|
20 |
global $wppa_session;
|
|
|
|
|
|
|
21 |
|
22 |
// Diagnostics
|
23 |
wppa_dbg_msg( 'Entering wppa_albums' );
|
@@ -89,6 +92,54 @@ global $wppa_session;
|
|
89 |
// Set wppa( 'src' ) = true and wppa( 'searchstring' ) if this occurrance processes a search request.
|
90 |
wppa_test_for_search();
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
// There are 3 ways to get here:
|
93 |
// in order of priority:
|
94 |
// 1. The given query string applies to this invocation ( occurrance )
|
@@ -871,9 +922,16 @@ global $wppa_session;
|
|
871 |
// Done
|
872 |
$out = str_replace( 'w#location', wppa( 'geo' ), wppa( 'out' ) );
|
873 |
|
|
|
|
|
|
|
|
|
|
|
874 |
// Reset
|
875 |
wppa_reset_occurrance();
|
876 |
-
|
|
|
|
|
877 |
}
|
878 |
|
879 |
|
@@ -5644,3 +5702,34 @@ global $wpdb;
|
|
5644 |
|
5645 |
return 'approved';
|
5646 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
18 |
global $wpdb;
|
19 |
global $thumbs;
|
20 |
global $wppa_session;
|
21 |
+
global $wppa;
|
22 |
+
|
23 |
+
wppa_occur_timer( 'init' );
|
24 |
|
25 |
// Diagnostics
|
26 |
wppa_dbg_msg( 'Entering wppa_albums' );
|
92 |
// Set wppa( 'src' ) = true and wppa( 'searchstring' ) if this occurrance processes a search request.
|
93 |
wppa_test_for_search();
|
94 |
|
95 |
+
// Test for caching
|
96 |
+
$caching = false; // Assume not
|
97 |
+
if ( wppa( 'cache' ) ) {
|
98 |
+
|
99 |
+
// No querystring?
|
100 |
+
if ( ! wppa_in_widget() && ! $_ENV['REQUEST_URI'] ) {
|
101 |
+
$caching = true;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Querystring not for this occur?
|
105 |
+
elseif ( ! wppa_in_widget() && wppa( 'occur' ) != wppa_get_get( 'occur' ) ) {
|
106 |
+
$caching = true;
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( $caching ) {
|
110 |
+
|
111 |
+
$cache_id = sanitize_file_name( str_replace( '/', '.', get_permalink() ) ) . '-' . wppa( 'occur' );
|
112 |
+
$cache_id = str_replace( array( '..', '.', '_' ), '-', $cache_id );
|
113 |
+
$cache_id = str_replace( '--', '-', $cache_id );
|
114 |
+
$root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) .'/wppa-shortcode';
|
115 |
+
if ( ! wppa_is_dir ( $root ) ) {
|
116 |
+
wppa_mktree( $root );
|
117 |
+
}
|
118 |
+
$cache_file = $root . '/' . $cache_id;
|
119 |
+
|
120 |
+
// Cachefile present?
|
121 |
+
if ( wppa_is_file( $cache_file ) ) {
|
122 |
+
|
123 |
+
// Expired?
|
124 |
+
if ( wppa_filetime( $cache_file ) < ( time() - 60 * wppa( 'cache' ) ) ) {
|
125 |
+
wppa_unlink( $cache_file );
|
126 |
+
}
|
127 |
+
|
128 |
+
// No, use it
|
129 |
+
else {
|
130 |
+
$timer = wppa_occur_timer( 'show', $_ENV['REQUEST_URI'] . ' oc ' . wppa( 'mocc' ), true );
|
131 |
+
return wppa_get_contents( $cache_file ) . $timer;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
else {
|
137 |
+
$cache_id = false;
|
138 |
+
$cache_file = false;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
// There are 3 ways to get here:
|
144 |
// in order of priority:
|
145 |
// 1. The given query string applies to this invocation ( occurrance )
|
922 |
// Done
|
923 |
$out = str_replace( 'w#location', wppa( 'geo' ), wppa( 'out' ) );
|
924 |
|
925 |
+
// Cache?
|
926 |
+
if ( $caching ) {
|
927 |
+
wppa_put_contents( $cache_file, $out );
|
928 |
+
}
|
929 |
+
|
930 |
// Reset
|
931 |
wppa_reset_occurrance();
|
932 |
+
|
933 |
+
$timer = wppa_occur_timer( 'show', $_ENV['REQUEST_URI'] . ' oc ' . wppa( 'mocc' ) );
|
934 |
+
return $out . $timer;
|
935 |
}
|
936 |
|
937 |
|
5702 |
|
5703 |
return 'approved';
|
5704 |
}
|
5705 |
+
|
5706 |
+
function wppa_occur_timer( $key = '', $title = '', $cached = false ) {
|
5707 |
+
static $queries;
|
5708 |
+
static $time;
|
5709 |
+
|
5710 |
+
switch( $key ) {
|
5711 |
+
case 'init':
|
5712 |
+
$queries = get_num_queries();
|
5713 |
+
$time = microtime( true );
|
5714 |
+
break;
|
5715 |
+
|
5716 |
+
case 'show':
|
5717 |
+
$queries = get_num_queries() - $queries;
|
5718 |
+
$time = microtime( true ) - $time;
|
5719 |
+
$result = "\n" .
|
5720 |
+
'<!-- End ' . $title . ' ' .
|
5721 |
+
sprintf( '%d queries in %3.1f ms. at %s',
|
5722 |
+
$queries,
|
5723 |
+
$time * 1000,
|
5724 |
+
wppa_local_date( wppa_get_option( 'time_format' ) ) ) .
|
5725 |
+
( $cached ? ' (cached) ' : ' ' ) .
|
5726 |
+
'-->';
|
5727 |
+
wppa_log( 'tim', trim( $result, "\n<>" ) );
|
5728 |
+
return $result;
|
5729 |
+
break;
|
5730 |
+
|
5731 |
+
default:
|
5732 |
+
wppa_log( 'err', 'Unimplemented key in wppa_occur_timer (' . $key . ')' );
|
5733 |
+
break;
|
5734 |
+
}
|
5735 |
+
}
|
wppa-gp-widget.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* A text widget that interpretes wppa shortcodes
|
6 |
*
|
7 |
-
* Version 7.
|
8 |
*/
|
9 |
|
10 |
class WppaGpWidget extends WP_Widget {
|
@@ -16,28 +16,44 @@ class WppaGpWidget extends WP_Widget {
|
|
16 |
|
17 |
function widget( $args, $instance ) {
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
wppa_bump_mocc();
|
24 |
-
|
25 |
-
$instance
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
return;
|
31 |
}
|
32 |
|
33 |
-
//
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
|
|
|
|
41 |
// Body
|
42 |
$text = $instance['text'];
|
43 |
if ( wppa_checked( $instance['filter'] ) ) { // Do wpautop BEFORE do_shortcode
|
@@ -46,18 +62,30 @@ class WppaGpWidget extends WP_Widget {
|
|
46 |
$text = do_shortcode( $text );
|
47 |
$text = apply_filters( 'widget_text', $text ); // If shortcode at wppa filter priority, insert result. See wppa-filter.php
|
48 |
|
49 |
-
|
50 |
<div' .
|
51 |
' class="wppa-gp-widget"' .
|
52 |
' style="margin-top:2px; margin-left:2px;"' .
|
53 |
' data-wppa="yes"' .
|
54 |
' >' .
|
55 |
$text .
|
56 |
-
'</div>'
|
57 |
-
|
58 |
|
59 |
-
//
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
wppa( 'in_widget', false );
|
63 |
wppa( 'fullsize', '' ); // Reset to prevent inheritage of wrong size in case widget is rendered before main column
|
@@ -66,37 +94,63 @@ class WppaGpWidget extends WP_Widget {
|
|
66 |
|
67 |
function update( $new_instance, $old_instance ) {
|
68 |
|
69 |
-
|
70 |
-
$instance =
|
71 |
|
72 |
-
|
73 |
-
|
|
|
74 |
$instance['text'] = $new_instance['text'];
|
75 |
-
|
|
|
76 |
$instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
function form( $instance ) {
|
83 |
|
84 |
-
|
|
|
85 |
|
86 |
// Widget title
|
87 |
echo
|
88 |
-
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) )
|
89 |
|
90 |
// Text area
|
91 |
-
|
|
|
92 |
|
93 |
// Run wpautop?
|
94 |
-
|
|
|
95 |
|
96 |
// Logged in only?
|
97 |
-
|
|
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
|
|
100 |
}
|
101 |
// register WppaGpWidget widget
|
102 |
add_action( 'widgets_init', 'wppa_register_WppaGpWidget' );
|
4 |
*
|
5 |
* A text widget that interpretes wppa shortcodes
|
6 |
*
|
7 |
+
* Version 7.3.02
|
8 |
*/
|
9 |
|
10 |
class WppaGpWidget extends WP_Widget {
|
16 |
|
17 |
function widget( $args, $instance ) {
|
18 |
|
19 |
+
// Initialize
|
20 |
+
wppa_widget_timer( 'init' );
|
21 |
+
wppa_reset_occurrance();
|
22 |
+
wppa( 'in_widget', 'gp' );
|
23 |
wppa_bump_mocc();
|
24 |
+
extract( $args );
|
25 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
26 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
27 |
+
$cache = $instance['cache'];
|
28 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
29 |
+
|
30 |
+
// Logged in only and logged out?
|
31 |
+
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
32 |
return;
|
33 |
}
|
34 |
|
35 |
+
// Cache?
|
36 |
+
if ( $cache ) {
|
37 |
|
38 |
+
if ( wppa_is_file( $cachefile ) ) {
|
39 |
+
|
40 |
+
// Cache expired?
|
41 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
42 |
+
wppa_remove_widget_cache_path( $this->id );
|
43 |
+
}
|
44 |
+
|
45 |
+
// No, use it
|
46 |
+
else {
|
47 |
+
echo wppa_get_contents( $cachefile );
|
48 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
49 |
+
wppa( 'in_widget', false );
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
}
|
53 |
}
|
54 |
|
55 |
+
// Other inits
|
56 |
+
|
57 |
// Body
|
58 |
$text = $instance['text'];
|
59 |
if ( wppa_checked( $instance['filter'] ) ) { // Do wpautop BEFORE do_shortcode
|
62 |
$text = do_shortcode( $text );
|
63 |
$text = apply_filters( 'widget_text', $text ); // If shortcode at wppa filter priority, insert result. See wppa-filter.php
|
64 |
|
65 |
+
$widget_content = '
|
66 |
<div' .
|
67 |
' class="wppa-gp-widget"' .
|
68 |
' style="margin-top:2px; margin-left:2px;"' .
|
69 |
' data-wppa="yes"' .
|
70 |
' >' .
|
71 |
$text .
|
72 |
+
'</div>' .
|
73 |
+
'<div style="clear:both"></div>';
|
74 |
|
75 |
+
// Output
|
76 |
+
$result = "\n" . $before_widget;
|
77 |
+
if ( ! empty( $widget_title ) ) {
|
78 |
+
$result .= $before_title . $widget_title . $after_title;
|
79 |
+
}
|
80 |
+
$result .= $widget_content . $after_widget;
|
81 |
+
|
82 |
+
echo $result;
|
83 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
84 |
+
|
85 |
+
// Cache?
|
86 |
+
if ( $cache ) {
|
87 |
+
wppa_put_contents( $cachefile, $result );
|
88 |
+
}
|
89 |
|
90 |
wppa( 'in_widget', false );
|
91 |
wppa( 'fullsize', '' ); // Reset to prevent inheritage of wrong size in case widget is rendered before main column
|
94 |
|
95 |
function update( $new_instance, $old_instance ) {
|
96 |
|
97 |
+
// Completize all parms
|
98 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
99 |
|
100 |
+
// Sanitize certain args
|
101 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
102 |
+
if ( current_user_can('unfiltered_html') ) {
|
103 |
$instance['text'] = $new_instance['text'];
|
104 |
+
}
|
105 |
+
else {
|
106 |
$instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) ); // wp_filter_post_kses() expects slashed
|
107 |
+
}
|
108 |
+
|
109 |
+
wppa_remove_widget_cache_path( $this->id );
|
110 |
+
|
111 |
+
return $instance;
|
112 |
+
|
113 |
}
|
114 |
|
115 |
function form( $instance ) {
|
116 |
|
117 |
+
// Defaults
|
118 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
119 |
|
120 |
// Widget title
|
121 |
echo
|
122 |
+
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) );
|
123 |
|
124 |
// Text area
|
125 |
+
echo
|
126 |
+
wppa_widget_textarea( $this, 'text', $instance['text'], __( 'Enter the content just like a normal text widget. This widget will interpret [wppa] shortcodes', 'wp-photo-album-plus' ) );
|
127 |
|
128 |
// Run wpautop?
|
129 |
+
echo
|
130 |
+
wppa_widget_checkbox( $this, 'filter', $instance['filter'], __( 'Automatically add paragraphs', 'wp-photo-album-plus' ) );
|
131 |
|
132 |
// Logged in only?
|
133 |
+
echo
|
134 |
+
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
135 |
|
136 |
+
// Cache
|
137 |
+
echo
|
138 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
// Set defaults
|
143 |
+
function get_defaults() {
|
144 |
+
|
145 |
+
$defaults = array( 'title' => __( 'Text', 'wp-photo-album-plus' ),
|
146 |
+
'text' => '',
|
147 |
+
'filter' => 'no',
|
148 |
+
'logonly' => 'no',
|
149 |
+
'cache' => '0',
|
150 |
+
);
|
151 |
+
return $defaults;
|
152 |
}
|
153 |
+
|
154 |
}
|
155 |
// register WppaGpWidget widget
|
156 |
add_action( 'widgets_init', 'wppa_register_WppaGpWidget' );
|
wppa-lasten-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the last uploaded photos
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
class LasTenWidget extends WP_Widget {
|
@@ -19,32 +19,44 @@ class LasTenWidget extends WP_Widget {
|
|
19 |
global $wpdb;
|
20 |
global $wppa_opt;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
wppa_bump_mocc();
|
26 |
-
|
27 |
extract( $args );
|
28 |
-
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
'albumenum' => '',
|
33 |
-
'timesince' => 'yes',
|
34 |
-
'display' => 'thumbs',
|
35 |
-
'includesubs' => 'no',
|
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 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
$max = wppa_opt( 'lasten_count' );
|
49 |
$album = $instance['album'];
|
50 |
$timesince = wppa_checked( $instance['timesince'] ) ? 'yes' : 'no';
|
@@ -161,38 +173,36 @@ class LasTenWidget extends WP_Widget {
|
|
161 |
else $widget_content .= __( 'There are no uploaded photos (yet)', 'wp-photo-album-plus' );
|
162 |
|
163 |
$widget_content .= '<div style="clear:both"></div>';
|
164 |
-
$widget_content .= "\n".'<!-- WPPA+ LasTen Widget end -->';
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
wppa( 'in_widget', false );
|
171 |
}
|
172 |
|
173 |
/** @see WP_Widget::update */
|
174 |
function update($new_instance, $old_instance) {
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
'albumenum' => '',
|
182 |
-
'timesince' => 'yes',
|
183 |
-
'display' => 'thumbs',
|
184 |
-
'includesubs' => 'no',
|
185 |
-
'logonly' => 'no',
|
186 |
-
) );
|
187 |
-
|
188 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
189 |
-
$instance['album'] = strval( intval( $new_instance['album'] ) );
|
190 |
-
$instance['albumenum'] = $new_instance['albumenum'];
|
191 |
if ( $instance['album'] != '-99' ) $instance['albumenum'] = '';
|
192 |
-
|
193 |
-
$
|
194 |
-
$instance['includesubs'] = isset( $new_instance['includesubs'] ) ? $new_instance['includesubs'] : false;
|
195 |
-
$instance['logonly'] = $new_instance['logonly'];
|
196 |
|
197 |
return $instance;
|
198 |
}
|
@@ -200,16 +210,9 @@ class LasTenWidget extends WP_Widget {
|
|
200 |
/** @see WP_Widget::form */
|
201 |
function form($instance) {
|
202 |
global $wppa_opt;
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
'album' => '0',
|
207 |
-
'albumenum' => '',
|
208 |
-
'timesince' => 'yes',
|
209 |
-
'display' => 'thumbs',
|
210 |
-
'includesubs' => 'no',
|
211 |
-
'logonly' => 'no',
|
212 |
-
) );
|
213 |
|
214 |
// Title
|
215 |
echo
|
@@ -256,6 +259,10 @@ class LasTenWidget extends WP_Widget {
|
|
256 |
echo
|
257 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
258 |
|
|
|
|
|
|
|
|
|
259 |
echo
|
260 |
'<p>' .
|
261 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
@@ -264,6 +271,21 @@ class LasTenWidget extends WP_Widget {
|
|
264 |
|
265 |
}
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
} // class LasTenWidget
|
268 |
|
269 |
// register LasTenWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the last uploaded photos
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class LasTenWidget extends WP_Widget {
|
19 |
global $wpdb;
|
20 |
global $wppa_opt;
|
21 |
|
22 |
+
// Initialize
|
23 |
+
wppa_widget_timer( 'init' );
|
24 |
+
wppa_reset_occurrance();
|
25 |
+
wppa( 'in_widget', 'lasten' );
|
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 = in_array( wppa_opt( 'lasten_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page( 'lasten_widget_linkpage', __( 'Last Ten Photos', 'wp-photo-album-plus' ) );
|
60 |
$max = wppa_opt( 'lasten_count' );
|
61 |
$album = $instance['album'];
|
62 |
$timesince = wppa_checked( $instance['timesince'] ) ? 'yes' : 'no';
|
173 |
else $widget_content .= __( 'There are no uploaded photos (yet)', 'wp-photo-album-plus' );
|
174 |
|
175 |
$widget_content .= '<div style="clear:both"></div>';
|
|
|
176 |
|
177 |
+
// Output
|
178 |
+
$result = "\n" . $before_widget;
|
179 |
+
if ( ! empty( $widget_title ) ) {
|
180 |
+
$result .= $before_title . $widget_title . $after_title;
|
181 |
+
}
|
182 |
+
$result .= $widget_content . $after_widget;
|
183 |
+
|
184 |
+
echo $result;
|
185 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
186 |
+
|
187 |
+
// Cache?
|
188 |
+
if ( $cache ) {
|
189 |
+
wppa_put_contents( $cachefile, $result );
|
190 |
+
}
|
191 |
|
192 |
wppa( 'in_widget', false );
|
193 |
}
|
194 |
|
195 |
/** @see WP_Widget::update */
|
196 |
function update($new_instance, $old_instance) {
|
197 |
+
|
198 |
+
// Completize all parms
|
199 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
200 |
+
|
201 |
+
// Sanitize certain args
|
202 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
if ( $instance['album'] != '-99' ) $instance['albumenum'] = '';
|
204 |
+
|
205 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
206 |
|
207 |
return $instance;
|
208 |
}
|
210 |
/** @see WP_Widget::form */
|
211 |
function form($instance) {
|
212 |
global $wppa_opt;
|
213 |
+
|
214 |
+
// Defaults
|
215 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
// Title
|
218 |
echo
|
259 |
echo
|
260 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
261 |
|
262 |
+
// Cache
|
263 |
+
echo
|
264 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
265 |
+
|
266 |
echo
|
267 |
'<p>' .
|
268 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
271 |
|
272 |
}
|
273 |
|
274 |
+
// Set defaults
|
275 |
+
function get_defaults() {
|
276 |
+
|
277 |
+
$defaults = array( 'title' => __( 'Last Ten Photos', 'wp-photo-album-plus' ),
|
278 |
+
'album' => '0',
|
279 |
+
'albumenum' => '',
|
280 |
+
'timesince' => 'no',
|
281 |
+
'display' => 'thumbs',
|
282 |
+
'includesubs' => 'no',
|
283 |
+
'logonly' => 'no',
|
284 |
+
'cache' => '0',
|
285 |
+
);
|
286 |
+
return $defaults;
|
287 |
+
}
|
288 |
+
|
289 |
} // class LasTenWidget
|
290 |
|
291 |
// register LasTenWidget widget
|
wppa-multitag-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the multitag widget
|
6 |
-
* Version 7.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -13,63 +13,88 @@ class MultitagPhotos extends WP_Widget {
|
|
13 |
function __construct() {
|
14 |
$widget_ops = array( 'classname' => 'wppa_multitag_photos', 'description' => __( 'Display checkboxes to select photos by one or more tags', 'wp-photo-album-plus' ) );
|
15 |
parent::__construct( 'wppa_multitag_photos', __( 'WPPA+ Photo Tags Filter', 'wp-photo-album-plus' ), $widget_ops );
|
16 |
-
|
17 |
-
$this -> defaults['title'] = __( 'Photo Tags Filter', 'wp-photo-album-plus' );
|
18 |
}
|
19 |
|
20 |
-
var $defaults = array( 'title' => '',
|
21 |
-
'cols' => '2',
|
22 |
-
'tags' => '',
|
23 |
-
'logonly' => 'no',
|
24 |
-
);
|
25 |
-
|
26 |
/** @see WP_Widget::widget */
|
27 |
function widget($args, $instance) {
|
28 |
global $widget_content;
|
29 |
|
30 |
-
|
|
|
|
|
|
|
31 |
wppa_bump_mocc();
|
32 |
-
|
33 |
-
wppa_initialize_runtime();
|
34 |
-
|
35 |
extract( $args );
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
// Logged in only and logged out?
|
40 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
41 |
return;
|
42 |
}
|
43 |
|
44 |
-
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
|
|
51 |
$tags = is_array( $instance['tags'] ) ? implode( ',', $instance['tags'] ) : '';
|
52 |
|
53 |
-
|
|
|
54 |
<div class="wppa-multitag-widget" data-wppa="yes" >' .
|
55 |
wppa_get_multitag_html( $instance['cols'], $tags ) .
|
56 |
-
'</div>'
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
wppa( 'in_widget', false );
|
61 |
-
|
|
|
62 |
|
63 |
/** @see WP_Widget::update */
|
64 |
function update( $new_instance, $old_instance ) {
|
65 |
|
66 |
-
//
|
67 |
-
$instance = wppa_parse_args( $new_instance, $this->
|
68 |
|
69 |
-
// Sanitize
|
70 |
$instance['title'] = strip_tags( $instance['title'] );
|
71 |
$instance['cols'] = min( max( '1', $instance['cols'] ), '6' );
|
72 |
-
|
|
|
73 |
|
74 |
return $instance;
|
75 |
}
|
@@ -77,8 +102,8 @@ class MultitagPhotos extends WP_Widget {
|
|
77 |
/** @see WP_Widget::form */
|
78 |
function form( $instance ) {
|
79 |
|
80 |
-
//Defaults
|
81 |
-
$instance = wppa_parse_args( $instance, $this->
|
82 |
|
83 |
$title = $instance['title'];
|
84 |
$cols = $instance['cols'];
|
@@ -118,8 +143,24 @@ class MultitagPhotos extends WP_Widget {
|
|
118 |
echo
|
119 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
120 |
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
} // class MultitagPhotos
|
124 |
|
125 |
// register Photo Tags widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the multitag widget
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
13 |
function __construct() {
|
14 |
$widget_ops = array( 'classname' => 'wppa_multitag_photos', 'description' => __( 'Display checkboxes to select photos by one or more tags', 'wp-photo-album-plus' ) );
|
15 |
parent::__construct( 'wppa_multitag_photos', __( 'WPPA+ Photo Tags Filter', 'wp-photo-album-plus' ), $widget_ops );
|
|
|
|
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/** @see WP_Widget::widget */
|
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', 'multitag' );
|
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 |
$tags = is_array( $instance['tags'] ) ? implode( ',', $instance['tags'] ) : '';
|
60 |
|
61 |
+
// Make the widget content
|
62 |
+
$widget_content = '
|
63 |
<div class="wppa-multitag-widget" data-wppa="yes" >' .
|
64 |
wppa_get_multitag_html( $instance['cols'], $tags ) .
|
65 |
+
'</div>' .
|
66 |
+
'<div style="clear:both" ></div>';
|
67 |
+
|
68 |
+
// Output
|
69 |
+
$result = "\n" . $before_widget;
|
70 |
+
if ( ! empty( $widget_title ) ) {
|
71 |
+
$result .= $before_title . $widget_title . $after_title;
|
72 |
+
}
|
73 |
+
$result .= $widget_content . $after_widget;
|
74 |
+
|
75 |
+
echo $result;
|
76 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
77 |
+
|
78 |
+
// Cache?
|
79 |
+
if ( $cache ) {
|
80 |
+
wppa_put_contents( $cachefile, $result );
|
81 |
+
}
|
82 |
|
83 |
wppa( 'in_widget', false );
|
84 |
+
|
85 |
+
}
|
86 |
|
87 |
/** @see WP_Widget::update */
|
88 |
function update( $new_instance, $old_instance ) {
|
89 |
|
90 |
+
// Completize all parms
|
91 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
92 |
|
93 |
+
// Sanitize certain args
|
94 |
$instance['title'] = strip_tags( $instance['title'] );
|
95 |
$instance['cols'] = min( max( '1', $instance['cols'] ), '6' );
|
96 |
+
|
97 |
+
wppa_remove_widget_cache_path( $this->id );
|
98 |
|
99 |
return $instance;
|
100 |
}
|
102 |
/** @see WP_Widget::form */
|
103 |
function form( $instance ) {
|
104 |
|
105 |
+
// Defaults
|
106 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
107 |
|
108 |
$title = $instance['title'];
|
109 |
$cols = $instance['cols'];
|
143 |
echo
|
144 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
145 |
|
146 |
+
// Cache
|
147 |
+
echo
|
148 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
149 |
+
|
150 |
}
|
151 |
|
152 |
+
// Set defaults
|
153 |
+
function get_defaults() {
|
154 |
+
|
155 |
+
$defaults = array( 'title' => __( 'Photo Tags Filter', 'wp-photo-album-plus' ),
|
156 |
+
'cols' => '2',
|
157 |
+
'tags' => '',
|
158 |
+
'logonly' => 'no',
|
159 |
+
'cache' => '0',
|
160 |
+
);
|
161 |
+
return $defaults;
|
162 |
+
}
|
163 |
+
|
164 |
} // class MultitagPhotos
|
165 |
|
166 |
// register Photo Tags widget
|
wppa-notify-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* notify events to users
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
class wppaNotifyWidget extends WP_Widget {
|
@@ -17,19 +17,46 @@ class wppaNotifyWidget extends WP_Widget {
|
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget( $args, $instance ) {
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => __( 'Notify me', 'wp-photo-album-plus' ),
|
23 |
-
'logonly' => 'yes',
|
24 |
-
) );
|
25 |
// Logged in only and logged out?
|
26 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
27 |
return;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
$widget_content .= __( 'Notify me when...', 'wp-photo-album-plus' ) . '<br />';
|
34 |
|
35 |
// Get the body of the widget
|
@@ -244,25 +271,34 @@ class wppaNotifyWidget extends WP_Widget {
|
|
244 |
$widget_content .= '<div style="clear:both" ></div>';
|
245 |
$widget_content .= "\n".'<!-- WPPA+ notify Widget end -->';
|
246 |
|
247 |
-
|
|
|
248 |
if ( ! empty( $widget_title ) ) {
|
|
|
|
|
|
|
249 |
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
-
|
|
|
253 |
}
|
254 |
|
255 |
/** @see WP_Widget::update */
|
256 |
function update( $new_instance, $old_instance ) {
|
257 |
-
$instance = $old_instance;
|
258 |
|
259 |
-
//
|
260 |
-
$instance =
|
261 |
-
'logonly' => 'yes',
|
262 |
-
) );
|
263 |
|
264 |
-
|
265 |
-
$instance['title']
|
|
|
|
|
266 |
|
267 |
return $instance;
|
268 |
}
|
@@ -270,15 +306,18 @@ class wppaNotifyWidget extends WP_Widget {
|
|
270 |
/** @see WP_Widget::form */
|
271 |
function form( $instance ) {
|
272 |
|
273 |
-
//Defaults
|
274 |
-
$instance =
|
275 |
-
'logonly' => 'yes',
|
276 |
-
) );
|
277 |
|
278 |
// Title
|
279 |
echo
|
280 |
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) );
|
281 |
|
|
|
|
|
|
|
|
|
|
|
282 |
echo
|
283 |
'<div style="padding:6px;border:1px solid lightgray;margin-top:2px;" >' .
|
284 |
__( 'You can configure the availability of mailing types in Table IX-M', 'wp-photo-album-plus' ) .
|
@@ -286,6 +325,17 @@ class wppaNotifyWidget extends WP_Widget {
|
|
286 |
|
287 |
}
|
288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
} // class wppaNotifyWidget
|
290 |
|
291 |
// register wppaNotifyWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* notify events to users
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class wppaNotifyWidget extends WP_Widget {
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget( $args, $instance ) {
|
19 |
|
20 |
+
// Initialize
|
21 |
+
wppa_widget_timer( 'init' );
|
22 |
+
wppa_reset_occurrance();
|
23 |
+
wppa( 'in_widget', 'notify' );
|
24 |
+
wppa_bump_mocc();
|
25 |
+
extract( $args );
|
26 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
27 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
28 |
+
$cache = $instance['cache'];
|
29 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
30 |
|
|
|
|
|
|
|
31 |
// Logged in only and logged out?
|
32 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
// Cache?
|
37 |
+
if ( $cache ) {
|
38 |
|
39 |
+
if ( wppa_is_file( $cachefile ) ) {
|
40 |
+
|
41 |
+
// Cache expired?
|
42 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
43 |
+
wppa_remove_widget_cache_path( $this->id );
|
44 |
+
}
|
45 |
+
|
46 |
+
// No, use it
|
47 |
+
else {
|
48 |
+
echo wppa_get_contents( $cachefile );
|
49 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
50 |
+
wppa( 'in_widget', false );
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
// Other inits
|
57 |
+
|
58 |
+
// Make the widget content
|
59 |
+
$widget_content = '<!-- WPPA+ notify Widget start -->';
|
60 |
$widget_content .= __( 'Notify me when...', 'wp-photo-album-plus' ) . '<br />';
|
61 |
|
62 |
// Get the body of the widget
|
271 |
$widget_content .= '<div style="clear:both" ></div>';
|
272 |
$widget_content .= "\n".'<!-- WPPA+ notify Widget end -->';
|
273 |
|
274 |
+
// Output
|
275 |
+
$result = "\n" . $before_widget;
|
276 |
if ( ! empty( $widget_title ) ) {
|
277 |
+
$result .= $before_title . $widget_title . $after_title;
|
278 |
+
}
|
279 |
+
$result .= $widget_content . $after_widget;
|
280 |
|
281 |
+
echo $result;
|
282 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
283 |
+
|
284 |
+
// Cache?
|
285 |
+
if ( $cache ) {
|
286 |
+
wppa_put_contents( $cachefile, $result );
|
287 |
}
|
288 |
+
|
289 |
+
wppa( 'in_widget', false );
|
290 |
}
|
291 |
|
292 |
/** @see WP_Widget::update */
|
293 |
function update( $new_instance, $old_instance ) {
|
|
|
294 |
|
295 |
+
// Completize all parms
|
296 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
|
|
|
|
297 |
|
298 |
+
// Sanitize certain args
|
299 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
300 |
+
|
301 |
+
wppa_remove_widget_cache_path( $this->id );
|
302 |
|
303 |
return $instance;
|
304 |
}
|
306 |
/** @see WP_Widget::form */
|
307 |
function form( $instance ) {
|
308 |
|
309 |
+
// Defaults
|
310 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
311 |
|
312 |
// Title
|
313 |
echo
|
314 |
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) );
|
315 |
|
316 |
+
// Cache
|
317 |
+
// Do not cache this widget. data differs for every visitor
|
318 |
+
// echo
|
319 |
+
// wppa_widget_cache( $this, $instance['cache'] );
|
320 |
+
|
321 |
echo
|
322 |
'<div style="padding:6px;border:1px solid lightgray;margin-top:2px;" >' .
|
323 |
__( 'You can configure the availability of mailing types in Table IX-M', 'wp-photo-album-plus' ) .
|
325 |
|
326 |
}
|
327 |
|
328 |
+
// Set defaults
|
329 |
+
function get_defaults() {
|
330 |
+
|
331 |
+
$defaults = array( 'title' => __( 'Notify me', 'wp-photo-album-plus' ),
|
332 |
+
'logonly' => 'yes',
|
333 |
+
'cache' => '0',
|
334 |
+
);
|
335 |
+
return $defaults;
|
336 |
+
}
|
337 |
+
|
338 |
+
|
339 |
} // class wppaNotifyWidget
|
340 |
|
341 |
// register wppaNotifyWidget widget
|
wppa-photo-admin-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
-
* Version 7.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1986,7 +1986,18 @@ function wppaToggleExif( id, count ) {
|
|
1986 |
'<select' .
|
1987 |
' onchange="wppaAddTag( this.value, \'tags-' . $id . '\' ); wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', document.getElementById( \'tags-' . $id . '\' ).value )"' .
|
1988 |
' >';
|
1989 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1990 |
if ( is_array( $taglist ) ) {
|
1991 |
echo '<option value="" >' . __( '- select to add -', 'wp-photo-album-plus' ) . '</option>';
|
1992 |
foreach ( $taglist as $tag ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
1986 |
'<select' .
|
1987 |
' onchange="wppaAddTag( this.value, \'tags-' . $id . '\' ); wppaAjaxUpdatePhoto( ' . $id . ', \'tags\', document.getElementById( \'tags-' . $id . '\' ).value )"' .
|
1988 |
' >';
|
1989 |
+
|
1990 |
+
if ( wppa_switch( 'predef_tags_only' ) ) {
|
1991 |
+
$keys = explode( ',', trim( wppa_opt( 'minimum_tags' ) ) );
|
1992 |
+
$taglist = array();
|
1993 |
+
foreach ( $keys as $key ) {
|
1994 |
+
$taglist[$key]['tag'] = $key;
|
1995 |
+
}
|
1996 |
+
}
|
1997 |
+
else {
|
1998 |
+
$taglist = wppa_get_taglist();
|
1999 |
+
}
|
2000 |
+
|
2001 |
if ( is_array( $taglist ) ) {
|
2002 |
echo '<option value="" >' . __( '- select to add -', 'wp-photo-album-plus' ) . '</option>';
|
2003 |
foreach ( $taglist as $tag ) {
|
wppa-potd-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the widget
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -20,23 +20,43 @@ class PhotoOfTheDay extends WP_Widget {
|
|
20 |
function widget($args, $instance) {
|
21 |
global $wpdb;
|
22 |
|
23 |
-
|
|
|
|
|
|
|
24 |
wppa_bump_mocc();
|
25 |
-
|
26 |
-
wppa_initialize_runtime();
|
27 |
-
|
28 |
extract( $args );
|
29 |
-
|
30 |
-
|
31 |
-
$
|
32 |
-
|
33 |
|
34 |
// Logged in only and logged out?
|
35 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
// get the photo ($image)
|
42 |
$image = wppa_get_potd();
|
@@ -61,7 +81,7 @@ class PhotoOfTheDay extends WP_Widget {
|
|
61 |
|
62 |
$id = $image['id'];
|
63 |
$w = wppa_opt( 'potd_widget_width' );
|
64 |
-
$ratio = wppa_get_photoy( $id ) / wppa_get_photox( $id );
|
65 |
$h = round( $w * $ratio );
|
66 |
$usethumb = wppa_use_thumb_file( $id, wppa_opt( 'potd_widget_width' ), '0' );
|
67 |
$imgurl = $usethumb ? wppa_get_thumb_url( $id, true, '', $w, $h ) : wppa_get_photo_url( $id, true, '', $w, $h );
|
@@ -212,24 +232,34 @@ class PhotoOfTheDay extends WP_Widget {
|
|
212 |
|
213 |
$widget_content .= "\n".'<!-- WPPA+ Photo of the day Widget end -->';
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
wppa( 'in_widget', false );
|
220 |
}
|
221 |
|
222 |
/** @see WP_Widget::update */
|
223 |
function update( $new_instance, $old_instance ) {
|
224 |
-
$instance = $old_instance;
|
225 |
|
226 |
-
//
|
227 |
-
$instance =
|
228 |
-
'logonly' => 'no',
|
229 |
-
) );
|
230 |
|
231 |
-
|
232 |
-
$instance['
|
|
|
|
|
233 |
|
234 |
return $instance;
|
235 |
}
|
@@ -238,9 +268,7 @@ class PhotoOfTheDay extends WP_Widget {
|
|
238 |
function form( $instance ) {
|
239 |
|
240 |
// Defaults
|
241 |
-
$instance =
|
242 |
-
'logonly' => 'no',
|
243 |
-
) );
|
244 |
|
245 |
// Title
|
246 |
echo
|
@@ -250,6 +278,10 @@ class PhotoOfTheDay extends WP_Widget {
|
|
250 |
echo
|
251 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
252 |
|
|
|
|
|
|
|
|
|
253 |
// Explanation
|
254 |
echo
|
255 |
'<p>' .
|
@@ -257,6 +289,16 @@ class PhotoOfTheDay extends WP_Widget {
|
|
257 |
'</p>';
|
258 |
}
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
} // class PhotoOfTheDay
|
261 |
|
262 |
require_once 'wppa-widget-functions.php';
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the widget
|
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', 'potd' );
|
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 |
|
61 |
// get the photo ($image)
|
62 |
$image = wppa_get_potd();
|
81 |
|
82 |
$id = $image['id'];
|
83 |
$w = wppa_opt( 'potd_widget_width' );
|
84 |
+
$ratio = ( wppa_get_photox( $id ) ? wppa_get_photoy( $id ) / wppa_get_photox( $id ) : 1 );
|
85 |
$h = round( $w * $ratio );
|
86 |
$usethumb = wppa_use_thumb_file( $id, wppa_opt( 'potd_widget_width' ), '0' );
|
87 |
$imgurl = $usethumb ? wppa_get_thumb_url( $id, true, '', $w, $h ) : wppa_get_photo_url( $id, true, '', $w, $h );
|
232 |
|
233 |
$widget_content .= "\n".'<!-- WPPA+ Photo of the day Widget end -->';
|
234 |
|
235 |
+
// Output
|
236 |
+
$result = "\n" . $before_widget;
|
237 |
+
if ( ! empty( $widget_title ) ) {
|
238 |
+
$result .= $before_title . $widget_title . $after_title;
|
239 |
+
}
|
240 |
+
$result .= $widget_content . $after_widget;
|
241 |
+
|
242 |
+
echo $result;
|
243 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
244 |
+
|
245 |
+
// Cache?
|
246 |
+
if ( $cache ) {
|
247 |
+
wppa_put_contents( $cachefile, $result );
|
248 |
+
}
|
249 |
|
250 |
wppa( 'in_widget', false );
|
251 |
}
|
252 |
|
253 |
/** @see WP_Widget::update */
|
254 |
function update( $new_instance, $old_instance ) {
|
|
|
255 |
|
256 |
+
// Completize all parms
|
257 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
|
|
|
|
258 |
|
259 |
+
// Sanitize certain args
|
260 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
261 |
+
|
262 |
+
wppa_remove_widget_cache_path( $this->id );
|
263 |
|
264 |
return $instance;
|
265 |
}
|
268 |
function form( $instance ) {
|
269 |
|
270 |
// Defaults
|
271 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
272 |
|
273 |
// Title
|
274 |
echo
|
278 |
echo
|
279 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
280 |
|
281 |
+
// Cache
|
282 |
+
echo
|
283 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
284 |
+
|
285 |
// Explanation
|
286 |
echo
|
287 |
'<p>' .
|
289 |
'</p>';
|
290 |
}
|
291 |
|
292 |
+
// Set defaults
|
293 |
+
function get_defaults() {
|
294 |
+
|
295 |
+
$defaults = array( 'title' => wppa_opt( 'potd_title' ),
|
296 |
+
'logonly' => 'no',
|
297 |
+
'cache' => '0',
|
298 |
+
);
|
299 |
+
return $defaults;
|
300 |
+
}
|
301 |
+
|
302 |
} // class PhotoOfTheDay
|
303 |
|
304 |
require_once 'wppa-widget-functions.php';
|
wppa-qr-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display qr code
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
class wppaQRWidget extends WP_Widget {
|
@@ -17,26 +17,50 @@ class wppaQRWidget extends WP_Widget {
|
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget( $args, $instance ) {
|
19 |
global $wpdb;
|
20 |
-
global $widget_content;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
// Logged in only and logged out?
|
29 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
30 |
return;
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
// Get the qrcode
|
42 |
$qrsrc = wppa_create_qrcode_cache( $_SERVER['SCRIPT_URI'], wppa_opt( 'qr_size' ) );
|
@@ -73,23 +97,42 @@ class wppaQRWidget extends WP_Widget {
|
|
73 |
});' ) . '
|
74 |
</script>';
|
75 |
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
/** @see WP_Widget::update */
|
80 |
function update( $new_instance, $old_instance ) {
|
81 |
-
$instance = $old_instance;
|
82 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
83 |
-
$instance['logonly'] = $new_instance['logonly'];
|
84 |
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
/** @see WP_Widget::form */
|
89 |
function form( $instance ) {
|
90 |
|
91 |
// Defaults
|
92 |
-
$instance =
|
93 |
|
94 |
// Title
|
95 |
echo
|
@@ -99,13 +142,28 @@ class wppaQRWidget extends WP_Widget {
|
|
99 |
echo
|
100 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
101 |
|
|
|
|
|
|
|
|
|
|
|
102 |
// Explanation
|
103 |
echo
|
104 |
'<p>' .
|
105 |
__( 'You can set the sizes and colors in this widget in the <b>Photo Albums -> Settings</b> admin page Table IX-K1.x.', 'wp-photo-album-plus' ) .
|
106 |
'</p>';
|
107 |
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
} // class wppaQRWidget
|
111 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display qr code
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class wppaQRWidget extends WP_Widget {
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget( $args, $instance ) {
|
19 |
global $wpdb;
|
|
|
20 |
|
21 |
+
// Initialize
|
22 |
+
wppa_widget_timer( 'init' );
|
23 |
+
wppa_reset_occurrance();
|
24 |
+
wppa( 'in_widget', 'qr' );
|
25 |
+
wppa_bump_mocc();
|
26 |
+
extract( $args );
|
27 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
28 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
29 |
+
$cache = $instance['cache'];
|
30 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
31 |
|
32 |
// Logged in only and logged out?
|
33 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
+
// Cache?
|
38 |
+
if ( $cache ) {
|
39 |
+
|
40 |
+
if ( wppa_is_file( $cachefile ) ) {
|
41 |
+
|
42 |
+
// Cache expired?
|
43 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
44 |
+
wppa_remove_widget_cache_path( $this->id );
|
45 |
+
}
|
46 |
+
|
47 |
+
// No, use it
|
48 |
+
else {
|
49 |
+
echo wppa_get_contents( $cachefile );
|
50 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
51 |
+
wppa( 'in_widget', false );
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// Other inits
|
58 |
+
$qrsrc = 'http' . ( is_ssl() ? 's' : '' ) . '://api.qrserver.com/v1/create-qr-code/' .
|
59 |
+
'?format=svg' .
|
60 |
+
'&size='. wppa_opt( 'qr_size' ).'x'.wppa_opt( 'qr_size' ) .
|
61 |
+
'&color='.trim( wppa_opt( 'qr_color' ), '#' ) .
|
62 |
+
'&bgcolor='.trim( wppa_opt( 'qr_bgcolor' ), '#' ) .
|
63 |
+
'&data=' . urlencode( $_SERVER['SCRIPT_URI'] );
|
64 |
|
65 |
// Get the qrcode
|
66 |
$qrsrc = wppa_create_qrcode_cache( $_SERVER['SCRIPT_URI'], wppa_opt( 'qr_size' ) );
|
97 |
});' ) . '
|
98 |
</script>';
|
99 |
|
100 |
+
// Output
|
101 |
+
$result = "\n" . $before_widget;
|
102 |
+
if ( ! empty( $widget_title ) ) {
|
103 |
+
$result .= $before_title . $widget_title . $after_title;
|
104 |
+
}
|
105 |
+
$result .= $widget_content . $after_widget;
|
106 |
+
|
107 |
+
echo $result;
|
108 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
109 |
+
|
110 |
+
// Cache?
|
111 |
+
if ( $cache ) {
|
112 |
+
wppa_put_contents( $cachefile, $result );
|
113 |
+
}
|
114 |
+
|
115 |
+
wppa( 'in_widget', false );
|
116 |
+
|
117 |
}
|
118 |
|
119 |
/** @see WP_Widget::update */
|
120 |
function update( $new_instance, $old_instance ) {
|
|
|
|
|
|
|
121 |
|
122 |
+
// Completize all parms
|
123 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
124 |
+
|
125 |
+
// Sanitize certain args
|
126 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
127 |
+
|
128 |
+
wppa_remove_widget_cache_path( $this->id );
|
129 |
+
}
|
130 |
|
131 |
/** @see WP_Widget::form */
|
132 |
function form( $instance ) {
|
133 |
|
134 |
// Defaults
|
135 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
136 |
|
137 |
// Title
|
138 |
echo
|
142 |
echo
|
143 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
144 |
|
145 |
+
// Cache
|
146 |
+
// Do not cache QR widget
|
147 |
+
// echo
|
148 |
+
// wppa_widget_cache( $this, $instance['cache'] );
|
149 |
+
|
150 |
// Explanation
|
151 |
echo
|
152 |
'<p>' .
|
153 |
__( 'You can set the sizes and colors in this widget in the <b>Photo Albums -> Settings</b> admin page Table IX-K1.x.', 'wp-photo-album-plus' ) .
|
154 |
'</p>';
|
155 |
|
156 |
+
}
|
157 |
+
|
158 |
+
// Set defaults
|
159 |
+
function get_defaults() {
|
160 |
+
|
161 |
+
$defaults = array( 'title' => __( 'Sidebar Slideshow', 'wp-photo-album-plus' ),
|
162 |
+
'logonly' => 'no',
|
163 |
+
'cache' => '0',
|
164 |
+
);
|
165 |
+
return $defaults;
|
166 |
+
}
|
167 |
|
168 |
} // class wppaQRWidget
|
169 |
|
wppa-search-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the search widget
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -22,83 +22,82 @@ class SearchPhotos extends WP_Widget {
|
|
22 |
global $widget_content;
|
23 |
global $wpdb;
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
extract( $args );
|
31 |
-
|
32 |
-
$
|
33 |
-
|
34 |
-
|
35 |
-
'root' => false,
|
36 |
-
'sub' => false,
|
37 |
-
'album' => '0',
|
38 |
-
'landingpage' => '0',
|
39 |
-
'catbox' => false,
|
40 |
-
'selboxes' => false,
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if ( ! empty( $widget_title ) ) {
|
55 |
-
|
56 |
}
|
|
|
57 |
|
58 |
-
echo
|
59 |
-
echo
|
60 |
-
wppa_checked( $instance['sub'] ),
|
61 |
-
wppa_checked( $instance['root'] ),
|
62 |
-
$instance['album'],
|
63 |
-
$instance['landingpage'],
|
64 |
-
wppa_checked( $instance['catbox'] ),
|
65 |
-
wppa_checked( $instance['selboxes'] ) ? wppa_opt( 'search_selboxes' ) : false
|
66 |
-
);
|
67 |
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
-
// Reset switch
|
71 |
wppa( 'in_widget', false );
|
72 |
}
|
73 |
|
74 |
/** @see WP_Widget::update */
|
75 |
function update( $new_instance, $old_instance ) {
|
76 |
|
77 |
-
|
|
|
78 |
|
79 |
-
//
|
80 |
-
$instance =
|
81 |
-
array(
|
82 |
-
'title' => __( 'Search Photos', 'wp-photo-album-plus' ),
|
83 |
-
'label' => '',
|
84 |
-
'root' => false,
|
85 |
-
'sub' => false,
|
86 |
-
'album' => '0',
|
87 |
-
'landingpage' => '',
|
88 |
-
'catbox' => false,
|
89 |
-
'selboxes' => false,
|
90 |
-
'logonly' => 'no',
|
91 |
-
) );
|
92 |
|
93 |
-
$
|
94 |
-
$instance['label'] = $new_instance['label'];
|
95 |
-
$instance['root'] = isset( $new_instance['root'] ) ? $new_instance['root'] : false;
|
96 |
-
$instance['sub'] = isset( $new_instance['sub'] ) ? $new_instance['sub'] : false;
|
97 |
-
$instance['album'] = $new_instance['album'];
|
98 |
-
$instance['landingpage'] = $new_instance['landingpage'];
|
99 |
-
$instance['catbox'] = isset( $new_instance['catbox'] ) ? $new_instance['catbox'] : false;
|
100 |
-
$instance['selboxes'] = isset( $new_instance['selboxes'] ) ? $new_instance['selboxes'] : false;
|
101 |
-
$instance['logonly'] = $new_instance['logonly'];
|
102 |
|
103 |
return $instance;
|
104 |
}
|
@@ -108,18 +107,7 @@ class SearchPhotos extends WP_Widget {
|
|
108 |
global $wpdb;
|
109 |
|
110 |
// Defaults
|
111 |
-
$instance
|
112 |
-
array(
|
113 |
-
'title' => __( 'Search Photos', 'wp-photo-album-plus' ),
|
114 |
-
'label' => '',
|
115 |
-
'root' => false,
|
116 |
-
'sub' => false,
|
117 |
-
'album' => '0',
|
118 |
-
'landingpage' => '',
|
119 |
-
'catbox' => false,
|
120 |
-
'selboxes' => false,
|
121 |
-
'logonly' => 'no',
|
122 |
-
) );
|
123 |
|
124 |
// Title
|
125 |
echo
|
@@ -239,7 +227,28 @@ class SearchPhotos extends WP_Widget {
|
|
239 |
echo
|
240 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
241 |
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
} // class SearchPhotos
|
245 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the search widget
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
22 |
global $widget_content;
|
23 |
global $wpdb;
|
24 |
|
25 |
+
// Initialize
|
26 |
+
wppa_widget_timer( 'init' );
|
27 |
+
wppa_reset_occurrance();
|
28 |
+
wppa( 'in_widget', 'search' );
|
29 |
+
wppa_bump_mocc();
|
30 |
extract( $args );
|
31 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
32 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
33 |
+
$cache = $instance['cache'];
|
34 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
// Logged in only and logged out?
|
37 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
38 |
return;
|
39 |
}
|
40 |
|
41 |
+
// Cache?
|
42 |
+
if ( $cache ) {
|
43 |
+
|
44 |
+
if ( wppa_is_file( $cachefile ) ) {
|
45 |
+
|
46 |
+
// Cache expired?
|
47 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
48 |
+
wppa_remove_widget_cache_path( $this->id );
|
49 |
+
}
|
50 |
|
51 |
+
// No, use it
|
52 |
+
else {
|
53 |
+
echo wppa_get_contents( $cachefile );
|
54 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
55 |
+
wppa( 'in_widget', false );
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
|
61 |
+
// Make the widget content
|
62 |
+
$widget_content = '
|
63 |
+
<span data-wppa="yes" ></span>' .
|
64 |
+
wppa_get_search_html( $instance['label'],
|
65 |
+
wppa_checked( $instance['sub'] ),
|
66 |
+
wppa_checked( $instance['root'] ),
|
67 |
+
$instance['album'],
|
68 |
+
$instance['landingpage'],
|
69 |
+
wppa_checked( $instance['catbox'] ),
|
70 |
+
wppa_checked( $instance['selboxes'] ) ? wppa_opt( 'search_selboxes' ) : false
|
71 |
+
);
|
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 |
}
|
107 |
global $wpdb;
|
108 |
|
109 |
// Defaults
|
110 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
// Title
|
113 |
echo
|
227 |
echo
|
228 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
229 |
|
230 |
+
// Cache
|
231 |
+
echo
|
232 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
// Set defaults
|
237 |
+
function get_defaults() {
|
238 |
+
|
239 |
+
$defaults = array( 'title' => __( 'Search Photos', 'wp-photo-album-plus' ),
|
240 |
+
'label' => '',
|
241 |
+
'root' => false,
|
242 |
+
'sub' => false,
|
243 |
+
'album' => '0',
|
244 |
+
'landingpage' => '',
|
245 |
+
'catbox' => false,
|
246 |
+
'selboxes' => false,
|
247 |
+
'logonly' => 'no',
|
248 |
+
'cache' => '0',
|
249 |
+
);
|
250 |
+
return $defaults;
|
251 |
+
}
|
252 |
|
253 |
} // class SearchPhotos
|
254 |
|
wppa-settings-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
-
* Version 7.3.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -8793,6 +8793,15 @@ global $wppa_supported_camara_brands;
|
|
8793 |
$tags = 'system,mail';
|
8794 |
wppa_setting($slug, '9.6', $name, $desc, $html, $help, $clas, $tags);
|
8795 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8796 |
$name = __('Retry failed mails', 'wp-photo-album-plus');
|
8797 |
$desc = __('Select number of retries for failed mails', 'wp-photo-album-plus');
|
8798 |
$help = (__('Retries occur at the background every hour', 'wp-photo-album-plus'));
|
@@ -8812,6 +8821,15 @@ global $wppa_supported_camara_brands;
|
|
8812 |
$tags = 'system';
|
8813 |
wppa_setting($slug, '11', $name, $desc, $html, $help, $clas, $tags);
|
8814 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8815 |
$name = __('Login link', 'wp-photo-album-plus');
|
8816 |
$desc = __('Modify this link if you have a custom login page.', 'wp-photo-album-plus');
|
8817 |
$help = '';
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
8793 |
$tags = 'system,mail';
|
8794 |
wppa_setting($slug, '9.6', $name, $desc, $html, $help, $clas, $tags);
|
8795 |
|
8796 |
+
$name = __('Log Timings', 'wp-photo-album-plus');
|
8797 |
+
$desc = __('Keep track of various timings.', 'wp-photo-album-plus');
|
8798 |
+
$help = '';
|
8799 |
+
$slug = 'wppa_log_tim';
|
8800 |
+
$html = wppa_checkbox($slug);
|
8801 |
+
$clas = '';
|
8802 |
+
$tags = 'system,mail';
|
8803 |
+
wppa_setting($slug, '9.7', $name, $desc, $html, $help, $clas, $tags);
|
8804 |
+
|
8805 |
$name = __('Retry failed mails', 'wp-photo-album-plus');
|
8806 |
$desc = __('Select number of retries for failed mails', 'wp-photo-album-plus');
|
8807 |
$help = (__('Retries occur at the background every hour', 'wp-photo-album-plus'));
|
8821 |
$tags = 'system';
|
8822 |
wppa_setting($slug, '11', $name, $desc, $html, $help, $clas, $tags);
|
8823 |
|
8824 |
+
$name = __('Show minimum tags only', 'wp-photo-album-plus');
|
8825 |
+
$desc = __('Shows only the minimum tags in the photo admin tags seclection box', 'wp-photo-album-plus');
|
8826 |
+
$help = __('To limit the use of these tags only, also tick Table VII-C9: New tags restricted', 'wp-photo-album-plus');
|
8827 |
+
$slug = 'wppa_predef_tags_only';
|
8828 |
+
$html = wppa_checkbox($slug);
|
8829 |
+
$clas = '';
|
8830 |
+
$tags = 'system';
|
8831 |
+
wppa_setting($slug, '11.1', $name, $desc, $html, $help, $clas, $tags);
|
8832 |
+
|
8833 |
$name = __('Login link', 'wp-photo-album-plus');
|
8834 |
$desc = __('Modify this link if you have a custom login page.', 'wp-photo-album-plus');
|
8835 |
$help = '';
|
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 7.3.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -17,61 +17,52 @@ class SlideshowWidget extends WP_Widget {
|
|
17 |
function __construct() {
|
18 |
$widget_ops = array( 'classname' => 'slideshow_widget', 'description' => __( 'Display a slideshow', 'wp-photo-album-plus' ) );
|
19 |
parent::__construct( 'slideshow_widget', __( 'WPPA+ Sidebar Slideshow', 'wp-photo-album-plus' ), $widget_ops);
|
20 |
-
|
21 |
-
// Fix non constant defaults
|
22 |
-
$this -> defaults['title'] = __( 'Sidebar Slideshow', 'wp-photo-album-plus' );
|
23 |
-
$this -> defaults['width'] = wppa_get_option( 'wppa_widget_width' );
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
// Default settins. Can not use functions or calculations here. Only constants are allowed
|
28 |
-
var $defaults = array( 'title' => '',
|
29 |
-
'album' => '-2',
|
30 |
-
'width' => '0',
|
31 |
-
'height' => '0',
|
32 |
-
'ponly' => 'no',
|
33 |
-
'linkurl' => '',
|
34 |
-
'linktitle' => '',
|
35 |
-
'subtext' => '',
|
36 |
-
'supertext' => '',
|
37 |
-
'valign' => 'center',
|
38 |
-
'timeout' => '4',
|
39 |
-
'film' => 'no',
|
40 |
-
'browse' => 'no',
|
41 |
-
'name' => 'no',
|
42 |
-
'numbar' => 'no',
|
43 |
-
'desc' => 'no',
|
44 |
-
'maxslides' => '100',
|
45 |
-
'random' => 'no',
|
46 |
-
'incsubs' => 'no',
|
47 |
-
'logonly' => 'no',
|
48 |
-
);
|
49 |
|
50 |
/** @see WP_Widget::widget */
|
51 |
function widget( $args, $instance ) {
|
52 |
global $wpdb;
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
require_once(dirname(__FILE__) . '/wppa-slideshow.php');
|
60 |
-
wppa_initialize_runtime();
|
61 |
-
|
62 |
extract( $args );
|
63 |
-
|
64 |
-
$
|
65 |
-
$
|
66 |
-
$
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
|
70 |
// Logged in only and logged out?
|
71 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
72 |
return;
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
// Calculate the height if set to 0
|
76 |
if ( ! $instance['height'] ) {
|
77 |
$instance['height'] = round( wppa_opt( 'widget_width' ) * wppa_opt( 'maxheight' ) / wppa_opt( 'fullsize' ) );
|
@@ -80,17 +71,9 @@ class SlideshowWidget extends WP_Widget {
|
|
80 |
// Do the widget if we know the album
|
81 |
if ( is_numeric( $album ) && ( wppa_album_exists( $album ) || $album == '-2' ) ) {
|
82 |
|
83 |
-
// Open widget
|
84 |
-
echo $before_widget;
|
85 |
-
|
86 |
-
// Widget title
|
87 |
-
if ( ! empty( $title ) ) {
|
88 |
-
echo $before_title . $title . $after_title;
|
89 |
-
}
|
90 |
-
|
91 |
// Show text above slideshow
|
92 |
if ( __( $instance['supertext'] ) ) {
|
93 |
-
|
94 |
'<div style="padding-top:2px; padding-bottom:4px; text-align:center" >' .
|
95 |
__( $instance['supertext'] ) .
|
96 |
'</div>';
|
@@ -123,16 +106,16 @@ class SlideshowWidget extends WP_Widget {
|
|
123 |
}
|
124 |
|
125 |
// Open the slideshow container
|
126 |
-
|
127 |
'<div' .
|
128 |
' style="padding-top:2px; padding-bottom:4px;" ' .
|
129 |
' data-wppa="yes" >';
|
130 |
|
131 |
// The very slideshow
|
132 |
-
|
133 |
|
134 |
// Close slideshw container
|
135 |
-
|
136 |
'</div>';
|
137 |
|
138 |
// Reset runtime parameters
|
@@ -140,39 +123,52 @@ class SlideshowWidget extends WP_Widget {
|
|
140 |
|
141 |
// Show text below the slideshow
|
142 |
if ( __( $instance['subtext'] ) ) {
|
143 |
-
|
144 |
'<div style="padding-top:2px; padding-bottom:0px; text-align:center" >' .
|
145 |
__( $instance['subtext'] ) .
|
146 |
'</div>';
|
147 |
}
|
148 |
|
149 |
-
// Close the widget
|
150 |
-
echo $after_widget;
|
151 |
}
|
152 |
|
153 |
// No album specified
|
154 |
else {
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
159 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
/** @see WP_Widget::update */
|
163 |
function update( $new_instance, $old_instance ) {
|
164 |
|
165 |
// Completize all parms
|
166 |
-
$instance = wppa_parse_args( $new_instance, $this->
|
167 |
|
168 |
// Sanitize certain args
|
169 |
$instance['title'] = strip_tags( $instance['title'] );
|
170 |
-
$instance['linkurl'] = $instance['linkurl'];
|
171 |
$instance['linktitle'] = strip_tags( $instance['linktitle'] );
|
172 |
$instance['supertext'] = force_balance_tags( $instance['supertext'] );
|
173 |
$instance['subtext'] = force_balance_tags( $instance['subtext'] );
|
174 |
$instance['linkurl'] = esc_url( $instance['linkurl'] );
|
175 |
|
|
|
|
|
176 |
return $instance;
|
177 |
}
|
178 |
|
@@ -180,7 +176,7 @@ class SlideshowWidget extends WP_Widget {
|
|
180 |
function form( $instance ) {
|
181 |
|
182 |
// Defaults
|
183 |
-
$instance = wppa_parse_args( (array) $instance, $this->
|
184 |
|
185 |
// Title
|
186 |
echo
|
@@ -354,9 +350,48 @@ class SlideshowWidget extends WP_Widget {
|
|
354 |
echo
|
355 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
}
|
359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
} // class SlideshowWidget
|
361 |
|
362 |
// register SlideshowWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display a slideshow in the sidebar
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
17 |
function __construct() {
|
18 |
$widget_ops = array( 'classname' => 'slideshow_widget', 'description' => __( 'Display a slideshow', 'wp-photo-album-plus' ) );
|
19 |
parent::__construct( 'slideshow_widget', __( 'WPPA+ Sidebar Slideshow', 'wp-photo-album-plus' ), $widget_ops);
|
20 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
/** @see WP_Widget::widget */
|
23 |
function widget( $args, $instance ) {
|
24 |
global $wpdb;
|
25 |
|
26 |
+
// Initialize
|
27 |
+
wppa_widget_timer( 'init' );
|
28 |
+
wppa_reset_occurrance();
|
29 |
+
wppa( 'in_widget', 'slide' );
|
30 |
+
wppa_bump_mocc();
|
|
|
|
|
|
|
31 |
extract( $args );
|
32 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
33 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
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_switch( 'defer_javascript' ) ? '0' : $instance['cache'] );
|
38 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
39 |
+
$widget_content = '';
|
40 |
|
41 |
// Logged in only and logged out?
|
42 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
43 |
return;
|
44 |
}
|
45 |
|
46 |
+
// Cache?
|
47 |
+
if ( $cache ) {
|
48 |
+
|
49 |
+
if ( wppa_is_file( $cachefile ) ) {
|
50 |
+
|
51 |
+
// Cache expired?
|
52 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
53 |
+
wppa_remove_widget_cache_path( $this->id );
|
54 |
+
}
|
55 |
+
|
56 |
+
// No, use it
|
57 |
+
else {
|
58 |
+
echo wppa_get_contents( $cachefile );
|
59 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
60 |
+
wppa( 'in_widget', false );
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
// Calculate the height if set to 0
|
67 |
if ( ! $instance['height'] ) {
|
68 |
$instance['height'] = round( wppa_opt( 'widget_width' ) * wppa_opt( 'maxheight' ) / wppa_opt( 'fullsize' ) );
|
71 |
// Do the widget if we know the album
|
72 |
if ( is_numeric( $album ) && ( wppa_album_exists( $album ) || $album == '-2' ) ) {
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
// Show text above slideshow
|
75 |
if ( __( $instance['supertext'] ) ) {
|
76 |
+
$widget_content .=
|
77 |
'<div style="padding-top:2px; padding-bottom:4px; text-align:center" >' .
|
78 |
__( $instance['supertext'] ) .
|
79 |
'</div>';
|
106 |
}
|
107 |
|
108 |
// Open the slideshow container
|
109 |
+
$widget_content .=
|
110 |
'<div' .
|
111 |
' style="padding-top:2px; padding-bottom:4px;" ' .
|
112 |
' data-wppa="yes" >';
|
113 |
|
114 |
// The very slideshow
|
115 |
+
$widget_content .= wppa_albums( $album, 'slideonly', $instance['width'], 'center' );
|
116 |
|
117 |
// Close slideshw container
|
118 |
+
$widget_content .=
|
119 |
'</div>';
|
120 |
|
121 |
// Reset runtime parameters
|
123 |
|
124 |
// Show text below the slideshow
|
125 |
if ( __( $instance['subtext'] ) ) {
|
126 |
+
$widget_content .=
|
127 |
'<div style="padding-top:2px; padding-bottom:0px; text-align:center" >' .
|
128 |
__( $instance['subtext'] ) .
|
129 |
'</div>';
|
130 |
}
|
131 |
|
|
|
|
|
132 |
}
|
133 |
|
134 |
// No album specified
|
135 |
else {
|
136 |
+
$widget_content .= __( 'Unknown album or album does not exist', 'wp-photo-album-plus' );
|
137 |
+
}
|
138 |
+
|
139 |
+
// Output
|
140 |
+
$result = "\n" . $before_widget;
|
141 |
+
if ( ! empty( $widget_title ) ) {
|
142 |
+
$result .= $before_title . $widget_title . $after_title;
|
143 |
}
|
144 |
+
$result .= $widget_content . $after_widget;
|
145 |
+
|
146 |
+
echo $result;
|
147 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
148 |
+
|
149 |
+
// Cache?
|
150 |
+
if ( $cache ) {
|
151 |
+
wppa_put_contents( $cachefile, $result );
|
152 |
+
}
|
153 |
+
|
154 |
+
wppa( 'in_widget', false );
|
155 |
}
|
156 |
|
157 |
/** @see WP_Widget::update */
|
158 |
function update( $new_instance, $old_instance ) {
|
159 |
|
160 |
// Completize all parms
|
161 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
162 |
|
163 |
// Sanitize certain args
|
164 |
$instance['title'] = strip_tags( $instance['title'] );
|
|
|
165 |
$instance['linktitle'] = strip_tags( $instance['linktitle'] );
|
166 |
$instance['supertext'] = force_balance_tags( $instance['supertext'] );
|
167 |
$instance['subtext'] = force_balance_tags( $instance['subtext'] );
|
168 |
$instance['linkurl'] = esc_url( $instance['linkurl'] );
|
169 |
|
170 |
+
wppa_remove_widget_cache_path( $this->id );
|
171 |
+
|
172 |
return $instance;
|
173 |
}
|
174 |
|
176 |
function form( $instance ) {
|
177 |
|
178 |
// Defaults
|
179 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
180 |
|
181 |
// Title
|
182 |
echo
|
350 |
echo
|
351 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
352 |
|
353 |
+
// Cache
|
354 |
+
if ( wppa_switch( 'defer_javascript' ) ) {
|
355 |
+
echo
|
356 |
+
'<p>' .
|
357 |
+
__( 'Caching of this widget is not possible when defer javascript is active (Table IV-A13)', 'wp-photo-album-plus' ) .
|
358 |
+
'</p>';
|
359 |
+
}
|
360 |
+
else {
|
361 |
+
echo
|
362 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
363 |
+
}
|
364 |
|
365 |
}
|
366 |
|
367 |
+
// Set defaults
|
368 |
+
function get_defaults() {
|
369 |
+
|
370 |
+
$defaults = array( 'title' => __( 'Sidebar Slideshow', 'wp-photo-album-plus' ),
|
371 |
+
'album' => '-2',
|
372 |
+
'width' => wppa_get_option( 'wppa_widget_width' ),
|
373 |
+
'height' => '0',
|
374 |
+
'ponly' => 'no',
|
375 |
+
'linkurl' => '',
|
376 |
+
'linktitle' => '',
|
377 |
+
'subtext' => '',
|
378 |
+
'supertext' => '',
|
379 |
+
'valign' => 'center',
|
380 |
+
'timeout' => '4',
|
381 |
+
'film' => 'no',
|
382 |
+
'browse' => 'no',
|
383 |
+
'name' => 'no',
|
384 |
+
'numbar' => 'no',
|
385 |
+
'desc' => 'no',
|
386 |
+
'maxslides' => '100',
|
387 |
+
'random' => 'no',
|
388 |
+
'incsubs' => 'no',
|
389 |
+
'logonly' => 'no',
|
390 |
+
'cache' => '0',
|
391 |
+
);
|
392 |
+
return $defaults;
|
393 |
+
}
|
394 |
+
|
395 |
} // class SlideshowWidget
|
396 |
|
397 |
// register SlideshowWidget widget
|
wppa-slideshow.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
-
* Version 7.3.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -299,7 +299,7 @@ function wppa_start_stop_icons( $opt = '' ) {
|
|
299 |
' >' .
|
300 |
wppa_get_svghtml( 'Eagle-1', $iconsize ) .
|
301 |
'</span>' );
|
302 |
-
|
303 |
// Renew link on slidonly?
|
304 |
if ( wppa( 'is_filmonly' ) && wppa_switch( 'show_renew_filmonly' ) ) {
|
305 |
$ajax_url = wppa_get_ajaxlink();
|
@@ -314,7 +314,7 @@ function wppa_start_stop_icons( $opt = '' ) {
|
|
314 |
wppa_get_svghtml( 'Redo', $iconsize ) . '
|
315 |
</span>' );
|
316 |
}
|
317 |
-
|
318 |
wppa_out( '</div>' );
|
319 |
}
|
320 |
}
|
@@ -394,7 +394,7 @@ function wppa_start_stop_text( $opt = '' ) {
|
|
394 |
id="renew-'.wppa( 'mocc' ).'"
|
395 |
class="wppa-nav-text renew"
|
396 |
style="'.wppa_wcs('wppa-nav-text').' float:right;"
|
397 |
-
onclick="wppaDoAjaxRender('.wppa('mocc').', \''.$ajax_url.'wppa-slide=1&wppa-filmonly=1&wppa-album='.wppa('start_album').'&\', \'\' )"
|
398 |
>' .
|
399 |
__('Renew', 'wp-photo-album-plus') . '
|
400 |
</a>' );
|
@@ -1456,10 +1456,11 @@ function wppa_startstop_icons() {
|
|
1456 |
' onmouseout="jQuery(this).stop().fadeTo(200,0);"' .
|
1457 |
' ontouchend="jQuery(this).stop().fadeTo(200,0);"' .
|
1458 |
' onclick="wppaStartStop( ' . wppa( 'mocc' ) . ', -1 );"' .
|
1459 |
-
' onload="jQuery(this).fadeTo(1000,0);"' .
|
1460 |
' >' .
|
1461 |
wppa_get_svghtml( 'Play-Button', $iconsize, false, true, '0', '5', '50', '50' ) .
|
1462 |
-
'</div>'
|
|
|
1463 |
);
|
1464 |
}
|
1465 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
299 |
' >' .
|
300 |
wppa_get_svghtml( 'Eagle-1', $iconsize ) .
|
301 |
'</span>' );
|
302 |
+
|
303 |
// Renew link on slidonly?
|
304 |
if ( wppa( 'is_filmonly' ) && wppa_switch( 'show_renew_filmonly' ) ) {
|
305 |
$ajax_url = wppa_get_ajaxlink();
|
314 |
wppa_get_svghtml( 'Redo', $iconsize ) . '
|
315 |
</span>' );
|
316 |
}
|
317 |
+
|
318 |
wppa_out( '</div>' );
|
319 |
}
|
320 |
}
|
394 |
id="renew-'.wppa( 'mocc' ).'"
|
395 |
class="wppa-nav-text renew"
|
396 |
style="'.wppa_wcs('wppa-nav-text').' float:right;"
|
397 |
+
onclick="_wppaStop('.wppa('mocc').');wppaDoAjaxRender('.wppa('mocc').', \''.$ajax_url.'wppa-slide=1&wppa-filmonly=1&wppa-album='.wppa('start_album').'&\', \'\' )"
|
398 |
>' .
|
399 |
__('Renew', 'wp-photo-album-plus') . '
|
400 |
</a>' );
|
1456 |
' onmouseout="jQuery(this).stop().fadeTo(200,0);"' .
|
1457 |
' ontouchend="jQuery(this).stop().fadeTo(200,0);"' .
|
1458 |
' onclick="wppaStartStop( ' . wppa( 'mocc' ) . ', -1 );"' .
|
1459 |
+
// ' onload="jQuery(this).stop().fadeTo(1000,0);"' .
|
1460 |
' >' .
|
1461 |
wppa_get_svghtml( 'Play-Button', $iconsize, false, true, '0', '5', '50', '50' ) .
|
1462 |
+
'</div>' .
|
1463 |
+
'<script>jQuery(document).ready(jQuery(\'#wppa-startstop-icon-' . wppa( 'mocc' ) . '\').stop().fadeTo(2500,0))</script>'
|
1464 |
);
|
1465 |
}
|
1466 |
|
wppa-stats-widget.php
CHANGED
@@ -3,30 +3,11 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the stats widget
|
6 |
-
* Version 7.
|
7 |
*
|
8 |
*/
|
9 |
class WppaStatsWidget extends WP_Widget {
|
10 |
|
11 |
-
// Default settings
|
12 |
-
var $defaults = array( 'title' => '',
|
13 |
-
'ip' => 'no',
|
14 |
-
'browser' => 'no',
|
15 |
-
'dayno' => 'no',
|
16 |
-
'sessions-active' => 'no',
|
17 |
-
'sessions-day' => 'no',
|
18 |
-
'reg-users' => 'no',
|
19 |
-
'albums' => 'no',
|
20 |
-
'mediaitems' => 'no',
|
21 |
-
'photos' => 'no',
|
22 |
-
'videos' => 'no',
|
23 |
-
'audios' => 'no',
|
24 |
-
'pdfs' => 'no',
|
25 |
-
'comments' => 'no',
|
26 |
-
'rating' => 'no',
|
27 |
-
'logonly' => 'no',
|
28 |
-
);
|
29 |
-
|
30 |
// Constructor
|
31 |
function __construct() {
|
32 |
$widget_ops = array( 'classname' => 'wppa_stats_widget', 'description' => __( 'WPPA Statistics', 'your-ip-widget' ) );
|
@@ -35,23 +16,46 @@ class WppaStatsWidget extends WP_Widget {
|
|
35 |
|
36 |
// Widget
|
37 |
function widget( $args, $instance ) {
|
38 |
-
|
39 |
global $wpdb;
|
40 |
-
global $widget_content;
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
extract( $args );
|
43 |
-
|
44 |
-
$
|
45 |
-
$
|
|
|
|
|
46 |
|
47 |
// Logged in only and logged out?
|
48 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
49 |
return;
|
50 |
}
|
51 |
|
|
|
|
|
52 |
|
53 |
-
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
if ( wppa_checked( $instance['ip'] ) ) {
|
56 |
$widget_content .= __('Your ip is', 'wp-photo-album-plus') . ': <b>'.$_SERVER['REMOTE_ADDR'].'</b><br />';
|
57 |
}
|
@@ -141,27 +145,43 @@ class WppaStatsWidget extends WP_Widget {
|
|
141 |
$widget_content = substr( $widget_content, 0, strlen( $widget_content ) - 6 );
|
142 |
}
|
143 |
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
// Update settings
|
148 |
function update( $new_instance, $old_instance ) {
|
149 |
-
$instance = $new_instance;
|
150 |
|
151 |
-
//
|
152 |
-
$
|
153 |
-
|
|
|
|
|
|
|
|
|
154 |
|
155 |
-
$instance
|
156 |
-
return $instance;
|
157 |
}
|
158 |
|
159 |
// Settings dialog
|
160 |
function form( $instance ) {
|
161 |
|
162 |
// Defaults
|
163 |
-
$
|
164 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
165 |
|
166 |
// Title
|
167 |
echo
|
@@ -292,7 +312,35 @@ class WppaStatsWidget extends WP_Widget {
|
|
292 |
__( 'Show to logged in visitors only', 'wp-photo-album-plus' )
|
293 |
);
|
294 |
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
} // class WppaStatsWidget
|
298 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the stats widget
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
class WppaStatsWidget extends WP_Widget {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
// Constructor
|
12 |
function __construct() {
|
13 |
$widget_ops = array( 'classname' => 'wppa_stats_widget', 'description' => __( 'WPPA Statistics', 'your-ip-widget' ) );
|
16 |
|
17 |
// Widget
|
18 |
function widget( $args, $instance ) {
|
|
|
19 |
global $wpdb;
|
|
|
20 |
|
21 |
+
// Initialize
|
22 |
+
wppa_widget_timer( 'init' );
|
23 |
+
wppa_reset_occurrance();
|
24 |
+
wppa( 'in_widget', 'stats' );
|
25 |
+
wppa_bump_mocc();
|
26 |
extract( $args );
|
27 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
28 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
29 |
+
$cache = $instance['cache'];
|
30 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
31 |
+
$widget_content = '';
|
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 |
+
// Make the widget content
|
59 |
if ( wppa_checked( $instance['ip'] ) ) {
|
60 |
$widget_content .= __('Your ip is', 'wp-photo-album-plus') . ': <b>'.$_SERVER['REMOTE_ADDR'].'</b><br />';
|
61 |
}
|
145 |
$widget_content = substr( $widget_content, 0, strlen( $widget_content ) - 6 );
|
146 |
}
|
147 |
|
148 |
+
// Output
|
149 |
+
$result = "\n" . $before_widget;
|
150 |
+
if ( ! empty( $widget_title ) ) {
|
151 |
+
$result .= $before_title . $widget_title . $after_title;
|
152 |
+
}
|
153 |
+
$result .= $widget_content . $after_widget;
|
154 |
+
|
155 |
+
echo $result;
|
156 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
157 |
+
|
158 |
+
// Cache?
|
159 |
+
if ( $cache ) {
|
160 |
+
wppa_put_contents( $cachefile, $result );
|
161 |
+
}
|
162 |
+
|
163 |
+
wppa( 'in_widget', false );
|
164 |
+
}
|
165 |
|
166 |
// Update settings
|
167 |
function update( $new_instance, $old_instance ) {
|
|
|
168 |
|
169 |
+
// Completize all parms
|
170 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
171 |
+
|
172 |
+
// Sanitize certain args
|
173 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
174 |
+
|
175 |
+
wppa_remove_widget_cache_path( $this->id );
|
176 |
|
177 |
+
return $instance;
|
|
|
178 |
}
|
179 |
|
180 |
// Settings dialog
|
181 |
function form( $instance ) {
|
182 |
|
183 |
// Defaults
|
184 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
185 |
|
186 |
// Title
|
187 |
echo
|
312 |
__( 'Show to logged in visitors only', 'wp-photo-album-plus' )
|
313 |
);
|
314 |
|
315 |
+
// Cache
|
316 |
+
echo
|
317 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
318 |
+
|
319 |
+
}
|
320 |
+
|
321 |
+
// Set defaults
|
322 |
+
function get_defaults() {
|
323 |
+
|
324 |
+
$defaults = array( 'title' => __( 'Statistics', 'wp-photo-album-plus' ),
|
325 |
+
'ip' => 'no',
|
326 |
+
'browser' => 'no',
|
327 |
+
'dayno' => 'no',
|
328 |
+
'sessions-active' => 'no',
|
329 |
+
'sessions-day' => 'no',
|
330 |
+
'reg-users' => 'no',
|
331 |
+
'albums' => 'no',
|
332 |
+
'mediaitems' => 'no',
|
333 |
+
'photos' => 'no',
|
334 |
+
'videos' => 'no',
|
335 |
+
'audios' => 'no',
|
336 |
+
'pdfs' => 'no',
|
337 |
+
'comments' => 'no',
|
338 |
+
'rating' => 'no',
|
339 |
+
'logonly' => 'no',
|
340 |
+
'cache' => '0',
|
341 |
+
);
|
342 |
+
return $defaults;
|
343 |
+
}
|
344 |
|
345 |
} // class WppaStatsWidget
|
346 |
|
wppa-stereo-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
-
* Version
|
7 |
*/
|
8 |
|
9 |
class wppaStereoWidget extends WP_Widget {
|
@@ -18,45 +18,78 @@ class wppaStereoWidget extends WP_Widget {
|
|
18 |
function widget( $args, $instance ) {
|
19 |
global $wpdb;
|
20 |
|
21 |
-
|
22 |
-
|
|
|
23 |
wppa( 'in_widget', 'stereo' );
|
24 |
wppa_bump_mocc();
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$
|
|
|
29 |
|
30 |
// Logged in only and logged out?
|
31 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
32 |
return;
|
33 |
}
|
34 |
|
35 |
-
|
|
|
36 |
|
37 |
-
|
38 |
|
39 |
-
|
|
|
|
|
|
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
$widget_content .= '<div style="clear:both;" data-wppa="yes" ></div>';
|
42 |
$widget_content .= "\n".'<!-- WPPA+ stereo Widget end -->';
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
wppa( 'in_widget', false );
|
49 |
}
|
50 |
|
51 |
/** @see WP_Widget::update */
|
52 |
function update($new_instance, $old_instance) {
|
53 |
-
$instance = $old_instance;
|
54 |
|
55 |
-
//
|
56 |
-
$instance
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
$instance['logonly'] = $new_instance['logonly'];
|
60 |
|
61 |
return $instance;
|
62 |
}
|
@@ -64,8 +97,8 @@ class wppaStereoWidget extends WP_Widget {
|
|
64 |
/** @see WP_Widget::form */
|
65 |
function form($instance) {
|
66 |
|
67 |
-
//Defaults
|
68 |
-
$instance
|
69 |
|
70 |
// Title
|
71 |
echo
|
@@ -74,8 +107,25 @@ class wppaStereoWidget extends WP_Widget {
|
|
74 |
// Loggedin only
|
75 |
echo
|
76 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
} // class wppaStereoWidget
|
80 |
|
81 |
// register wppaStereoWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class wppaStereoWidget extends WP_Widget {
|
18 |
function widget( $args, $instance ) {
|
19 |
global $wpdb;
|
20 |
|
21 |
+
// Initialize
|
22 |
+
wppa_widget_timer( 'init' );
|
23 |
+
wppa_reset_occurrance();
|
24 |
wppa( 'in_widget', 'stereo' );
|
25 |
wppa_bump_mocc();
|
26 |
+
extract( $args );
|
27 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
28 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
29 |
+
$cache = $instance['cache'];
|
30 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
31 |
|
32 |
// Logged in only and logged out?
|
33 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
+
// Cache?
|
38 |
+
if ( $cache ) {
|
39 |
|
40 |
+
if ( wppa_is_file( $cachefile ) ) {
|
41 |
|
42 |
+
// Cache expired?
|
43 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
44 |
+
wppa_remove_widget_cache_path( $this->id );
|
45 |
+
}
|
46 |
|
47 |
+
// No, use it
|
48 |
+
else {
|
49 |
+
echo wppa_get_contents( $cachefile );
|
50 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
51 |
+
wppa( 'in_widget', false );
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// Other inits
|
58 |
+
|
59 |
+
// Make the widget content
|
60 |
+
$widget_content = "\n".'<!-- WPPA+ stereo Widget start -->';
|
61 |
+
$widget_content .= wppa_get_stereo_html();
|
62 |
$widget_content .= '<div style="clear:both;" data-wppa="yes" ></div>';
|
63 |
$widget_content .= "\n".'<!-- WPPA+ stereo Widget end -->';
|
64 |
|
65 |
+
// Output
|
66 |
+
$result = "\n" . $before_widget;
|
67 |
+
if ( ! empty( $widget_title ) ) {
|
68 |
+
$result .= $before_title . $widget_title . $after_title;
|
69 |
+
}
|
70 |
+
$result .= $widget_content . $after_widget;
|
71 |
+
|
72 |
+
echo $result;
|
73 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
74 |
+
|
75 |
+
// Cache?
|
76 |
+
if ( $cache ) {
|
77 |
+
wppa_put_contents( $cachefile, $result );
|
78 |
+
}
|
79 |
|
80 |
wppa( 'in_widget', false );
|
81 |
}
|
82 |
|
83 |
/** @see WP_Widget::update */
|
84 |
function update($new_instance, $old_instance) {
|
|
|
85 |
|
86 |
+
// Completize all parms
|
87 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
88 |
+
|
89 |
+
// Sanitize certain args
|
90 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
91 |
|
92 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
93 |
|
94 |
return $instance;
|
95 |
}
|
97 |
/** @see WP_Widget::form */
|
98 |
function form($instance) {
|
99 |
|
100 |
+
// Defaults
|
101 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
102 |
|
103 |
// Title
|
104 |
echo
|
107 |
// Loggedin only
|
108 |
echo
|
109 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
110 |
+
|
111 |
+
// Cache
|
112 |
+
// Do not cache this widget
|
113 |
+
// echo
|
114 |
+
// wppa_widget_cache( $this, $instance['cache'] );
|
115 |
+
|
116 |
}
|
117 |
|
118 |
+
// Set defaults
|
119 |
+
function get_defaults() {
|
120 |
+
|
121 |
+
$defaults = array( 'title' => __( 'Stereo Photo Settings', 'wp-photo-album-plus ' ),
|
122 |
+
'logonly' => 'no',
|
123 |
+
'cache' => '0',
|
124 |
+
);
|
125 |
+
return $defaults;
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
} // class wppaStereoWidget
|
130 |
|
131 |
// register wppaStereoWidget widget
|
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
|
7 |
*/
|
8 |
|
9 |
|
@@ -18,52 +18,89 @@ class WppaSuperView extends WP_Widget {
|
|
18 |
/** @see WP_Widget::widget */
|
19 |
function widget($args, $instance) {
|
20 |
global $wpdb;
|
21 |
-
global $widget_content;
|
22 |
-
|
23 |
-
wppa_initialize_runtime();
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
extract( $args );
|
26 |
-
$instance
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
'logonly' => 'no',
|
31 |
-
) );
|
32 |
|
33 |
// Logged in only and logged out?
|
34 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
$album_root = $instance['root'];
|
40 |
$sort = wppa_checked( $instance['sort'] ) ? true : false;
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
|
|
45 |
$widget_content = '<span data-wppa="yes" ></span>' . wppa_get_superview_html( $album_root, $sort );
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
wppa( 'in_widget', false );
|
48 |
|
49 |
-
echo $before_widget . $before_title . $widget_title . $after_title . $widget_content . $after_widget;
|
50 |
}
|
51 |
|
52 |
/** @see WP_Widget::update */
|
53 |
function update($new_instance, $old_instance) {
|
54 |
-
$instance = $old_instance;
|
55 |
|
56 |
-
//
|
57 |
-
$instance =
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
) );
|
62 |
|
63 |
-
$
|
64 |
-
$instance['root'] = $new_instance['root'];
|
65 |
-
$instance['sort'] = $new_instance['sort'];
|
66 |
-
$instance['logonly'] = $new_instance['logonly'];
|
67 |
|
68 |
return $instance;
|
69 |
}
|
@@ -71,12 +108,8 @@ class WppaSuperView extends WP_Widget {
|
|
71 |
/** @see WP_Widget::form */
|
72 |
function form( $instance ) {
|
73 |
|
74 |
-
//Defaults
|
75 |
-
$instance =
|
76 |
-
'root' => '0',
|
77 |
-
'sort' => true,
|
78 |
-
'logonly' => 'no',
|
79 |
-
) );
|
80 |
|
81 |
// Title
|
82 |
echo
|
@@ -100,8 +133,25 @@ class WppaSuperView extends WP_Widget {
|
|
100 |
echo
|
101 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
102 |
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
} // class WppaSuperView
|
106 |
|
107 |
// register WppaSuperView widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* ask the album / display you want
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
|
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', 'superview' );
|
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 |
$album_root = $instance['root'];
|
60 |
$sort = wppa_checked( $instance['sort'] ) ? true : false;
|
61 |
|
62 |
+
// Cache?
|
63 |
+
if ( $cache ) {
|
64 |
+
if ( wppa_is_file( $cachefile ) ) {
|
65 |
+
echo wppa_get_contents( $cachefile );
|
66 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
67 |
+
wppa( 'in_widget', false );
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
}
|
71 |
|
72 |
+
// Make the widget content
|
73 |
$widget_content = '<span data-wppa="yes" ></span>' . wppa_get_superview_html( $album_root, $sort );
|
74 |
|
75 |
+
// Output
|
76 |
+
$result = "\n" . $before_widget;
|
77 |
+
if ( ! empty( $widget_title ) ) {
|
78 |
+
$result .= $before_title . $widget_title . $after_title;
|
79 |
+
}
|
80 |
+
$result .= $widget_content . $after_widget;
|
81 |
+
|
82 |
+
echo $result;
|
83 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
84 |
+
|
85 |
+
// Cache?
|
86 |
+
if ( $cache ) {
|
87 |
+
wppa_put_contents( $cachefile, $result );
|
88 |
+
}
|
89 |
+
|
90 |
wppa( 'in_widget', false );
|
91 |
|
|
|
92 |
}
|
93 |
|
94 |
/** @see WP_Widget::update */
|
95 |
function update($new_instance, $old_instance) {
|
|
|
96 |
|
97 |
+
// Completize all parms
|
98 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
99 |
+
|
100 |
+
// Sanitize certain args
|
101 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
|
|
102 |
|
103 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
|
|
104 |
|
105 |
return $instance;
|
106 |
}
|
108 |
/** @see WP_Widget::form */
|
109 |
function form( $instance ) {
|
110 |
|
111 |
+
// Defaults
|
112 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
|
|
|
|
113 |
|
114 |
// Title
|
115 |
echo
|
133 |
echo
|
134 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
135 |
|
136 |
+
// Cache
|
137 |
+
echo
|
138 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
139 |
+
|
140 |
}
|
141 |
|
142 |
+
// Set defaults
|
143 |
+
function get_defaults() {
|
144 |
+
|
145 |
+
$defaults = array( 'title' => __( 'Super View' , 'wp-photo-album-plus' ),
|
146 |
+
'root' => '0',
|
147 |
+
'sort' => true,
|
148 |
+
'logonly' => 'no',
|
149 |
+
'cache' => '0',
|
150 |
+
);
|
151 |
+
return $defaults;
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
} // class WppaSuperView
|
156 |
|
157 |
// register WppaSuperView widget
|
wppa-tagcloud-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the tagcloud widget
|
6 |
-
* Version 7.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -19,57 +19,83 @@ class TagcloudPhotos extends WP_Widget {
|
|
19 |
function widget($args, $instance) {
|
20 |
global $widget_content;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
wppa_bump_mocc();
|
26 |
-
|
27 |
extract( $args );
|
28 |
-
|
29 |
-
$
|
|
|
|
|
30 |
|
31 |
// Logged in only and logged out?
|
32 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
-
|
|
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
<div' .
|
47 |
' class="wppa-tagcloud-widget"' .
|
48 |
' data-wppa="yes"' .
|
49 |
' >' .
|
50 |
wppa_get_tagcloud_html( implode( ',', $instance['tags'] ), wppa_opt( 'tagcloud_min' ), wppa_opt( 'tagcloud_max' ) ) .
|
51 |
-
'</div>'
|
|
|
52 |
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
wppa( 'in_widget', false );
|
57 |
-
|
58 |
|
59 |
/** @see WP_Widget::update */
|
60 |
function update($new_instance, $old_instance) {
|
61 |
-
$instance = $old_instance;
|
62 |
|
63 |
-
//
|
64 |
-
$instance =
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
) );
|
69 |
|
70 |
-
$
|
71 |
-
$instance['tags'] = $new_instance['tags'];
|
72 |
-
$instance['logonly'] = $new_instance['logonly'];
|
73 |
|
74 |
return $instance;
|
75 |
}
|
@@ -78,7 +104,8 @@ class TagcloudPhotos extends WP_Widget {
|
|
78 |
function form( $instance ) {
|
79 |
|
80 |
// Defaults
|
81 |
-
$instance =
|
|
|
82 |
$title = $instance['title'];
|
83 |
$stags = $instance['tags'];
|
84 |
if ( ! $stags ) $stags = array();
|
@@ -111,6 +138,20 @@ class TagcloudPhotos extends WP_Widget {
|
|
111 |
echo
|
112 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
} // class TagcloudPhotos
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the tagcloud 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', 'tagcloud' );
|
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 |
+
if ( empty( $instance['tags'] ) ) $instance['tags'] = array();
|
60 |
+
|
61 |
+
|
62 |
+
$widget_content = '
|
63 |
<div' .
|
64 |
' class="wppa-tagcloud-widget"' .
|
65 |
' data-wppa="yes"' .
|
66 |
' >' .
|
67 |
wppa_get_tagcloud_html( implode( ',', $instance['tags'] ), wppa_opt( 'tagcloud_min' ), wppa_opt( 'tagcloud_max' ) ) .
|
68 |
+
'</div>' .
|
69 |
+
'<div style="clear:both"></div>';
|
70 |
|
71 |
+
// Output
|
72 |
+
$result = "\n" . $before_widget;
|
73 |
+
if ( ! empty( $widget_title ) ) {
|
74 |
+
$result .= $before_title . $widget_title . $after_title;
|
75 |
+
}
|
76 |
+
$result .= $widget_content . $after_widget;
|
77 |
+
|
78 |
+
echo $result;
|
79 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
80 |
+
|
81 |
+
// Cache?
|
82 |
+
if ( $cache ) {
|
83 |
+
wppa_put_contents( $cachefile, $result );
|
84 |
+
}
|
85 |
|
86 |
wppa( 'in_widget', false );
|
87 |
+
}
|
88 |
|
89 |
/** @see WP_Widget::update */
|
90 |
function update($new_instance, $old_instance) {
|
|
|
91 |
|
92 |
+
// Completize all parms
|
93 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
94 |
+
|
95 |
+
// Sanitize certain args
|
96 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
|
|
97 |
|
98 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
99 |
|
100 |
return $instance;
|
101 |
}
|
104 |
function form( $instance ) {
|
105 |
|
106 |
// Defaults
|
107 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
108 |
+
|
109 |
$title = $instance['title'];
|
110 |
$stags = $instance['tags'];
|
111 |
if ( ! $stags ) $stags = array();
|
138 |
echo
|
139 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
140 |
|
141 |
+
// Cache
|
142 |
+
echo
|
143 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
144 |
+
}
|
145 |
+
|
146 |
+
// Set defaults
|
147 |
+
function get_defaults() {
|
148 |
+
|
149 |
+
$defaults = array( 'title' => __( 'Photo Tag Cloud', 'wp-photo-album-plus' ),
|
150 |
+
'tags' => '',
|
151 |
+
'logonly' => 'no',
|
152 |
+
'cache' => '0',
|
153 |
+
);
|
154 |
+
return $defaults;
|
155 |
}
|
156 |
|
157 |
} // class TagcloudPhotos
|
wppa-thumbnail-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display thumbnail photos
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
class ThumbnailWidget extends WP_Widget {
|
@@ -16,34 +16,45 @@ class ThumbnailWidget extends WP_Widget {
|
|
16 |
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget($args, $instance) {
|
19 |
-
|
20 |
global $wpdb;
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
wppa_bump_mocc();
|
26 |
-
|
27 |
extract( $args );
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
$instance = wp_parse_args( (array) $instance, array(
|
30 |
-
'title' => __( 'Thumbnail Photos', 'wp-photo-album-plus' ),
|
31 |
-
'album' => 'no',
|
32 |
-
'link' => '',
|
33 |
-
'linktitle' => '',
|
34 |
-
'name' => 'no',
|
35 |
-
'display' => 'thumbs',
|
36 |
-
'sortby' => wppa_get_photo_order('0'),
|
37 |
-
'limit' => wppa_opt( 'thumbnail_widget_count' ),
|
38 |
-
'logonly' => 'no',
|
39 |
-
) );
|
40 |
// Logged in only and logged out?
|
41 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
42 |
return;
|
43 |
}
|
44 |
|
45 |
-
|
|
|
|
|
|
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
$widget_link = $instance['link'];
|
48 |
$page = in_array( wppa_opt( 'thumbnail_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('thumbnail_widget_linkpage', __('Thumbnail photos', 'wp-photo-album-plus'));
|
49 |
$max = $instance['limit'];
|
@@ -53,6 +64,7 @@ class ThumbnailWidget extends WP_Widget {
|
|
53 |
$display = $instance['display'];
|
54 |
$linktitle = $instance['linktitle'];
|
55 |
|
|
|
56 |
$generic = ( $album == '-2' );
|
57 |
if ( $generic ) {
|
58 |
$album = '0';
|
@@ -80,7 +92,6 @@ class ThumbnailWidget extends WP_Widget {
|
|
80 |
LIMIT %d", $max ), ARRAY_A );
|
81 |
}
|
82 |
|
83 |
-
global $widget_content;
|
84 |
$widget_content = "\n".'<!-- WPPA+ thumbnail Widget start -->';
|
85 |
$maxw = wppa_opt( 'thumbnail_widget_size' );
|
86 |
$maxh = $maxw;
|
@@ -120,7 +131,7 @@ class ThumbnailWidget extends WP_Widget {
|
|
120 |
$imgevents = wppa_get_imgevents('thumb', $image['id'], true);
|
121 |
$title = $link ? esc_attr(stripslashes($link['title'])) : '';
|
122 |
|
123 |
-
|
124 |
|
125 |
$widget_content .= "\n\t".'<div style="font-size:'.wppa_opt( 'fontsize_widget_thumb' ).'px; line-height:'.$lineheight.'px;">';
|
126 |
if ( $name == 'yes' && $display == 'thumbs' ) {
|
@@ -139,54 +150,42 @@ class ThumbnailWidget extends WP_Widget {
|
|
139 |
else $widget_content .= __( 'There are no photos (yet)', 'wp-photo-album-plus' );
|
140 |
|
141 |
$widget_content .= '<div style="clear:both"></div>';
|
142 |
-
$widget_content .= "\n".'<!-- WPPA+ thumbnail Widget end -->';
|
143 |
|
144 |
-
|
145 |
-
if ( !empty( $
|
|
|
|
|
|
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
}
|
152 |
-
else {
|
153 |
-
echo $widget_title;
|
154 |
-
}
|
155 |
|
156 |
-
|
|
|
|
|
157 |
}
|
158 |
|
159 |
-
echo $widget_content . $after_widget;
|
160 |
-
|
161 |
wppa( 'in_widget', false );
|
162 |
}
|
163 |
|
164 |
/** @see WP_Widget::update */
|
165 |
function update($new_instance, $old_instance) {
|
166 |
-
$instance = $old_instance;
|
167 |
|
168 |
-
//
|
169 |
-
$instance =
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
'sortby' => wppa_get_photo_order('0'),
|
177 |
-
'limit' => wppa_opt( 'thumbnail_widget_count' ),
|
178 |
-
'logonly' => 'no',
|
179 |
-
) );
|
180 |
-
|
181 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
182 |
-
$instance['link'] = strip_tags($new_instance['link']);
|
183 |
-
$instance['album'] = $new_instance['album'];
|
184 |
-
$instance['name'] = $new_instance['name'];
|
185 |
-
$instance['display'] = $new_instance['display'];
|
186 |
-
$instance['linktitle'] = $new_instance['linktitle'];
|
187 |
-
$instance['sortby'] = $new_instance['sortby'];
|
188 |
-
$instance['limit'] = strval(intval($new_instance['limit']));
|
189 |
-
$instance['logonly'] = $new_instance['logonly'];
|
190 |
|
191 |
return $instance;
|
192 |
}
|
@@ -194,18 +193,8 @@ class ThumbnailWidget extends WP_Widget {
|
|
194 |
/** @see WP_Widget::form */
|
195 |
function form( $instance ) {
|
196 |
|
197 |
-
//Defaults
|
198 |
-
$instance =
|
199 |
-
'title' => __( 'Thumbnail Photos', 'wp-photo-album-plus' ),
|
200 |
-
'link' => '',
|
201 |
-
'linktitle' => '',
|
202 |
-
'album' => '0',
|
203 |
-
'name' => 'no',
|
204 |
-
'display' => 'thumbs',
|
205 |
-
'sortby' => wppa_get_photo_order('0'),
|
206 |
-
'limit' => wppa_opt( 'thumbnail_widget_count' ),
|
207 |
-
'logonly' => 'no',
|
208 |
-
) );
|
209 |
|
210 |
// Title
|
211 |
echo
|
@@ -264,6 +253,10 @@ class ThumbnailWidget extends WP_Widget {
|
|
264 |
echo
|
265 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
266 |
|
|
|
|
|
|
|
|
|
267 |
echo
|
268 |
'<p>' .
|
269 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
@@ -272,6 +265,23 @@ class ThumbnailWidget extends WP_Widget {
|
|
272 |
|
273 |
}
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
} // class thumbnailWidget
|
276 |
|
277 |
// register thumbnailWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display thumbnail photos
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class ThumbnailWidget extends WP_Widget {
|
16 |
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget($args, $instance) {
|
|
|
19 |
global $wpdb;
|
20 |
|
21 |
+
// Initialize
|
22 |
+
wppa_widget_timer( 'init' );
|
23 |
+
wppa_reset_occurrance();
|
24 |
+
wppa( 'in_widget', 'tn' );
|
25 |
wppa_bump_mocc();
|
|
|
26 |
extract( $args );
|
27 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
28 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
29 |
+
$cache = $instance['cache'];
|
30 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
// Logged in only and logged out?
|
33 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
+
// Cache?
|
38 |
+
if ( $cache ) {
|
39 |
+
|
40 |
+
if ( wppa_is_file( $cachefile ) ) {
|
41 |
|
42 |
+
// Cache expired?
|
43 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
44 |
+
wppa_remove_widget_cache_path( $this->id );
|
45 |
+
}
|
46 |
+
|
47 |
+
// No, use it
|
48 |
+
else {
|
49 |
+
echo wppa_get_contents( $cachefile );
|
50 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
51 |
+
wppa( 'in_widget', false );
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// Other inits
|
58 |
$widget_link = $instance['link'];
|
59 |
$page = in_array( wppa_opt( 'thumbnail_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('thumbnail_widget_linkpage', __('Thumbnail photos', 'wp-photo-album-plus'));
|
60 |
$max = $instance['limit'];
|
64 |
$display = $instance['display'];
|
65 |
$linktitle = $instance['linktitle'];
|
66 |
|
67 |
+
// Make the widget content
|
68 |
$generic = ( $album == '-2' );
|
69 |
if ( $generic ) {
|
70 |
$album = '0';
|
92 |
LIMIT %d", $max ), ARRAY_A );
|
93 |
}
|
94 |
|
|
|
95 |
$widget_content = "\n".'<!-- WPPA+ thumbnail Widget start -->';
|
96 |
$maxw = wppa_opt( 'thumbnail_widget_size' );
|
97 |
$maxh = $maxw;
|
131 |
$imgevents = wppa_get_imgevents('thumb', $image['id'], true);
|
132 |
$title = $link ? esc_attr(stripslashes($link['title'])) : '';
|
133 |
|
134 |
+
$widget_content .= wppa_get_the_widget_thumb('thumbnail', $image, $album, $display, $link, $title, $imgurl, $imgstyle_a, $imgevents);
|
135 |
|
136 |
$widget_content .= "\n\t".'<div style="font-size:'.wppa_opt( 'fontsize_widget_thumb' ).'px; line-height:'.$lineheight.'px;">';
|
137 |
if ( $name == 'yes' && $display == 'thumbs' ) {
|
150 |
else $widget_content .= __( 'There are no photos (yet)', 'wp-photo-album-plus' );
|
151 |
|
152 |
$widget_content .= '<div style="clear:both"></div>';
|
|
|
153 |
|
154 |
+
// Title link
|
155 |
+
if ( ! empty( $widget_link ) ) {
|
156 |
+
$widget_title = '
|
157 |
+
<a href="' . esc_url( $widget_link ) . '" title="' . esc_attr( $linktitle ) . '" >' . $widget_title . '</a>';
|
158 |
+
}
|
159 |
|
160 |
+
// Output
|
161 |
+
$result = "\n" . $before_widget;
|
162 |
+
if ( ! empty( $widget_title ) ) {
|
163 |
+
$result .= $before_title . $widget_title . $after_title;
|
164 |
+
}
|
165 |
+
$result .= $widget_content . $after_widget;
|
166 |
|
167 |
+
echo $result;
|
168 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
|
|
|
|
|
|
|
|
169 |
|
170 |
+
// Cache?
|
171 |
+
if ( $cache ) {
|
172 |
+
wppa_put_contents( $cachefile, $result );
|
173 |
}
|
174 |
|
|
|
|
|
175 |
wppa( 'in_widget', false );
|
176 |
}
|
177 |
|
178 |
/** @see WP_Widget::update */
|
179 |
function update($new_instance, $old_instance) {
|
|
|
180 |
|
181 |
+
// Completize all parms
|
182 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
183 |
+
|
184 |
+
// Sanitize certain args
|
185 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
186 |
+
$instance['link'] = strip_tags( $new_instance['link'] );
|
187 |
+
|
188 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
return $instance;
|
191 |
}
|
193 |
/** @see WP_Widget::form */
|
194 |
function form( $instance ) {
|
195 |
|
196 |
+
// Defaults
|
197 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
|
199 |
// Title
|
200 |
echo
|
253 |
echo
|
254 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
255 |
|
256 |
+
// Cache
|
257 |
+
echo
|
258 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
259 |
+
|
260 |
echo
|
261 |
'<p>' .
|
262 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
265 |
|
266 |
}
|
267 |
|
268 |
+
// Set defaults
|
269 |
+
function get_defaults() {
|
270 |
+
|
271 |
+
$defaults = array( 'title' => __( 'Thumbnail Photos', 'wp-photo-album-plus' ),
|
272 |
+
'link' => '',
|
273 |
+
'linktitle' => '',
|
274 |
+
'album' => '0',
|
275 |
+
'name' => 'no',
|
276 |
+
'display' => 'thumbs',
|
277 |
+
'sortby' => wppa_get_photo_order('0'),
|
278 |
+
'limit' => wppa_opt( 'thumbnail_widget_count' ),
|
279 |
+
'logonly' => 'no',
|
280 |
+
'cache' => '0',
|
281 |
+
);
|
282 |
+
return $defaults;
|
283 |
+
}
|
284 |
+
|
285 |
} // class thumbnailWidget
|
286 |
|
287 |
// register thumbnailWidget widget
|
wppa-topten-widget.php
CHANGED
@@ -3,71 +3,33 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
-
* Version 7.
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
10 |
|
11 |
-
// Defaults
|
12 |
-
var $defaults = array(
|
13 |
-
'sortby' => 'mean_rating',
|
14 |
-
'title' => '',
|
15 |
-
'album' => '0',
|
16 |
-
'display' => 'thumbs',
|
17 |
-
'meanrat' => 'yes',
|
18 |
-
'ratcount' => 'yes',
|
19 |
-
'viewcount' => 'yes',
|
20 |
-
'dlcount' => 'yes',
|
21 |
-
'includesubs' => 'yes',
|
22 |
-
'medalsonly' => 'no',
|
23 |
-
'showowner' => 'no',
|
24 |
-
'showalbum' => 'no',
|
25 |
-
'logonly' => 'no',
|
26 |
-
);
|
27 |
-
|
28 |
/** constructor */
|
29 |
function __construct() {
|
30 |
$widget_ops = array( 'classname' => 'wppa_topten_widget', 'description' => __( 'Display top rated photos', 'wp-photo-album-plus' ) );
|
31 |
parent::__construct( 'wppa_topten_widget', __( 'WPPA+ Top Ten Photos', 'wp-photo-album-plus' ), $widget_ops );
|
32 |
-
$this->defaults['title'] = __( 'Top Ten Photos', 'wp-photo-album-plus' );
|
33 |
}
|
34 |
|
35 |
/** @see WP_Widget::widget */
|
36 |
function widget( $args, $instance ) {
|
37 |
global $wpdb;
|
38 |
|
39 |
-
|
40 |
-
|
|
|
41 |
wppa( 'in_widget', 'topten' );
|
42 |
wppa_bump_mocc();
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
47 |
-
|
48 |
-
// Logged in only and logged out?
|
49 |
-
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
50 |
-
return;
|
51 |
-
}
|
52 |
-
|
53 |
-
$widget_title = apply_filters('widget_title', $instance['title'] );
|
54 |
$page = in_array( wppa_opt( 'topten_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('topten_widget_linkpage', __('Top Ten Photos', 'wp-photo-album-plus'));
|
55 |
$albumlinkpage = wppa_get_the_landing_page('topten_widget_album_linkpage', __('Top Ten Photo album', 'wp-photo-album-plus'));
|
56 |
$max = wppa_opt( 'topten_count' );
|
57 |
$album = $instance['album'];
|
58 |
-
/*
|
59 |
-
switch ( $instance['sortby'] ) {
|
60 |
-
case 'mean_rating':
|
61 |
-
$sortby = 'mean_rating DESC, rating_count DESC, views DESC';
|
62 |
-
break;
|
63 |
-
case 'rating_count':
|
64 |
-
$sortby = 'rating_count DESC, mean_rating DESC, views DESC';
|
65 |
-
break;
|
66 |
-
case 'views':
|
67 |
-
$sortby = 'views DESC, mean_rating DESC, rating_count DESC';
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
*/
|
71 |
$display = $instance['display'];
|
72 |
$meanrat = wppa_checked( $instance['meanrat'] ) ? 'yes' : false;
|
73 |
$ratcount = wppa_checked( $instance['ratcount'] ) ? 'yes' : false;
|
@@ -78,7 +40,35 @@ class TopTenWidget extends WP_Widget {
|
|
78 |
$medalsonly = wppa_checked( $instance['medalsonly'] ) ? 'yes' : false;
|
79 |
$showowner = wppa_checked( $instance['showowner'] ) ? 'yes' : false;
|
80 |
$showalbum = wppa_checked( $instance['showalbum'] ) ? 'yes' : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
wppa( 'medals_only', $medalsonly );
|
83 |
|
84 |
$likes = wppa_opt( 'rating_display_type' ) == 'likes';
|
@@ -505,25 +495,36 @@ class TopTenWidget extends WP_Widget {
|
|
505 |
else $widget_content .= __( 'There are no rated photos (yet)', 'wp-photo-album-plus' );
|
506 |
|
507 |
$widget_content .= '<div style="clear:both"></div>';
|
508 |
-
$widget_content .= "\n".'<!-- WPPA+ TopTen Widget end -->';
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
-
//
|
515 |
-
|
|
|
|
|
|
|
|
|
516 |
}
|
517 |
|
518 |
/** @see WP_Widget::update */
|
519 |
function update( $new_instance, $old_instance ) {
|
520 |
|
521 |
-
//
|
522 |
-
$
|
|
|
|
|
|
|
|
|
523 |
|
524 |
-
|
525 |
-
$new_instance['title'] = strip_tags( $new_instance['title'] );
|
526 |
-
$new_instance['album'] = strval( intval( $new_instance['album'] ) );
|
527 |
|
528 |
return $new_instance;
|
529 |
}
|
@@ -531,15 +532,20 @@ class TopTenWidget extends WP_Widget {
|
|
531 |
/** @see WP_Widget::form */
|
532 |
function form( $instance ) {
|
533 |
|
534 |
-
//
|
535 |
-
$instance =
|
536 |
|
537 |
// Title
|
538 |
echo
|
539 |
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) );
|
540 |
|
541 |
// Album
|
542 |
-
$body = wppa_album_select_a( array( 'selected'
|
|
|
|
|
|
|
|
|
|
|
543 |
echo
|
544 |
wppa_widget_selection_frame( $this, 'album', $body, __( 'Album', 'wp-photo-album-plus' ) );
|
545 |
|
@@ -605,6 +611,10 @@ class TopTenWidget extends WP_Widget {
|
|
605 |
echo
|
606 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
607 |
|
|
|
|
|
|
|
|
|
608 |
echo
|
609 |
'<p>' .
|
610 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
@@ -613,6 +623,27 @@ class TopTenWidget extends WP_Widget {
|
|
613 |
|
614 |
}
|
615 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
} // class TopTenWidget
|
617 |
|
618 |
// register TopTenWidget widget
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
+
* Version 7.3.02
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
/** constructor */
|
12 |
function __construct() {
|
13 |
$widget_ops = array( 'classname' => 'wppa_topten_widget', 'description' => __( 'Display top rated photos', 'wp-photo-album-plus' ) );
|
14 |
parent::__construct( 'wppa_topten_widget', __( 'WPPA+ Top Ten Photos', 'wp-photo-album-plus' ), $widget_ops );
|
|
|
15 |
}
|
16 |
|
17 |
/** @see WP_Widget::widget */
|
18 |
function widget( $args, $instance ) {
|
19 |
global $wpdb;
|
20 |
|
21 |
+
// Initialize
|
22 |
+
wppa_widget_timer( 'init' );
|
23 |
+
wppa_reset_occurrance();
|
24 |
wppa( 'in_widget', 'topten' );
|
25 |
wppa_bump_mocc();
|
26 |
+
extract( $args );
|
27 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
28 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
$page = in_array( wppa_opt( 'topten_widget_linktype' ), wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('topten_widget_linkpage', __('Top Ten Photos', 'wp-photo-album-plus'));
|
30 |
$albumlinkpage = wppa_get_the_landing_page('topten_widget_album_linkpage', __('Top Ten Photo album', 'wp-photo-album-plus'));
|
31 |
$max = wppa_opt( 'topten_count' );
|
32 |
$album = $instance['album'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
$display = $instance['display'];
|
34 |
$meanrat = wppa_checked( $instance['meanrat'] ) ? 'yes' : false;
|
35 |
$ratcount = wppa_checked( $instance['ratcount'] ) ? 'yes' : false;
|
40 |
$medalsonly = wppa_checked( $instance['medalsonly'] ) ? 'yes' : false;
|
41 |
$showowner = wppa_checked( $instance['showowner'] ) ? 'yes' : false;
|
42 |
$showalbum = wppa_checked( $instance['showalbum'] ) ? 'yes' : false;
|
43 |
+
$cache = $instance['cache'];
|
44 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
45 |
+
|
46 |
+
// Logged in only and logged out?
|
47 |
+
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
|
51 |
+
// Cache?
|
52 |
+
if ( $cache ) {
|
53 |
+
|
54 |
+
if ( wppa_is_file( $cachefile ) ) {
|
55 |
+
|
56 |
+
// Cache expired?
|
57 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
58 |
+
wppa_remove_widget_cache_path( $this->id );
|
59 |
+
}
|
60 |
+
|
61 |
+
// No, use it
|
62 |
+
else {
|
63 |
+
echo wppa_get_contents( $cachefile );
|
64 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
65 |
+
wppa( 'in_widget', false );
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
// Make the widget content
|
72 |
wppa( 'medals_only', $medalsonly );
|
73 |
|
74 |
$likes = wppa_opt( 'rating_display_type' ) == 'likes';
|
495 |
else $widget_content .= __( 'There are no rated photos (yet)', 'wp-photo-album-plus' );
|
496 |
|
497 |
$widget_content .= '<div style="clear:both"></div>';
|
|
|
498 |
|
499 |
+
// Output
|
500 |
+
$result = "\n" . $before_widget;
|
501 |
+
if ( ! empty( $widget_title ) ) {
|
502 |
+
$result .= $before_title . $widget_title . $after_title;
|
503 |
+
}
|
504 |
+
$result .= $widget_content . $after_widget;
|
505 |
+
|
506 |
+
echo $result;
|
507 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
508 |
|
509 |
+
// Cache?
|
510 |
+
if ( $cache ) {
|
511 |
+
wppa_put_contents( $cachefile, $result );
|
512 |
+
}
|
513 |
+
|
514 |
+
wppa( 'in_widget', false );
|
515 |
}
|
516 |
|
517 |
/** @see WP_Widget::update */
|
518 |
function update( $new_instance, $old_instance ) {
|
519 |
|
520 |
+
// Completize all parms
|
521 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
522 |
+
|
523 |
+
// Sanitize certain args
|
524 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
525 |
+
$instance['album'] = strval( intval( $new_instance['album'] ) );
|
526 |
|
527 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
528 |
|
529 |
return $new_instance;
|
530 |
}
|
532 |
/** @see WP_Widget::form */
|
533 |
function form( $instance ) {
|
534 |
|
535 |
+
// Defaults
|
536 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
537 |
|
538 |
// Title
|
539 |
echo
|
540 |
wppa_widget_input( $this, 'title', $instance['title'], __( 'Title', 'wp-photo-album-plus' ) );
|
541 |
|
542 |
// Album
|
543 |
+
$body = wppa_album_select_a( array( 'selected' => $instance['album'],
|
544 |
+
'addall' => true,
|
545 |
+
'addowner' => true,
|
546 |
+
'path' => true,
|
547 |
+
'sort' => true,
|
548 |
+
) );
|
549 |
echo
|
550 |
wppa_widget_selection_frame( $this, 'album', $body, __( 'Album', 'wp-photo-album-plus' ) );
|
551 |
|
611 |
echo
|
612 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
613 |
|
614 |
+
// Cache
|
615 |
+
echo
|
616 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
617 |
+
|
618 |
echo
|
619 |
'<p>' .
|
620 |
__( 'You can set the sizes in this widget in the <b>Photo Albums -> Settings</b> admin page.', 'wp-photo-album-plus' ) .
|
623 |
|
624 |
}
|
625 |
|
626 |
+
// Set defaults
|
627 |
+
function get_defaults() {
|
628 |
+
|
629 |
+
$defaults = array( 'title' => __( 'Top Ten Photos', 'wp-photo-album-plus' ),
|
630 |
+
'sortby' => 'mean_rating',
|
631 |
+
'album' => '0',
|
632 |
+
'display' => 'thumbs',
|
633 |
+
'meanrat' => 'no',
|
634 |
+
'ratcount' => 'no',
|
635 |
+
'viewcount' => 'no',
|
636 |
+
'dlcount' => 'no',
|
637 |
+
'includesubs' => 'no',
|
638 |
+
'medalsonly' => 'no',
|
639 |
+
'showowner' => 'no',
|
640 |
+
'showalbum' => 'no',
|
641 |
+
'logonly' => 'no',
|
642 |
+
'cache' => '0',
|
643 |
+
);
|
644 |
+
return $defaults;
|
645 |
+
}
|
646 |
+
|
647 |
} // class TopTenWidget
|
648 |
|
649 |
// register TopTenWidget widget
|
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 7.
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -20,27 +20,42 @@ class UpldrWidget extends WP_Widget {
|
|
20 |
function widget($args, $instance) {
|
21 |
global $wpdb;
|
22 |
|
23 |
-
|
24 |
-
|
|
|
25 |
wppa( 'in_widget', 'upldr' );
|
26 |
wppa_bump_mocc();
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
|
32 |
-
'sortby' => 'name',
|
33 |
-
'ignore' => 'admin',
|
34 |
-
'parent' => '',
|
35 |
-
'logonly' => 'no',
|
36 |
-
) );
|
37 |
|
38 |
// Logged in only and logged out?
|
39 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
40 |
return;
|
41 |
}
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
$page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus'));
|
45 |
$ignorelist = explode(',', $instance['ignore']);
|
46 |
$upldrcache = wppa_get_upldr_cache();
|
@@ -51,7 +66,6 @@ class UpldrWidget extends WP_Widget {
|
|
51 |
$showphotocount = wppa_checked( $instance['showphotocount'] );
|
52 |
$total_ownercount = 0;
|
53 |
$total_photocount = 0;
|
54 |
-
|
55 |
$selalbs = str_replace( '.', ',', wppa_expand_enum( wppa_alb_to_enum_children( wppa_expand_enum( $instance['parent'] ) ) ) );
|
56 |
|
57 |
// Make the data we need
|
@@ -173,39 +187,36 @@ class UpldrWidget extends WP_Widget {
|
|
173 |
}
|
174 |
$widget_content .= '</tbody></table></div>';
|
175 |
$widget_content .= '<div style="clear:both"></div>';
|
176 |
-
$widget_content .= "\n".'<!-- WPPA+ Upldr Widget end -->';
|
177 |
|
178 |
// Output
|
179 |
-
|
180 |
-
if ( !empty( $widget_title ) ) {
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
wppa( 'in_widget', false );
|
184 |
-
|
|
|
185 |
|
186 |
/** @see WP_Widget::update */
|
187 |
function update( $new_instance, $old_instance ) {
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
'parent' => '',
|
197 |
-
'showownercount' => '',
|
198 |
-
'showphotocount' => '',
|
199 |
-
'logonly' => 'no',
|
200 |
-
) );
|
201 |
-
|
202 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
203 |
-
$instance['sortby'] = $new_instance['sortby'];
|
204 |
-
$instance['ignore'] = $new_instance['ignore'];
|
205 |
-
$instance['parent'] = $new_instance['parent'];
|
206 |
-
$instance['showownercount'] = $new_instance['showownercount'];
|
207 |
-
$instance['showphotocount'] = $new_instance['showphotocount'];
|
208 |
-
$instance['logonly'] = $new_instance['logonly'];
|
209 |
|
210 |
wppa_flush_upldr_cache( 'widgetid', $this->get_widget_id() );
|
211 |
|
@@ -216,16 +227,8 @@ class UpldrWidget extends WP_Widget {
|
|
216 |
function form( $instance ) {
|
217 |
global $wpdb;
|
218 |
|
219 |
-
//Defaults
|
220 |
-
$instance
|
221 |
-
'title' => __( 'Uploader Photos', 'wp-photo-album-plus' ),
|
222 |
-
'sortby' => 'name',
|
223 |
-
'ignore' => 'admin',
|
224 |
-
'parent' => '',
|
225 |
-
'showownercount' => '',
|
226 |
-
'showphotocount' => '',
|
227 |
-
'logonly' => 'no',
|
228 |
-
) );
|
229 |
|
230 |
// Title
|
231 |
echo
|
@@ -305,6 +308,10 @@ class UpldrWidget extends WP_Widget {
|
|
305 |
echo
|
306 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
307 |
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
function get_widget_id() {
|
@@ -313,6 +320,20 @@ class UpldrWidget extends WP_Widget {
|
|
313 |
return $widgetid;
|
314 |
}
|
315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
|
317 |
} // class UpldrWidget
|
318 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display a list of users linking to their 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', 'upldr' );
|
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 |
$page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus'));
|
60 |
$ignorelist = explode(',', $instance['ignore']);
|
61 |
$upldrcache = wppa_get_upldr_cache();
|
66 |
$showphotocount = wppa_checked( $instance['showphotocount'] );
|
67 |
$total_ownercount = 0;
|
68 |
$total_photocount = 0;
|
|
|
69 |
$selalbs = str_replace( '.', ',', wppa_expand_enum( wppa_alb_to_enum_children( wppa_expand_enum( $instance['parent'] ) ) ) );
|
70 |
|
71 |
// Make the data we need
|
187 |
}
|
188 |
$widget_content .= '</tbody></table></div>';
|
189 |
$widget_content .= '<div style="clear:both"></div>';
|
|
|
190 |
|
191 |
// Output
|
192 |
+
$result = "\n" . $before_widget;
|
193 |
+
if ( ! empty( $widget_title ) ) {
|
194 |
+
$result .= $before_title . $widget_title . $after_title;
|
195 |
+
}
|
196 |
+
$result .= $widget_content . $after_widget;
|
197 |
+
|
198 |
+
echo $result;
|
199 |
+
echo wppa_widget_timer( 'show', $widget_title );
|
200 |
+
|
201 |
+
// Cache?
|
202 |
+
if ( $cache ) {
|
203 |
+
wppa_put_contents( $cachefile, $result );
|
204 |
+
}
|
205 |
|
206 |
wppa( 'in_widget', false );
|
207 |
+
|
208 |
+
}
|
209 |
|
210 |
/** @see WP_Widget::update */
|
211 |
function update( $new_instance, $old_instance ) {
|
212 |
|
213 |
+
// Completize all parms
|
214 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
215 |
+
|
216 |
+
// Sanitize certain args
|
217 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
218 |
+
|
219 |
+
wppa_remove_widget_cache_path( $this->id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
wppa_flush_upldr_cache( 'widgetid', $this->get_widget_id() );
|
222 |
|
227 |
function form( $instance ) {
|
228 |
global $wpdb;
|
229 |
|
230 |
+
// Defaults
|
231 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
// Title
|
234 |
echo
|
308 |
echo
|
309 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
310 |
|
311 |
+
// Cache
|
312 |
+
echo
|
313 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
314 |
+
|
315 |
}
|
316 |
|
317 |
function get_widget_id() {
|
320 |
return $widgetid;
|
321 |
}
|
322 |
|
323 |
+
// Set defaults
|
324 |
+
function get_defaults() {
|
325 |
+
|
326 |
+
$defaults = array( 'title' => __( 'Uploader Photos', 'wp-photo-album-plus' ),
|
327 |
+
'sortby' => 'name',
|
328 |
+
'ignore' => 'admin',
|
329 |
+
'parent' => '',
|
330 |
+
'showownercount' => '',
|
331 |
+
'showphotocount' => '',
|
332 |
+
'logonly' => 'no',
|
333 |
+
'cache' => '0',
|
334 |
+
);
|
335 |
+
return $defaults;
|
336 |
+
}
|
337 |
|
338 |
} // class UpldrWidget
|
339 |
|
wppa-upload-widget.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* A wppa widget to upload photos
|
6 |
*
|
7 |
-
* Version 7.
|
8 |
*/
|
9 |
|
10 |
class WppaUploadWidget extends WP_Widget {
|
@@ -17,21 +17,42 @@ class WppaUploadWidget extends WP_Widget {
|
|
17 |
function widget( $args, $instance ) {
|
18 |
global $wpdb;
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
// Logged in only and logged out?
|
30 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
31 |
return;
|
32 |
}
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
$album = $instance['album'];
|
36 |
|
37 |
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
|
@@ -41,8 +62,6 @@ class WppaUploadWidget extends WP_Widget {
|
|
41 |
|
42 |
wppa_user_upload(); // Do the upload if required
|
43 |
|
44 |
-
wppa( 'in_widget', 'upload' );
|
45 |
-
wppa_bump_mocc();
|
46 |
$mocc = wppa( 'mocc' );
|
47 |
$is_responsive = wppa_opt( 'colwidth' ) == 'auto';
|
48 |
|
@@ -60,7 +79,7 @@ class WppaUploadWidget extends WP_Widget {
|
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
-
$
|
64 |
'<div' .
|
65 |
' id="wppa-container-' . $mocc . '"' .
|
66 |
' class="wppa-upload-widget"' .
|
@@ -72,32 +91,42 @@ class WppaUploadWidget extends WP_Widget {
|
|
72 |
$upload .
|
73 |
'</div>';
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
-
echo $text;
|
80 |
-
echo '<div style="clear:both"></div>';
|
81 |
-
echo $after_widget;
|
82 |
|
83 |
wppa( 'in_widget', false );
|
84 |
}
|
85 |
|
86 |
function update( $new_instance, $old_instance ) {
|
87 |
-
$instance = $old_instance;
|
88 |
|
89 |
-
|
|
|
90 |
|
91 |
-
|
|
|
92 |
$instance['album'] = strval( intval( $new_instance['album'] ) );
|
93 |
-
|
|
|
94 |
|
95 |
return $instance;
|
96 |
}
|
97 |
|
98 |
function form( $instance ) {
|
99 |
|
100 |
-
|
|
|
101 |
|
102 |
// Widget title
|
103 |
echo
|
@@ -112,7 +141,22 @@ class WppaUploadWidget extends WP_Widget {
|
|
112 |
echo
|
113 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
|
|
116 |
}
|
117 |
|
118 |
// register WppaUploadWidget
|
4 |
*
|
5 |
* A wppa widget to upload photos
|
6 |
*
|
7 |
+
* Version 7.3.02
|
8 |
*/
|
9 |
|
10 |
class WppaUploadWidget extends WP_Widget {
|
17 |
function widget( $args, $instance ) {
|
18 |
global $wpdb;
|
19 |
|
20 |
+
// Initialize
|
21 |
+
wppa_widget_timer( 'init' );
|
22 |
+
wppa_reset_occurrance();
|
23 |
+
wppa( 'in_widget', 'upload' );
|
24 |
+
wppa_bump_mocc();
|
25 |
+
extract( $args );
|
26 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
27 |
+
$widget_title = apply_filters( 'widget_title', $instance['title'] );
|
28 |
+
$cache = $instance['cache'];
|
29 |
+
$cachefile = wppa_get_widget_cache_path( $this->id );
|
30 |
|
31 |
// Logged in only and logged out?
|
32 |
if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
// Cache?
|
37 |
+
if ( $cache ) {
|
38 |
+
|
39 |
+
if ( wppa_is_file( $cachefile ) ) {
|
40 |
+
|
41 |
+
// Cache expired?
|
42 |
+
if ( wppa_filetime( $cachefile ) < time() - 60 * $cache ) {
|
43 |
+
wppa_remove_widget_cache_path( $this->id );
|
44 |
+
}
|
45 |
+
|
46 |
+
// No, use it
|
47 |
+
else {
|
48 |
+
echo wppa_get_contents( $cachefile );
|
49 |
+
echo wppa_widget_timer( 'show', $widget_title, true );
|
50 |
+
wppa( 'in_widget', false );
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
$album = $instance['album'];
|
57 |
|
58 |
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
|
62 |
|
63 |
wppa_user_upload(); // Do the upload if required
|
64 |
|
|
|
|
|
65 |
$mocc = wppa( 'mocc' );
|
66 |
$is_responsive = wppa_opt( 'colwidth' ) == 'auto';
|
67 |
|
79 |
return;
|
80 |
}
|
81 |
|
82 |
+
$widget_content =
|
83 |
'<div' .
|
84 |
' id="wppa-container-' . $mocc . '"' .
|
85 |
' class="wppa-upload-widget"' .
|
91 |
$upload .
|
92 |
'</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 |
}
|
111 |
|
112 |
function update( $new_instance, $old_instance ) {
|
|
|
113 |
|
114 |
+
// Completize all parms
|
115 |
+
$instance = wppa_parse_args( $new_instance, $this->get_defaults() );
|
116 |
|
117 |
+
// Sanitize certain args
|
118 |
+
$instance['title'] = strip_tags( $instance['title'] );
|
119 |
$instance['album'] = strval( intval( $new_instance['album'] ) );
|
120 |
+
|
121 |
+
wppa_remove_widget_cache_path( $this->id );
|
122 |
|
123 |
return $instance;
|
124 |
}
|
125 |
|
126 |
function form( $instance ) {
|
127 |
|
128 |
+
// Defaults
|
129 |
+
$instance = wppa_parse_args( (array) $instance, $this->get_defaults() );
|
130 |
|
131 |
// Widget title
|
132 |
echo
|
141 |
echo
|
142 |
wppa_widget_checkbox( $this, 'logonly', $instance['logonly'], __( 'Show to logged in visitors only', 'wp-photo-album-plus' ) );
|
143 |
|
144 |
+
// Cache
|
145 |
+
echo
|
146 |
+
wppa_widget_cache( $this, $instance['cache'] );
|
147 |
+
}
|
148 |
+
|
149 |
+
// Set defaults
|
150 |
+
function get_defaults() {
|
151 |
+
|
152 |
+
$defaults = array( 'title' => __( 'Upload Photos', 'wp-photo-album-plus' ),
|
153 |
+
'album' => '0',
|
154 |
+
'logonly' => 'no',
|
155 |
+
'cache' => '0',
|
156 |
+
);
|
157 |
+
return $defaults;
|
158 |
}
|
159 |
+
|
160 |
}
|
161 |
|
162 |
// register WppaUploadWidget
|
wppa-utils.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
-
* Version 7.3.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1603,6 +1603,13 @@ static $repeat_count;
|
|
1603 |
case 'o':
|
1604 |
$type = 'Obs';
|
1605 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1606 |
case 'u':
|
1607 |
$type = 'Upl';
|
1608 |
break;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
+
* Version 7.3.02
|
7 |
*
|
8 |
*/
|
9 |
|
1603 |
case 'o':
|
1604 |
$type = 'Obs';
|
1605 |
break;
|
1606 |
+
case 't':
|
1607 |
+
if ( wppa_get_option( 'wppa_log_tim' ) == 'no' ) {
|
1608 |
+
$busy = false;
|
1609 |
+
return;
|
1610 |
+
}
|
1611 |
+
$type = '{span style="color:darkgreen;" }Tim{/span}';
|
1612 |
+
break;
|
1613 |
case 'u':
|
1614 |
$type = 'Upl';
|
1615 |
break;
|
wppa-widget-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-widget-functions.php
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
-
/* Version 7.3.
|
6 |
/*
|
7 |
*/
|
8 |
|
@@ -333,6 +333,28 @@ static $potd;
|
|
333 |
return $result;
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
// Get widget checkbox html
|
337 |
function wppa_widget_checkbox( $class, $item, $value, $label, $subtext = '', $disabled = false, $onchange = '' ) {
|
338 |
|
@@ -548,3 +570,70 @@ function wppa_log_potd( $id ) {
|
|
548 |
update_option( 'wppa_potd_log_data', $his );
|
549 |
}
|
550 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/* wppa-widget-functions.php
|
3 |
/* Package: wp-photo-album-plus
|
4 |
/*
|
5 |
+
/* Version 7.3.02
|
6 |
/*
|
7 |
*/
|
8 |
|
333 |
return $result;
|
334 |
}
|
335 |
|
336 |
+
// Widget cache dialog
|
337 |
+
function wppa_widget_cache( $class, $value ) {
|
338 |
+
|
339 |
+
$options = array( __( '--- none ---', 'wp-photo-album-plus' ),
|
340 |
+
'5', '6', '7', '8', '9', '10', '12', '15', '20', '25', '30', '40', '45', '50', '55', '60',
|
341 |
+
);
|
342 |
+
$values = array( '0',
|
343 |
+
'5', '6', '7', '8', '9', '10', '12', '15', '20', '25', '30', '40', '45', '50', '55', '60',
|
344 |
+
);
|
345 |
+
$result = wppa_widget_selection( $class,
|
346 |
+
'cache',
|
347 |
+
$value,
|
348 |
+
__( 'Select cache expiration time (min)', 'wp-photo-album-plus' ),
|
349 |
+
$options,
|
350 |
+
$values,
|
351 |
+
array(),
|
352 |
+
'',
|
353 |
+
__( 'Select --- none --- to disable caching.', 'wp-photo-album-plus' )
|
354 |
+
);
|
355 |
+
return $result;
|
356 |
+
}
|
357 |
+
|
358 |
// Get widget checkbox html
|
359 |
function wppa_widget_checkbox( $class, $item, $value, $label, $subtext = '', $disabled = false, $onchange = '' ) {
|
360 |
|
570 |
update_option( 'wppa_potd_log_data', $his );
|
571 |
}
|
572 |
}
|
573 |
+
|
574 |
+
function wppa_get_widget_cache_root() {
|
575 |
+
return WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-widget';
|
576 |
+
}
|
577 |
+
|
578 |
+
function wppa_get_widget_cache_path( $widget_id ) {
|
579 |
+
|
580 |
+
$root = wppa_get_widget_cache_root();
|
581 |
+
|
582 |
+
if ( ! wppa_is_dir( $root ) ) {
|
583 |
+
wppa_mktree( $root );
|
584 |
+
}
|
585 |
+
|
586 |
+
return $root . '/' . $widget_id;
|
587 |
+
}
|
588 |
+
|
589 |
+
function wppa_remove_widget_cache_path( $name = '' ) {
|
590 |
+
|
591 |
+
$root = wppa_get_widget_cache_root();
|
592 |
+
|
593 |
+
if ( $name ) {
|
594 |
+
$file = wppa_get_widget_cache_path( $name );
|
595 |
+
if ( wppa_is_file( $file ) ) {
|
596 |
+
wppa_unlink( $file );
|
597 |
+
return;
|
598 |
+
}
|
599 |
+
}
|
600 |
+
|
601 |
+
$files = wppa_glob( $root . '/*' );
|
602 |
+
$nfiles = count( $files );
|
603 |
+
if ( $nfiles ) {
|
604 |
+
foreach( $files as $file ) {
|
605 |
+
wppa_unlink( $file );
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
|
610 |
+
function wppa_widget_timer( $key = '', $title = '', $cached = false ) {
|
611 |
+
static $queries;
|
612 |
+
static $time;
|
613 |
+
|
614 |
+
switch( $key ) {
|
615 |
+
case 'init':
|
616 |
+
$queries = get_num_queries();
|
617 |
+
$time = microtime( true );
|
618 |
+
break;
|
619 |
+
|
620 |
+
case 'show':
|
621 |
+
$queries = get_num_queries() - $queries;
|
622 |
+
$time = microtime( true ) - $time;
|
623 |
+
$result = "\n" .
|
624 |
+
'<!-- End ' . $title . ' ' .
|
625 |
+
sprintf( '%d queries in %3.1f ms. at %s',
|
626 |
+
$queries,
|
627 |
+
$time * 1000,
|
628 |
+
wppa_local_date( wppa_get_option( 'time_format' ) ) ) .
|
629 |
+
( $cached ? ' (cached) ' : ' ' ) .
|
630 |
+
'-->';
|
631 |
+
wppa_log( 'tim', trim( $result, "\n<>" ) );
|
632 |
+
return $result;
|
633 |
+
break;
|
634 |
+
|
635 |
+
default:
|
636 |
+
wppa_log( 'err', 'Unimplemented key in wppa_widget_timer (' . $key . ')' );
|
637 |
+
break;
|
638 |
+
}
|
639 |
+
}
|
wppa-wrappers.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Contains wrappers for standard php functions
|
6 |
* For security and bug reasons
|
7 |
*
|
8 |
-
* Version 7.3.
|
9 |
*
|
10 |
*/
|
11 |
|
@@ -704,3 +704,13 @@ function wppa_shortpath( $path ) {
|
|
704 |
$result = str_replace( WPPA_ABSPATH, '.../', $path );
|
705 |
return $result;
|
706 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
* Contains wrappers for standard php functions
|
6 |
* For security and bug reasons
|
7 |
*
|
8 |
+
* Version 7.3.02
|
9 |
*
|
10 |
*/
|
11 |
|
704 |
$result = str_replace( WPPA_ABSPATH, '.../', $path );
|
705 |
return $result;
|
706 |
}
|
707 |
+
|
708 |
+
function wppa_filetime( $path, $log = true ) {
|
709 |
+
|
710 |
+
if ( ! wppa_is_path_safe( $path ) ) {
|
711 |
+
if ( $log ) wppa_log( 'Err', 'Unsafe path detected in wppa_filetime(): ' . wppa_shortpath( $path ), true );
|
712 |
+
return false;
|
713 |
+
}
|
714 |
+
|
715 |
+
return filemtime( $path );
|
716 |
+
}
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 7.3.
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
@@ -23,8 +23,8 @@ global $wpdb;
|
|
23 |
global $wp_version;
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
-
global $wppa_revno; $wppa_revno = '
|
27 |
-
global $wppa_api_version; $wppa_api_version = '7.3.
|
28 |
|
29 |
/* Init page js data */
|
30 |
global $wppa_js_page_data; $wppa_js_page_data = '';
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
+
* Version: 7.3.02.007
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
23 |
global $wp_version;
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
+
global $wppa_revno; $wppa_revno = '7302'; // WPPA db version
|
27 |
+
global $wppa_api_version; $wppa_api_version = '7.3.02.007'; // WPPA software version
|
28 |
|
29 |
/* Init page js data */
|
30 |
global $wppa_js_page_data; $wppa_js_page_data = '';
|