WP Photo Album Plus - Version 7.7.01.010

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

Code changes from version 7.7.01.009 to 7.7.01.010

Files changed (4) hide show
  1. wppa-boxes-html.php +71 -46
  2. wppa-defaults.php +2 -1
  3. wppa-settings-autosave.php +10 -1
  4. wppa.php +2 -2
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.009
7
  *
8
  */
9
 
@@ -203,20 +203,32 @@ global $wpdb;
203
  // Get display type
204
  $type = wppa_opt( 'contest_sortby' );
205
  $numb = wppa_opt( 'contest_number' );
 
206
 
207
  // Sequenc is by mean rating
208
  if ( $type == 'average' ) {
209
- $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE album IN ($alblist) ORDER BY mean_rating DESC", ARRAY_A );
 
 
 
 
210
  }
211
 
212
  // Sequenc order is total score
213
  if ( $type == 'total' ) {
214
- $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE album IN ($alblist)", ARRAY_A );
215
- foreach( array_keys( $photos ) as $idx ) {
216
- $photos[$idx]['total'] = wppa_get_rating_total_by_id( $photos[$idx]['id'] );
 
 
 
 
 
 
 
 
 
217
  }
218
- $photos = wppa_array_sort( $photos, 'total' );
219
- $photos = array_reverse( $photos );
220
  }
221
 
222
  // Create html
@@ -233,17 +245,32 @@ global $wpdb;
233
  </h3>';
234
  }
235
 
 
 
 
 
 
 
236
  $result .= '
237
  <table class="wppa-contest-table" >
238
  <thead>
239
- <th class="wppa-contest-table-photo" >' . __( 'Photo', 'wp-photo-album-plus' ) . '</th>
240
- <th class="wppa-contest-table-rater" >' . __( 'Rater', 'wp-photo-album-plus' ) . '</th>
241
- <th class="wppa-contest-table-points" >' . __( 'Points', 'wp-photo-album-plus' ) . '</th>
242
- <th class="wppa-contest-table-owner" >' . __( 'Owner', 'wp-photo-album-plus' ) . '</th>
243
- <th class="wppa-contest-table-ranking" >' . __( 'Ranking', 'wp-photo-album-plus' ) . '</th>
 
 
244
  </thead>
245
  <tbody>';
 
 
246
  $rank = '1';
 
 
 
 
 
247
  foreach( $photos as $photo ) {
248
  $id = $photo['id'];
249
  $alb = $photo['album'];
@@ -256,17 +283,29 @@ global $wpdb;
256
  <tr>
257
  <td class="wppa-contest-table-photo" >
258
  <a href="' . wppa_get_hires_url( $id ) . '" data-rel="wppa" data-wppa="yes" >
259
- <img src="' . wppa_get_photo_url( $id ) . '" alt="' . $photo['name'] . '" >
260
  </a>
261
  <br /> ';
262
- $result .= $photo['name'];
263
  if ( $numb == 'id' ) $result .= ' (' . $id . ')';
264
  if ( $numb == 'seqno' ) $result .= ' (' . wppa_get_seqno( $alb, $id ) . ')';
265
  $result .= '
266
  </td>
267
  <td class="wppa-contest-table-rater" >';
268
  foreach( $ratings as $rating ) {
269
- $result .= wppa_get_user_by( 'id', $rating['userid'] )->display_name . '<br />';
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
  $result .= '&nbsp;<br />';
272
  if ( $type == 'total' ) $result .= __( 'Total', 'wp-photo-album-plus' );
@@ -279,11 +318,15 @@ global $wpdb;
279
  $result .= $t . '<br />';
280
  }
281
  $result .= '-----<br /><b>';
 
282
  if ( $type == 'total' ) {
283
- $t = $photo['total'];
284
- $result .= $t;
 
 
 
 
285
  }
286
- if ( $type == 'average' ) $result .= sprintf( '%3.1f', $photo['mean_rating'] );
287
  $result .= '</b>
288
  </td>
289
  <td class="wppa-contest-table-owner" >' .
@@ -291,7 +334,14 @@ global $wpdb;
291
  </td>
292
  <td class="wppa-contest-table-ranking" >
293
  <b>';
294
- switch ( $rank ) {
 
 
 
 
 
 
 
295
  case '1':
296
  $result .= '
297
  <span style="font-size:2em;" >1</span>&nbsp;
@@ -320,7 +370,7 @@ global $wpdb;
320
  />';
321
  break;
322
  default:
323
- $result .= $rank;
324
  break;
325
  }
326
  $result .= '
@@ -328,37 +378,12 @@ global $wpdb;
328
  </td>
329
  </tr>';
330
  }
