WP Photo Album Plus - Version 8.2.04.008

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

Code changes from version 8.2.04.007 to 8.2.04.008

changelog.txt CHANGED
@@ -6,9 +6,10 @@ WP Photo Album Plus Changelog
6
  * The dirs wp-content/cache and wp-content/widget-cache are now skipped when scanning for importable files.
7
  * To improve previews, you can now add your theme and custom css at the backend. See new settings Advanced settings -> Admin -> VI -> Items 15, 16 and 17.
8
  * Improved algorithm to decide if an album or item (photo, video, document) is visble for the current visitor.
9
- This takes in account: itmem (photo) status, album status, user status: admin/superuser, logged-in or out, owner of the item or not etc.
10
  Note: The visibility of items that reside in albums that can not be seen by the current visitor,
11
  depends upon their own status when they are explicitly requested e.g. by a shortcode like [wppa type="photo" photo=".."].
 
12
 
13
  = 8.2.03 =
14
 
6
  * The dirs wp-content/cache and wp-content/widget-cache are now skipped when scanning for importable files.
7
  * To improve previews, you can now add your theme and custom css at the backend. See new settings Advanced settings -> Admin -> VI -> Items 15, 16 and 17.
8
  * Improved algorithm to decide if an album or item (photo, video, document) is visble for the current visitor.
9
+ This takes in account: item (photo) status, album status, user status: admin/superuser, logged-in or out, owner of the item or not etc.
10
  Note: The visibility of items that reside in albums that can not be seen by the current visitor,
11
  depends upon their own status when they are explicitly requested e.g. by a shortcode like [wppa type="photo" photo=".."].
12
+ * Added the following items that were missing after the recent restructuration of the photo admin page: Single image shortcode and photo specific urls.
13
 
14
  = 8.2.03 =
15
 
theme/wppa-theme.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the albums/photos/slideshow in a page or post
6
- * Version 8.2.04.005
7
  */
