WP Photo Album Plus - Version 8.2.07.001

Version Description

= 8.1.08 =

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

Release Info

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

Code changes from version 8.2.06.006 to 8.2.07.001

Files changed (5) hide show
  1. changelog.txt +5 -0
  2. wppa-filter.php +29 -1
  3. wppa-settings-autosave.php +3 -3
  4. wppa-utils.php +15 -2
  5. wppa.php +2 -2
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
3
  = 8.2.06 =
4
 
5
  * Export page enhanced.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 8.2.07.001 =
4
+
5
+ * New virtual album shortcode specification: #posttitle. Example: [wppa type="cover" album="#posttitle"]
6
+ Shows the album(s) with their names eaqual to the title of the post/page. If such an albuym does not exist, it will be created with the owner set to the post/page author.
7
+
8
  = 8.2.06 =
9
 
10
  * Export page enhanced.
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version: 8.2.05.002
7
  *
8
  */
9
 
@@ -323,6 +323,34 @@ global $other_deps;
323
  $atts['album'] = '#tags,' . $unam;
324
  }
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  // Displatch on type
327
  switch ( $type ) {
328
  case 'version':
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version: 8.2.07.001
7
  *
8
  */
9
 
323
  $atts['album'] = '#tags,' . $unam;
324
  }
325
 
326
+ // If album="#posttitle", convert to id, if not found, create it
327
+ if ( $atts['album'] == '#posttitle' ) {
328
+ $post_id = get_the_ID();
329
+ if ( $post_id ) {
330
+ $the_post = get_post( $post_id );
331
+ $the_name = $the_post->post_title;
332
+ $owner_id = $the_post->post_author;
333
+ $albs = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE name = %s", $the_name ) );
334
+ if ( $albs ) {
335
+ $atts['album'] = implode( '.', $albs );
336
+ }
337
+ else {
338
+ $owner = get_user_by( 'ID', $owner_id );
339
+ $alb = wppa_create_album_entry( ['name' => $the_name,
340
+ 'description' => __( 'Automatically created for post', 'wp-photo-album-plus' ) . ' ' . $the_name,
341
+ 'owner' => $owner->user_login,
342
+ ] );
343
+ if ( $alb ) {
344
+ $atts['album'] = $alb;
345
+ }
346
+ else {
347
+ wppa_log( 'err', 'Could not create album for post ' . $the_name );
348
+ return "Error. Could not create album for this post";
349
+ }
350
+ }
351
+ }
352
+ }
353
+
354
  // Displatch on type
355
  switch ( $type ) {
356
  case 'version':
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.2.06.004
7
  *
8
  */
9
 
@@ -1698,9 +1698,9 @@ global $wppa_subtab_names;
1698
 
1699
  $name = __('Viewcount on cover', 'wp-photo-album-plus' );
1700
  $desc = __('Show total photo viewcount on album covers.', 'wp-photo-album-plus' );
1701
- $help = '';
1702
  $slug = 'wppa_viewcount_on_cover';
1703
- $opts = array( __('none', 'wp-photo-album-plus' ), __('top album only', 'wp-photo-album-plus' ), __('total tree', 'wp-photo-album-plus' ));
1704
  $vals = array( '-none-', 'self', 'total' );
1705
  $html = wppa_select($slug, $opts, $vals);
1706
  wppa_setting_new($slug, '9', $name, $desc, $html, $help);
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.2.07.001
7
  *
8
  */
9
 
1698
 
1699
  $name = __('Viewcount on cover', 'wp-photo-album-plus' );
1700
  $desc = __('Show total photo viewcount on album covers.', 'wp-photo-album-plus' );
1701
+ $help = __('Works on albums with one coverphoto only', 'wp-photo-album-plus');
1702
  $slug = 'wppa_viewcount_on_cover';
1703
+ $opts = array( __('none', 'wp-photo-album-plus' ), __('on each album', 'wp-photo-album-plus' ), __('total views of tree', 'wp-photo-album-plus' ));
1704
  $vals = array( '-none-', 'self', 'total' );
1705
  $html = wppa_select($slug, $opts, $vals);
1706
  wppa_setting_new($slug, '9', $name, $desc, $html, $help);
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 8.2.06.005
7
  *
8
  */
9
 
@@ -854,6 +854,7 @@ function wppa_album_exists( $id ) {
854
  global $wpdb;
855
  static $existing_albums;
856
 
 
857
  if ( ! wppa_is_int( $id ) ) {
858
  return false;
859
  }
@@ -863,7 +864,19 @@ static $existing_albums;
863
  $existing_albums = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums" );
864
  }
865
 
866
- return in_array( $id, $existing_albums );
 
 
 
 
 
 
 
 
 
 
 
 
867
  }
868
 
869
  function wppa_photo_exists( $id ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.2.07.001
7
  *
8
  */
9
 
854
  global $wpdb;
855
  static $existing_albums;
856
 
857
+ // Can only test album ids
858
  if ( ! wppa_is_int( $id ) ) {
859
  return false;
860
  }
864
  $existing_albums = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums" );
865
  }
866
 
867
+ // If in cache, exists = true
868
+ if ( in_array( $id, $existing_albums ) ) {
869
+ return true;
870
+ }
871
+
872
+ // Maybe just created
873
+ $is_new = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE id = %s", $id ) );
874
+ if ( $is_new ) {
875
+
876
+ // Add to cache
877
+ $existing_albums[] = $is_new;
878
+ }
879
+ return $is_new;
880
  }
881
 
882
  function wppa_photo_exists( $id ) {
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.2.06.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/
@@ -23,7 +23,7 @@ global $wpdb;
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
- global $wppa_version; $wppa_version = '8.2.06.006'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js 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: 8.2.07.001
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/
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
+ global $wppa_version; $wppa_version = '8.2.07.001'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */