WP Photo Album Plus - Version 7.7.01.006

Version Description

= 7.7.01 =

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

Release Info

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

Code changes from version 7.7.01.004 to 7.7.01.006

changelog.txt CHANGED
@@ -7,9 +7,12 @@ display name, description, rating and comments. You can select default to use th
7
  This works for slideshows, thumbnails and lightbox, where applicable.
8
  * Fixes: Slideshow animation type swipe only worked for next slide but did not wor for previous slide. Fixed.
9
  * Removed obsolete css attribute enable-background on svg elements and missing colors for svg tags are now replaced by transparent.
10
- * The album admin page (Edit album information) now also has a button to download the album (zipfile of the images). Works like the download link on album covers.
 
11
  * When 'adding owner to name' was activated in Table II-B5.1 and/or Table II-D2, the name of the photo was displayed even when displaying name was off (Table II-B5 and Table II-D1).
12
  This has been corrected; the photo names will now be hidden in that case.
 
 
13
 
14
  = 7.6.10 =
15
 
7
  This works for slideshows, thumbnails and lightbox, where applicable.
8
  * Fixes: Slideshow animation type swipe only worked for next slide but did not wor for previous slide. Fixed.
9
  * Removed obsolete css attribute enable-background on svg elements and missing colors for svg tags are now replaced by transparent.
10
+ * The album admin page (Edit album information) now also has a button to download the album (zipfile of the images). Works like the download link on album covers.
11
+ Note that Table VI-C2: Album download link must be ticked. If you want this feature only for admins, make it a restricted action in Table VII-C11.
12
  * When 'adding owner to name' was activated in Table II-B5.1 and/or Table II-D2, the name of the photo was displayed even when displaying name was off (Table II-B5 and Table II-D1).
13
  This has been corrected; the photo names will now be hidden in that case.
14
+ * The state of the 'remove empty dirs' switch on the import screen is now saved in a technical cookie and is no longer always on.
15
+ * New shortcode type type="contest". Displays the rating results of an album. Syntax: [wppa type="contest" album="<album id>"] The album id must be a positive integer.
16
 
17
  = 7.6.10 =
18
 
wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 7.6.10.003
7
  *
8
  */
9
 
@@ -1305,7 +1305,7 @@ global $wppa_revno;
1305
  }
1306
 
1307
  // Download album
1308
- if ( ! wppa_switch( 'download_album_is_restricted' ) || wppa_user_is( 'administrator' ) ) {
1309
 
1310
  echo
1311
  '<input' .
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 7.7.01.005
7
  *
8
  */
9
 
1305
  }
1306
 
1307
  // Download album