331
-
332
- /*
333
- foreach( $ratings as $rating ) {
334
- $result .= '
335
- <tr>
336
- <td>' . $seqno . '</td>
337
- <td>' . wppa_get_user_by( 'id', $rating['userid'] )->display_name . '</td>
338
- <td>' . $rating['value'] . '</td>
339
- <td>' . $photo['name'] . '</td>
340
- <td>' . wppa_get_user_by( 'login', $photo['owner'] )->display_name . '</td>
341
- <td></td>
342
- </tr>';
343
- $seqno = '';
344
- }
345
- $result .= '
346
- <tr>
347
- <th>' . $seqno . '</th>
348
- <th>' . __( 'Total', 'wp-photo-album-plus' ) . '</th>
349
- <th>' . $photo['total'] . '</th>
350
- <th></th>
351
- <th></th>
352
- <th>' . $rank . '</th>
353
- </tr>';
354
- */
355
  $rank++;
356
-
357
  }
358
  $result .= '
359
  </tbody>
360
  </table>
361
- <br />';
362
 
363
  return $result;
364
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.7.01.011
7
  *
8
  */
9
 
203
  // Get display type
204
  $type = wppa_opt( 'contest_sortby' );
205
  $numb = wppa_opt( 'contest_number' );
206
+ $max = wppa_opt( 'contest_max' );
207
 
208
  // Sequenc is by mean rating
209
  if ( $type == 'average' ) {
210
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
211
+ WHERE album IN ($alblist)
212
+ AND mean_rating <> ''
213
+ ORDER BY mean_rating DESC
214
+ LIMIT %d", $max ), ARRAY_A );
215
  }
216
 
217
  // Sequenc order is total score
218
  if ( $type == 'total' ) {
219
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
220
+ WHERE album IN ($alblist)
221
+ AND mean_rating <> ''", ARRAY_A );
222
+ if ( is_array( $photos ) ) {
223
+ foreach( array_keys( $photos ) as $idx ) {
224
+ $photos[$idx]['total'] = wppa_get_rating_total_by_id( $photos[$idx]['id'] );
225
+ }
226
+ $photos = wppa_array_sort( $photos, 'total' );
227
+ $photos = array_reverse( $photos );
228
+ if ( count( $photos ) > $max ) {
229
+ $photos = array_slice( $photos, 0, $max );
230
+ }
231
  }
 
 
232
  }
233
 
234
  // Create html
245
  </h3>';
246
  }
247
 
248
+ if ( ! $photos ) {
249
+ $result .= __( 'There are no rated photos to display', 'wp-photo-album-plus' );
250
+ $result .= '<br />';
251
+ return $result;
252
+ }
253
+
254
  $result .= '
255
  <table class="wppa-contest-table" >
256
  <thead>
257
+ <tr>
258
+ <th class="wppa-contest-table-photo" >' . __( 'Photo', 'wp-photo-album-plus' ) . '</th>
259
+ <th class="wppa-contest-table-rater" >' . __( 'Rater', 'wp-photo-album-plus' ) . '</th>
260
+ <th class="wppa-contest-table-points" >' . __( 'Points', 'wp-photo-album-plus' ) . '</th>
261
+ <th class="wppa-contest-table-owner" >' . __( 'Owner', 'wp-photo-album-plus' ) . '</th>
262
+ <th class="wppa-contest-table-ranking" >' . __( 'Ranking', 'wp-photo-album-plus' ) . '</th>
263
+ </tr>
264
  </thead>
265
  <tbody>';
266
+
267
+ // Misc inits
268
  $rank = '1';
