WP Photo Album Plus - Version 7.7.01.007

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

Code changes from version 7.7.01.006 to 7.7.01.007

changelog.txt CHANGED
@@ -7,12 +7,13 @@ 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
  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
 
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
+ * New setting: Table IV-E28: Contest top creterium. You can select 'aveage' (default) and 'total'
17
 
18
  = 7.6.10 =
19
 
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.006
7
  *
8
  */
9
 
@@ -202,13 +202,23 @@ global $wpdb;
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 = '
@@ -217,21 +227,96 @@ global $wpdb;
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>
@@ -253,6 +338,7 @@ global $wpdb;
253
  <th></th>
254
  <th>' . $rank . '</th>
255
  </tr>';
 
256
  $rank++;
257
 
258
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.7.01.007
7
  *
8
  */
9
 
202
  return $result;
203
  }
204
 
205
+ // Get display type
206
+ $type = wppa_opt( 'contest_sortby' );
207
+
208
+ // Sequenc is by mean rating
209
+ if ( $type == 'average' ) {
210
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %d ORDER BY mean_rating DESC", $alb ), ARRAY_A );
211
+ }
212
+
213
+ // Sequenc order is total score
214
+ if ( $type == 'total' ) {
215
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %d", $alb ), ARRAY_A );
216
+ foreach( array_keys( $photos ) as $idx ) {
217
+ $photos[$idx]['total'] = wppa_get_rating_total_by_id( $photos[$idx]['id'] );
218
+ }
219
+ $photos = wppa_array_sort( $photos, 'total' );
220
+ $photos = array_reverse( $photos );
221
  }
 
 
222
 
223
  // Create html
224
  $result = '
227
  </h3>';
228
 
229
  $result .= '
230
+ <table class="wppa-contest-table" >
231
  <thead>
232
+ <th class="wppa-contest-table-photo" >' . __( 'Photo', 'wp-photo-album-plus' ) . '</th>
233
+ <th class="wppa-contest-table-rater" >' . __( 'Rater', 'wp-photo-album-plus' ) . '</th>
234
+ <th class="wppa-contest-table-points" >' . __( 'Points', 'wp-photo-album-plus' ) . '</th>
235
+ <th></th>
236
+ <th class="wppa-contest-table-owner" >' . __( 'Owner', 'wp-photo-album-plus' ) . '</th>
237
+ <th class="wppa-contest-table-ranking" >' . __( 'Ranking', 'wp-photo-album-plus' ) . '</th>
238
  </thead>
239
  <tbody>';
240
  $rank = '1';
241
  foreach( $photos as $photo ) {
242
+ $id = $photo['id'];
243
+ $seqno = wppa_get_seqno( $alb, $id );
244
+ $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating WHERE photo = %d", $id ), ARRAY_A );
245
+
246
+ if ( $ratings ) {
247
+
248
+ $result .= '
249
+ <tr>
250
+ <td class="wppa-contest-table-photo" >
251
+ <a href="' . wppa_get_hires_url( $id ) . '" data-rel="wppa" data-wppa="yes" >
252
+ <img src="' . wppa_get_thumb_url( $id ) . '" style="max-width:25%;" alt="' . $photo['name'] . '" >
253
+ </a>
254
+ <br /> '.
255
+ $photo['name'] . ' (' . wppa_get_seqno( $alb, $id ) . ')
256
+ </td>
257
+ <td class="wppa-contest-table-rater" >';
258
+ foreach( $ratings as $rating ) {
259
+ $result .= wppa_get_user_by( 'id', $rating['userid'] )->display_name . '<br />';
260
+ }
261
+ $result .= '&nbsp;<br />';
262
+ if ( $type == 'total' ) $result .= __( 'Total', 'wp-photo-album-plus' );
263
+ if ( $type == 'average' ) $result .= __( 'Average', 'wp-photo-album-plus' );
264
+ $result .= '
265
+ </td>
266
+ <td class="wppa-contest-table-points" >';
267
+ foreach( $ratings as $rating ) {
268
+ $result .= $rating['value'] . '<br />';
269
+ }
270
+ $result .= '---<br /><b>';
271
+ if ( $type == 'total' ) $result .= $photo['total'];
272
+ if ( $type == 'average' ) $result .= sprintf( '%3.1f', $photo['mean_rating'] );
273
+ $result .= '</b>
274
+ </td>
275
+ <td></td>
276
+ <td class="wppa-contest-table-owner" >' .
277
+ wppa_get_user_by( 'login', $photo['owner'] )->display_name . '
278
+ </td>
279
+ <td class="wppa-contest-table-ranking" >
280
+ <b>';
281
+ switch ( $rank ) {
282
+ case '1':
283
+ $result .= '
284
+ <span style="font-size:2em;" >1</span>&nbsp;
285
+ <img
286
+ src="' . WPPA_URL . '/img/medal_gold_' . wppa_opt( 'medal_color' ) .'.png"
287
+ alt="gold medal"
288
+ title="' . esc_attr( __( 'Gold medal', 'wp-photo-album-plus' ) ) . '"
289
+ />';
290
+ break;
291
+ case '2':
292
+ $result .= '
293
+ <span style="font-size:1.75em;" >2</span>&nbsp;
294
+ <img
295
+ src="' . WPPA_URL . '/img/medal_silver_' . wppa_opt( 'medal_color' ) .'.png"
296
+ alt="silver medal"
297
+ title="' . esc_attr( __( 'Silver medal', 'wp-photo-album-plus' ) ) . '"
298
+ />';
299
+ break;
300
+ case '3':
301
+ $result .= '
302
+ <span style="font-size:1.5em;" >3</span>
303
+ <img
304
+ src="' . WPPA_URL . '/img/medal_bronze_' . wppa_opt( 'medal_color' ) .'.png"
305
+ alt="bronze medal"
306
+ title="' . esc_attr( __( 'Bronze medal', 'wp-photo-album-plus' ) ) . '"
307
+ />';
308
+ break;
309
+ default:
310
+ $result .= $rank;
311
+ break;
312
+ }
313
+ $result .= '
314
+ </b>
315
+ </td>
316
+ </tr>';
317
+ }
318
 
319
+ /*
320
  foreach( $ratings as $rating ) {
321
  $result .= '
322
  <tr>
338
  <th></th>
339
  <th>' . $rank . '</th>
340
  </tr>';
341
+ */
342
  $rank++;
343
 
344
  }
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 7.6.10.003
7
  *