1308
+ if ( wppa_switch( 'allow_download_album' ) && ( ! wppa_switch( 'download_album_is_restricted' ) || wppa_user_is( 'administrator' ) ) ) {
1309
 
1310
  echo
1311
  '<input' .
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 7.7.01.002
7
  *
8
  */
9
 
@@ -117,6 +117,153 @@ function wppa_thumb_area( $action ) {
117
  wppa_out( $result );
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  // Search box
121
  function wppa_search_box() {
122
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.7.01.006
7
  *
8
  */
9
 
117
  wppa_out( $result );
118
  }
119
 
120
+ // Contest box
121
+ function wppa_contest_box() {
122
+
123
+ // Init
124
+ $result = '';
125
+ $mocc = wppa( 'mocc' );
126
+ $alt = wppa( 'alt' );
127
+ $maxh = wppa_opt( 'area_size' );
128
+ $nice = wppa_switch( 'nicescroll' );
129
+ $overflow = 'visible';
130
+ if ( $maxh ) {
131
+ if ( $nice ) $overflow = 'hidden';
132
+ else $overflow = 'auto';
133
+ }
134
+
135
+ // Open contest box
136
+ if ( is_feed() ) {
137
+ $result .= '<div'.
138
+ ' id="wppa-thumb-area-' . $mocc . '"' .
139
+ ' class="wppa-thumb-area"' .
140
+ ' style="' . wppa_wcs( 'wppa-box' ) . wppa_wcs( 'wppa-' . $alt ) . '"' .
141
+ ' >';
142
+ }
143
+ else {
144
+ $result .= "\n";
145
+ $result .= '<div' .
146
+ ' id="wppa-thumb-area-' . $mocc . '"' .
147
+ ' class="' .
148
+ 'wppa-contest ' .
149
+ 'wppa-thumb-area ' .
150
+ 'wppa-thumb-area-' . $mocc . ' ' .
151
+ 'wppa-box wppa-' . $alt .
152
+ '"' .
153
+ ' style="' .
154
+ wppa_wcs( 'wppa-box' ) .
155
+ wppa_wcs( 'wppa-' . $alt ) .
156
+ ( $maxh > '1' ? 'max-height:' . $maxh . 'px;' : '' ) .
157
+ 'overflow:' . $overflow . ';' .
158
+ '"' .
159
+ ' onscroll="wppaMakeLazyVisible(' . $mocc . ');" ' .
160
+ ' >';
161
+ }
162
+
163
+ // Use nicescroller?
164
+ if ( $nice ) {
165
+ $result .= '<div class="wppa-nicewrap" >';
166
+ }
167
+
168
+ // Toggle alt/even
169
+ wppa_toggle_alt();
170
+
171
+ $result .= wppa_get_contest_html( wppa( 'start_album' ) );
172
+
173
+ // After content
174
+ $result .= '<div class="wppa-clear" style="' . wppa_wis( 'clear:both;' ) . '" ></div>';
175
+
176
+ // Nicescroller
177
+ if ( $nice ) {
178
+ $result .=
179
+ wppa_js(
180
+ '<script type="text/javascript" >' .
181
+ 'jQuery(document).ready(function(){' .
182
+ 'jQuery(".wppa-thumb-area").niceScroll(".wppa-nicewrap",{' . wppa_opt( 'nicescroll_opts' ) . '});' .
183
+ '});' .
184
+ '</script>', true ) .
185
+ '</div>'; // close .wppa-nicewrap div
186
+ }
187
+
188
+ // Close the box
189
+ $result .= '</div>';
190
+
191
+ // Output result
192
+ wppa_out( $result );
193
+ }
194
+
195
+ // Get contest html
196
+ function wppa_get_contest_html( $alb ) {
197
+ global $wpdb;
198
+
199
+ // Validate args
200
+ if ( ! $alb || ! intval( $alb ) == $alb ) {
201
+ $result = 'Invalid album identifier supplied';
202
+ return $result;
203
+ }
204
+
205
+ // Get data
206
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %d", $alb ), ARRAY_A );
207
+ foreach( array_keys( $photos ) as $idx ) {
208
+ $photos[$idx]['total'] = wppa_get_rating_total_by_id( $photos[$idx]['id'] );
209
+ }
210
+ $photos = wppa_array_sort( $photos, 'total' );
211
+ $photos = array_reverse( $photos );
212
+
213
+ // Create html
214
+ $result = '
215
+ <h3>' .
216
+ sprintf( __( 'Results of contest %s', 'wp-photo-album-plus' ), wppa_get_album_name( $alb ) ) . '
217
+ </h3>';
218
+
219
+ $result .= '
220
+ <table>
221
+ <thead>
222
+ <th>' . __( 'Photo#', 'wp-photo-album-plus' ) . '</th>
223
+ <th>' . __( 'Rater', 'wp-photo-album-plus' ) . '</th>
224
+ <th>' . __( 'Points', 'wp-photo-album-plus' ) . '</th>
225
+ <th>' . __( 'Photo name', 'wp-photo-album-plus' ) . '</th>
226
+ <th>' . __( 'Owner', 'wp-photo-album-plus' ) . '</th>
227
+ <th>' . __( 'Ranking', 'wp-photo-album-plus' ) . '</th>
228
+ </thead>
229
+ <tbody>';
230
+ $rank = '1';
231
+ foreach( $photos as $photo ) {
232
+ $seqno = wppa_get_seqno( $alb, $photo['id'] );
233
+
234
+ $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating WHERE photo = %d", $photo['id'] ), ARRAY_A );
235
+ foreach( $ratings as $rating ) {
236
+ $result .= '
237
+ <tr>
238
+ <td>' . $seqno . '</td>
239
+ <td>' . wppa_get_user_by( 'id', $rating['userid'] )->display_name . '</td>
240
+ <td>' . $rating['value'] . '</td>
241
+ <td>' . $photo['name'] . '</td>
242
+ <td>' . wppa_get_user_by( 'login', $photo['owner'] )->display_name . '</td>
243
+ <td></td>
244
+ </tr>';
245
+ $seqno = '';
246
+ }
247
+ $result .= '
248
+ <tr>
249
+ <th>' . $seqno . '</th>
250
+ <th>' . __( 'Total', 'wp-photo-album-plus' ) . '</th>
251
+ <th>' . $photo['total'] . '</th>
252
+ <th></th>
253
+ <th></th>
254
+ <th>' . $rank . '</th>
255
+ </tr>';
256
+ $rank++;
257
+
258
+ }
259
+ $result .= '
260
+ </tbody>
261
+ </table>
262
+ <br />';
263
+
264
+ return $result;
265
+ }
266
+
267
  // Search box
268
  function wppa_search_box() {
269
 
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.6.01
6
  *
7
  */
8
 
@@ -254,6 +254,7 @@ global $thumbs;
254
  'cache' => '0',
255
  'delayerror' => '',
256
  'is_potdhis' => false,
 
257
 
258
  );
259
  }
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.7.01.006
6
  *
7
  */
8
 
254
  'cache' => '0',
255
  'delayerror' => '',
256
  'is_potdhis' => false,
257
+ 'is_contest' => false,
258
 
259
  );
