WP Photo Album Plus - Version 7.7.01.008

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

Code changes from version 7.7.01.007 to 7.7.01.008

Files changed (5) hide show
  1. changelog.txt +3 -2
  2. theme/wppa-style.css +20 -1
  3. wppa-boxes-html.php +28 -19
  4. wppa-filter.php +7 -4
  5. wppa.php +2 -2
changelog.txt CHANGED
@@ -12,8 +12,9 @@ Note that Table VI-C2: Album download link must be ticked. If you want this feat
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
 
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 may be either a single id or an enumeration.
16
+ Alternatively you can supply attribute parent="<parent id>" where parent id may be a single id or an enumeration of album ids.
17
+ * New setting: Table IV-E28: Contest top creterium. You can select 'average' (default) and 'total'
18
 
19
  = 7.6.10 =
20
 
theme/wppa-style.css CHANGED
@@ -8,7 +8,7 @@
8
  /*
9
  /* You may always look into a newer version of this file to see what new classes and id's come with an upgrade
10
  /*
11
- /* This is version 7.7.01.002
12
  */
13
 
14
  .wppa-container, .wppa-cover-box, .wppa-thumb-area {
@@ -597,3 +597,22 @@ display:none;
597
  .wppa-pan-div canvas {
598
  background-color:transparent;
599
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  /*
9
  /* You may always look into a newer version of this file to see what new classes and id's come with an upgrade
10
  /*
11
+ /* This is version 7.7.01.008
12
  */
13
 
14
  .wppa-container, .wppa-cover-box, .wppa-thumb-area {
597
  .wppa-pan-div canvas {
598
  background-color:transparent;
599
  }
600
+
601
+ /* Contest */
602
+ .wppa-content-table th{
603
+ text-align:center;
604
+ }
605
+ .wppa-content-table td{
606
+ text-align:left;
607
+ }
608
+ .wppa-contest-table-photo{
609
+ text-align:center;
610
+ width:30% !important;
611
+ }
612
+ .wppa-contest-table-photo img{
613
+ width:100% !important;
614
+ }
615
+ .wppa-contest-table-points{
616
+ text-align:right !important;
617
+ padding-right: 2% !important;
618
+ }
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.007
7
  *
8
  */
9
 
@@ -193,26 +193,24 @@ function wppa_contest_box() {
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 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
  }
@@ -221,10 +219,18 @@ global $wpdb;
221
  }
222
 
223
  // Create html
224
- $result = '
225
- <h3>' .
226
- sprintf( __( 'Results of contest %s', 'wp-photo-album-plus' ), wppa_get_album_name( $alb ) ) . '
227
- </h3>';
 
 
 
 
 
 
 
 
228
 
229
  $result .= '
230
  <table class="wppa-contest-table" >
@@ -232,7 +238,6 @@ global $wpdb;
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>
@@ -240,6 +245,7 @@ global $wpdb;
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
 
@@ -249,7 +255,7 @@ global $wpdb;
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 ) . ')
@@ -265,14 +271,17 @@ global $wpdb;
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>
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.7.01.008
7
  *
8
  */
9
 
193
  }
194
 
195
  // Get contest html
196
+ function wppa_get_contest_html( $xalb ) {
197
  global $wpdb;
198
 
199
+ $albs = wppa_expand_enum( $xalb );
200
+ $albarr = explode( '.', $albs );
201
+ $alblist = implode( ',', $albarr );
 
 
202
 
203
  // Get display type
204
  $type = wppa_opt( 'contest_sortby' );
205
 
206
  // Sequenc is by mean rating
207
  if ( $type == 'average' ) {
208
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE album IN ($alblist) ORDER BY mean_rating DESC", ARRAY_A );
209
  }
210
 
211
  // Sequenc order is total score
212
  if ( $type == 'total' ) {
213
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE album IN ($alblist)", ARRAY_A );
214
  foreach( array_keys( $photos ) as $idx ) {
215
  $photos[$idx]['total'] = wppa_get_rating_total_by_id( $photos[$idx]['id'] );
216
  }
219
  }
220
 
221
  // Create html
222
+ if ( count( $albarr ) == 1 ) {
223
+ $result = '
224
+ <h3>' .
225
+ sprintf( __( 'Results of contest %s', 'wp-photo-album-plus' ), wppa_get_album_name( $xalb ) ) . '
226
+ </h3>';
227
+ }
228
+ else {
229
+ $result = '
230
+ <h3>' .
231
+ __( 'Results of contest', 'wp-photo-album-plus' ) . '
232
+ </h3>';
233
+ }
234
 
235
  $result .= '
236
  <table class="wppa-contest-table" >
238
  <th class="wppa-contest-table-photo" >' . __( 'Photo', 'wp-photo-album-plus' ) . '</th>
239
  <th class="wppa-contest-table-rater" >' . __( 'Rater', 'wp-photo-album-plus' ) . '</th>
240
  <th class="wppa-contest-table-points" >' . __( 'Points', 'wp-photo-album-plus' ) . '</th>
 
241
  <th class="wppa-contest-table-owner" >' . __( 'Owner', 'wp-photo-album-plus' ) . '</th>
242
  <th class="wppa-contest-table-ranking" >' . __( 'Ranking', 'wp-photo-album-plus' ) . '</th>
243
  </thead>
245
  $rank = '1';
246
  foreach( $photos as $photo ) {
247
  $id = $photo['id'];
248
+ $alb = $photo['album'];
249
  $seqno = wppa_get_seqno( $alb, $id );
250
  $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating WHERE photo = %d", $id ), ARRAY_A );
251
 
255
  <tr>
256
  <td class="wppa-contest-table-photo" >
257
  <a href="' . wppa_get_hires_url( $id ) . '" data-rel="wppa" data-wppa="yes" >
258
+ <img src="' . wppa_get_photo_url( $id ) . '" alt="' . $photo['name'] . '" >
259
  </a>
260
  <br /> '.
261
  $photo['name'] . ' (' . wppa_get_seqno( $alb, $id ) . ')
271
  </td>
272
  <td class="wppa-contest-table-points" >';
273
  foreach( $ratings as $rating ) {
274
+ $t = $rating['value'];
275
+ $result .= $t . '<br />';
276
+ }
277
+ $result .= '-----<br /><b>';
278
+ if ( $type == 'total' ) {
279
+ $t = $photo['total'];
280
+ $result .= $t;
281
  }
 
 
282
  if ( $type == 'average' ) $result .= sprintf( '%3.1f', $photo['mean_rating'] );
283
  $result .= '</b>
284
  </td>
 
285
  <td class="wppa-contest-table-owner" >' .
286
  wppa_get_user_by( 'login', $photo['owner'] )->display_name . '
287
  </td>
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.7.01.006
7
  *
8
  */
9
 
@@ -477,12 +477,15 @@ global $wpdb;
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'];
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 7.7.01.008
7
  *
8
  */
9
 
477
  break;
478
  case 'contest':
479
  $album = $atts['album'] ? $atts['album'] : '0';
480
+ if ( strpos( $album, '..' ) !== false ) {
481
+ $album = wppa_expand_enum( $album );
482
+ }
483
+ if ( ! $album ) {
484
  $err = '
485
  <span style="color:red;" >
486
  Error in shortcode spec for type="contest":
487
+ Missing or invalid attribute album="<album id>"<br />
488
+ album=' . $atts['album'] . ', parent=' . $atts['parent'] . '</span>';
489
  return $err;
490
  }
491
  $wppa['start_album'] = $atts['album'];
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.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,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.007'; // 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.008
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.008'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';