WP Photo Album Plus - Version 8.0.06.002

Version Description

= 8.0.06 =

  • 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 8.0.06.002
Comparing to
See all releases

Code changes from version 8.0.05.004 to 8.0.06.002

changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
3
  = 8.0.05 =
4
 
5
  * New shortcode type: grid. New attribute photos. Typical use: [wppa type="grid" photos="1.2.5..19"] [wppa type="grid" album="5"] optionally size= and align=.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 8.0.06 =
4
+
5
+ * New setting options to Basic settings -> Thumbnails -> II: Thumbnail display options -> Item 4: Thumbnail comcount.
6
+ Enables you to select a userrole, and show the number of comments given by userts with that role separately, only visible to users of that role.
7
+ * Pagination is now switched off when a photo enumeration is given.
8
+ * Fixed wrong links when photo names in urls is activated.
9
+
10
  = 8.0.05 =
11
 
12
  * New shortcode type: grid. New attribute photos. Typical use: [wppa type="grid" photos="1.2.5..19"] [wppa type="grid" album="5"] optionally size= and align=.
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, f
5
  Requires at least: 3.9
6
  Tested up to: 5.8
7
  Requires PHP: 5.5
8
- Stable tag: 8.0.04.007
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -134,7 +134,7 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
134
 
135
  == Upgrade Notice ==
136
 
137
- = 8.0.05 =
138
 
139
  * This version addresses various minor bug fixes and feature requests.
140
 
5
  Requires at least: 3.9
6
  Tested up to: 5.8
7
  Requires PHP: 5.5
8
+ Stable tag: 8.0.05.004
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
134
 
135
  == Upgrade Notice ==
136
 
137
+ = 8.0.06 =
138
 
139
  * This version addresses various minor bug fixes and feature requests.
140
 
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 8.0.05.002
7
  *
8
  */
9
 
@@ -6556,7 +6556,7 @@ function wppa_grid_box() {
6556
  id="wppa-thumb-area-' . $mocc . '"
6557
  class="wppa-box wppa-contest wppa-thumb-area wppa-thumb-area-' . $mocc . '"
6558
  style="' . ( $maxh > '1' ? 'max-height:' . $maxh . 'px;' : '' ) . '
6559
- overflow:' . $overflow . ';"
6560
  onscroll="wppaMakeLazyVisibleScrollEnd();"
6561
  >';
6562
  }