260
  }
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.6.08.006
7
  *
8
  */
9
 
@@ -475,6 +475,19 @@ global $wpdb;
475
  return ( __( 'Unavailable', 'wp-photo-album-plus' ) );
476
  }
477
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
478
 
479
  default:
480
  wppa_dbg_msg ( 'Invalid type: '.htmlentities($atts['type']).' in wppa shortcode.', 'red', 'force' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 7.7.01.006
7
  *
8
  */
9
 
475
  return ( __( 'Unavailable', 'wp-photo-album-plus' ) );
476
  }
477
  break;
478
+ case 'contest':
479
+ $album = $atts['album'] ? $atts['album'] : '0';
480
+ if ( ! $album || $album < '0' || strpos( $album, '.' ) !== false ) {
481
+ $err = '
482
+ <span style="color:red;" >
483
+ Error in shortcode spec for type="contest":
484
+ Missing or invalid attribute album="<album id>"
485
+ </span>';
486
+ return $err;
487
+ }
488
+ $wppa['start_album'] = $atts['album'];
489
+ $wppa['is_contest'] = true;
490
+ break;
491
 
492
  default:
493
  wppa_dbg_msg ( 'Invalid type: '.htmlentities($atts['type']).' in wppa shortcode.', 'red', 'force' );
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.7.01.003
7
  *
8
  */
9
 
@@ -961,6 +961,10 @@ global $locale;
961
  wppa_calendar_box();
962
  }
963
  }
 
 
 
 
964
  // The normal case