8
  function wppa_theme() {
9
 
@@ -22,7 +22,7 @@ global $wppa_empty_content;
22
  wppa_container( 'open' );
23
 
24
  // Show statistics if set so by the page template
25
- if ( $wppa_show_statistics ) wppa_statistics();
26
 
27
  // Display breadcrumb navigation only if it is set in the settings page
28
  wppa_breadcrumb( 'optional' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the albums/photos/slideshow in a page or post
6
+ * Version 8.2.04.008
7
  */
8
  function wppa_theme() {
9
 
22
  wppa_container( 'open' );
23
 
24
  // Show statistics if set so by the page template
25
+ if ( $wppa_show_statistics ) wppa_show_statistics();
26
 
27
  // Display breadcrumb navigation only if it is set in the settings page
28
  wppa_breadcrumb( 'optional' );
wppa-admin-styles.css CHANGED
@@ -1,7 +1,7 @@
1
  /* admin-styles.css
2
  *
3
  * wp-photo-album-plus
4
- * version 8.2.04.002
5
  */
6
  #files_list, #files_list2
7
  {
@@ -606,7 +606,7 @@ details.hidden {
606
  margin-right: 4px;
607
  }
608
 
609
- .wppa-flex div label {
610
  font-size:0.8em;
611
  font-weight: 600;
612
  margin-bottom: 10px;
1
  /* admin-styles.css
2
  *
3
  * wp-photo-album-plus
4
+ * version 8.2.04.008
5
  */
6
  #files_list, #files_list2
7
  {
606
  margin-right: 4px;
607
  }
608
 
609
+ .wppa-flex div label, .wppa-flex-column div label {
610
  font-size:0.8em;
611
  font-weight: 600;
612
  margin-bottom: 10px;
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 8.2.04.005
6
  *
7
  */
8
 
@@ -618,7 +618,7 @@ global $wppa;
618
  }
619
 
620
  // Restricted and not admin?
621
- if ( wppa_switch( 'download_album_is_restricted' ) && ! wppa_user_is( 'administrator' ) ) {
622
  wppa_echo( '||ER||' . __( 'This feature is restricted to administrators', 'wp-photo-album-plus' ) );
623
  wppa_exit();
624
  }
@@ -626,24 +626,18 @@ global $wppa;
626
  // Validate args
627
  $alb = wppa_get( 'album-id' );
628
 
629
- if ( is_user_logged_in() ) {
630
- $query = "SELECT * FROM $wpdb->wppa_photos
631
- WHERE album = %d
632
- AND ( ( status <> 'pending'
633
- AND status <> 'scheduled' )
634
- OR owner = %s )";
635
- }
636
- else {
637
- $query = "SELECT * FROM $wpdb->wppa_photos
638
- WHERE album = %d
639
- AND ( ( status <> 'pending'
640
- AND status <> 'scheduled'
641
- AND status <> 'private' )
642
- OR owner = %s )";
643
  }
644
- $photos = $wpdb->get_results( $wpdb->prepare( $query, $alb, wppa_get_user() ), ARRAY_A );
645
 
646
- if ( ! $photos ) {
 
647
  wppa_echo( '||ER||' . __( 'The album is empty', 'wp-photo-album-plus' ) );
648
  wppa_exit();
649
  }
@@ -665,25 +659,23 @@ global $wppa;
665
 
666
  // Add photos to zip
667
  $stop = false;
668
- foreach ( $photos as $p ) {
669
  if ( wppa_is_time_up() ) {
670
  wppa_log( 'war', 'Time up during album to zip creation' );
671
  $stop = true;
672
  }
673
  else {
674
- $id = $p['id'];
675
- if ( ! wppa_is_multi( $id ) ) {
676
- $source = ( wppa_switch( 'download_album_source' ) && is_file( wppa_get_source_path( $id ) ) ) ? wppa_get_source_path( $id ) : wppa_get_photo_path( $id );
677
- if ( is_file( $source ) ) {
678
- $dest = $p['filename'] ? wppa_sanitize_file_name( $p['filename'] ) : wppa_sanitize_file_name( wppa_strip_ext( $p['name'] ).'.'.$p['ext'] );
679
- $dest = wppa_fix_poster_ext( $dest, $id );
680
- $iret = $wppa_zip->addFile( $source, $dest );
681
-
682
- // To prevent too may files open, and to have at least a file when there are too many photos, close and re-open
683
- $wppa_zip->close();
684
- $wppa_zip->open( $zipfilepath );
685
- // wppa_log( 'dbg', 'Added ' . basename($source) . ' to ' . basename($zipfilepath));
686
- }
687
  }
688
  }
689
  if ( $stop ) break;
@@ -727,7 +719,7 @@ global $wppa;
727
 
728
  // Check if the user is allowed to do this
729
  $choice = wppa_opt( 'admins_choice' );
730
- if ( ( wppa_user_is( 'administrator' ) && $choice != 'none' ) ||
731
  ( is_user_logged_in() && $choice == 'login' ) ) {
732
  // Its ok
733
  }
@@ -829,7 +821,7 @@ global $wppa;
829
  // Check if the user is allowed to do this
830
  $photo = wppa_get( 'photo-id' );
831
  $choice = wppa_opt( 'admins_choice' );
832
- if ( ( wppa_user_is( 'administrator' ) && $choice != 'none' ) ||
833
  ( is_user_logged_in() && $choice == 'login' ) ) {
834
  // Its ok
835
  }
@@ -1543,7 +1535,7 @@ global $wppa;
1543
  }
1544
 
1545
  // Non admins/superusers can only delete their own photos
1546
- if ( ! wppa_user_is( 'administrator' ) && wppa_get_photo_item( $photo, 'owner' ) != wppa_get_user() ) {
1547
  wppa_echo( '||0||'.__( 'You do not have the rights to delete this photo' , 'wp-photo-album-plus' ) );
1548
  wppa_exit();
1549
  }
@@ -3990,7 +3982,7 @@ global $wppa;
3990
  break;
3991
 
3992
  case 'export-table':
3993
- if ( ! wppa_user_is( 'administrator' ) ) {
3994
  wppa_echo( '||1||'.__( 'Security check failure' , 'wp-photo-album-plus' ) );
3995
  wppa_exit();
3996
  }
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 8.2.04.008
6
  *
7
  */
8
 
618
  }
619
 
620
  // Restricted and not admin?
621
+ if ( wppa_switch( 'download_album_is_restricted' ) && ! wppa_user_is_admin() ) {
622
  wppa_echo( '||ER||' . __( 'This feature is restricted to administrators', 'wp-photo-album-plus' ) );
623
  wppa_exit();
624
  }
626
  // Validate args
627
  $alb = wppa_get( 'album-id' );
628
 
629
+ // Get all items in the album
630
+ $photos = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos WHERE album = %d", $alb ) );
631
+
632
+ // Only visible photos are downloadable
633
+ if ( is_array( $photos ) ) foreach( array_keys( $photos ) as $i ) {
634
+ if ( ! wppa_is_photo( $photos[$i] ) || ! wppa_is_photo_visible( $photos[$i] ) ) {
635
+ unset( $photos[$i] );
636
+ }
 
 
 
 
 
 
637
  }
 
638
 
639
+ // Anything left?
640
+ if ( ! $photos || count( $photos ) == '0' ) {
641
  wppa_echo( '||ER||' . __( 'The album is empty', 'wp-photo-album-plus' ) );
642
  wppa_exit();
643
  }
659
 
660
  // Add photos to zip
661
  $stop = false;
662
+ foreach ( $photos as $id ) {
663
  if ( wppa_is_time_up() ) {
664
  wppa_log( 'war', 'Time up during album to zip creation' );
665
  $stop = true;
666
  }
667
  else {
668
+ $p = wppa_cache_photo( $id );
669
+ $source = ( wppa_switch( 'download_album_source' ) && is_file( wppa_get_source_path( $id ) ) ) ? wppa_get_source_path( $id ) : wppa_get_photo_path( $id );
670
+ if ( is_file( $source ) ) {
671
+ $dest = $p['filename'] ? wppa_sanitize_file_name( $p['filename'] ) : wppa_sanitize_file_name( wppa_strip_ext( $p['name'] ).'.'.$p['ext'] );
672
+ $dest = wppa_fix_poster_ext( $dest, $id );
673
+ $iret = $wppa_zip->addFile( $source, $dest );
674
+
675
+ // To prevent too may files open, and to have at least a file when there are too many photos, close and re-open
676
+ $wppa_zip->close();
677
+ $wppa_zip->open( $zipfilepath );
678
+ // wppa_log( 'dbg', 'Added ' . basename($source) . ' to ' . basename($zipfilepath));
 
 
679
  }
680
  }
681
  if ( $stop ) break;
719
 
720
  // Check if the user is allowed to do this
721
  $choice = wppa_opt( 'admins_choice' );
722
+ if ( ( wppa_user_is_admin() && $choice != 'none' ) ||
723
  ( is_user_logged_in() && $choice == 'login' ) ) {
724
  // Its ok
725
  }
821
  // Check if the user is allowed to do this
822
  $photo = wppa_get( 'photo-id' );
823
  $choice = wppa_opt( 'admins_choice' );
824
+ if ( ( wppa_user_is_admin() && $choice != 'none' ) ||
825
  ( is_user_logged_in() && $choice == 'login' ) ) {
826
  // Its ok
827
  }
1535
  }
1536
 
1537
  // Non admins/superusers can only delete their own photos
1538
+ if ( ! wppa_user_is_admin() && wppa_get_photo_item( $photo, 'owner' ) != wppa_get_user() ) {
1539
  wppa_echo( '||0||'.__( 'You do not have the rights to delete this photo' , 'wp-photo-album-plus' ) );
1540
  wppa_exit();
1541
  }
3982
  break;
3983
 
3984
  case 'export-table':
3985
+ if ( ! wppa_user_is_admin() ) {
3986
  wppa_echo( '||1||'.__( 'Security check failure' , 'wp-photo-album-plus' ) );
3987
  wppa_exit();
3988
  }
wppa-album-covers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
- * Version 8.2.04.007
7
  *
8
  */
9
 
@@ -98,7 +98,7 @@ global $wpdb;
98
  $coverphoto = wppa_get_coverphoto_id( $albumid );
99
  $image = wppa_cache_photo( $coverphoto );
100
  $photocount = wppa_get_visible_photo_count( $albumid );
101
- $albumcount = wppa_get_album_count( $albumid, 'use_treecounts' );
102
 
103
  // Init links
104
  $title = '';
@@ -383,7 +383,7 @@ global $wpdb;
383
  }
384
 
385
  $photocount = wppa_get_visible_photo_count( $albumid );
386
- $albumcount = wppa_get_album_count( $albumid, 'use_treecounts' );
387
  $title = '';
388
  $linkpage = '';
389
 
@@ -581,7 +581,7 @@ global $wpdb;
581
  $coverphoto = wppa_get_coverphoto_id( $albumid );
582
  $image = wppa_cache_photo( $coverphoto );
583
  $photocount = wppa_get_visible_photo_count( $albumid );
584
- $albumcount = wppa_get_album_count( $albumid, true );
585
  $title = '';
586
  $linkpage = '';
587
 
@@ -766,7 +766,7 @@ global $wpdb;
766
  if ( ! $coverphoto ) return;
767
  $image = wppa_cache_photo( $coverphoto );
768
  $photocount = wppa_get_visible_photo_count( $id );
769
- $albumcount = wppa_get_album_count( $id, 'use_treecounts' );
770
 
771
  // Init links
772
  $title = '';
@@ -2030,8 +2030,15 @@ global $wpdb;
2030
  // Process the subalbums
2031
  foreach( $subs as $album ) {
2032
 
 
 
 
2033
  // This subalbum visible for this user?
2034
- if ( wppa_is_album_visible( $album['id'] ) ) {
 
 
 
 
2035
 
2036
  // What is the albums title linktype
2037
  $linktype = $album['cover_linktype'];
@@ -2043,7 +2050,7 @@ global $wpdb;
2043
 
2044
  // Find the content 'View' link
2045
  $albumid = $album['id'];
2046
- $photocount = wppa_get_visible_photo_count( $albumid );
2047
 
2048
  // Thumbnails and covers, show subalbum covers
2049
  // in case slideshow is requested on an empty album
@@ -2072,8 +2079,6 @@ global $wpdb;
2072
 
2073
  // Subalbum title link
2074
  elseif ( wppa_opt( 'cover_sublinks' ) == 'title' ) {
2075
- $pc = wppa_get_visible_photo_count( $albumid, true );
2076
- $ac = wppa_get_album_count( $albumid, true );
2077
  $sub_attr = wppa_get_album_title_attr_a( $albumid,
2078
  $album['cover_linktype'],
2079
  $album['cover_linkpage'],
@@ -2094,7 +2099,7 @@ global $wpdb;
2094
  }
2095
 
2096
  // Physical empty? Even no link for admin, except when empty thumblist requested and upload link on thumblist
2097
- if ( wppa_is_album_empty( $albumid ) ) {
2098
  if ( ! wppa_switch( 'show_empty_thumblist' ) || wppa_opt( 'upload_link_thumbs' ) == 'none' ) {
2099
  $href_content = '';
2100
  $onclick_content = '';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
+ * Version 8.2.04.008
7
  *
8
  */
9
 
98
  $coverphoto = wppa_get_coverphoto_id( $albumid );
99
  $image = wppa_cache_photo( $coverphoto );
100
  $photocount = wppa_get_visible_photo_count( $albumid );
101
+ $albumcount = wppa_get_visible_album_count( $albumid );
102
 
103
  // Init links
104
  $title = '';
383
  }
384
 
385
  $photocount = wppa_get_visible_photo_count( $albumid );
386
+ $albumcount = wppa_get_visible_album_count( $albumid );
387
  $title = '';
388
  $linkpage = '';
389
 
581
  $coverphoto = wppa_get_coverphoto_id( $albumid );
582
  $image = wppa_cache_photo( $coverphoto );
583
  $photocount = wppa_get_visible_photo_count( $albumid );
584
+ $albumcount = wppa_get_visible_album_count( $albumid );
585
  $title = '';
586
  $linkpage = '';
587
 
766
  if ( ! $coverphoto ) return;
767
  $image = wppa_cache_photo( $coverphoto );
768
  $photocount = wppa_get_visible_photo_count( $id );
769
+ $albumcount = wppa_get_visible_album_count( $id );
770
 
771
  // Init links
772
  $title = '';
2030
  // Process the subalbums
2031
  foreach( $subs as $album ) {
2032
 
2033
+ // The album id
2034
+ $albumid = $album['id'];
2035
+
2036
  // This subalbum visible for this user?
2037
+ if ( wppa_is_album_visible( $albumid ) ) {
2038
+
2039
+ // What is in there visible?
2040
+ $pc = wppa_get_visible_photo_count( $albumid );
2041
+ $ac = wppa_get_visible_album_count( $albumid );
2042
 
2043
  // What is the albums title linktype
2044
  $linktype = $album['cover_linktype'];
2050
 
2051
  // Find the content 'View' link
2052
  $albumid = $album['id'];
2053
+ $photocount = $pc;
2054
 
2055
  // Thumbnails and covers, show subalbum covers
2056
  // in case slideshow is requested on an empty album
2079
 
2080
  // Subalbum title link
2081
  elseif ( wppa_opt( 'cover_sublinks' ) == 'title' ) {
 
 
2082
  $sub_attr = wppa_get_album_title_attr_a( $albumid,
2083
  $album['cover_linktype'],
2084
  $album['cover_linkpage'],
2099
  }
2100
 
2101
  // Physical empty? Even no link for admin, except when empty thumblist requested and upload link on thumblist
2102
+ if ( ! $pc && ! $ac ) {
2103
  if ( ! wppa_switch( 'show_empty_thumblist' ) || wppa_opt( 'upload_link_thumbs' ) == 'none' ) {
2104
  $href_content = '';
2105
  $onclick_content = '';
wppa-common-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
- * Version 8.2.04.005
6
  *
7
  */
8
 
@@ -25,15 +25,18 @@ global $wppa_defaults;
25
  wppa_set_defaults();
26
 
27
  // Now find the non defaults
28
- $non_defaults = $wpdb->get_results( $wpdb->prepare( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE %s", $wpdb->esc_like( 'wppa_' ) . '%' ), ARRAY_A );
 
29
 
30
  // Init with defaults
31
  $wppa_opt = $wppa_defaults;
32
 
33
  // Check all existing wppa_xxx options
34
- foreach( $non_defaults as $option ) {
35
- $name = $option['option_name'];
36
- $value = $option['option_value'];
 
 
37
 
38
  // If it is a setting
39
  if ( isset( $wppa_opt[$name] ) ) {
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 8.2.04.008
6
  *
7
  */
8
 
25
  wppa_set_defaults();
26
 
27
  // Now find the non defaults
28
+ // $non_defaults = $wpdb->get_results( $wpdb->prepare( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE %s", $wpdb->esc_like( 'wppa_' ) . '%' ), ARRAY_A );
29
+ $non_defaults = wp_load_alloptions();
30
 
31
  // Init with defaults
32
  $wppa_opt = $wppa_defaults;
33
 
34
  // Check all existing wppa_xxx options
35
+ // foreach( $non_defaults as $option ) {
36
+ foreach( array_keys( $non_defaults ) as $name ) {
37
+ // $name = $option['option_name'];
38
+ // $value = $option['option_value'];
39
+ $value = $non_defaults[$name];
40
 
41
  // If it is a setting
42
  if ( isset( $wppa_opt[$name] ) ) {
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.2.04.007
7
  *
8
  */
9
 
@@ -948,7 +948,7 @@ global $other_deps;
948
  }
949
  else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
950
  global $wppa_version;
951
- $expected_version = '8.2.04.005';
952
  if ( $wppa_version != $expected_version ) {
953
  wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
954
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.2.04.008
7
  *
8
  */
9
 
948
  }
949
  else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
950
  global $wppa_version;
951
+ $expected_version = '8.2.04.008';
952
  if ( $wppa_version != $expected_version ) {
953
  wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
954
  }
wppa-photo-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
- * Version 8.2.04.005
7
  *
8
  */
9
 
@@ -1047,14 +1047,35 @@ function wppaTryScheduledel( id ) {
1047
  if ( $scheduledel ) {
1048
  wppa_echo( '
1049
  <div class="left">
1050
- <label>' .
1051
- __( 'Delete at', 'wp-photo-album-plus' ) . '
1052
- </label>
1053
- <div class="wppa-ldi">' .
1054
- wppa_get_date_time_select_html( 'delphoto', $id, false ) . '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055
  </div>
 
 
 
 
 
 
1056
  </div>' );
1057
- }
1058
  }
1059
 
1060
  // End fieldset
@@ -1338,14 +1359,6 @@ function wppaTryScheduledel( id ) {
1338
  />
1339
  </div>' );
1340
  }
1341
- /*
1342
- elseif ( basename( $wmfile ) != '--- none ---' ) {
1343
- wppa_echo(
1344
- __( 'Watermark', 'wp-photo-album-plus' ) . ' ' .
1345
- __( 'File', 'wp-photo-album-plus' ) . ' ' . strip_tags( basename( $wmfile ) ) . ' ' .
1346
- __( 'Pos', 'wp-photo-album-plus' ) . ' ' . strip_tags( $wmpos ) );
1347
- }
1348
- */
1349
  }
1350
 
1351
  // Schedule for delete
@@ -1786,6 +1799,122 @@ function wppaTryScheduledel( id ) {
1786
  </fieldset>' );
1787
  }
1788
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1789
  wppa_echo( '
1790
  </div>' );
1791
 
@@ -2120,7 +2249,7 @@ function wppaTryScheduledel( id ) {
2120
  $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', $file ) . '<br>';
2121
 
2122
  $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file );
2123
- $urls .= '<a href="'.$url.'" target="_blank">' . $file . '</a><br>';
2124
  }
2125
  }
2126
  $txt .= '</span>';
@@ -2142,511 +2271,41 @@ function wppaTryScheduledel( id ) {
2142
  </tr>' );
2143
  }
2144
  }
2145
- /*
2146
- $lbl = __( 'Local CDN files', 'wp-photo-album-plus' );
2147
- $txt = '<span id="cdnfiles-' . $id . '">';
2148
-
2149
- $files = wppa_cdn_files( $id );
2150
- if ( !empty( $files ) ) {
2151
- foreach( $files as $file ) {
2152
- if ( basename( $file ) != 'index.php' ) {
2153
- $t = explode( '.', basename( $file ) );
2154
- $t = explode( '-', $t[0] );
2155
- $x = $t[0];
2156
- $y = $t[1];
2157
- $size = filesize( $file );
2158
- $txt .= '
2159
- <a
2160
- href="' . wppa_cdn_url( $id, $x, $y ) . '"
2161
- target="_blank"
2162
- >' .
2163
- basename( $file ) .
2164
- '</a> ' .
2165
- sprintf( '%4.2fkB', $size / 1024 ) . '<br>';
2166
- }
2167
- }
2168
- }
2169
- }
2170
-
2171
- */
2172
 
2173
  wppa_echo( '
2174
  </tbody>
2175
  </table>' );
2176
  }
2177
- /*
2178
- // Pdf
2179
- if ( wppa_is_pdf( $id ) ) {
2180
- $sp = wppa_get_source_path( $id );
2181
- $fs = wppa_get_filesize( $sp );
2182
- wppa_echo( '
2183
- <div>
2184
- <label>' .
2185
- __( 'Document file', 'wp-photo-album-plus' ) . '
2186
- </label><br>
2187
- <div class="wppa-ldi">' .
2188
- $fs . '
2189
- </div>
2190
- </div>' );
2191
- }
2192
- */
2193
- /*
2194
- // Source
2195
- $sp = wppa_get_o1_source_path( $id );
2196
- if ( ! wppa_is_file( $sp ) ) {
2197
- $sp = wppa_get_source_path( $id );
2198
- }
2199
- if ( wppa_is_pdf( $id ) ) {
2200
- $sp = wppa_strip_ext( $sp ) . '.jpg';
2201
- if ( ! wppa_is_file( $sp ) ) {
2202
- $sp = wppa_strip_ext( $sp ) . '.png';
2203
- }
2204
- }
2205
- if ( is_file( $sp ) ) {
2206
- $ima = getimagesize( $sp );
2207
- $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $sp ) . '.' . $br;
2208
- }
2209
- else {
2210
- $txt = __( 'Unavailable', 'wp-photo-album-plus' );
2211
- }
2212
- wppa_echo( '
2213
- <div style="max-width:300px">
2214
- <label>' .
2215
- __( 'Source file', 'wp-photo-album-plus' ) . '
2216
- </label><br>
2217
- <div class="wppa-ldi">' .
2218
- $txt . '
2219
- </div>
2220
- </div>' );
2221
- */
2222
- /*
2223
- // Display
2224
- if ( $is_video || $has_audio ) {
2225
- $lbl = __( 'Poster file', 'wp-photo-album-plus' );
2226
- }
2227
- else {
2228
- $lbl = __( 'Display file', 'wp-photo-album-plus' );
2229
- }
2230
- $dp = wppa_get_photo_path( $id );
2231
- if ( is_file( $dp ) ) {
2232
- $txt = '
2233
- <span id="photox-' . $id . '">' . wppa_get_photox( $id ) . '</span> x
2234
- <span id="photoy-' . $id . '">' . wppa_get_photoy( $id ) . '</span>:
2235
- (<span id="photofilesize-' . $id . '">' . wppa_get_filesize( $dp ) . '</span>)';
2236
- }
2237
- else {
2238
- $txt = '
2239
- <span style="color:red">' .
2240
- __( 'Unavailable', 'wp-photo-album-plus' ) . '
2241
- </span>';
2242
- }
2243
- wppa_echo( '
2244
- <div style="max-width:300px">
2245
- <label>' .
2246
- $lbl . '
2247
- </label><br>
2248
- <div class="wppa-ldi">' .
2249
- $txt . '
2250
- </div>
2251
- </div>' );
2252
- */
2253
- /*
2254
- // Thumbnail
2255
  if ( ! $is_video ) {
2256
- $lbl = __( 'Thumbnail file', 'wp-photo-album-plus' );
2257
- $tp = wppa_get_thumb_path( $id );
2258
- if ( is_file( $tp ) ) {
2259
- $txt = '
2260
- <span id="thumbx-' . $id . '">' . wppa_get_thumbx( $id ) . '</span> x
2261
- <span id="thumby-' . $id . '">' . wppa_get_thumby( $id ) . '</span>:
2262
- (<span id="thumbfilesize-' . $id . '">' . wppa_get_filesize( $tp ) . '</span>)
2263
- &nbsp;
2264
- <input
2265
- type="checkbox"' .
2266
- ( $thumblock ? ' checked' : '' ) . '
2267
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'thumblock\', jQuery(this).prop(\'checked\') ? 1 : 0 )" /> ' .
2268
- __( 'Locked', 'wp-photo-album-plus' );
2269
- }
2270
- else {
2271
- $txt = '
2272
- <span style="color:red">' .
2273
- __( 'Unavailable', 'wp-photo-album-plus' ) . '.
2274
- </span>';
2275
- }
2276
  wppa_echo( '
2277
- <div style="max-width:300px">
2278
- <label>' .
2279
- $lbl . '
2280
- </label><br>
2281
- <div class="wppa-ldi">' .
2282
- $txt . '
2283
- </div>
2284
- </div>' );
2285
- }
2286
 
2287
- // Local CDN
2288
- if ( wppa_cdn( 'admin' ) == 'local' ) {
2289
- $lbl = __( 'Local CDN files', 'wp-photo-album-plus' );
2290
- $txt = '<span id="cdnfiles-' . $id . '">';
2291
-
2292
- $files = wppa_cdn_files( $id );
2293
- if ( !empty( $files ) ) {
2294
- foreach( $files as $file ) {
2295
- if ( basename( $file ) != 'index.php' ) {
2296
- $t = explode( '.', basename( $file ) );
2297
- $t = explode( '-', $t[0] );
2298
- $x = $t[0];
2299
- $y = $t[1];
2300
- $size = filesize( $file );
2301
- $txt .= '
2302
- <a
2303
- href="' . wppa_cdn_url( $id, $x, $y ) . '"
2304
- target="_blank"
2305
- >' .
2306
- basename( $file ) .
2307
- '</a> ' .
2308
- sprintf( '%4.2fkB', $size / 1024 ) . '<br>';
2309
- }
2310
- }
2311
- }
2312
- else {
2313
- $txt .= __( 'None', 'wp-photo-album-plus' );
2314
- }
2315
- $txt .= '</span>';
2316
- wppa_echo( '
2317
- <div>
2318
- <label>' .
2319
- $lbl . '
2320
- </label><br>
2321
- <div class="wppa-ldi">' .
2322
- $txt . '
2323
- </div>
2324
- </div>' );
2325
  }
2326
 
2327
- // Video
2328
- if ( $b_is_video ) {
2329
-
2330
- // Width
2331
  wppa_echo( '
2332
- <div>
2333
- <label>' .
2334
- __( 'Video width', 'wp-photo-album-plus' ) . '
2335
- </label><br>
2336
- <input
2337
- type="text"
2338
- style="width:50px;margin:0 4px"
2339
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videox\', this.value)"
2340
- value="' . esc_attr( $videox ) . '"
2341
- />px
2342
- <br>' . sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_width' ) ) . '
2343
- </div>' );
2344
 
2345
- // Height
2346
- wppa_echo( '
2347
- <div>
2348
- <label>' .
2349
- __( 'Video height', 'wp-photo-album-plus' ) . '
2350
- </label><br>
2351
  <input
2352
- type="text"
2353
- style="width:50px;margin:0 4px"
2354
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videoy\', this.value)"
2355
- value="' . esc_attr( $videoy ) . '"
2356
- />px
2357
- <br>' . sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_height' ) ) . '
2358
- </div>' );
2359
-
2360
- // Formats
2361
- $txt = '';
2362
- foreach ( $is_video as $fmt ) {
2363
- $txt .= $fmt . ' (' . wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . ')<br>';
2364
- }
2365
- wppa_echo( '
2366
- <div>
2367
- <label>' .
2368
- __( 'Formats', 'wp-photo-album-plus' ) . '
2369
- </label><br>
2370
- <div class="wppa-ldi">' .
2371
- $txt . '
2372
- </div>
2373
- </div>' );
2374
- }
2375
-
2376
- // Audio
2377
- if ( $b_has_audio ) {
2378
- $txt = '';
2379
- foreach ( $has_audio as $fmt ) {
2380
- $txt .= $fmt . ' (' . wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . ')<br>';
2381
- }
2382
- wppa_echo( '
2383
- <div>
2384
- <label>' .
2385
- __( 'Formats', 'wp-photo-album-plus' ) . '
2386
- </label><br>
2387
- <div class="wppa-ldi">' .
2388
- $txt . '
2389
- </div>
2390
- </div>' );
2391
  }
2392
 
2393
- // End flex div
2394
- wppa_echo( '</div>' );
2395
-
2396
- wppa_echo( '<div class="wppa-flex">' );
2397
-
2398
- // Remake displayfiles
2399
- if ( ! $is_video ) {
2400
- wppa_echo( '
2401
- <div>
2402
- <label>
2403
- &nbsp;
2404
- </label><br>
2405
- <input
2406
- type="button"
2407
- class="wppa-admin-button button"
2408
- title="' . esc_attr( __( 'Remake display file and thumbnail file', 'wp-photo-album-plus' ) ) . '"
2409
- onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', 0 )"
2410
- value="' . esc_attr( __( 'Remake files', 'wp-photo-album-plus' ) ) . '"
2411
- />
2412
- </div>' );
2413
- }
2414
-
2415
- // Remake thumbnail
2416
- if ( ! $is_video ) {
2417
- wppa_echo( '
2418
- <div style="max-width:500px;">
2419
- <label>
2420
- &nbsp;
2421
- </label><br>
2422
- <input
2423
- type="button"
2424
- class="wppa-admin-button button"
2425
- title="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2426
- onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', 0 )"
2427
- value="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2428
- />
2429
- </div>' );
2430
- }
2431
-
2432
- // End flex div
2433
- wppa_echo( '</div>' );
2434
-
2435
- // Links to files
2436
- wppa_echo( '<div>' );
2437
-
2438
- wppa_echo( '
2439
- <table class="wppa-table">' );
2440
-
2441
- // -- Auto Page --
2442
- if ( wppa_switch( 'auto_page' ) && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
2443
- $appl = get_permalink( wppa_get_the_auto_page( $id ) );
2444
- wppa_echo( '
2445
- <tr>
2446
- <th>' .
2447
- __( 'Autopage Permalink', 'wp-photo-album-plus' ) . '
2448
- </th>
2449
- <td>
2450
- <a href="' . $appl . '" target="_blank">' .
2451
- $appl . '
2452
- </a>
2453
- </td>
2454
- <td>
2455
- </td>
2456
- </tr>' );
2457
- }
2458
-
2459
- // -- Link url --
2460
- if ( ! wppa_switch( 'link_is_restricted' ) || wppa_user_is( 'administrator' ) ) {
2461
- wppa_echo( '
2462
- <tr>
2463
- <th>' .
2464
- __( 'Photo specific link url', 'wp-photo-album-plus' ) . '
2465
- </th>
2466
- <td>
2467
- <input
2468
- type="text"
2469
- id="pislink-' . $id . '"
2470
- style="width:100%"
2471
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this.value)"
2472
- value="' . esc_attr( $linkurl ) . '"
2473
- />
2474
- </td>
2475
- <td>
2476
- <select
2477
- id="pistarget-' . $id . '"
2478
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktarget\', this.value)"
2479
- >
2480
- <option
2481
- value="_self"' .
2482
- ( $linktarget == '_self' ? ' selected' : '' ) . '
2483
- >' .
2484
- __( 'Same tab', 'wp-photo-album-plus' ) . '
2485
- </option>
2486
- <option
2487
- value="_blank"' .
2488
- ( $linktarget == '_blank' ? ' selected' : '' ) . '
2489
- >' .
2490
- __( 'New tab', 'wp-photo-album-plus' ) . '
2491
- </option>
2492
- </select>
2493
- <input
2494
- type="button"
2495
- class="button wppa-admin-button"
2496
- onclick="window.open( jQuery( \'#pislink-' . $id . '\' ).val(), jQuery( \'#pistarget-' . $id . '\' ).val() )"
2497
- value="' . __( 'Tryit!', 'wp-photo-album-plus' ) . '"
2498
- />
2499
- </td>
2500
- </tr>' );
2501
-
2502
- // -- Link title --
2503
- wppa_echo( '
2504
- <tr>
2505
- <th>' .
2506
- __( 'Photo specific link title', 'wp-photo-album-plus' ) . '
2507
- </th>
2508
- <td>
2509
- <input
2510
- type="text"
2511
- style="width:100%"
2512
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this.value)"
2513
- value="' . esc_attr( $linktitle ) . '"
2514
- />' );
2515
- if ( current_user_can( 'wppa_settings' ) ) {
2516
- wppa_echo( '
2517
- <br>
2518
- <span class="description">' .
2519
- sprintf( __( 'If you want this link to be used, check \'PS Overrule\' checkbox in %s.' , 'wp-photo-album-plus' ), wppa_setting_path( 'b', 'links', 2 ) ) . '
2520
- </span>' );
2521
- }
2522
- wppa_echo( '
2523
- </td>
2524
- <td>
2525
- </td>
2526
- </tr>' );
2527
- }
2528
-
2529
- // -- Custom ALT field --
2530
- if ( wppa_opt( 'alt_type' ) == 'custom' ) {
2531
- wppa_echo( '
2532
- <tr>
2533
- <th>' .
2534
- __( 'HTML Alt attribute' , 'wp-photo-album-plus' ) . '
2535
- </th>
2536
- <td>
2537
- <input
2538
- type="text"
2539
- style="width:100%"
2540
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this.value)"
2541
- value="' . esc_attr( $alt ) . '"
2542
- />
2543
- </td>
2544
- <td>
2545
- </td>
2546
- </tr>' );
2547
- }
2548
-
2549
- // If Quick, skip the following items for speed and space
2550
- if ( ! $quick ) {
2551
-
2552
- // Shortcode
2553
- if ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) {
2554
- wppa_echo( '
2555
- <tr>
2556
- <th>' .
2557
- __( 'Single image shortcode', 'wp-photo-album-plus' ) . ':
2558
- </th>
2559
- <td>
2560
- [wppa type="photo" photo="' . $id .'"]
2561
- </td>
2562
- <td>
2563
- <small>' .
2564
- sprintf( __( 'See %s The documentation %s for more shortcode options.', 'wp-photo-album-plus' ),
2565
- '<a href="https://wppa.nl/shortcode-reference/" target="_blank">',
2566
- '</a>'
2567
- ) . '
2568
- </small>
2569
- </td>
2570
- </tr>' );
2571
- }
2572
-
2573
- // Source permalink
2574
- if ( is_file( wppa_get_source_path( $id ) ) ) {
2575
- $spl = wppa_get_source_pl( $id );
2576
- wppa_echo( '
2577
- <tr>
2578
- <th>' .
2579
- __( 'Permalink', 'wp-photo-album-plus' ) . ':
2580
- </th>
2581
- <td>
2582
- <a href="' . esc_attr( $spl ) . '" target="_blank">' . htmlspecialchars( $spl ) . '</a>
2583
- </td>
2584
- <td>
2585
- </td>
2586
- </tr>' );
2587
- }
2588
-
2589
- // High resolution url
2590
- if ( $is_video ) {
2591
- reset( $is_video );
2592
- $fmt = current( $is_video );
2593
- $hru = wppa_strip_ext( wppa_get_photo_path( $id, false ) ) . '.' . $fmt;
2594
- $hru = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $hru );
2595
- }
2596
- else {
2597
- $hru = htmlspecialchars( wppa_get_hires_url( $id ) );
2598
- }
2599
- wppa_echo( '
2600
- <tr>
2601
- <th>' .
2602
- __( 'High resolution url', 'wp-photo-album-plus' ) . ':
2603
- </th>
2604
- <td>
2605
- <a href="' . esc_attr( $hru ) . '" target="_blank">' . $hru . '</a>
2606
- </td>
2607
- <td>
2608
- </td>
2609
- </tr>' );
2610
-
2611
- // Display file
2612
- if ( is_file( wppa_get_photo_path( $id ) ) ) {
2613
- $lru = wppa_fix_poster_ext( wppa_get_lores_url( $id ), $id );
2614
- wppa_echo( '
2615
- <tr>
2616
- <th>' .
2617
- __( 'Display file url', 'wp-photo-album-plus' ) . ':
2618
- </th>
2619
- <td>
2620
- <a href="' . esc_attr( $lru ) . '" target="_blank">' . $lru . '</a>
2621
- </td>
2622
- <td>
2623
- </td>
2624
- </tr>' );
2625
- }
2626
-
2627
- // Thumbnail
2628
- if ( is_file( wppa_get_thumb_path( $id ) ) ) {
2629
- $tnu = wppa_fix_poster_ext( wppa_get_tnres_url( $id ), $id );
2630
- wppa_echo( '
2631
- <tr>
2632
- <th>' .
2633
- __( 'Thumbnail file url', 'wp-photo-album-plus' ) . ':
2634
- </th>
2635
- <td>
2636
- <a href="' . esc_attr( $tnu ) . '" target="_blank">' . $tnu . '</a>
2637
- </td>
2638
- <td>
2639
- </td>
2640
- </tr>' );
2641
- }
2642
- }
2643
-
2644
- wppa_echo( '</table>' );
2645
-
2646
- // End Links to files
2647
- wppa_echo( '</div>' );
2648
 
2649
- */
2650
 
2651
  // End Tab 2
2652
  wppa_echo( '</div>' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 8.2.04.008
7
  *
8
  */
9
 
1047
  if ( $scheduledel ) {
1048
  wppa_echo( '
1049
  <div class="left">
1050
+ <label>' .
1051
+ __( 'Delete at', 'wp-photo-album-plus' ) . '
1052
+ </label>
1053
+ <div class="wppa-ldi">' .
1054
+ wppa_get_date_time_select_html( 'delphoto', $id, false ) . '
1055
+ </div>
1056
+ </div>' );
1057
+ }
1058
+ }
1059
+
1060
+ // Shortcode
1061
+ if ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) {
1062
+ wppa_echo( '
1063
+ <div class="left">
1064
+ <label>
1065
+ <span style="float:left">' .
1066
+ __( 'Single image shortcode example', 'wp-photo-album-plus' ) . '
1067
+ </span>
1068
+ </label><br>
1069
+ <div class="wppa-ldi">
1070
+ [wppa type="photo" photo="' . $id .'"]
1071
  </div>
1072
+ <small>' .
1073
+ sprintf( __( 'See %s The documentation %s for more shortcode options.', 'wp-photo-album-plus' ),
1074
+ '<a href="https://wppa.nl/shortcode-reference/" target="_blank">',
1075
+ '</a>'
1076
+ ) . '
1077
+ </small>
1078
  </div>' );
 
1079
  }
1080
 
1081
  // End fieldset
1359
  />
1360
  </div>' );
1361
  }
 
 
 
 
 
 
 
 
1362
  }
1363
 
1364
  // Schedule for delete
1799
  </fieldset>' );
1800
  }
1801
 
1802
+ // Links etc. Open fieldset
1803
+ wppa_echo( '
1804
+ <fieldset class="wppa-fieldset">
1805
+ <legend class="wppa-legend">' .
1806
+ __( 'Photo specific links', 'wp-photo-album-plus' ) . '
1807
+ </legend>' );
1808
+
1809
+ // -- Auto Page --
1810
+ if ( wppa_switch( 'auto_page' ) && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
1811
+ $appl = get_permalink( wppa_get_the_auto_page( $id ) );
1812
+ wppa_echo( '
1813
+ <div>
1814
+ <label>
1815
+ <span style="float:left">' .
1816
+ __( 'Autopage Permalink', 'wp-photo-album-plus' ) . '
1817
+ </span>
1818
+ </label><br>
1819
+ <div class="wppa-ldi">
1820
+ <a href="' . $appl . '" target="_blank">' .
1821
+ $appl . '
1822
+ </a>
1823
+ </div>
1824
+ </div>' );
1825
+ }
1826
+
1827
+ // -- Photo specific link --
1828
+ if ( ! wppa_switch( 'link_is_restricted' ) || wppa_user_is( 'administrator' ) ) {
1829
+
1830
+ // -- Link url --
1831
+ wppa_echo( '
1832
+ <div>
1833
+ <label>
1834
+ <span style="float:left">' .
1835
+ __( 'Photo specific link url', 'wp-photo-album-plus' ) . '
1836
+ </span>
1837
+ </label><br>
1838
+ <input
1839
+ type="text"
1840
+ id="pislink-' . $id . '"
1841
+ style="width:100%"
1842
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linkurl\', this.value)"
1843
+ value="' . esc_attr( $linkurl ) . '"
1844
+ />
1845
+ <select
1846
+ id="pistarget-' . $id . '"
1847
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktarget\', this.value)"
1848
+ >
1849
+ <option
1850
+ value="_self"' .
1851
+ ( $linktarget == '_self' ? ' selected' : '' ) . '
1852
+ >' .
1853
+ __( 'Same tab', 'wp-photo-album-plus' ) . '
1854
+ </option>
1855
+ <option
1856
+ value="_blank"' .
1857
+ ( $linktarget == '_blank' ? ' selected' : '' ) . '
1858
+ >' .
1859
+ __( 'New tab', 'wp-photo-album-plus' ) . '
1860
+ </option>
1861
+ </select>
1862
+ <input
1863
+ type="button"
1864
+ class="button wppa-admin-button"
1865
+ onclick="window.open( jQuery( \'#pislink-' . $id . '\' ).val(), jQuery( \'#pistarget-' . $id . '\' ).val() )"
1866
+ value="' . __( 'Tryit!', 'wp-photo-album-plus' ) . '"
1867
+ />
1868
+ </div>' );
1869
+
1870
+ // -- Link title --
1871
+ wppa_echo( '
1872
+ <div>
1873
+ <label>
1874
+ <span style="float:left">' .
1875
+ __( 'Photo specific link title', 'wp-photo-album-plus' ) . '
1876
+ </span>
1877
+ </label><br>
1878
+ <input
1879
+ type="text"
1880
+ style="width:100%"
1881
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'linktitle\', this.value)"
1882
+ value="' . esc_attr( $linktitle ) . '"
1883
+ />' );
1884
+
1885
+ if ( current_user_can( 'wppa_settings' ) ) {
1886
+ wppa_echo( '
1887
+ <br>
1888
+ <small>' .
1889
+ sprintf( __( 'If you want this link to be used, check \'PS Overrule\' checkbox in %s.' , 'wp-photo-album-plus' ), wppa_setting_path( 'b', 'links', 2 ) ) . '
1890
+ </small>' );
1891
+ }
1892
+ wppa_echo( '
1893
+ </div>' );
1894
+ }
1895
+
1896
+ // -- Custom ALT field --
1897
+ if ( wppa_opt( 'alt_type' ) == 'custom' ) {
1898
+ wppa_echo( '
1899
+ <div>
1900
+ <label>
1901
+ <span style="float:left">' .
1902
+ __( 'HTML Alt attribute' , 'wp-photo-album-plus' ) . '
1903
+ </span>
1904
+ </label><br>
1905
+ <input
1906
+ type="text"
1907
+ style="width:100%"
1908
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'alt\', this.value)"
1909
+ value="' . esc_attr( $alt ) . '"
1910
+ />
1911
+ </div>' );
1912
+ }
1913
+
1914
+ // End PS Links etc
1915
+ wppa_echo( '
1916
+ </fieldset>' );
1917
+
1918
  wppa_echo( '
1919
  </div>' );
1920
 
2249
  $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', $file ) . '<br>';
2250
 
2251
  $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file );
2252
+ $urls .= '<a href="'.$url.'" target="_blank">' . $url . '</a><br>';
2253
  }
2254
  }
2255
  $txt .= '</span>';
2271
  </tr>' );
2272
  }
2273
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2274
 
2275
  wppa_echo( '
2276
  </tbody>
2277
  </table>' );
2278
  }
2279
+
2280
+ // Remake displayfiles
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2281
  if ( ! $is_video ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2282
  wppa_echo( '
 
 
 
 
 
 
 
 
 
2283
 
2284
+ <input
2285
+ type="button"
2286
+ class="wppa-admin-button button"
2287
+ title="' . esc_attr( __( 'Remake display file and thumbnail file', 'wp-photo-album-plus' ) ) . '"
2288
+ onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', 0 )"
2289
+ value="' . esc_attr( __( 'Remake files', 'wp-photo-album-plus' ) ) . '"
2290
+ />
2291
+ ' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2292
  }
2293
 
2294
+ // Remake thumbnail
2295
+ if ( ! $is_video ) {
 
 
2296
  wppa_echo( '
 
 
 
 
 
 
 
 
 
 
 
 
2297
 
 
 
 
 
 
 
2298
  <input
2299
+ type="button"
2300
+ class="wppa-admin-button button"
2301
+ title="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2302
+ onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', 0 )"
2303
+ value="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2304
+ />
2305
+ ' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2306
  }
2307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2308
 
 
2309
 
2310
  // End Tab 2
2311
  wppa_echo( '</div>' );
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.2.04.004
7
  *
8
  */
9
 
@@ -1772,7 +1772,7 @@ global $wppa_subtab_names;
1772
 
1773
  $name = __('Number of coverphotos', 'wp-photo-album-plus' );
1774
  $desc = __('The number of coverphotos. Must be > 1 and < 25.', 'wp-photo-album-plus' );
1775
- $help = '';
1776
  $slug = 'wppa_imgfact_count';
1777
  $html = wppa_input($slug, '50px', '', __('photos', 'wp-photo-album-plus' ));
1778
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.2.04.008
7
  *
8
  */
9
 
1772
 
1773
  $name = __('Number of coverphotos', 'wp-photo-album-plus' );
1774
  $desc = __('The number of coverphotos. Must be > 1 and < 25.', 'wp-photo-album-plus' );
1775
+ $help = __('This works on cover type Image Factory (mcr) only', 'wp-photo-album-plus' );
1776
  $slug = 'wppa_imgfact_count';
1777
  $html = wppa_input($slug, '50px', '', __('photos', 'wp-photo-album-plus' ));
1778
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
wppa-statistics.php CHANGED
@@ -4,18 +4,14 @@
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
- * Version 8.2.04.007
8
  *
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
12
 
13
  // show system statistics
14
- function wppa_statistics() {
15
-
16
- wppa_out( wppa_get_statistics() );
17
- }
18
- function wppa_get_statistics() {
19
 
20
  $count = wppa_get_total_album_count();
21
  $y_id = wppa_get_youngest_album_id();
@@ -35,66 +31,7 @@ function wppa_get_statistics() {
35
 
36
  $result .= '.</div>';
37
 
38
- return $result;
39
- }
40
-
41
- /*
42
- // get number of photos in album
43
- function wppa_get _photo_count( $id = '0', $use_treecounts = false ) {
44
- global $wpdb;
45
-
46
- if ( $use_treecounts && $id ) {
47
- $treecounts = wppa_get_treecounts_a( $id );
48
- if ( current_user_can('wppa_moderate') ) {
49
- $count = $treecounts['selfphotos'] + $treecounts['pendselfphotos'] + $treecounts['scheduledselfphotos'];
50
- }
51
- else {
52
- $count = $treecounts['selfphotos'];
53
- }
54
- }
55
- elseif ( ! $id ) {
56
- if ( current_user_can('wppa_moderate') ) {
57
- $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos " );
58
- }
59
- else {
60
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE ( ( status <> 'pending' AND status <> 'scheduled' ) OR owner = %s )", wppa_get_user() ) );
61
- }
62
- }
63
- else {
64
- if ( current_user_can('wppa_moderate') ) {
65
- $count = $wpdb->get_var($wpdb->prepare(
66
- "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $id ) );
67
- }
68
- else {
69
- $count = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
70
- WHERE album = %d
71
- AND ( ( status <> 'pending' AND status <> 'scheduled' )
72
- OR owner = %s )", $id, wppa_get_user() ) );
73
- }
74
- }
75
-
76
- // Substract private photos if not logged in and album given
77
- if ( $id && ! is_user_logged_in() ) {
78
- $count -= $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
79
- WHERE album = %d AND status = 'private' ", $id ) );
80
- }
81
- return $count;
82
- }
83
- */
84
-
85
- // get number of albums in album
86
- function wppa_get_album_count( $id, $use_treecounts = false ) {
87
- global $wpdb;
88
-
89
- if ( $use_treecounts && $id ) {
90
- $treecounts = wppa_get_treecounts_a( $id );
91
- $count = $treecounts['selfalbums'];
92
- }
93
- else {
94
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
95
- WHERE a_parent = %d", $id ) );
96
- }
97
- return $count;
98
  }
99
 
100
  // get number of albums in system
@@ -290,16 +227,10 @@ global $wppa_session;
290
  }
291
  }
292
 
293
- function wppa_get_upldr_cache() {
294
-
295
- $result = wppa_get_option( 'wppa_upldr_cache', array() );
296
-
297
- return $result;
298
- }
299
-
300
  function wppa_flush_upldr_cache( $key = '', $id = '' ) {
301
 
302
- $upldrcache = wppa_get_upldr_cache();
303
 
304
  foreach ( array_keys( $upldrcache ) as $widget_id ) {
305
 
@@ -337,27 +268,6 @@ function wppa_flush_upldr_cache( $key = '', $id = '' ) {
337
  update_option('wppa_upldr_cache', $upldrcache);
338
  }
339
 
340
- function wppa_get_random_photo_id_from_youngest_album() {
341
- global $wpdb;
342
-
343
- $albums = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums ORDER BY timestamp DESC" );
344
- $found = false;
345
- $count = count( $albums );
346
- $idx = 0;
347
- $result = false;
348
-
349
- while ( ! $found && $idx < $count ) {
350
- $album = $albums[$idx];
351
- $result = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos WHERE album = %d ORDER BY RAND() LIMIT 1", $album ) );
352
- if ( $result ) {
353
- $found = true;
354
- }
355
- $idx++;
356
- }
357
-
358
- return $result;
359
- }
360
-
361
  // Mark treecounts of album $alb as being update required, default: clear all
362
  function wppa_invalidate_treecounts( $alb = '' ) {
363
  global $wpdb;
@@ -679,16 +589,19 @@ global $wpdb;
679
  function wppa_is_album_empty( $id ) {
680
  global $wpdb;
681
 
 
682
  $has_albums = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
683
  if ( $has_albums ) {
684
  return false;
685
  }
686
 
 
687
  $has_photos = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $id ) );
688
  if ( $has_photos ) {
689
  return false;
690
  }
691
 
 
692
  $has_deleted_photos = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", - ( $id + '9' ) ) );
693
  if ( $has_deleted_photos ) {
694
  return false;
@@ -768,7 +681,6 @@ static $login;
768
 
769
  // Get number of visible 1st generation albums
770
  function wppa_get_visible_album_count( $id ) {
771
- // global $wpdb;
772
 
773
  $result = '0';
774
 
@@ -881,7 +793,7 @@ static $cache;
881
  $result = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s AND ( status NOT IN ('pending','scheduled') OR owner = %s )", $id, $user ) );
882
  }
883
  else {
884
- $result = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s AND status NOT IN ('pending','private','scheduled' )", $id ) );
885
  }
886
  $cache[$id] = $result;
887
  return $result;
@@ -911,7 +823,7 @@ static $cache;
911
  return $result;
912
  }
913
 
914
- // Get array of subalbum ids
915
  function wppa_get_sub_album_ids( $id ) {
916
  global $wpdb;
917
  static $cache;
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
+ * Version 8.2.04.008
8
  *
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
12
 
13
  // show system statistics
14
+ function wppa_show_statistics() {
 
 
 
 
15
 
16
  $count = wppa_get_total_album_count();
17
  $y_id = wppa_get_youngest_album_id();
31
 
32
  $result .= '.</div>';
33
 
34
+ wppa_out( $result );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  // get number of albums in system
227
  }
228
  }
229
 
230
+ // Flush uploader cache selectively
 
 
 
 
 
 
231
  function wppa_flush_upldr_cache( $key = '', $id = '' ) {
232
 
233
+ $upldrcache = wppa_get_option( 'wppa_upldr_cache', array() );
234
 
235
  foreach ( array_keys( $upldrcache ) as $widget_id ) {
236
 
268
  update_option('wppa_upldr_cache', $upldrcache);
269
  }
270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  // Mark treecounts of album $alb as being update required, default: clear all
272
  function wppa_invalidate_treecounts( $alb = '' ) {
273
  global $wpdb;
589
  function wppa_is_album_empty( $id ) {
590
  global $wpdb;
591
 
592
+ // Subalbums?
593
  $has_albums = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
594
  if ( $has_albums ) {
595
  return false;
596
  }
597
 
598
+ // Photos?
599
  $has_photos = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $id ) );
600
  if ( $has_photos ) {
601
  return false;
602
  }
603
 
604
+ // Deleted photos?
605
  $has_deleted_photos = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", - ( $id + '9' ) ) );
606
  if ( $has_deleted_photos ) {
607
  return false;
681
 
682
  // Get number of visible 1st generation albums
683
  function wppa_get_visible_album_count( $id ) {
 
684
 
685
  $result = '0';
686
 
793
  $result = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s AND ( status NOT IN ('pending','scheduled') OR owner = %s )", $id, $user ) );
794
  }
795
  else {
796
+ $result = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s AND status NOT IN ('pending','private','scheduled')", $id ) );
797
  }
798
  $cache[$id] = $result;
799
  return $result;
823
  return $result;
824
  }
825
 
826
+ // Get array of subalbum ids, not checked for visibility
827
  function wppa_get_sub_album_ids( $id ) {
828
  global $wpdb;
829
  static $cache;
wppa-upldr-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
- * Version 8.2.04.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -36,7 +36,7 @@ class UpldrWidget extends WP_Widget {
36
 
37
  $page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus' ));
38
  $ignorelist = explode(',', $instance['ignore']);
39
- $upldrcache = wppa_get_upldr_cache();
40
  $needupdate = false;
41
  $users = wppa_get_users();
42
  $workarr = array();
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
+ * Version 8.2.04.008
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
36
 
37
  $page = in_array( 'album', wppa( 'links_no_page' ) ) ? '' : wppa_get_the_landing_page('upldr_widget_linkpage', __('User uploaded photos', 'wp-photo-album-plus' ));
38
  $ignorelist = explode(',', $instance['ignore']);
39
+ $upldrcache = wppa_get_option( 'wppa_upldr_cache', array() );
40
  $needupdate = false;
41
  $users = wppa_get_users();
42
  $workarr = array();
wppa-users.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
- * Version 8.1.09.003
7
  *
8
  */
9
 
@@ -133,6 +133,10 @@ function wppa_user_is( $role, $user_id = null ) {
133
  }
134
  }
135
 
 
 
 
 
136
  // Test if current user has extended access
137
  // returns bool
138
  function wppa_extended_access() {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
+ * Version 8.2.04.008
7
  *
8
  */
9
 
133
  }
134
  }
135
 
136
+ function wppa_user_is_admin() {
137
+ return wppa_user_is( 'administrator' );
138
+ }
139
+
140
  // Test if current user has extended access
141
  // returns bool
142
  function wppa_extended_access() {
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.04.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_api_version;
27
- $wppa_api_version = '8.2.04.007'; // 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.2.04.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_api_version;
27
+ $wppa_api_version = '8.2.04.008'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30