@@ -6609,9 +6609,8 @@ function wppa_get_grid_box_html( $photos ) {
6609
  <style>
6610
  .wppa-grid {
6611
  border:none;
6612
- margin:0;
6613
- padding:0;
6614
- margin-left:-3px;
6615
  }
6616
  .wppa-grid tr {
6617
  border:none;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 8.0.06.001
7
  *
8
  */
9
 
6556
  id="wppa-thumb-area-' . $mocc . '"
6557
  class="wppa-box wppa-contest wppa-thumb-area wppa-thumb-area-' . $mocc . '"
6558
  style="' . ( $maxh > '1' ? 'max-height:' . $maxh . 'px;' : '' ) . '
6559
+ overflow:' . $overflow . ';padding-left:0;"
6560
  onscroll="wppaMakeLazyVisibleScrollEnd();"
6561
  >';
6562
  }
6609
  <style>
6610
  .wppa-grid {
6611
  border:none;
6612
+ margin:0 !important;
6613
+ padding:0 !important;
 
6614
  }
6615
  .wppa-grid tr {
6616
  border:none;
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 8.0.05.003
7
  *
8
  */
9
 
@@ -258,6 +258,7 @@ horizrailenabled:false,";
258
  'wppa_thumb_text_desc' => 'yes', // 2
259
  'wppa_thumb_text_rating' => 'yes', // 3
260
  'wppa_thumb_text_comcount' => 'no',
 
261
  'wppa_thumb_text_viewcount' => 'no',
262
  'wppa_thumb_text_virt_album' => 'yes',
263
  'wppa_thumb_video' => 'no',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 8.0.06.001
7
  *
8
  */
9
 
258
  'wppa_thumb_text_desc' => 'yes', // 2
259
  'wppa_thumb_text_rating' => 'yes', // 3
260
  'wppa_thumb_text_comcount' => 'no',
261
+ 'wppa_thumb_text_comcount_note_role' => '',
262
  'wppa_thumb_text_viewcount' => 'no',
263
  'wppa_thumb_text_virt_album' => 'yes',
264
  'wppa_thumb_video' => 'no',
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.0.05.003
7
  *
8
  */
9
 
@@ -795,14 +795,19 @@ global $wppa_current_shortcode_atts;
795
 
796
  // See if the photo id is a name and convert it if possible
797
  if ( wppa( 'single_photo' ) && ! is_numeric( wppa( 'single_photo' ) ) ) {
798
- if ( substr( wppa( 'single_photo' ), 0, 1 ) == '$' ) { // Name
799
- $id = wppa_get_photo_id_by_name( substr( wppa( 'single_photo' ), 1 ) );
800
- if ( $id > '0' ) wppa( 'single_photo', $id );
801
- else {
802
- wppa_dbg_msg( 'Photo name not found: ' . wppa( 'single_photo' ), 'red', 'force' );
803
- wppa_reset_occurrance();
804
- return; // Forget this occurrance
805
- }
 
 
 
 
 
806
  }
807
  }
808
 
@@ -3489,6 +3494,11 @@ function wppa_get_pagesize( $type = '' ) {
3489
  return '0';
3490
  }
3491
 
 
 
 
 
 
3492
  if ( $type == 'albums' ) return wppa_opt( 'album_page_size' );
3493
  if ( $type == 'thumbs' ) return wppa_opt( 'thumb_page_size' );
3494
  return '0';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.0.06.002
7
  *
8
  */
9
 
795
 
796
  // See if the photo id is a name and convert it if possible
797
  if ( wppa( 'single_photo' ) && ! is_numeric( wppa( 'single_photo' ) ) ) {
798
+ if ( substr( wppa( 'single_photo' ), 0, 1 ) == '$' ) { // Name preceeded by $
799
+ wppa( 'single_photo', substr( wppa( 'single_photo' ), 1 ) );
800
+ }
801
+
802
+ $id = wppa_get_photo_id_by_name( wppa( 'single_photo' ) );
803
+
804
+ if ( $id > '0' ) {
805
+ wppa( 'single_photo', $id );
806
+ }
807
+ else {
808
+ wppa_dbg_msg( 'Photo name not found: ' . wppa( 'single_photo' ), 'red', 'force' );
809
+ wppa_reset_occurrance();
810
+ return; // Forget this occurrance
811
  }
812
  }
813
 
3494
  return '0';
3495
  }
3496
 
3497
+ // Pagination is off when photo enumeration
3498
+ if ( wppa( 'start_photos' ) ) {
3499
+ return '0';
3500
+ }
3501
+
3502
  if ( $type == 'albums' ) return wppa_opt( 'album_page_size' );
3503
  if ( $type == 'thumbs' ) return wppa_opt( 'thumb_page_size' );
3504
  return '0';
wppa-links.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
- * Version 8.0.05.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -1572,10 +1572,10 @@ global $wpdb;
1572
  $result['target'] = '_blank';
1573
  break;
1574
  case 'photo': // slideshow
1575
- case 'single': // single image slide
1576
  if ( $type == 'single' ) {
1577
  $a = wppa_get_photo_item( $id, 'album' );
1578
- $result['url'] = wppa_encrypt_url( wppa_get_permalink( $page ) . 'wppa-occur=' . $occ . '&amp;wppa-slide=1&amp;wppa-album=' . $a . '&amp;wppa-photo=' . $id . '&amp;wppa-single=1');
1579
  }
1580
  elseif ( wppa( 'start_album' ) ) {
1581
  $album = wppa( 'start_album' );
@@ -1613,6 +1613,7 @@ global $wpdb;
1613
  $result['ajax_url'] = str_replace( wppa_get_permalink( $page ), wppa_get_ajaxlink(), $result['url'] );
1614
  $result['ajax_url'] = str_replace( '&amp;', '&', $result['ajax_url'] );
1615
  }
 
1616
  return $result;
1617
  break;
1618
  case 'sphoto':
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
+ * Version 8.0.06.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
1572
  $result['target'] = '_blank';
1573
  break;
1574
  case 'photo': // slideshow
1575
+ case 'single': // single image
1576
  if ( $type == 'single' ) {
1577
  $a = wppa_get_photo_item( $id, 'album' );
1578
+ $result['url'] = wppa_encrypt_url( wppa_get_permalink( $page ) . 'wppa-occur=' . $occ . '&amp;wppa-photo=' . $id );
1579
  }
1580
  elseif ( wppa( 'start_album' ) ) {
1581
  $album = wppa( 'start_album' );
1613
  $result['ajax_url'] = str_replace( wppa_get_permalink( $page ), wppa_get_ajaxlink(), $result['url'] );
1614
  $result['ajax_url'] = str_replace( '&amp;', '&', $result['ajax_url'] );
1615
  }
1616
+ $result['url'] = wppa_convert_to_pretty( $result['url'] );
1617
  return $result;
1618
  break;
1619
  case 'sphoto':
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.0.05.002
7
  *
8
  */
9
 
@@ -2745,7 +2745,21 @@ global $wppa_subtab_names;
2745
  $desc = __('Display Thumbnail Comment count.', 'wp-photo-album-plus');
2746
  $help = __('Display the number of comments to the photo under the thumbnail image.', 'wp-photo-album-plus');
2747
  $slug = 'wppa_thumb_text_comcount';
2748
- $html = wppa_checkbox($slug);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2749
  wppa_setting_new($slug, '4', $name, $desc, $html, $help);
2750
 
2751
  $name = __('Thumbnail viewcount', 'wp-photo-album-plus');
@@ -9787,7 +9801,7 @@ global $wppa_subtab_names;
9787
  wppa_setting_new($slug, '8', $name, $desc, $html, $help, wppa_switch('enable_video'));
9788
 
9789
  $name = __('Grid video controls', 'wp-photo-album-plus');
9790
- $desc = __('Show the video controms on a video in a grid display', 'wp-photo-album-plus');
9791
  $help = '';
9792
  $slug = 'wppa_grid_video';
9793
  $html = wppa_checkbox($slug);
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.0.06.001
7
  *
8
  */
9
 
2745
  $desc = __('Display Thumbnail Comment count.', 'wp-photo-album-plus');
2746
  $help = __('Display the number of comments to the photo under the thumbnail image.', 'wp-photo-album-plus');
2747
  $slug = 'wppa_thumb_text_comcount';
2748
+ $slug2 = 'wppa_thumb_text_comcount_note_role';
2749
+ $roles = $wp_roles->roles;
2750
+ $opts = array();
2751
+ $vals = array();
2752
+ $opts[] = '-- '.__('Select a role', 'wp-photo-album-plus').' --';
2753
+ $vals[] = '';
2754
+ foreach (array_keys($roles) as $key) {
2755
+ $role = $roles[$key];
2756
+ $rolename = translate_user_role( $role['name'] );
2757
+ $opts[] = $rolename;
2758
+ $vals[] = $key;
2759
+ }
2760
+ $html = wppa_checkbox($slug) .
2761
+ '<span style="float:left;" >&nbsp;' . __( 'For userrole users indicate comments given by userrole', 'wp-photo-album-plus' ) . '&nbsp;</span>' .
2762
+ wppa_select($slug2, $opts, $vals);
2763
  wppa_setting_new($slug, '4', $name, $desc, $html, $help);
2764
 
2765
  $name = __('Thumbnail viewcount', 'wp-photo-album-plus');
9801
  wppa_setting_new($slug, '8', $name, $desc, $html, $help, wppa_switch('enable_video'));
9802
 
9803
  $name = __('Grid video controls', 'wp-photo-album-plus');
9804
+ $desc = __('Show the video controls on a video in a grid display', 'wp-photo-album-plus');
9805
  $help = '';
9806
  $slug = 'wppa_grid_video';
9807
  $html = wppa_checkbox($slug);
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 8.0.05.002
7
  *
8
  */
9
 
@@ -114,10 +114,15 @@ global $thumbs;
114
  global $thumbs_ids;
115
  global $previous_page_last_id;
116
 
 
117
  wppa( 'ss_pag', false );
118
 
 
119
  if ( ! $thumbs ) return;
120
 
 
 
 
121
  // Save thumb ids of full selection
122
  $thumbs_ids = array();
123
  if ( $thumbs ) foreach ( $thumbs as $t ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the slideshow high level functions
6
+ * Version 8.0.06.002
7
  *
8
  */
9
 
114
  global $thumbs_ids;
115
  global $previous_page_last_id;
116
 
117
+ // Init: no pagination
118
  wppa( 'ss_pag', false );
119
 
120
+ // Any items?
121
  if ( ! $thumbs ) return;
122
 
123
+ // Not on photo enumeration
124
+ if ( wppa( 'start_photos' ) ) return;
125
+
126
  // Save thumb ids of full selection
127
  $thumbs_ids = array();
128
  if ( $thumbs ) foreach ( $thumbs as $t ) {
wppa-thumbnails.php CHANGED
@@ -5,7 +5,7 @@
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
- * Version 8.0.00.019
9
  *
10
  */
11
 
@@ -747,12 +747,56 @@ global $wpdb;
747
 
748
  // Comcount
749
  if ( wppa_is_item_displayable( $alb, 'comments', 'thumb_text_comcount' ) ) {
 
750
  $comcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments
751
  WHERE photo = %d", $id ) );
752
- if ( $comcount ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  $result .= '<div' .
754
  ' class="wppa-thumb-text"' .
755
- ' >' . sprintf( _n( '%d comment', '%d comments', $comcount, 'wp-photo-album-plus'), $comcount ) .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756
  '</div>';
757
  }
758
  }
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
+ * Version 8.0.06.001
9
  *
10
  */
11
 
747
 
748
  // Comcount
749
  if ( wppa_is_item_displayable( $alb, 'comments', 'thumb_text_comcount' ) ) {
750
+ $comcount_role = 0;
751
  $comcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments
752
  WHERE photo = %d", $id ) );
753
+
754
+ // Note special role?
755
+ $role = wppa_opt( 'thumb_text_comcount_note_role' );
756
+
757
+ if ( $comcount && $role ) {
758
+
759
+ if ( current_user_can( $role ) ) {
760
+
761
+ global $wp_roles;
762
+ $roles = $wp_roles->roles;
763
+ $role_name = translate_user_role( $roles[$role]['name'] );
764
+
765
+ // Get the comments users
766
+ $com_user_ids = $wpdb->get_col( $wpdb->prepare( "SELECT userid FROM $wpdb->wppa_comments
767
+ WHERE photo = %d", $id ) );
768
+
769
+ // Count the comments given by users with the specified role
770
+ foreach( $com_user_ids as $usr_id ) {
771
+ if ( user_can( $usr_id, $role ) ) {
772
+ $comcount_role++;
773
+ }
774
+ }
775
+ }
776
+ }
777
+ $comcount -= $comcount_role;
778
+
779
+ if ( $comcount + $comcount_role ) {
780
  $result .= '<div' .
781
  ' class="wppa-thumb-text"' .
782
+ ' >';
783
+ if ( $comcount && $comcount_role ) {
784
+ $result .=
785
+ sprintf( _n( '%d comment', '%d comments', $comcount, 'wp-photo-album-plus'), $comcount ) .
786
+ '<br/><span class="wppa-role-spec" >' . sprintf( __( 'and %d by &lt;%s&gt;', 'wp-photo-album-plus' ), $comcount_role, $role_name ) .
787
+ '</span>';
788
+ }
789
+ elseif ( $comcount ) {
790
+ $result .=
791
+ sprintf( _n( '%d comment', '%d comments', $comcount, 'wp-photo-album-plus'), $comcount );
792
+ }
793
+ else {
794
+ $result .=
795
+ '<span class="wppa-role-spec" >' .
796
+ sprintf( _n( '%d comment by &lt;%s&gt;', '%d comments by &lt;%s&gt;', $comcount_role, 'wp-photo-album-plus' ), $comcount_role, $role_name ) .
797
+ '</span>';
798
+ }
799
+ $result .=
800
  '</div>';
801
  }
802
  }
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: 8.0.05.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_api_version;
27
- $wppa_api_version = '8.0.05.004'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30
 
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: 8.0.06.002
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_api_version;
27
+ $wppa_api_version = '8.0.06.002'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30