8
  */
9
 
@@ -631,6 +631,7 @@ horizrailenabled:false,";
631
  'wppa_medal_color' => '2',
632
  'wppa_medal_position' => 'botright',
633
  'wppa_topten_sortby' => 'mean_rating',
 
634
 
635
  // F Comments
636
  'wppa_comment_login' => 'no',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 7.7.01.007
7
  *
8
  */
9
 
631
  'wppa_medal_color' => '2',
632
  'wppa_medal_position' => 'botright',
633
  'wppa_topten_sortby' => 'mean_rating',
634
+ 'wppa_contest_sortby' => 'average',
635
 
636
  // F Comments
637
  'wppa_comment_login' => 'no',
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.005
7
  *
8
  */
9
 
@@ -5439,7 +5439,7 @@ global $wppa_supported_camara_brands;
5439
  $desc = __('The top sort item used for topten results from shortcodes.', 'wp-photo-album-plus');
5440
  $help = '';
5441
  $slug = 'wppa_topten_sortby';
5442
- $opts = array( __('Mean raiting', 'wp-photo-album-plus'),
5443
  __('Rating count', 'wp-photo-album-plus'),
5444
  __('Viewcount', 'wp-photo-album-plus'),
5445
  __('Downloads', 'wp-photo-album-plus'));
@@ -5448,6 +5448,18 @@ global $wppa_supported_camara_brands;
5448
  $clas = '';
5449
  $tags = 'rating,layout';
5450
  wppa_setting($slug, '17', $name, $desc, $html, $help, $clas, $tags);
 
 
 
 
 
 
 
 
 
 
 
 
5451
  }
5452
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5453
  {
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.7.01.007
7
  *
8
  */
9
 
5439
  $desc = __('The top sort item used for topten results from shortcodes.', 'wp-photo-album-plus');
5440
  $help = '';
5441
  $slug = 'wppa_topten_sortby';
5442
+ $opts = array( __('Mean rating', 'wp-photo-album-plus'),
5443
  __('Rating count', 'wp-photo-album-plus'),
5444
  __('Viewcount', 'wp-photo-album-plus'),
5445
  __('Downloads', 'wp-photo-album-plus'));
5448
  $clas = '';
5449
  $tags = 'rating,layout';
5450
  wppa_setting($slug, '17', $name, $desc, $html, $help, $clas, $tags);
5451
+
5452
+ $name = __('Contest top creterium', 'wp-photo-album-plus');
5453
+ $desc = __('The top sort creterium used for the contest.', 'wp-photo-album-plus');
5454
+ $help = '';
5455
+ $slug = 'wppa_contest_sortby';
5456
+ $opts = array( __('Mean rating', 'wp-photo-album-plus'),
5457
+ __('Total rating', 'wp-photo-album-plus'));
5458
+ $vals = array( 'average', 'total' );
5459
+ $html = wppa_select($slug, $opts, $vals);
5460
+ $clas = '';
5461
+ $tags = 'rating,layout';
5462
+ wppa_setting($slug, '18', $name, $desc, $html, $help, $clas, $tags);
5463
  }
5464
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5465
  {
wppa-users.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
- * Version 7.5.03
7
  *
8
  */
9
 
@@ -48,6 +48,12 @@ static $usercache;
48
  }
49
 
50
  $result = get_user_by( $key, $user );
 
 
 
 
 
 
51
  $usercache[$key][$user] = $result;
52
  return $result;
53
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
+ * Version 7.7.01.007
7
  *
8
  */
9
 
48
  }
49
 
50
  $result = get_user_by( $key, $user );
51
+
52
+ if ( ! $result ) {
53
+ $result = new WP_User;
54
+ $result -> display_name = __( 'Nomen Nescio', 'wp-photo-album-plus' );
55
+ $result -> login_name = __( 'Anonymous', 'wp-photo-album-plus' );
56
+ }
57
  $usercache[$key][$user] = $result;
58
  return $result;
59
  }
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.006
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_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 = '';
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.007
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_revno; $wppa_revno = '7701'; // WPPA db version
27
+ global $wppa_api_version; $wppa_api_version = '7.7.01.007'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';