965
  else {
966
  if ( function_exists( 'wppa_theme' ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.7.01.006
7
  *
8
  */
9
 
961
  wppa_calendar_box();
962
  }
963
  }
964
+ // Is it a contest
965
+ elseif ( wppa( 'is_contest' ) ) {
966
+ wppa_contest_box();
967
+ }
968
  // The normal case
969
  else {
970
  if ( function_exists( 'wppa_theme' ) ) {
wppa-import.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
- * Version 7.6.02
7
  *
8
  */
9
 
@@ -1355,12 +1355,13 @@ global $wppa_session;
1355
  ' type="checkbox"' .
1356
  ' id="del-dir"' .
1357
  ' name="del-dir"' .
1358
- ' checked="checked"' .
1359
  ' />' .
1360
  '<b>' .
1361
  '&nbsp;&nbsp;' .
1362
  __( 'Remove empty dirs', 'wp-photo-album-plus') .
1363
  '</b>' .
 
1364
  '</td>' .
1365
  '</tr>' .
1366
  '</thead>' .
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 7.7.01.005
7
  *
8
  */
9
 
1355
  ' type="checkbox"' .
1356
  ' id="del-dir"' .
1357
  ' name="del-dir"' .
1358
+ ' onchange="wppa_setCookie(\'removeemptydirs\', this.checked, \'365\')"' .
1359
  ' />' .
1360
  '<b>' .
1361
  '&nbsp;&nbsp;' .
1362
  __( 'Remove empty dirs', 'wp-photo-album-plus') .
1363
  '</b>' .
1364
+ '<script type="text/javascript" >if ( wppa_getCookie(\'removeemptydirs\') == \'true\' ) { jQuery(\'#del-dir\').prop(\'checked\', true) }</script>' .
1365
  '</td>' .
1366
  '</tr>' .
1367
  '</thead>' .
wppa-items.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
- * Version 7.7.01.001
7
  *
8
  */
9
 
@@ -483,21 +483,9 @@ global $wpdb;
483
  // Sequence no in album
484
  if ( strpos( $result, 'w#seqno' ) !== false ) {
485
  $alb = $thumb['album'];
486
- static $seqs;
487
- if ( isset( $seqs[$alb] ) ) {
488
- $seq = $seqs[$alb];
489
- }
490
- else {
491
- $ord = wppa_get_photo_order( $alb );
492
- $seq = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos WHERE album = %d " . $ord, $alb ) );
493
- $seqs[$alb] = $seq;
494
- }
495
- $no = 0;
496
- for ( $i = 0; $i < count( $seq ); $i++ ) {
497
- if ( $seq[$i] == $id ) {
498
- $no = $i + 1;
499
- }
500
- }
501
  if ( $no ) {
502
  $result = str_replace( 'w#seqno', $no, $result );
503
  }
@@ -556,6 +544,28 @@ global $wpdb;
556
  return $result;
557
  }
558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  // get album name
560
  function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
561
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
+ * Version 7.7.01.006
7
  *
8
  */
9
 
483
  // Sequence no in album
484
  if ( strpos( $result, 'w#seqno' ) !== false ) {
485
  $alb = $thumb['album'];
486
+
487
+ $no = wppa_get_seqno( $alb, $id );
488
+
 
 
 
 
 
 
 
 
 
 
 
 
489
  if ( $no ) {
490
  $result = str_replace( 'w#seqno', $no, $result );
491
  }
544
  return $result;
545
  }
546
 
547
+ // Get photo sequence no in album
548
+ function wppa_get_seqno( $alb, $id ) {
549
+ static $seqs;
550
+ global $wpdb;
551
+
552
+ if ( isset( $seqs[$alb] ) ) {
553
+ $seq = $seqs[$alb];
554
+ }
555
+ else {
556
+ $ord = wppa_get_photo_order( $alb );
557
+ $seq = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos WHERE album = %d " . $ord, $alb ) );
558
+ $seqs[$alb] = $seq;
559
+ }
560
+ $no = 0;
561
+ for ( $i = 0; $i < count( $seq ); $i++ ) {
562
+ if ( $seq[$i] == $id ) {
563
+ $no = $i + 1;
564
+ }
565
+ }
566
+ return $no;
567
+ }
568
+
569
  // get album name
570
  function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
571
 
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 7.6.10.003
7
  *
8
  */
9
 
@@ -6924,7 +6924,7 @@ global $wppa_supported_camara_brands;
6924
  }
6925
  {
6926
  $name = __('Album download link', 'wp-photo-album-plus');
6927
- $desc = __('Place an album download link on the album covers', 'wp-photo-album-plus');
6928
  $help = (__('Creates a download zipfile containing the photos of the album', 'wp-photo-album-plus'));
6929
  $slug = 'wppa_allow_download_album';
6930
  $html = wppa_checkbox($slug);
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.6.10.005
7
  *
8
  */
9
 
6924
  }
6925
  {
6926
  $name = __('Album download link', 'wp-photo-album-plus');
6927
+ $desc = __('Place an album download link on the album covers and the edit album info page', 'wp-photo-album-plus');
6928
  $help = (__('Creates a download zipfile containing the photos of the album', 'wp-photo-album-plus'));
6929
  $slug = 'wppa_allow_download_album';
6930
  $html = wppa_checkbox($slug);
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.7.01.001
7
  *
8
  */
9
 
@@ -410,6 +410,15 @@ global $wpdb;
410
  return $result;
411
  }
412
 
 
 
 
 
 
 
 
 
 
413
  function wppa_get_my_rating_by_id($id, $opt = '') {
414
  global $wpdb;
415
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.7.01.006
7
  *
8
  */
9
 
410
  return $result;
411
  }
412
 
413
+ function wppa_get_rating_total_by_id($id) {
414
+ global $wpdb;
415
+
416
+ if ( ! is_numeric($id) || $id < '1' ) wppa_dbg_msg('Invalid arg wppa_get_rating_total_by_id('.$id.')', 'red');
417
+
418
+ $result = $wpdb->get_var( $wpdb->prepare( "SELECT SUM(value) FROM $wpdb->wppa_rating WHERE photo = %d", $id ) );
419
+ return $result;
420
+ }
421
+
422
  function wppa_get_my_rating_by_id($id, $opt = '') {
423
  global $wpdb;
424
 
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.6.07.007
9
  *
10
  */
11
 
@@ -222,7 +222,8 @@ function wppa_glob( $pattern, $flags = 0, $wp_content = false ) {
222
  }
223
 
224
  // Get dirlist
225
- $dirlist = glob( $pattern, $flags );
 
226
 
227
  // Init result;
228
  $result = array();
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 7.7.01.005
9
  *
10
  */
11
 
222
  }
223
 
224
  // Get dirlist
225
+ wppa_log('obs', 'Flags = '.$flags.', filtered = '.intval($flags) and 0xFBFF);
226
+ $dirlist = glob( $pattern, intval($flags) and 0xFBFF );
227
 
228
  // Init result;
229
  $result = array();
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.7.01.004
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_revno; $wppa_revno = '7701'; // WPPA db version
27
- global $wppa_api_version; $wppa_api_version = '7.7.01.004'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 7.7.01.006
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_revno; $wppa_revno = '7701'; // WPPA db version
27
+ global $wppa_api_version; $wppa_api_version = '7.7.01.006'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';