269
+ $prev_score = '0';
270
+ $this_score = '0';
271
+ $prev_rank = '0';
272
+ $this_rank = '0';
273
+
274
  foreach( $photos as $photo ) {
275
  $id = $photo['id'];
276
  $alb = $photo['album'];
283
  <tr>
284
  <td class="wppa-contest-table-photo" >
285
  <a href="' . wppa_get_hires_url( $id ) . '" data-rel="wppa" data-wppa="yes" >
286
+ <img src="' . wppa_get_photo_url( $id ) . '" alt="' . esc_attr( $photo['name'] ) . '" >
287
  </a>
288
  <br /> ';
289
+ $result .= htmlspecialchars( $photo['name'] );
290
  if ( $numb == 'id' ) $result .= ' (' . $id . ')';
291
  if ( $numb == 'seqno' ) $result .= ' (' . wppa_get_seqno( $alb, $id ) . ')';
292
  $result .= '
293
  </td>
294
  <td class="wppa-contest-table-rater" >';
295
  foreach( $ratings as $rating ) {
296
+ $comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment FROM $wpdb->wppa_comments WHERE photo = %d AND userid = %d", $id, $rating['userid'] ) );
297
+ if ( $comment ) {
298
+ $result .= '
299
+ <a
300
+ title="' . esc_attr( $comment ) . '"
301
+ onclick="alert(\'' . esc_js( $comment ) . '\')"
302
+ >' . wppa_get_user_by( 'id', $rating['userid'] )->display_name . '
303
+ </a>
304
+ <br />';
305
+ }
306
+ else {
307
+ $result .= wppa_get_user_by( 'id', $rating['userid'] )->display_name . '<br />';
308
+ }
309
  }
310
  $result .= '&nbsp;<br />';
311
  if ( $type == 'total' ) $result .= __( 'Total', 'wp-photo-album-plus' );
318
  $result .= $t . '<br />';
319
  }
320
  $result .= '-----<br /><b>';
321
+ $prev_score = $this_score;
322
  if ( $type == 'total' ) {
323
+ $this_score = $photo['total'];
324
+ $result .= $this_score;
325
+ }
326
+ if ( $type == 'average' ) {
327
+ $this_score = $photo['mean_rating'];
328
+ $result .= sprintf( '%3.1f', $this_score );
329
  }
 
330
  $result .= '</b>
331
  </td>
332
  <td class="wppa-contest-table-owner" >' .
334
  </td>
335
  <td class="wppa-contest-table-ranking" >
336
  <b>';
337
+ if ( $prev_score == $this_score ) {
338
+ $this_rank = $prev_rank;
339
+ }
340
+ else {
341
+ $this_rank = $rank;
342
+ $prev_rank = $rank;
343
+ }
344
+ switch ( $this_rank ) {
345
  case '1':
346
  $result .= '
347
  <span style="font-size:2em;" >1</span>&nbsp;
370
  />';
371
  break;
372
  default:
373
+ $result .= $this_rank;
374
  break;
375
  }
376
  $result .= '
378
  </td>
379
  </tr>';
380
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  $rank++;
 
382
  }
383
  $result .= '
384
  </tbody>
385
  </table>
386
+ <br /><div style="clear:both;" ></div>';
387
 
388
  return $result;
389
  }
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 7.7.01.009
7
  *
8
  */
9
 
@@ -633,6 +633,7 @@ horizrailenabled:false,";
633
  'wppa_topten_sortby' => 'mean_rating',
634
  'wppa_contest_sortby' => 'average',
635
  'wppa_contest_number' => 'none',
 
636
 
637
  // F Comments
638
  'wppa_comment_login' => 'no',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 7.7.01.010
7
  *
8
  */
9
 
633
  'wppa_topten_sortby' => 'mean_rating',
634
  'wppa_contest_sortby' => 'average',
635
  'wppa_contest_number' => 'none',
636
+ 'wppa_contest_max' => '10',
637
 
638
  // F Comments
639
  '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.7.01.009
7
  *
8
  */
9
 
@@ -5474,6 +5474,15 @@ global $wppa_supported_camara_brands;
5474
  $tags = 'rating,layout';
5475
  wppa_setting($slug, '19', $name, $desc, $html, $help, $clas, $tags);
5476
 
 
 
 
 
 
 
 
 
 
5477
  }
5478
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5479
  {
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.7.01.010
7
  *
8
  */
9
 
5474
  $tags = 'rating,layout';
5475
  wppa_setting($slug, '19', $name, $desc, $html, $help, $clas, $tags);
5476
 
5477
+ $name = __('Contest max ranking', 'wp-photo-album-plus');
5478
+ $desc = __('The number of photos in the contest results display.', 'wp-photo-album-plus');
5479
+ $help = '';
5480
+ $slug = 'wppa_contest_max';
5481
+ $html = wppa_number($slug, '3', '100');
5482
+ $clas = '';
5483
+ $tags = 'rating,layout';
5484
+ wppa_setting($slug, '20', $name, $desc, $html, $help, $clas, $tags);
5485
+
5486
  }
5487
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5488
  {
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.009
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.009'; // 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.010
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.010'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';