WP Photo Album Plus - Version 8.2.09.103

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

Code changes from version 8.3.01.005 to 8.2.09.103

Files changed (54) hide show
  1. changelog.txt +7 -15
  2. js/wppa-admin-scripts.js +5 -7
  3. js/wppa-admin-scripts.min.js +1 -1
  4. wppa-admin-functions.php +82 -429
  5. wppa-admin-local-js.php +0 -335
  6. wppa-admin-styles.css +33 -29
  7. wppa-admin.php +27 -143
  8. wppa-adminbar.php +24 -24
  9. wppa-ajax.php +5 -4
  10. wppa-album-admin-autosave.php +548 -422
  11. wppa-album-covers.php +261 -293
  12. wppa-album-widget.php +4 -4
  13. wppa-boxes-html.php +10 -10
  14. wppa-breadcrumb.php +4 -4
  15. wppa-cache.php +4 -3
  16. wppa-comment-admin.php +11 -22
  17. wppa-common-functions.php +2 -2
  18. wppa-defaults.php +5 -1
  19. wppa-edit-email.php +224 -31
  20. wppa-edit-sequence.php +7 -3
  21. wppa-edit-tags.php +22 -15
  22. wppa-export.php +4 -4
  23. wppa-functions.php +24 -16
  24. wppa-gutenberg-wppa.php +2 -2
  25. wppa-help.php +2 -4
  26. wppa-import.php +2 -6
  27. wppa-init.php +3 -3
  28. wppa-input.php +18 -3
  29. wppa-lasten-widget.php +3 -3
  30. wppa-links.php +13 -13
  31. wppa-listtable.php +0 -1320
  32. wppa-maintenance.php +5 -5
  33. wppa-photo-admin-autosave.php +1378 -1324
  34. wppa-picture.php +2 -2
  35. wppa-search-widget.php +2 -2
  36. wppa-setting-see-also.php +2 -2
  37. wppa-settings-autosave.php +75 -43
  38. wppa-setup.php +2 -2
  39. wppa-slideshow-widget.php +4 -4
  40. wppa-slideshow.php +2 -2
  41. wppa-statistics.php +7 -7
  42. wppa-thumbnails.php +12 -1
  43. wppa-tinymce-shortcodes.php +2 -2
  44. wppa-topten-widget.php +4 -4
  45. wppa-upldr-widget.php +2 -2
  46. wppa-upload-common.php +2 -2
  47. wppa-upload-widget.php +3 -3
  48. wppa-upload.php +2 -4
  49. wppa-users.php +1 -16
  50. wppa-utils.php +2 -2
  51. wppa-widget-functions.php +2 -2
  52. wppa-wpdb-update.php +1 -6
  53. wppa-wrappers.php +2 -4
  54. wppa.php +2 -2
changelog.txt CHANGED
@@ -1,13 +1,5 @@
1
  WP Photo Album Plus Changelog
2
 
3
- = 8.3.01 =
4
-
5
- * Maintenance release
6
- * It is now properly detected when an album owner no longer exists.
7
- * Many textual corrections.
8
- * Pagination of admin pages made like the wp style, with the addition of page size selection at the top.
9
- Admin page sizes are no longer in the settings page, but user individually remembered by transient options.
10
-
11
  = 8.2.09 =
12
 
13
  * New admin page: Email admin. Enables adding/removing subscribers from the various wppa email lists as well as enabling, disabling and clearing lists.
@@ -68,12 +60,12 @@ depends upon their own status when they are explicitly requested e.g. by a short
68
 
69
  * The display of the album and photo admin page has been restructured. Phase II
70
  * You can now enter exif dates ending in 00 min and 00 sec.
71
- * New album setting: Max sub albums. This setting only limits the creation of sub albums at the frontend and looks at direct sub albums only.
72
 
73
  = 8.2.02 =
74
 
75
  * Introduction of native blocks: Photo of the day, upload and simple slideshow. Usable for posts/pages and widgets.
76
- * Textual corrections. The use of 'sub album' is now consistent.
77
  * Emai callback urls did not work when refuse unencrypted is enabled. Fixed.
78
  * The display of the album and photo admin page has been restructured.
79
 
@@ -461,7 +453,7 @@ Alternatively you can supply attribute parent="<parent id>" where parent id may
461
  = 7.6.07 =
462
 
463
  * Speeded up by caching the list of sub(sub...)albums of any album.
464
- This reduces the number of db queries in certain circumstances e.g. when the coverimage selection method is set to random or most recent from sub albums.
465
  * The new photo description as defined in Table IX-D5 is now applied to all media types, if not overruled by the user and required by Table IX-D3.
466
  * Fixed a layout issue in masonry thumbnails while using Tabby.
467
  * The number of colums on mobile devices when thumbnail type is Masonry Columns is now half the number on pc.
@@ -681,7 +673,7 @@ In this case one should not cache the widget.
681
  This type is like masonry style vertical, but is fully mobile friendly.
682
  2. Masonry style mix. Uses Masonry style vert on pc and plus on mobile. Best of two worlds.
683
  * Some minor fixes.
684
- * New setting: Table VII-B1.0: Max nesting level. Limits the ability to create sub albums at the frontend to the indicated level.
685
  The album nesting level is displayed in parenthesis on the album admin page next to the id.
686
 
687
  = 7.3.10 =
@@ -729,7 +721,7 @@ Setting this for an administrator or a superuser has no effect.
729
  = 7.3.06 =
730
 
731
  * Table VI-C8: Album navigator Link has been moved to Table VI-A3.1 and the options are extended.
732
- * To Table VI-C11: Album cover sub albums link, added option "Sub album title link". This also supports the otpion "the link page with a clean url" when set on the album admin page.
733
  * Added cache and delay checkboxes to shortcode generators.
734
  * Wppa cache is now also automatically cleard when a page or post is saved that contains a wppa shortcode.
735
  * Fixed a layout issue when Table IX-L3 (size of [photo] shortcode photo) was set to a fraction i.e. a positive value < 1.0;
@@ -826,7 +818,7 @@ If an update comes with a changed default value, and the setting had been set to
826
  The parent attribute overrules a possible album attribute.
827
  The parent attribute may be an enumeration of parent ids.
828
  Note that parent="0" means: all non separate albums, and parent="-1" means: all separate albums.
829
- * The most recent status of the 'opened' lists of sub albums of the album table on the album admin page is now remembered like the open tables of the settings page.
830
  * New setting: Table IX-E23. In case of conflicts you can set the form method for search to 'get' as opposed to 'post'.
831
 
832
  = 7.2.14 =
@@ -975,7 +967,7 @@ It will now be updated immediately when update is pending and the value is reque
975
  * Changed defaults for Table IX-D19 and IX-D20 as this seems to be the most convenient.
976
  * The mailing of frontload upload notifications will now combine multiple photos in one notification email for photos that have the same owner and are in the same album,
977
  and the uploads have been done during a period of max 5 minutes.
978
- * For users who can create (sub) albums, the uplaod widget and the box created by [wppa type="upload"] will now show a selectionbox of parents where the user can create a sub album.
979
  The selectionbox may contain --- none --- and --- separate --- if the user can create toplevel albums.
980
  * The number of downloads as enabled in Table VI-C1.x is now registered.
981
  * Added w#dlcount as photo description keyword to display the download count.
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
3
  = 8.2.09 =
4
 
5
  * New admin page: Email admin. Enables adding/removing subscribers from the various wppa email lists as well as enabling, disabling and clearing lists.
60
 
61
  * The display of the album and photo admin page has been restructured. Phase II
62
  * You can now enter exif dates ending in 00 min and 00 sec.
63
+ * New album setting: Max subalbums. This setting only limits the creation of sub albums at the frontend and looks at direct subalbums only.
64
 
65
  = 8.2.02 =
66
 
67
  * Introduction of native blocks: Photo of the day, upload and simple slideshow. Usable for posts/pages and widgets.
68
+ * Textual corrections. The use of 'subalbum' is now consistent.
69
  * Emai callback urls did not work when refuse unencrypted is enabled. Fixed.
70
  * The display of the album and photo admin page has been restructured.
71
 
453
  = 7.6.07 =
454
 
455
  * Speeded up by caching the list of sub(sub...)albums of any album.
456
+ This reduces the number of db queries in certain circumstances e.g. when the coverimage selection method is set to random or most recent from subalbums.
457
  * The new photo description as defined in Table IX-D5 is now applied to all media types, if not overruled by the user and required by Table IX-D3.
458
  * Fixed a layout issue in masonry thumbnails while using Tabby.
459
  * The number of colums on mobile devices when thumbnail type is Masonry Columns is now half the number on pc.
673
  This type is like masonry style vertical, but is fully mobile friendly.
674
  2. Masonry style mix. Uses Masonry style vert on pc and plus on mobile. Best of two worlds.
675
  * Some minor fixes.
676
+ * New setting: Table VII-B1.0: Max nesting level. Limits the ability to create subalbums at the frontend to the indicated level.
677
  The album nesting level is displayed in parenthesis on the album admin page next to the id.
678
 
679
  = 7.3.10 =
721
  = 7.3.06 =
722
 
723
  * Table VI-C8: Album navigator Link has been moved to Table VI-A3.1 and the options are extended.
724
+ * To Table VI-C11: Album cover subalbums link, added option "Subalbum title link". This also supports the otpion "the link page with a clean url" when set on the album admin page.
725
  * Added cache and delay checkboxes to shortcode generators.
726
  * Wppa cache is now also automatically cleard when a page or post is saved that contains a wppa shortcode.
727
  * Fixed a layout issue when Table IX-L3 (size of [photo] shortcode photo) was set to a fraction i.e. a positive value < 1.0;
818
  The parent attribute overrules a possible album attribute.
819
  The parent attribute may be an enumeration of parent ids.
820
  Note that parent="0" means: all non separate albums, and parent="-1" means: all separate albums.
821
+ * The most recent status of the 'opened' lists of subalbums of the album table on the album admin page is now remembered like the open tables of the settings page.
822
  * New setting: Table IX-E23. In case of conflicts you can set the form method for search to 'get' as opposed to 'post'.
823
 
824
  = 7.2.14 =
967
  * Changed defaults for Table IX-D19 and IX-D20 as this seems to be the most convenient.
968
  * The mailing of frontload upload notifications will now combine multiple photos in one notification email for photos that have the same owner and are in the same album,
969
  and the uploads have been done during a period of max 5 minutes.
970
+ * For users who can create (sub) albums, the uplaod widget and the box created by [wppa type="upload"] will now show a selectionbox of parents where the user can create a subalbum.
971
  The selectionbox may contain --- none --- and --- separate --- if the user can create toplevel albums.
972
  * The number of downloads as enabled in Table VI-C1.x is now registered.
973
  * Added w#dlcount as photo description keyword to display the download count.
js/wppa-admin-scripts.js CHANGED
@@ -1,7 +1,7 @@
1
  /* admin-scripts.js */
2
  /* Package: wp-photo-album-plus
3
  /*
4
- /* Version 8.3.01.001
5
  /* Various js routines used in admin pages
6
  */
7
 
@@ -1053,7 +1053,7 @@ function wppaAjaxUpdateOptionCheckBox(slug, elm) {
1053
  '&wppa-nonce='+document.getElementById('wppa-nonce').value;
1054
  if (elm.checked) myData += '&value=yes';
1055
  else myData += '&value=no';
1056
-
1057
  // jQuery('#img_'+slug).attr('src',wppaImageDirectory+'spinner.gif');
1058
 
1059
  jQuery.ajax( { url: wppaAjaxUrl,
@@ -1071,7 +1071,7 @@ function wppaAjaxUpdateOptionCheckBox(slug, elm) {
1071
  if (ArrValues[0] != '') {
1072
  alert('The server returned unexpected output:\n'+ArrValues[0]);
1073
  }
1074
-
1075
  switch (ArrValues[1]) {
1076
  case '0': // No error
1077
  jQuery('#img_'+slug).attr('src',wppaImageDirectory+'tick.png');
@@ -2064,9 +2064,7 @@ function wppaSetThumbsize( elm ) {
2064
  jQuery(document).ready( function() {
2065
  if ( !document.getElementById( 'wppa-bulk-action' ) ) return;
2066
  var action = wppa_getCookie( 'wppa_bulk_action' );
2067
- if ( action != '' ) {
2068
- document.getElementById( 'wppa-bulk-action' ).value = action;
2069
- }
2070
  if ( action == 'wppa-bulk-move-to' || action == 'wppa-bulk-copy-to' ) {
2071
  jQuery( '#wppa-bulk-album' ).css( 'display','inline' );
2072
  document.getElementById( 'wppa-bulk-album' ).value = wppa_getCookie( 'wppa_bulk_album' );
@@ -2136,7 +2134,7 @@ function wppaAjaxReplaceLog() {
2136
  },
2137
  success: function( result, status, xhr ) {
2138
  result = wppaEntityDecode(result);
2139
- jQuery( "#wppa-logbody" ).html( result.substr( 1 ));
2140
  jQuery( "#wppa-spinner" ).hide();
2141
  }
2142
  });
1
  /* admin-scripts.js */
2
  /* Package: wp-photo-album-plus
3
  /*
4
+ /* Version 8.2.09.001
5
  /* Various js routines used in admin pages
6
  */
7
 
1053
  '&wppa-nonce='+document.getElementById('wppa-nonce').value;
1054
  if (elm.checked) myData += '&value=yes';
1055
  else myData += '&value=no';
1056
+
1057
  // jQuery('#img_'+slug).attr('src',wppaImageDirectory+'spinner.gif');
1058
 
1059
  jQuery.ajax( { url: wppaAjaxUrl,
1071
  if (ArrValues[0] != '') {
1072
  alert('The server returned unexpected output:\n'+ArrValues[0]);
1073
  }
1074
+
1075
  switch (ArrValues[1]) {
1076
  case '0': // No error
1077
  jQuery('#img_'+slug).attr('src',wppaImageDirectory+'tick.png');
2064
  jQuery(document).ready( function() {
2065
  if ( !document.getElementById( 'wppa-bulk-action' ) ) return;
2066
  var action = wppa_getCookie( 'wppa_bulk_action' );
2067
+ document.getElementById( 'wppa-bulk-action' ).value = action;
 
 
2068
  if ( action == 'wppa-bulk-move-to' || action == 'wppa-bulk-copy-to' ) {
2069
  jQuery( '#wppa-bulk-album' ).css( 'display','inline' );
2070
  document.getElementById( 'wppa-bulk-album' ).value = wppa_getCookie( 'wppa_bulk_album' );
2134
  },
2135
  success: function( result, status, xhr ) {
2136
  result = wppaEntityDecode(result);
2137
+ jQuery( "#wppa-logbody" ).html( result );
2138
  jQuery( "#wppa-spinner" ).hide();
2139
  }
2140
  });
js/wppa-admin-scripts.min.js CHANGED
@@ -1 +1 @@
1
- function checkjQueryRev(e,t,a){var p=parseFloat(jQuery.fn.jquery);t.checked&&p<a&&(alert(e+"\nThe version of your jQuery library: "+p+" is too low for this feature. It requires version "+a),t.checked="")}function wppaReUpload(e,o,t,r){document.getElementById("wppa-re-up-form-"+o);var a=document.getElementById("wppa-re-up-file-"+o),u=document.getElementById("wppa-re-up-butn-"+o);e.preventDefault();a=a.files[0];if(a.type.match("image.*")){if(0==t.length)alert("Filename will be set to "+a.name);else if(a.name!=t&&!confirm("Filename is different.\nIf you continue, the filename will not be updated!.\n\nContinue?"))return void jQuery("#re-up-"+o).css("display","none");u.value="Uploading...",u.style.color="black";t=new FormData;t.append("photo",a,a.name);var i=new XMLHttpRequest,a="?action=wppa&wppa-action=update-photo&photo-id="+o+"&item=file&wppa-nonce="+document.getElementById("photo-nonce-"+o).value;i.open("POST",wppaAjaxUrl+a,!0),i.onload=function(){if(200===i.status){var e=wppaTrim(i.responseText).split("||");switch(""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),e[1]){case"0":var t,a,p,n=JSON.parse(e[2]);for(t in n)switch(p=n[t],t){case"remark":p=(p=(p=p.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),a="0"!=e[1]?'<span style="color:red;" >'+p+"</span>":'<span style="color:green;" >'+p+"</span>",r&&(a+=' <span style="color:blue;" >Reloading...</span>'),jQuery("#remark-"+o).html(a);break;case"photourl":wppaCropper[o]?wppaCropper[o].replace(p):jQuery("#photourl-"+o).attr("src",p),jQuery("#thumba-"+o).attr("href",p);break;case"thumburl":jQuery("#thumburl-"+o).attr("src",p);break;case"magickstack":jQuery("#magickstack-"+o).html(p),0<p.length?jQuery("#imstackbutton-"+o).css("display","inline"):jQuery("#imstackbutton-"+o).css("display","none");break;default:jQuery("#"+t+"-"+o).html(p)}u.value="Upload",jQuery("#re-up-"+o).css("display","none");break;case"99":document.getElementById("photoitem-"+o).innerHTML='<span style="color:red">'+e[2]+"</span>";break;default:document.getElementById("remark-"+o).innerHTML='<span style="color:red">'+e[2]+" ("+e[1]+")</span>",u.value="Error occured",u.style.color="red"}}else alert("An error occurred!")},i.send(t)}else alert("File is not an image file!")}jQuery(document).ready(function(){jQuery(window).on("DOMContentLoaded load resize scroll",function(){wppaMakeLazyVisible("windowon")}),wppaMakeLazyVisible("docready")});var _wppaRefreshAfter=!1;function wppaRefreshAfter(){_wppaRefreshAfter=!0}function wppaCheckWidgetMethod(){var e,t,a;if("4"==document.getElementById("wppa-wm").value?(document.getElementById("wppa-wp").style.visibility="visible","day-of-week"==(a=jQuery("#wppa-wp").val())||"day-of-month"==a||"day-of-year"==a?jQuery(".wppa-order").css("visibility",""):jQuery(".wppa-order").css("visibility","hidden")):(document.getElementById("wppa-wp").style.visibility="hidden",jQuery(".wppa-order").css("visibility","hidden")),"1"==document.getElementById("wppa-wm").value)for(e=document.getElementsByName("wppa-widget-photo"),t=0;t<e.length;)e[t].style.visibility="visible",t++;else for(e=document.getElementsByName("wppa-widget-photo"),t=0;t<e.length;)e[t].style.visibility="hidden",t++}function wppa_tablecookieon(e){wppa_setCookie("table_"+e,"on","365")}function wppa_tablecookieoff(e){wppa_setCookie("table_"+e,"off","365")}function wppaCookieCheckbox(e,t){e.checked?wppa_setCookie(t,"on","365"):wppa_setCookie(t,"off","365")}function wppa_move_up(e){document.location=wppa_moveup_url+e+"&wppa-nonce="+document.getElementById("wppa-nonce").value}function checkColor(e){var t=e.substr(5),e=jQuery("#"+t).val();jQuery("#colorbox-"+t).css("background-color",e)}function checkAll(e,t){e=document.getElementById(e);e&&(e.checked?jQuery(t).prop("checked",!0):jQuery(t).prop("checked",!1))}function impUpd(e,t){e.checked?(jQuery(t).val(wppa_update),jQuery(".hideifupdate").css("display","none")):(jQuery(t).val(wppa_import),jQuery(".hideifupdate").css("display",""))}function wppaAjaxDeletePhoto(t,e,a,p){var n="",o="",n=e||'<div style="padding-left:5px;" >';a?o=a:aftrer="</div>",wppaFeAjaxLog("in");var r=wppaGetXmlHttp(),a=wppaAjaxUrl+"?action=wppa&wppa-action=delete-photo&photo-id="+t;a+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,p&&(a+="&wppa-immediate=1"),r.open("GET",a,!0),r.send(),r.onreadystatechange=function(){switch(r.readyState){case 1:document.getElementById("remark-"+t).innerHTML="server connection established";break;case 2:document.getElementById("remark-"+t).innerHTML="request received";break;case 3:document.getElementById("remark-"+t).innerHTML="processing request";break;case 4:var e;200==r.status?("ER"==(e=wppaTrim(r.responseText).split("||"))[0]?(e[3]&&alert(e[3]),jQuery("#wppa-delete-"+t).css("text-decoration","line-through")):""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),0==e[1]?document.getElementById("remark-"+t).innerHTML=e[2]:(document.getElementById("photoitem-"+t).innerHTML=n+e[2]+o,wppaProcessFull(e[3],e[4])),jQuery(window).trigger("scroll"),wppaFeAjaxLog("out")):document.getElementById("photoitem-"+t).innerHTML=n+'<span style="color:red;" >Comm error '+r.status+": "+r.statusText+"</span>"+o}}}function wppaAjaxUndeletePhoto(t){wppaFeAjaxLog("in");var a=wppaGetXmlHttp(),e=wppaAjaxUrl+"?action=wppa&wppa-action=undelete-photo&photo-id="+t;e+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,a.open("GET",e,!0),a.send(),a.onreadystatechange=function(){switch(a.readyState){case 1:document.getElementById("remark-"+t).innerHTML="server connection established";break;case 2:document.getElementById("remark-"+t).innerHTML="request received";break;case 3:document.getElementById("remark-"+t).innerHTML="processing request";break;case 4:var e;200==a.status?("ER"==(e=wppaTrim(a.responseText).split("||"))[0]?(e[3]&&alert(e[3]),jQuery("#wppa-delete-"+t).css("text-decoration","line-through")):""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),0==e[1]?document.getElementById("remark-"+t).innerHTML=e[2]:document.getElementById("photoitem-"+t).innerHTML='<div style="padding-left:5px;" >'+e[2]+"</div>",wppaFeAjaxLog("out")):document.getElementById("photoitem-"+t).innerHTML=before+'<span style="color:red;" >Comm error '+a.status+": "+a.statusText+"</span>"+after}}}function wppaAjaxDeleteExportZips(){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=delexportzips",async:!1,type:"GET",timeout:6e4,success:function(e,t,a){document.location.reload(!0)},error:function(e,t,a){wppaConsoleLog("wppaAjaxDeleteExportZips failed. Error = "+a+", status = "+t)}})}function wppaAjaxApplyWatermark(t,e,a){wppaFeAjaxLog("in");var p=wppaGetXmlHttp();jQuery("#wppa-water-spin-"+t).css({visibility:"visible"});var n="action=wppa&wppa-action=watermark-photo&photo-id="+t;n+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,e&&(n+="&wppa-watermark-file="+e),a&&(n+="&wppa-watermark-pos="+a),p.open("POST",wppaAjaxUrl,!0),p.setRequestHeader("Content-type","application/x-www-form-urlencoded"),p.send(n),p.onreadystatechange=function(){var e;4==p.readyState&&(200==p.status?(""!=(e=wppaTrim(p.responseText).split("||"))[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?(document.getElementById("remark-"+t).innerHTML=e[2],setTimeout(function(){document.location.reload(!0)},500)):document.getElementById("remark-"+t).innerHTML='<span style="color:red">'+e[2]+"</span>",jQuery("#wppa-water-spin-"+t).css({visibility:"hidden"}),wppaFeAjaxLog("out")):document.getElementById("remark-"+t).innerHTML='<span style="color:red;" >Comm error '+p.status+": "+p.statusText+"</span>")}}function wppaAjaxUpdateIptc(i,e,t,a){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-iptc&photo-id="+i+"&item="+e+"&wppa-nonce="+document.getElementById("photo-nonce-"+i).value+"&value="+wppaEncode(t)+"&tagname="+a,async:!0,type:"POST",timeout:6e4,beforeSend:function(e){jQuery("#remark-"+i).html("Working, please wait...")},success:function(e,t,a){var p=wppaTrim(e).split("||");if(""!=p[0]&&alert("The server returned unexpected output:\n"+p[0]),"99"===p[1])jQuery("#photoitem-"+i).html(bef+'<span style="color:red">'+p[2]+"</span>"+aft);else{var n,o,r,u=JSON.parse(p[2]);for(n in u)switch(r=u[n],n){case"remark":r=(r=(r=r.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),o="0"!=p[1]?'<span style="color:red;" >'+r+"</span>":'<span style="color:green;" >'+r+"</span>",jQuery("#remark-"+i).html(o);break;case"photourl":wppaCropper[i]?wppaCropper[i].replace(r):jQuery("#photourl-"+i).attr("src",r),jQuery("#thumba-"+i).attr("href",r);break;case"thumburl":jQuery("#thumburl-"+i).attr("src",r);break;case"magickstack":jQuery("#magickstack-"+i).html(r),0<r.length?jQuery("#imstackbutton-"+i).css("display","inline"):jQuery("#imstackbutton-"+i).css("display","none")}}wppaFeAjaxLog("out")},error:function(e,t,a){jQuery("#remark-"+i).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("wppaAjaxUpdatePhoto failed. Error = "+a+", status = "+t)},complete:function(e,t,a){jQuery("#wppa-admin-spinner").css("display","none"),jQuery(window).trigger("scroll")}})}function wppaAjaxUpdatePhoto(i,l,e,c,s,d){s=s||"",d=d||"",wppaFeAjaxLog("in"),jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-photo&photo-id="+i+"&item="+l+"&wppa-nonce="+document.getElementById("photo-nonce-"+i).value+"&value="+wppaEncode(e),async:!0,type:"POST",timeout:6e4,beforeSend:function(e){"description"==l&&jQuery("#wppa-photo-spin-"+i).css({visibility:"visible"}),jQuery("#remark-"+i).html("Working, please wait...")},success:function(e,t,a){var p=wppaTrim(e).split("||");if(""!=p[0]&&alert("The server returned unexpected output:\n"+p[0]),"99"===p[1])jQuery("#photoitem-"+i).html(s+'<span style="color:red">'+p[2]+"</span>"+d);else{var n,o,r,u=JSON.parse(p[2]);for(n in u)switch(r=u[n],n){case"remark":r=(r=(r=r.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),o="0"!=p[1]?'<span style="color:red;" >'+r+"</span>":'<span style="color:green;" >'+r+"</span>",c&&(o+=' <span style="color:blue;" >Reloading...</span>'),jQuery("#remark-"+i).html(o);break;case"photourl":wppaCropper[i]?wppaCropper[i].replace(r):jQuery("#photourl-"+i).attr("src",r),jQuery("#thumba-"+i).attr("href",r);break;case"thumburl":jQuery("#thumburl-"+i).attr("src",r);break;case"magickstack":jQuery("#magickstack-"+i).html(r),0<r.length?jQuery("#imstackbutton-"+i).css("display","inline"):jQuery("#imstackbutton-"+i).css("display","none");break;default:jQuery("#"+n+"-"+i).html(r)}}"description"==l&&jQuery("#wppa-photo-spin-"+i).css({visibility:"hidden"}),wppaFeAjaxLog("out")},error:function(e,t,a){jQuery("#remark-"+i).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("wppaAjaxUpdatePhoto failed. Error = "+a+", status = "+t)},complete:function(e,t,a){var p=(p=document.location.href).replace(/&pano-val=./,"");c?setTimeout(function(){document.location.href=p},300):(jQuery("#wppa-admin-spinner").css("display","none"),jQuery(window).trigger("scroll"))}})}function wppaChangeScheduleAlbum(e,t){jQuery(t).prop("checked")?jQuery(".wppa-datetime-"+e).css("display","inline"):(jQuery(".wppa-datetime-"+e).css("display","none"),wppaAjaxUpdateAlbum(e,"scheduledtm",Math.rand()))}function wppaChangeScheduleDelAlbum(e,t){jQuery(t).prop("checked")?jQuery(".wppa-datetimedel-"+e).css("display","inline"):(jQuery(".wppa-datetimedel-"+e).css("display","none"),wppaAjaxUpdateAlbum(e,"scheduledel",Math.rand()))}var _wppaRefreshAfter=!1,wppaAjaxAlbumCount=0,wppaAlbumUpdateMatrix=new Array;function wppaAjaxUpdateAlbum(e,t,a,p){var n=0==jQuery("#wppaalbumdesc:visible").length;jQuery("#wppaalbumdesc-html").click();for(var o=wppaAlbumUpdateMatrix.length,r=0,u=!1,i=-1;r<o;)wppaAlbumUpdateMatrix[r][0]==e&&wppaAlbumUpdateMatrix[r][1]==t&&(u=!0,i=r),r++;u||(wppaAlbumUpdateMatrix[o]=[e,t,"undefined",!1,!1,p],i=o),a=a.value||a,wppaAlbumUpdateMatrix[i][3]=a,wppaAlbumUpdateMatrix[i][5]=p,wppaAjaxUpdateAlbumMonitor(n)}function wppaAjaxUpdateAlbumMonitor(e){for(var t=wppaAlbumUpdateMatrix.length,a=0;a<t;)wppaAlbumUpdateMatrix[a][2]==wppaAlbumUpdateMatrix[a][3]||wppaAlbumUpdateMatrix[a][4]||(wppaAlbumUpdateMatrix[a][4]=!0,_wppaAjaxUpdateAlbum(wppaAlbumUpdateMatrix[a][0],wppaAlbumUpdateMatrix[a][1],wppaAlbumUpdateMatrix[a][3],e,wppaAlbumUpdateMatrix[a][5])),a++;e&&jQuery("#wppaalbumdesc-tmce").click()}function _wppaAjaxUpdateAlbum(r,u,i,l,c){wppaAjaxAlbumCount++;jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-album&album-id="+r+"&item="+u+"&wppa-nonce="+document.getElementById("album-nonce-"+r).value+"&value="+wppaEncode(i),async:!0,type:"POST",timeout:6e4,beforeSend:function(e){"description"==u&&jQuery("#wppa-album-spin").css({visibility:"visible"}),jQuery("#albumstatus-"+r).html("Working, please wait... ("+wppaAjaxAlbumCount+")")},success:function(e,t,a){e=wppaTrim(e).split("||");if(wppaAjaxAlbumCount--,""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?0==wppaAjaxAlbumCount?(jQuery("#albumstatus-"+r).html(e[2]),wppaGetCoverPreview&&wppaGetCoverPreview(r,"cover-preview-"+r)):jQuery("#albumstatus-"+r).html("Working, please wait... ("+wppaAjaxAlbumCount+")"):jQuery("#albumstatus-"+r).html='<span style="color:red">'+e[2]+" ("+e[1]+")</span>",void 0!==e[3]&&wppaProcessFull(e[3],e[4]),c&&"0"==e[1])return jQuery("#albumstatus-"+r).after('<span style="color:blue;font-weight:bold;"> Reloading...</span>'),jQuery("#wppa-admin-spinner").fadeIn(),void setTimeout(function(){wppaReload()},100);"cover_linktype"==u&&("manual"==i?(jQuery("#link-url-tr").show(),jQuery("#-link-url-tr").hide()):(jQuery("#link-url-tr").hide(),jQuery("#-link-url-tr").show())),"description"==u&&jQuery("#wppa-album-spin").css({visibility:"hidden"});for(var p=0,n=-1,o=wppaAlbumUpdateMatrix.length;p<o;)wppaAlbumUpdateMatrix[p][0]==r&&wppaAlbumUpdateMatrix[p][1]==u&&(n=p),p++;wppaAlbumUpdateMatrix[n][2]=i||0,wppaAlbumUpdateMatrix[n][4]=!1,wppaAlbumUpdateMatrix[n][5]=!1,wppaAjaxUpdateAlbumMonitor(l)},error:function(e,t,a){wppaAjaxAlbumCount--,jQuery("#albumstatus-"+r).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("_wppaAjaxUpdateAlbum failed. Error = "+a+", status = "+t)},complete:function(e,t,a){}})}function wppaProcessFull(e,t){"full"==e&&(jQuery("#full").css("display",""),jQuery("#notfull").css("display","none")),"notfull"==e&&(jQuery("#full").css("display","none"),0<t?jQuery("#notfull").attr("value",wppaUploadToThisAlbum+" (max "+t+")"):jQuery("#notfull").attr("value",wppaUploadToThisAlbum),jQuery("#notfull").css("display",""))}function wppaAjaxUpdateCommentStatus(t,a,e){var p=wppaGetXmlHttp(),e=wppaAjaxUrl+"?action=wppa&wppa-action=update-comment-status&wppa-photo-id="+t+"&wppa-comment-id="+a+"&wppa-comment-status="+e+"&wppa-nonce="+document.getElementById("photo-nonce-"+t).value;p.onreadystatechange=function(){var e;4==p.readyState&&(200==p.status?(""!=(e=wppaTrim(p.responseText).split("||"))[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?jQuery("#remark-"+t).html(e[2]):jQuery("#remark-"+t).html('<span style="color:red">'+e[2]+"</span>"),jQuery("#wppa-comment-spin-"+a).css("visibility","hidden")):jQuery("#remark-"+t).html('<span style="color:red;" >Comm error '+p.status+": "+p.statusText+"</span>"))},p.open("GET",e,!0),p.send()}function wppaAjaxUpdateOptionCheckBox(p,e){var t="action=wppa&wppa-action=update-option&wppa-option="+p+"&wppa-nonce="+document.getElementById("wppa-nonce").value;e.checked?t+="&value=yes":t+="&value=no",jQuery.ajax({url:wppaAjaxUrl,data:t,async:!0,type:"POST",timeout:1e4,beforeSend:function(e,t){jQuery("#img_"+p).attr("src",wppaImageDirectory+"spinner.gif")},success:function(e,t,a){e=wppaTrim(e).split("||");""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?(jQuery("#img_"+p).attr("src",wppaImageDirectory+"tick.png"),jQuery("#img_"+p).attr("title",e[2])):(jQuery("#img_"+p).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+p).attr("title","Error #"+e[1]+", message: "+e[2]+", status: "+xmlhttp.status)),e[3]&&alert(e[3]),_wppaRefreshAfter&&(_wppaRefreshAfter=!1,document.location.reload(!0))},error:function(e,t,a){jQuery("#img_"+p).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+p).attr("title","Communication error, status = "+xmlhttp.status)},complete:function(){wppaCheckInconsistencies()}})}var wppaAlwaysContinue=100;function wppaMaintenanceProc(p,e,u){if(!u&&!e&&"yes"==document.getElementById(p+"_continue").value)return document.getElementById(p+"_continue").value="no",document.getElementById(p+"_button").value="Start!",void(0<jQuery("#"+p+"_togo").html()&&(jQuery("#"+p+"_status").html("Pausing..."),jQuery("#"+p+"_button").css("display","none")));u||(document.getElementById(p+"_continue").value="yes",document.getElementById(p+"_button").value="Stop!",""==jQuery("#"+p+"_status").html()&&jQuery("#"+p+"_status").html("Wait...")),jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=maintenance&slug="+p+"&wppa-nonce="+jQuery("#wppa-nonce").val()+(u?"&wppa-cron=1":""),async:!0,type:"POST",timeout:3e5,beforeSend:function(e){},success:function(e,t,a){var p,n=e.split("||"),o=n[1],r=!1;return o?(10<n[0].length&&(p=(p=n[0]).replace(/&gt;/g,">"),alert("An error occurred:\n"+p),r=!0),jQuery("#"+o+"_status").html(n[2]),jQuery("#"+o+"_togo").html(n[3]),jQuery("#"+o+"_button").css("display",""),r||"0"==n[3]?"reload"==n[4]?(alert("This page will now be reloaded to finish the operation. Please stay tuned..."),void wppaReload()):void setTimeout("wppaMaintenanceProc('"+o+"', false)",20):void(document.getElementById(o+"_continue")&&"yes"==document.getElementById(o+"_continue").value?setTimeout("wppaMaintenanceProc('"+o+"', true)",20):(u||jQuery("#"+o+"_status").html("Pending"),setTimeout(function(){wppaAjaxUpdateTogo(o)},1e3)))):(alert("The server returned unexpected output:\n"+e+"\nIf the current procedure has a Skip One button, press it before retrying. Reloading page..."),void wppaReload())},error:function(e,t,a){wppaConsoleLog("wppaMaintenanceProc failed. Slug = "+p+", Error = "+a+", status = "+t),jQuery("#"+p+"_status").html("Server error #"+(11-wppaAlwaysContinue));t=!1;--wppaAlwaysContinue<1&&(t=confirm("10 Server errors happened.\nDo you want to continue?"))&&(wppaAlwaysContinue=100),(t||0<wppaAlwaysContinue)&&("wppa_remake"==p&&wppaAjaxUpdateOptionValue("wppa_remake_skip_one",0),"wppa_regen_thumbs"==p&&wppaAjaxUpdateOptionValue("wppa_regen_thumbs_skip_one",0),"wppa_create_o1_files"==p&&wppaAjaxUpdateOptionValue("wppa_create_o1_files_skip_one",0),setTimeout("wppaMaintenanceProc('"+p+"', true)",2e3))},complete:function(e,t,a){}})}function wppaAjaxPopupWindow(e){switch(e){case"wppa_list_index":0;break;case"wppa_list_errorlog":0;break;case"wppa_list_rating":0;break;case"wppa_list_session":0;break;case"wppa_list_comments":0}var t=.9*wppaWindowWidth(),a=wppaGetXmlHttp(),p=wppaAjaxUrl,e="action=wppa&wppa-action=maintenancepopup&slug="+e;if(e+="&wppa-nonce="+document.getElementById("wppa-nonce").value,a.open("POST",p,!1),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(e),4==a.readyState&&200==a.status){e=wppaEntityDecode(a.responseText).split("|"),a=e[0];e[0]="";e=e.join("|").substring(1),t={modal:!0,resizable:!0,width:t,show:{effect:"fadeIn",duration:800},closeText:wppaCloseText};try{jQuery("#wppa-modal-container").dialog("destroy")}catch{jQuery("#wppa-modal-container").html("")}jQuery("#wppa-modal-container").html(e),jQuery("#wppa-modal-container").dialog(t),jQuery("#wppa-modal-container").css({width:"100%"}),jQuery(".ui-dialog").css({boxShadow:"0px 0px 5px 5px #aaaaaa",padding:"8px",backgroundColor:"#cccccc",boxSizing:"content-box",zIndex:"200200"}),jQuery(".ui-dialog-titlebar").css({lineHeight:"0px",height:"50px"}),jQuery(".ui-dialog-title").html("<h2>"+a+"</h2>"),jQuery(".ui-button").css({position:"absolute",top:"12px",right:"12px"}),jQuery(".ui-button").attr("title",wppaCloseText),jQuery(".ui-widget-overlay").css({backgroundColor:"transparent"}),setTimeout(function(){jQuery("#wppa-maintenance-list").niceScroll&&jQuery("#wppa-maintenance-list").niceScroll(".wppa-nicewrap",{})},1e3)}}function wppaAjaxUpdateOptionValue(i,e,t){var a="action=wppa&wppa-action=update-option&wppa-option="+wppaEncode(i)+"&wppa-nonce="+document.getElementById("wppa-nonce").value;0!=e&&(a+="number"==typeof e?"&value="+e:t?"&value="+wppaGetSelectionEnumByClass("."+i,","):"&value="+wppaEncode(e.value)),jQuery.ajax({url:wppaAjaxUrl,data:a,async:!0,type:"POST",timeout:1e5,beforeSend:function(e){jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"spinner.gif")},success:function(e,t,a){e=wppaTrim(e).split("||");if(""!=e[0])alert("The server returned unexpected output:\n"+e[0]);else if("0"===e[1]?(jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"tick.png"),e[3]&&alert(e[3]),_wppaRefreshAfter&&(_wppaRefreshAfter=!1,document.location.reload(!0))):(jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"cross.png"),e[3]&&alert(e[3])),jQuery("#img_"+i.replace("#","H")).attr("title",e[2]),e[4])for(var p,n,o,r=e[4].split(";"),u=0;u<r.length;)p=r[u].split(":"),n=jQuery("#"+p[0]).html(),o=p[1],""!=n&&""==o&&(o='<input type="button" class="button-secundary" style="border-radius:3px;font-size:11px;height:18px;margin: 0 4px;padding:0px;color:red;background-color:pink;" onclick="document.location.reload(true)" value="Reload" />'),jQuery("#"+p[0]).html(o),u++},error:function(e){jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+i.replace("#","H")).attr("title","Communication error")},complete:function(e){wppaCheckInconsistencies(),"spinner_shape"!=i&&"icon_corner_style"!=i||(wppaAjaxGetSpinnerHtml("normal","wppa-spin-pre-1"),wppaAjaxGetSpinnerHtml("lightbox","wppa-spin-pre-2")),"svg_color"!=i&&"svg_bg_color"!=i||wppaAjaxGetSpinnerHtml("normal","wppa-spin-pre-1"),"ovl_svg_color"!=i&&"ovl_svg_bg_color"!=i||wppaAjaxGetSpinnerHtml("lightbox","wppa-spin-pre-2")}})}function wppaEncode(e){if("string"!=typeof e)return e;var e=e,t=e.replace(/#/g,"||HASH||"),a=(e=t=(e=t).replace(/&/g,"||AMP||")).split("+"),p=0;for(t="";p<a.length;)t+=a[p],++p<a.length&&(t+="||PLUS||");return t}function wppaCheckInconsistencies(){jQuery("#use_thumb_popup").prop("checked")&&"lightbox"==jQuery("#thumb_linktype").val()?jQuery(".popup-lightbox-err").css("display",""):jQuery(".popup-lightbox-err").css("display","none")}function wppaGetXmlHttp(){return xmlhttp=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),xmlhttp}function wppaPhotoStatusChange(e){if(jQuery("#psdesc-"+e).css({display:"none"}),elm=document.getElementById("status-"+e),elm){if("pending"!=elm.value&&"scheduled"!=elm.value||jQuery("#photoitem-"+e).css({backgroundColor:"#ffebe8",borderColor:"#cc0000"}),"publish"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ffffe0",borderColor:"#e6db55"}),"featured"==elm.value){jQuery("#photoitem-"+e).css({backgroundColor:"#e0ffe0",borderColor:"#55ee55"});var t=document.getElementById("pname-"+e).value.split(".");if(1<t.length)for(var a=0;a<t.length;)"jpg"!=t[a]&&"JPG"!=t[a]||jQuery("#psdesc-"+e).css({display:""}),a++}"gold"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#eeeecc",borderColor:"#ddddbb"}),"silver"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ffffff",borderColor:"#eeeeee"}),"bronze"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ddddbb",borderColor:"#ccccaa"}),"private"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"transparent",borderColor:"#cccccc"}),"scheduled"==elm.value?jQuery(".wppa-datetime-"+e).css("display",""):jQuery(".wppa-datetime-"+e).css("display","none"),jQuery("#scheduledel-"+e).prop("checked")?jQuery(".wppa-del-datetime-"+e).css("display",""):jQuery(".wppa-del-datetime-"+e).css("display","none")}}function wppaSetComBgCol(e){"approved"==jQuery("#com-stat-"+e).val()?jQuery("#com-tr-"+e).css({backgroundColor:"#ffffe0"}):jQuery("#com-tr-"+e).css({backgroundColor:"#ffebe8"})}function wppaAddCat(e,t){wppaAddTag(e,t)}function wppaAddTag(e,t){t=document.getElementById(t);e&&(t.value?t.value+=","+e:t.value=e,"-clear-"==e&&(t.value=""))}function wppaRefresh(e){e=new String(document.location).split("#")[0]+"#"+e;document.location=e}function wppaReload(e){e?(url=document.location.href.split("#"),document.location.href=url[0]+e,setTimeout(function(){document.location.reload(!0)},10)):document.location.reload(!0)}var wppaFeCount=0;function wppaFeAjaxLog(e){"in"==e&&(0==wppaFeCount&&jQuery("#wppa-fe-exit").css("display","none"),wppaFeCount++,jQuery("#wppa-fe-count").html(wppaFeCount)),"out"==e&&(1==wppaFeCount&&(jQuery("#wppa-fe-count").html(""),jQuery("#wppa-fe-exit").css("display","inline"),wppaFeCount--),1<wppaFeCount&&(wppaFeCount--,jQuery("#wppa-fe-count").html(wppaFeCount)))}function wppaArrayToEnum(e,t){temp=e.sort(function(e,t){return e-t});for(var a,p="",n=-1,o=-2,r=0,u=!1,i=0;i<e.length;)0!=(a=e[i].valueOf())&&(r=n,a==++r?u=!0:u?(p+=n==o?t+n+t+a:t+t+n+t+a,u=!1):p+=t+a,u||(o=a,o++),n=a),i++;for(u&&(p+=".."+n);"."==p.substr(0,1);)p=p.substr(1);for(;p.substr(0,1)==t;)p=p.substr(1);return p}function wppaGetSelEnumToId(e,t){p=jQuery("."+e);var a=[];for(i=0,j=0;i<p.length;)p[i].selected&&(a[j]=p[i].value,j++),i++;jQuery("#"+t).val(wppaArrayToEnum(a,"."))}function wppaGetSelectionEnumByClass(e,t){var a,p=[],n=0,o=0;for(t=t||".",a=jQuery(e),o=n=0;n<a.length;)a[n].selected&&(p[o]=a[n].value,o++),n++;return wppaArrayToEnum(p,t)}function wppaEditSearch(e,t){t=jQuery("#"+t).val();0==t.length?alert("Please enter searchstring"):document.location.href=e+"&wppa-searchstring="+t}function wppaEditTrash(e){document.location.href=e}function wppaExportDbTable(p){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=export-table&table="+p,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){jQuery("#"+p+"-spin").css("display","inline")},success:function(e,t,a){e=e.split("||");"0"==e[1]?document.location=e[2]:alert("Error: "+e[1]+"\n\n"+e[2])},error:function(e,t,a){alert("Export Db Table "+p+" failed. Error = "+a+", status = "+t)},complete:function(e,t,a){jQuery("#"+p+"-spin").css("display","none")}})}function wppaDismissAdminNotice(e,t){wppaAjaxUpdateOptionCheckBox(e,t),jQuery("#wppa-wr-").css("display","none")}function wppaAjaxUpdateTogo(n){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=gettogo&slug="+n,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){},success:function(e,t,a){var p=e.split("|");jQuery("#"+n+"_togo").html(p[0]);e=jQuery("#"+n+"_status").html(),p=p[1];""!=e&&""==p&&(p='<input type="button" class="button-secundary" style="border-radius:3px;font-size:11px;height:18px;margin: 0 4px;padding:0px;color:red;background-color:pink;" onclick="document.location.reload(true)" value="Reload" />'),jQuery("#"+n+"_status").html(p),setTimeout(function(){wppaAjaxUpdateTogo(n)},1e3)},error:function(e){},complete:function(e){}})}function wppaIsEmpty(e){return(null==e||void 0===e||""==e||0==e)&&!0}function wppaTimedConfirm(e){var t={modal:!0,resizable:!1,width:400,show:{effect:"fadeIn",duration:800},closeText:"X",buttons:[{text:"NO",click:function(){jQuery(this).dialog("close")}},{text:"YES",click:function(){jQuery(this).dialog("close")}}]};jQuery("#wppa-modal-container").html(e).dialog(t).dialog("open"),jQuery(".ui-dialog").css({boxShadow:"0px 0px 5px 5px #aaaaaa",padding:"8px",backgroundColor:"#cccccc",boxSizing:"content-box",zIndex:"200200"}),jQuery(".ui-dialog-titlebar").css({lineHeight:"0px",height:"32px"}),jQuery(".ui-button").css({float:"right",position:"relative",bottom:"40px"}),jQuery(".ui-dialog-titlebar-close").css({display:"none"}),jQuery(".ui-widget-overlay").css({backgroundColor:"transparent"}),jQuery(".ui-button").attr("title",wppaCloseText),setTimeout(function(){jQuery(".ui-button").trigger("click")},6e4)}function wppaAjaxGetSpinnerHtml(e,p){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-option&wppa-option=getspinnerpreview&type="+e+"&wppa-nonce="+document.getElementById("wppa-nonce").value,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){},success:function(e,t,a){e=e.split("|");jQuery("#"+p).html(e[0])},error:function(e){},complete:function(e){}})}function wppaDragHorizon(t){var a=0,p=0;function n(e){(e=e||window.event).preventDefault(),a=p-e.clientY,p=e.clientY,t.style.top=t.offsetTop-a+"px"}function o(){document.onmouseup=null,document.onmousemove=null}t.onmousedown=function(e){(e=e||window.event).preventDefault(),pos3=e.clientX,p=e.clientY,document.onmouseup=o,document.onmousemove=n}}function wppaBulkActionChange(e,t){wppa_setCookie("wppa_bulk_action",e.value,365),"wppa-bulk-move-to"==e.value||"wppa-bulk-copy-to"==e.value?jQuery("#wppa-bulk-album").css("display","inline"):jQuery("#wppa-bulk-album").css("display","none"),"wppa-bulk-status"==e.value?jQuery("#wppa-bulk-status").css("display","inline"):jQuery("#wppa-bulk-status").css("display","none"),"wppa-bulk-owner"==e.value?jQuery("#wppa-bulk-owner").css("display","inline"):jQuery("#wppa-bulk-owner").css("display","none")}function wppaBulkDoitOnClick(){var e=jQuery(".wppa-bulk-photo"),t=0;for(i=0;i<e.length;i++)e[i].checked&&t++;if(0==t)return alert("No photos selected"),!1;var a=document.getElementById("wppa-bulk-action").value;switch(a){case"":return alert("No action selected"),!1;case"wppa-bulk-delete":case"wppa-bulk-delete-immediate":case"wppa-bulk-undelete":break;case"wppa-bulk-move-to":case"wppa-bulk-copy-to":if(0==document.getElementById("wppa-bulk-album").value)return alert("No album selected"),!1;break;case"wppa-bulk-status":if(0==document.getElementById("wppa-bulk-status").value)return alert("No status selected"),!1;break;case"wppa-bulk-owner":if(0==documnet.getElementById("wppa-bulk-owner").value)return alert("No new owner selected"),!1;break;default:return alert("Unimplemented action requested: "+a),!1}return!0}function wppaSetThumbsize(e){e=e.value;wppa_setCookie("wppa_bulk_thumbsize",e,365),jQuery(".wppa-bulk-thumb").css("max-width",e+"px"),jQuery(".wppa-bulk-thumb").css("max-height",e/2+"px"),jQuery(".wppa-bulk-dec").css("height",e/2+"px")}function wppaToggleConfirmDelete(e){jQuery(e).prop("checked")?wppa_setCookie("wppaConfirmDelete","checked",365):wppa_setCookie("wppaConfirmDelete","unchecked",365)}function wppaToggleConfirmMove(e){jQuery(e).prop("checked")?wppa_setCookie("wppaConfirmMove","checked",365):wppa_setCookie("wppaConfirmMove","unchecked",365)}function wppaSetConfirmDelete(e){"checked"==wppa_getCookie("wppaConfirmDelete")?jQuery("#"+e).prop("checked",!0):jQuery("#"+e).prop("checked",!1)}function wppaSetConfirmMove(e){"checked"==wppa_getCookie("wppaConfirmMove")?jQuery("#"+e).prop("checked",!0):jQuery("#"+e).prop("checked",!1)}function wppaAjaxReplaceLog(){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=maintenancepopup&slug=wppa_list_errorlog&raw=1&wppa-nonce="+jQuery("#wppa-nonce").val(),async:!0,type:"GET",timeout:1e5,beforeSend:function(e){jQuery("#wppa-spinner").show()},success:function(e,t,a){e=wppaEntityDecode(e),jQuery("#wppa-logbody").html(e.substr(1)),jQuery("#wppa-spinner").hide()}})}function wppaTestAdminReady(){"complete"===document.readyState?jQuery("#wppa-admin-spinner").fadeOut():setTimeout("wppaTestAdminReady()",200)}function wppaCommentAdminUpdateHref(e){var t=encodeURIComponent(jQuery("#commenttext-"+e).val()),a=jQuery("#href-"+e).attr("href"),p=a.split("commenttext=");p[1]=t,a=p[0]+"commenttext="+p[1],jQuery("#href-"+e).attr("href",a),jQuery("#href-"+e).css("display","inline")}function wppaInitMagick(t){var e,a,p;wppaCropper[t]||(e=document.querySelector("#fs-img-"+t),a=document.getElementById("button-"+t),p="ratio"==wppaImageMagickDefaultAspect?e.naturalWidth/e.naturalHeight:"NaN"==wppaImageMagickDefaultAspect?"":wppaImageMagickDefaultAspect,wppaCropper[t]=new Cropper(e,{zoomable:!1,viewMode:2,background:!1,dragMode:"move",responsive:!0,movable:!1,aspectRatio:p}),a.onclick=function(){var e=wppaCropper[t].getData(!0),e=e.width+"x"+e.height+(e.x<0?"-":"+")+e.x+(e.y<0?"-":"+")+e.y;wppaTryMagick(t,"crop",e)})}jQuery(document).ready(function(){var e;document.getElementById("wppa-bulk-action")&&(""!=(e=wppa_getCookie("wppa_bulk_action"))&&(document.getElementById("wppa-bulk-action").value=e),"wppa-bulk-move-to"!=e&&"wppa-bulk-copy-to"!=e||(jQuery("#wppa-bulk-album").css("display","inline"),document.getElementById("wppa-bulk-album").value=wppa_getCookie("wppa_bulk_album")),"wppa-bulk-status"==e&&(jQuery("#wppa-bulk-status").css("display","inline"),document.getElementById("wppa-bulk-status").value=wppa_getCookie("wppa_bulk_status")),"wppa-bulk-owner"==e&&(jQuery("#wppa-bulk-owner").css("display","inline"),document.getElementById("wppa-bulk-owner").value=wppa_getCookie("wppa_bulk_owner")))}),jQuery(document).ready(function(){setTimeout("wppaTestAdminReady()",200)});
1
+ function checkjQueryRev(e,t,a){var p=parseFloat(jQuery.fn.jquery);t.checked&&p<a&&(alert(e+"\nThe version of your jQuery library: "+p+" is too low for this feature. It requires version "+a),t.checked="")}function wppaReUpload(e,o,t,r){document.getElementById("wppa-re-up-form-"+o);var a=document.getElementById("wppa-re-up-file-"+o),u=document.getElementById("wppa-re-up-butn-"+o);e.preventDefault();a=a.files[0];if(a.type.match("image.*")){if(0==t.length)alert("Filename will be set to "+a.name);else if(a.name!=t&&!confirm("Filename is different.\nIf you continue, the filename will not be updated!.\n\nContinue?"))return void jQuery("#re-up-"+o).css("display","none");u.value="Uploading...",u.style.color="black";t=new FormData;t.append("photo",a,a.name);var i=new XMLHttpRequest,a="?action=wppa&wppa-action=update-photo&photo-id="+o+"&item=file&wppa-nonce="+document.getElementById("photo-nonce-"+o).value;i.open("POST",wppaAjaxUrl+a,!0),i.onload=function(){if(200===i.status){var e=wppaTrim(i.responseText).split("||");switch(""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),e[1]){case"0":var t,a,p,n=JSON.parse(e[2]);for(t in n)switch(p=n[t],t){case"remark":p=(p=(p=p.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),a="0"!=e[1]?'<span style="color:red;" >'+p+"</span>":'<span style="color:green;" >'+p+"</span>",r&&(a+=' <span style="color:blue;" >Reloading...</span>'),jQuery("#remark-"+o).html(a);break;case"photourl":wppaCropper[o]?wppaCropper[o].replace(p):jQuery("#photourl-"+o).attr("src",p),jQuery("#thumba-"+o).attr("href",p);break;case"thumburl":jQuery("#thumburl-"+o).attr("src",p);break;case"magickstack":jQuery("#magickstack-"+o).html(p),0<p.length?jQuery("#imstackbutton-"+o).css("display","inline"):jQuery("#imstackbutton-"+o).css("display","none");break;default:jQuery("#"+t+"-"+o).html(p)}u.value="Upload",jQuery("#re-up-"+o).css("display","none");break;case"99":document.getElementById("photoitem-"+o).innerHTML='<span style="color:red">'+e[2]+"</span>";break;default:document.getElementById("remark-"+o).innerHTML='<span style="color:red">'+e[2]+" ("+e[1]+")</span>",u.value="Error occured",u.style.color="red"}}else alert("An error occurred!")},i.send(t)}else alert("File is not an image file!")}jQuery(document).ready(function(){jQuery(window).on("DOMContentLoaded load resize scroll",function(){wppaMakeLazyVisible("windowon")}),wppaMakeLazyVisible("docready")});var _wppaRefreshAfter=!1;function wppaRefreshAfter(){_wppaRefreshAfter=!0}function wppaCheckWidgetMethod(){var e,t,a;if("4"==document.getElementById("wppa-wm").value?(document.getElementById("wppa-wp").style.visibility="visible","day-of-week"==(a=jQuery("#wppa-wp").val())||"day-of-month"==a||"day-of-year"==a?jQuery(".wppa-order").css("visibility",""):jQuery(".wppa-order").css("visibility","hidden")):(document.getElementById("wppa-wp").style.visibility="hidden",jQuery(".wppa-order").css("visibility","hidden")),"1"==document.getElementById("wppa-wm").value)for(e=document.getElementsByName("wppa-widget-photo"),t=0;t<e.length;)e[t].style.visibility="visible",t++;else for(e=document.getElementsByName("wppa-widget-photo"),t=0;t<e.length;)e[t].style.visibility="hidden",t++}function wppa_tablecookieon(e){wppa_setCookie("table_"+e,"on","365")}function wppa_tablecookieoff(e){wppa_setCookie("table_"+e,"off","365")}function wppaCookieCheckbox(e,t){e.checked?wppa_setCookie(t,"on","365"):wppa_setCookie(t,"off","365")}function wppa_move_up(e){document.location=wppa_moveup_url+e+"&wppa-nonce="+document.getElementById("wppa-nonce").value}function checkColor(e){var t=e.substr(5),e=jQuery("#"+t).val();jQuery("#colorbox-"+t).css("background-color",e)}function checkAll(e,t){e=document.getElementById(e);e&&(e.checked?jQuery(t).prop("checked",!0):jQuery(t).prop("checked",!1))}function impUpd(e,t){e.checked?(jQuery(t).val(wppa_update),jQuery(".hideifupdate").css("display","none")):(jQuery(t).val(wppa_import),jQuery(".hideifupdate").css("display",""))}function wppaAjaxDeletePhoto(t,e,a,p){var n="",o="",n=e||'<div style="padding-left:5px;" >';a?o=a:aftrer="</div>",wppaFeAjaxLog("in");var r=wppaGetXmlHttp(),a=wppaAjaxUrl+"?action=wppa&wppa-action=delete-photo&photo-id="+t;a+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,p&&(a+="&wppa-immediate=1"),r.open("GET",a,!0),r.send(),r.onreadystatechange=function(){switch(r.readyState){case 1:document.getElementById("remark-"+t).innerHTML="server connection established";break;case 2:document.getElementById("remark-"+t).innerHTML="request received";break;case 3:document.getElementById("remark-"+t).innerHTML="processing request";break;case 4:var e;200==r.status?("ER"==(e=wppaTrim(r.responseText).split("||"))[0]?(e[3]&&alert(e[3]),jQuery("#wppa-delete-"+t).css("text-decoration","line-through")):""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),0==e[1]?document.getElementById("remark-"+t).innerHTML=e[2]:(document.getElementById("photoitem-"+t).innerHTML=n+e[2]+o,wppaProcessFull(e[3],e[4])),jQuery(window).trigger("scroll"),wppaFeAjaxLog("out")):document.getElementById("photoitem-"+t).innerHTML=n+'<span style="color:red;" >Comm error '+r.status+": "+r.statusText+"</span>"+o}}}function wppaAjaxUndeletePhoto(t){wppaFeAjaxLog("in");var a=wppaGetXmlHttp(),e=wppaAjaxUrl+"?action=wppa&wppa-action=undelete-photo&photo-id="+t;e+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,a.open("GET",e,!0),a.send(),a.onreadystatechange=function(){switch(a.readyState){case 1:document.getElementById("remark-"+t).innerHTML="server connection established";break;case 2:document.getElementById("remark-"+t).innerHTML="request received";break;case 3:document.getElementById("remark-"+t).innerHTML="processing request";break;case 4:var e;200==a.status?("ER"==(e=wppaTrim(a.responseText).split("||"))[0]?(e[3]&&alert(e[3]),jQuery("#wppa-delete-"+t).css("text-decoration","line-through")):""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),0==e[1]?document.getElementById("remark-"+t).innerHTML=e[2]:document.getElementById("photoitem-"+t).innerHTML='<div style="padding-left:5px;" >'+e[2]+"</div>",wppaFeAjaxLog("out")):document.getElementById("photoitem-"+t).innerHTML=before+'<span style="color:red;" >Comm error '+a.status+": "+a.statusText+"</span>"+after}}}function wppaAjaxDeleteExportZips(){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=delexportzips",async:!1,type:"GET",timeout:6e4,success:function(e,t,a){document.location.reload(!0)},error:function(e,t,a){wppaConsoleLog("wppaAjaxDeleteExportZips failed. Error = "+a+", status = "+t)}})}function wppaAjaxApplyWatermark(t,e,a){wppaFeAjaxLog("in");var p=wppaGetXmlHttp();jQuery("#wppa-water-spin-"+t).css({visibility:"visible"});var n="action=wppa&wppa-action=watermark-photo&photo-id="+t;n+="&wppa-nonce="+document.getElementById("photo-nonce-"+t).value,e&&(n+="&wppa-watermark-file="+e),a&&(n+="&wppa-watermark-pos="+a),p.open("POST",wppaAjaxUrl,!0),p.setRequestHeader("Content-type","application/x-www-form-urlencoded"),p.send(n),p.onreadystatechange=function(){var e;4==p.readyState&&(200==p.status?(""!=(e=wppaTrim(p.responseText).split("||"))[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?(document.getElementById("remark-"+t).innerHTML=e[2],setTimeout(function(){document.location.reload(!0)},500)):document.getElementById("remark-"+t).innerHTML='<span style="color:red">'+e[2]+"</span>",jQuery("#wppa-water-spin-"+t).css({visibility:"hidden"}),wppaFeAjaxLog("out")):document.getElementById("remark-"+t).innerHTML='<span style="color:red;" >Comm error '+p.status+": "+p.statusText+"</span>")}}function wppaAjaxUpdateIptc(i,e,t,a){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-iptc&photo-id="+i+"&item="+e+"&wppa-nonce="+document.getElementById("photo-nonce-"+i).value+"&value="+wppaEncode(t)+"&tagname="+a,async:!0,type:"POST",timeout:6e4,beforeSend:function(e){jQuery("#remark-"+i).html("Working, please wait...")},success:function(e,t,a){var p=wppaTrim(e).split("||");if(""!=p[0]&&alert("The server returned unexpected output:\n"+p[0]),"99"===p[1])jQuery("#photoitem-"+i).html(bef+'<span style="color:red">'+p[2]+"</span>"+aft);else{var n,o,r,u=JSON.parse(p[2]);for(n in u)switch(r=u[n],n){case"remark":r=(r=(r=r.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),o="0"!=p[1]?'<span style="color:red;" >'+r+"</span>":'<span style="color:green;" >'+r+"</span>",jQuery("#remark-"+i).html(o);break;case"photourl":wppaCropper[i]?wppaCropper[i].replace(r):jQuery("#photourl-"+i).attr("src",r),jQuery("#thumba-"+i).attr("href",r);break;case"thumburl":jQuery("#thumburl-"+i).attr("src",r);break;case"magickstack":jQuery("#magickstack-"+i).html(r),0<r.length?jQuery("#imstackbutton-"+i).css("display","inline"):jQuery("#imstackbutton-"+i).css("display","none")}}wppaFeAjaxLog("out")},error:function(e,t,a){jQuery("#remark-"+i).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("wppaAjaxUpdatePhoto failed. Error = "+a+", status = "+t)},complete:function(e,t,a){jQuery("#wppa-admin-spinner").css("display","none"),jQuery(window).trigger("scroll")}})}function wppaAjaxUpdatePhoto(i,l,e,c,s,d){s=s||"",d=d||"",wppaFeAjaxLog("in"),jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-photo&photo-id="+i+"&item="+l+"&wppa-nonce="+document.getElementById("photo-nonce-"+i).value+"&value="+wppaEncode(e),async:!0,type:"POST",timeout:6e4,beforeSend:function(e){"description"==l&&jQuery("#wppa-photo-spin-"+i).css({visibility:"visible"}),jQuery("#remark-"+i).html("Working, please wait...")},success:function(e,t,a){var p=wppaTrim(e).split("||");if(""!=p[0]&&alert("The server returned unexpected output:\n"+p[0]),"99"===p[1])jQuery("#photoitem-"+i).html(s+'<span style="color:red">'+p[2]+"</span>"+d);else{var n,o,r,u=JSON.parse(p[2]);for(n in u)switch(r=u[n],n){case"remark":r=(r=(r=r.replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/\\/g,""),o="0"!=p[1]?'<span style="color:red;" >'+r+"</span>":'<span style="color:green;" >'+r+"</span>",c&&(o+=' <span style="color:blue;" >Reloading...</span>'),jQuery("#remark-"+i).html(o);break;case"photourl":wppaCropper[i]?wppaCropper[i].replace(r):jQuery("#photourl-"+i).attr("src",r),jQuery("#thumba-"+i).attr("href",r);break;case"thumburl":jQuery("#thumburl-"+i).attr("src",r);break;case"magickstack":jQuery("#magickstack-"+i).html(r),0<r.length?jQuery("#imstackbutton-"+i).css("display","inline"):jQuery("#imstackbutton-"+i).css("display","none");break;default:jQuery("#"+n+"-"+i).html(r)}}"description"==l&&jQuery("#wppa-photo-spin-"+i).css({visibility:"hidden"}),wppaFeAjaxLog("out")},error:function(e,t,a){jQuery("#remark-"+i).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("wppaAjaxUpdatePhoto failed. Error = "+a+", status = "+t)},complete:function(e,t,a){var p=(p=document.location.href).replace(/&pano-val=./,"");c?setTimeout(function(){document.location.href=p},300):(jQuery("#wppa-admin-spinner").css("display","none"),jQuery(window).trigger("scroll"))}})}function wppaChangeScheduleAlbum(e,t){jQuery(t).prop("checked")?jQuery(".wppa-datetime-"+e).css("display","inline"):(jQuery(".wppa-datetime-"+e).css("display","none"),wppaAjaxUpdateAlbum(e,"scheduledtm",Math.rand()))}function wppaChangeScheduleDelAlbum(e,t){jQuery(t).prop("checked")?jQuery(".wppa-datetimedel-"+e).css("display","inline"):(jQuery(".wppa-datetimedel-"+e).css("display","none"),wppaAjaxUpdateAlbum(e,"scheduledel",Math.rand()))}var _wppaRefreshAfter=!1,wppaAjaxAlbumCount=0,wppaAlbumUpdateMatrix=new Array;function wppaAjaxUpdateAlbum(e,t,a,p){var n=0==jQuery("#wppaalbumdesc:visible").length;jQuery("#wppaalbumdesc-html").click();for(var o=wppaAlbumUpdateMatrix.length,r=0,u=!1,i=-1;r<o;)wppaAlbumUpdateMatrix[r][0]==e&&wppaAlbumUpdateMatrix[r][1]==t&&(u=!0,i=r),r++;u||(wppaAlbumUpdateMatrix[o]=[e,t,"undefined",!1,!1,p],i=o),a=a.value||a,wppaAlbumUpdateMatrix[i][3]=a,wppaAlbumUpdateMatrix[i][5]=p,wppaAjaxUpdateAlbumMonitor(n)}function wppaAjaxUpdateAlbumMonitor(e){for(var t=wppaAlbumUpdateMatrix.length,a=0;a<t;)wppaAlbumUpdateMatrix[a][2]==wppaAlbumUpdateMatrix[a][3]||wppaAlbumUpdateMatrix[a][4]||(wppaAlbumUpdateMatrix[a][4]=!0,_wppaAjaxUpdateAlbum(wppaAlbumUpdateMatrix[a][0],wppaAlbumUpdateMatrix[a][1],wppaAlbumUpdateMatrix[a][3],e,wppaAlbumUpdateMatrix[a][5])),a++;e&&jQuery("#wppaalbumdesc-tmce").click()}function _wppaAjaxUpdateAlbum(r,u,i,l,c){wppaAjaxAlbumCount++;jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-album&album-id="+r+"&item="+u+"&wppa-nonce="+document.getElementById("album-nonce-"+r).value+"&value="+wppaEncode(i),async:!0,type:"POST",timeout:6e4,beforeSend:function(e){"description"==u&&jQuery("#wppa-album-spin").css({visibility:"visible"}),jQuery("#albumstatus-"+r).html("Working, please wait... ("+wppaAjaxAlbumCount+")")},success:function(e,t,a){e=wppaTrim(e).split("||");if(wppaAjaxAlbumCount--,""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?0==wppaAjaxAlbumCount?(jQuery("#albumstatus-"+r).html(e[2]),wppaGetCoverPreview&&wppaGetCoverPreview(r,"cover-preview-"+r)):jQuery("#albumstatus-"+r).html("Working, please wait... ("+wppaAjaxAlbumCount+")"):jQuery("#albumstatus-"+r).html='<span style="color:red">'+e[2]+" ("+e[1]+")</span>",void 0!==e[3]&&wppaProcessFull(e[3],e[4]),c&&"0"==e[1])return jQuery("#albumstatus-"+r).after('<span style="color:blue;font-weight:bold;"> Reloading...</span>'),jQuery("#wppa-admin-spinner").fadeIn(),void setTimeout(function(){wppaReload()},100);"cover_linktype"==u&&("manual"==i?(jQuery("#link-url-tr").show(),jQuery("#-link-url-tr").hide()):(jQuery("#link-url-tr").hide(),jQuery("#-link-url-tr").show())),"description"==u&&jQuery("#wppa-album-spin").css({visibility:"hidden"});for(var p=0,n=-1,o=wppaAlbumUpdateMatrix.length;p<o;)wppaAlbumUpdateMatrix[p][0]==r&&wppaAlbumUpdateMatrix[p][1]==u&&(n=p),p++;wppaAlbumUpdateMatrix[n][2]=i||0,wppaAlbumUpdateMatrix[n][4]=!1,wppaAlbumUpdateMatrix[n][5]=!1,wppaAjaxUpdateAlbumMonitor(l)},error:function(e,t,a){wppaAjaxAlbumCount--,jQuery("#albumstatus-"+r).html('<span style="color:red;" >Comm error '+t+"</span>"),wppaConsoleLog("_wppaAjaxUpdateAlbum failed. Error = "+a+", status = "+t)},complete:function(e,t,a){}})}function wppaProcessFull(e,t){"full"==e&&(jQuery("#full").css("display",""),jQuery("#notfull").css("display","none")),"notfull"==e&&(jQuery("#full").css("display","none"),0<t?jQuery("#notfull").attr("value",wppaUploadToThisAlbum+" (max "+t+")"):jQuery("#notfull").attr("value",wppaUploadToThisAlbum),jQuery("#notfull").css("display",""))}function wppaAjaxUpdateCommentStatus(t,a,e){var p=wppaGetXmlHttp(),e=wppaAjaxUrl+"?action=wppa&wppa-action=update-comment-status&wppa-photo-id="+t+"&wppa-comment-id="+a+"&wppa-comment-status="+e+"&wppa-nonce="+document.getElementById("photo-nonce-"+t).value;p.onreadystatechange=function(){var e;4==p.readyState&&(200==p.status?(""!=(e=wppaTrim(p.responseText).split("||"))[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?jQuery("#remark-"+t).html(e[2]):jQuery("#remark-"+t).html('<span style="color:red">'+e[2]+"</span>"),jQuery("#wppa-comment-spin-"+a).css("visibility","hidden")):jQuery("#remark-"+t).html('<span style="color:red;" >Comm error '+p.status+": "+p.statusText+"</span>"))},p.open("GET",e,!0),p.send()}function wppaAjaxUpdateOptionCheckBox(p,e){var t="action=wppa&wppa-action=update-option&wppa-option="+p+"&wppa-nonce="+document.getElementById("wppa-nonce").value;e.checked?t+="&value=yes":t+="&value=no",jQuery.ajax({url:wppaAjaxUrl,data:t,async:!0,type:"POST",timeout:1e4,beforeSend:function(e,t){jQuery("#img_"+p).attr("src",wppaImageDirectory+"spinner.gif")},success:function(e,t,a){e=wppaTrim(e).split("||");""!=e[0]&&alert("The server returned unexpected output:\n"+e[0]),"0"===e[1]?(jQuery("#img_"+p).attr("src",wppaImageDirectory+"tick.png"),jQuery("#img_"+p).attr("title",e[2])):(jQuery("#img_"+p).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+p).attr("title","Error #"+e[1]+", message: "+e[2]+", status: "+xmlhttp.status)),e[3]&&alert(e[3]),_wppaRefreshAfter&&(_wppaRefreshAfter=!1,document.location.reload(!0))},error:function(e,t,a){jQuery("#img_"+p).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+p).attr("title","Communication error, status = "+xmlhttp.status)},complete:function(){wppaCheckInconsistencies()}})}var wppaAlwaysContinue=100;function wppaMaintenanceProc(p,e,u){if(!u&&!e&&"yes"==document.getElementById(p+"_continue").value)return document.getElementById(p+"_continue").value="no",document.getElementById(p+"_button").value="Start!",void(0<jQuery("#"+p+"_togo").html()&&(jQuery("#"+p+"_status").html("Pausing..."),jQuery("#"+p+"_button").css("display","none")));u||(document.getElementById(p+"_continue").value="yes",document.getElementById(p+"_button").value="Stop!",""==jQuery("#"+p+"_status").html()&&jQuery("#"+p+"_status").html("Wait...")),jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=maintenance&slug="+p+"&wppa-nonce="+jQuery("#wppa-nonce").val()+(u?"&wppa-cron=1":""),async:!0,type:"POST",timeout:3e5,beforeSend:function(e){},success:function(e,t,a){var p,n=e.split("||"),o=n[1],r=!1;return o?(10<n[0].length&&(p=(p=n[0]).replace(/&gt;/g,">"),alert("An error occurred:\n"+p),r=!0),jQuery("#"+o+"_status").html(n[2]),jQuery("#"+o+"_togo").html(n[3]),jQuery("#"+o+"_button").css("display",""),r||"0"==n[3]?"reload"==n[4]?(alert("This page will now be reloaded to finish the operation. Please stay tuned..."),void wppaReload()):void setTimeout("wppaMaintenanceProc('"+o+"', false)",20):void(document.getElementById(o+"_continue")&&"yes"==document.getElementById(o+"_continue").value?setTimeout("wppaMaintenanceProc('"+o+"', true)",20):(u||jQuery("#"+o+"_status").html("Pending"),setTimeout(function(){wppaAjaxUpdateTogo(o)},1e3)))):(alert("The server returned unexpected output:\n"+e+"\nIf the current procedure has a Skip One button, press it before retrying. Reloading page..."),void wppaReload())},error:function(e,t,a){wppaConsoleLog("wppaMaintenanceProc failed. Slug = "+p+", Error = "+a+", status = "+t),jQuery("#"+p+"_status").html("Server error #"+(11-wppaAlwaysContinue));t=!1;--wppaAlwaysContinue<1&&(t=confirm("10 Server errors happened.\nDo you want to continue?"))&&(wppaAlwaysContinue=100),(t||0<wppaAlwaysContinue)&&("wppa_remake"==p&&wppaAjaxUpdateOptionValue("wppa_remake_skip_one",0),"wppa_regen_thumbs"==p&&wppaAjaxUpdateOptionValue("wppa_regen_thumbs_skip_one",0),"wppa_create_o1_files"==p&&wppaAjaxUpdateOptionValue("wppa_create_o1_files_skip_one",0),setTimeout("wppaMaintenanceProc('"+p+"', true)",2e3))},complete:function(e,t,a){}})}function wppaAjaxPopupWindow(e){switch(e){case"wppa_list_index":0;break;case"wppa_list_errorlog":0;break;case"wppa_list_rating":0;break;case"wppa_list_session":0;break;case"wppa_list_comments":0}var t=.9*wppaWindowWidth(),a=wppaGetXmlHttp(),p=wppaAjaxUrl,e="action=wppa&wppa-action=maintenancepopup&slug="+e;if(e+="&wppa-nonce="+document.getElementById("wppa-nonce").value,a.open("POST",p,!1),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(e),4==a.readyState&&200==a.status){e=wppaEntityDecode(a.responseText).split("|"),a=e[0];e[0]="";e=e.join("|").substring(1),t={modal:!0,resizable:!0,width:t,show:{effect:"fadeIn",duration:800},closeText:wppaCloseText};try{jQuery("#wppa-modal-container").dialog("destroy")}catch{jQuery("#wppa-modal-container").html("")}jQuery("#wppa-modal-container").html(e),jQuery("#wppa-modal-container").dialog(t),jQuery("#wppa-modal-container").css({width:"100%"}),jQuery(".ui-dialog").css({boxShadow:"0px 0px 5px 5px #aaaaaa",padding:"8px",backgroundColor:"#cccccc",boxSizing:"content-box",zIndex:"200200"}),jQuery(".ui-dialog-titlebar").css({lineHeight:"0px",height:"50px"}),jQuery(".ui-dialog-title").html("<h2>"+a+"</h2>"),jQuery(".ui-button").css({position:"absolute",top:"12px",right:"12px"}),jQuery(".ui-button").attr("title",wppaCloseText),jQuery(".ui-widget-overlay").css({backgroundColor:"transparent"}),setTimeout(function(){jQuery("#wppa-maintenance-list").niceScroll&&jQuery("#wppa-maintenance-list").niceScroll(".wppa-nicewrap",{})},1e3)}}function wppaAjaxUpdateOptionValue(i,e,t){var a="action=wppa&wppa-action=update-option&wppa-option="+wppaEncode(i)+"&wppa-nonce="+document.getElementById("wppa-nonce").value;0!=e&&(a+="number"==typeof e?"&value="+e:t?"&value="+wppaGetSelectionEnumByClass("."+i,","):"&value="+wppaEncode(e.value)),jQuery.ajax({url:wppaAjaxUrl,data:a,async:!0,type:"POST",timeout:1e5,beforeSend:function(e){jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"spinner.gif")},success:function(e,t,a){e=wppaTrim(e).split("||");if(""!=e[0])alert("The server returned unexpected output:\n"+e[0]);else if("0"===e[1]?(jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"tick.png"),e[3]&&alert(e[3]),_wppaRefreshAfter&&(_wppaRefreshAfter=!1,document.location.reload(!0))):(jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"cross.png"),e[3]&&alert(e[3])),jQuery("#img_"+i.replace("#","H")).attr("title",e[2]),e[4])for(var p,n,o,r=e[4].split(";"),u=0;u<r.length;)p=r[u].split(":"),n=jQuery("#"+p[0]).html(),o=p[1],""!=n&&""==o&&(o='<input type="button" class="button-secundary" style="border-radius:3px;font-size:11px;height:18px;margin: 0 4px;padding:0px;color:red;background-color:pink;" onclick="document.location.reload(true)" value="Reload" />'),jQuery("#"+p[0]).html(o),u++},error:function(e){jQuery("#img_"+i.replace("#","H")).attr("src",wppaImageDirectory+"cross.png"),jQuery("#img_"+i.replace("#","H")).attr("title","Communication error")},complete:function(e){wppaCheckInconsistencies(),"spinner_shape"!=i&&"icon_corner_style"!=i||(wppaAjaxGetSpinnerHtml("normal","wppa-spin-pre-1"),wppaAjaxGetSpinnerHtml("lightbox","wppa-spin-pre-2")),"svg_color"!=i&&"svg_bg_color"!=i||wppaAjaxGetSpinnerHtml("normal","wppa-spin-pre-1"),"ovl_svg_color"!=i&&"ovl_svg_bg_color"!=i||wppaAjaxGetSpinnerHtml("lightbox","wppa-spin-pre-2")}})}function wppaEncode(e){if("string"!=typeof e)return e;var e=e,t=e.replace(/#/g,"||HASH||"),a=(e=t=(e=t).replace(/&/g,"||AMP||")).split("+"),p=0;for(t="";p<a.length;)t+=a[p],++p<a.length&&(t+="||PLUS||");return t}function wppaCheckInconsistencies(){jQuery("#use_thumb_popup").prop("checked")&&"lightbox"==jQuery("#thumb_linktype").val()?jQuery(".popup-lightbox-err").css("display",""):jQuery(".popup-lightbox-err").css("display","none")}function wppaGetXmlHttp(){return xmlhttp=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),xmlhttp}function wppaPhotoStatusChange(e){if(jQuery("#psdesc-"+e).css({display:"none"}),elm=document.getElementById("status-"+e),elm){if("pending"!=elm.value&&"scheduled"!=elm.value||jQuery("#photoitem-"+e).css({backgroundColor:"#ffebe8",borderColor:"#cc0000"}),"publish"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ffffe0",borderColor:"#e6db55"}),"featured"==elm.value){jQuery("#photoitem-"+e).css({backgroundColor:"#e0ffe0",borderColor:"#55ee55"});var t=document.getElementById("pname-"+e).value.split(".");if(1<t.length)for(var a=0;a<t.length;)"jpg"!=t[a]&&"JPG"!=t[a]||jQuery("#psdesc-"+e).css({display:""}),a++}"gold"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#eeeecc",borderColor:"#ddddbb"}),"silver"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ffffff",borderColor:"#eeeeee"}),"bronze"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"#ddddbb",borderColor:"#ccccaa"}),"private"==elm.value&&jQuery("#photoitem-"+e).css({backgroundColor:"transparent",borderColor:"#cccccc"}),"scheduled"==elm.value?jQuery(".wppa-datetime-"+e).css("display",""):jQuery(".wppa-datetime-"+e).css("display","none"),jQuery("#scheduledel-"+e).prop("checked")?jQuery(".wppa-del-datetime-"+e).css("display",""):jQuery(".wppa-del-datetime-"+e).css("display","none")}}function wppaSetComBgCol(e){"approved"==jQuery("#com-stat-"+e).val()?jQuery("#com-tr-"+e).css({backgroundColor:"#ffffe0"}):jQuery("#com-tr-"+e).css({backgroundColor:"#ffebe8"})}function wppaAddCat(e,t){wppaAddTag(e,t)}function wppaAddTag(e,t){t=document.getElementById(t);e&&(t.value?t.value+=","+e:t.value=e,"-clear-"==e&&(t.value=""))}function wppaRefresh(e){e=new String(document.location).split("#")[0]+"#"+e;document.location=e}function wppaReload(e){e?(url=document.location.href.split("#"),document.location.href=url[0]+e,setTimeout(function(){document.location.reload(!0)},10)):document.location.reload(!0)}var wppaFeCount=0;function wppaFeAjaxLog(e){"in"==e&&(0==wppaFeCount&&jQuery("#wppa-fe-exit").css("display","none"),wppaFeCount++,jQuery("#wppa-fe-count").html(wppaFeCount)),"out"==e&&(1==wppaFeCount&&(jQuery("#wppa-fe-count").html(""),jQuery("#wppa-fe-exit").css("display","inline"),wppaFeCount--),1<wppaFeCount&&(wppaFeCount--,jQuery("#wppa-fe-count").html(wppaFeCount)))}function wppaArrayToEnum(e,t){temp=e.sort(function(e,t){return e-t});for(var a,p="",n=-1,o=-2,r=0,u=!1,i=0;i<e.length;)0!=(a=e[i].valueOf())&&(r=n,a==++r?u=!0:u?(p+=n==o?t+n+t+a:t+t+n+t+a,u=!1):p+=t+a,u||(o=a,o++),n=a),i++;for(u&&(p+=".."+n);"."==p.substr(0,1);)p=p.substr(1);for(;p.substr(0,1)==t;)p=p.substr(1);return p}function wppaGetSelEnumToId(e,t){p=jQuery("."+e);var a=[];for(i=0,j=0;i<p.length;)p[i].selected&&(a[j]=p[i].value,j++),i++;jQuery("#"+t).val(wppaArrayToEnum(a,"."))}function wppaGetSelectionEnumByClass(e,t){var a,p=[],n=0,o=0;for(t=t||".",a=jQuery(e),o=n=0;n<a.length;)a[n].selected&&(p[o]=a[n].value,o++),n++;return wppaArrayToEnum(p,t)}function wppaEditSearch(e,t){t=jQuery("#"+t).val();0==t.length?alert("Please enter searchstring"):document.location.href=e+"&wppa-searchstring="+t}function wppaEditTrash(e){document.location.href=e}function wppaExportDbTable(p){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=export-table&table="+p,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){jQuery("#"+p+"-spin").css("display","inline")},success:function(e,t,a){e=e.split("||");"0"==e[1]?document.location=e[2]:alert("Error: "+e[1]+"\n\n"+e[2])},error:function(e,t,a){alert("Export Db Table "+p+" failed. Error = "+a+", status = "+t)},complete:function(e,t,a){jQuery("#"+p+"-spin").css("display","none")}})}function wppaDismissAdminNotice(e,t){wppaAjaxUpdateOptionCheckBox(e,t),jQuery("#wppa-wr-").css("display","none")}function wppaAjaxUpdateTogo(n){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=gettogo&slug="+n,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){},success:function(e,t,a){var p=e.split("|");jQuery("#"+n+"_togo").html(p[0]);e=jQuery("#"+n+"_status").html(),p=p[1];""!=e&&""==p&&(p='<input type="button" class="button-secundary" style="border-radius:3px;font-size:11px;height:18px;margin: 0 4px;padding:0px;color:red;background-color:pink;" onclick="document.location.reload(true)" value="Reload" />'),jQuery("#"+n+"_status").html(p),setTimeout(function(){wppaAjaxUpdateTogo(n)},1e3)},error:function(e){},complete:function(e){}})}function wppaIsEmpty(e){return(null==e||void 0===e||""==e||0==e)&&!0}function wppaTimedConfirm(e){var t={modal:!0,resizable:!1,width:400,show:{effect:"fadeIn",duration:800},closeText:"X",buttons:[{text:"NO",click:function(){jQuery(this).dialog("close")}},{text:"YES",click:function(){jQuery(this).dialog("close")}}]};jQuery("#wppa-modal-container").html(e).dialog(t).dialog("open"),jQuery(".ui-dialog").css({boxShadow:"0px 0px 5px 5px #aaaaaa",padding:"8px",backgroundColor:"#cccccc",boxSizing:"content-box",zIndex:"200200"}),jQuery(".ui-dialog-titlebar").css({lineHeight:"0px",height:"32px"}),jQuery(".ui-button").css({float:"right",position:"relative",bottom:"40px"}),jQuery(".ui-dialog-titlebar-close").css({display:"none"}),jQuery(".ui-widget-overlay").css({backgroundColor:"transparent"}),jQuery(".ui-button").attr("title",wppaCloseText),setTimeout(function(){jQuery(".ui-button").trigger("click")},6e4)}function wppaAjaxGetSpinnerHtml(e,p){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=update-option&wppa-option=getspinnerpreview&type="+e+"&wppa-nonce="+document.getElementById("wppa-nonce").value,async:!0,type:"GET",timeout:1e5,beforeSend:function(e){},success:function(e,t,a){e=e.split("|");jQuery("#"+p).html(e[0])},error:function(e){},complete:function(e){}})}function wppaDragHorizon(t){var a=0,p=0;function n(e){(e=e||window.event).preventDefault(),a=p-e.clientY,p=e.clientY,t.style.top=t.offsetTop-a+"px"}function o(){document.onmouseup=null,document.onmousemove=null}t.onmousedown=function(e){(e=e||window.event).preventDefault(),pos3=e.clientX,p=e.clientY,document.onmouseup=o,document.onmousemove=n}}function wppaBulkActionChange(e,t){wppa_setCookie("wppa_bulk_action",e.value,365),"wppa-bulk-move-to"==e.value||"wppa-bulk-copy-to"==e.value?jQuery("#wppa-bulk-album").css("display","inline"):jQuery("#wppa-bulk-album").css("display","none"),"wppa-bulk-status"==e.value?jQuery("#wppa-bulk-status").css("display","inline"):jQuery("#wppa-bulk-status").css("display","none"),"wppa-bulk-owner"==e.value?jQuery("#wppa-bulk-owner").css("display","inline"):jQuery("#wppa-bulk-owner").css("display","none")}function wppaBulkDoitOnClick(){var e=jQuery(".wppa-bulk-photo"),t=0;for(i=0;i<e.length;i++)e[i].checked&&t++;if(0==t)return alert("No photos selected"),!1;var a=document.getElementById("wppa-bulk-action").value;switch(a){case"":return alert("No action selected"),!1;case"wppa-bulk-delete":case"wppa-bulk-delete-immediate":case"wppa-bulk-undelete":break;case"wppa-bulk-move-to":case"wppa-bulk-copy-to":if(0==document.getElementById("wppa-bulk-album").value)return alert("No album selected"),!1;break;case"wppa-bulk-status":if(0==document.getElementById("wppa-bulk-status").value)return alert("No status selected"),!1;break;case"wppa-bulk-owner":if(0==documnet.getElementById("wppa-bulk-owner").value)return alert("No new owner selected"),!1;break;default:return alert("Unimplemented action requested: "+a),!1}return!0}function wppaSetThumbsize(e){e=e.value;wppa_setCookie("wppa_bulk_thumbsize",e,365),jQuery(".wppa-bulk-thumb").css("max-width",e+"px"),jQuery(".wppa-bulk-thumb").css("max-height",e/2+"px"),jQuery(".wppa-bulk-dec").css("height",e/2+"px")}function wppaToggleConfirmDelete(e){jQuery(e).prop("checked")?wppa_setCookie("wppaConfirmDelete","checked",365):wppa_setCookie("wppaConfirmDelete","unchecked",365)}function wppaToggleConfirmMove(e){jQuery(e).prop("checked")?wppa_setCookie("wppaConfirmMove","checked",365):wppa_setCookie("wppaConfirmMove","unchecked",365)}function wppaSetConfirmDelete(e){"checked"==wppa_getCookie("wppaConfirmDelete")?jQuery("#"+e).prop("checked",!0):jQuery("#"+e).prop("checked",!1)}function wppaSetConfirmMove(e){"checked"==wppa_getCookie("wppaConfirmMove")?jQuery("#"+e).prop("checked",!0):jQuery("#"+e).prop("checked",!1)}function wppaAjaxReplaceLog(){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=maintenancepopup&slug=wppa_list_errorlog&raw=1&wppa-nonce="+jQuery("#wppa-nonce").val(),async:!0,type:"GET",timeout:1e5,beforeSend:function(e){jQuery("#wppa-spinner").show()},success:function(e,t,a){e=wppaEntityDecode(e),jQuery("#wppa-logbody").html(e),jQuery("#wppa-spinner").hide()}})}function wppaTestAdminReady(){"complete"===document.readyState?jQuery("#wppa-admin-spinner").fadeOut():setTimeout("wppaTestAdminReady()",200)}function wppaCommentAdminUpdateHref(e){var t=encodeURIComponent(jQuery("#commenttext-"+e).val()),a=jQuery("#href-"+e).attr("href"),p=a.split("commenttext=");p[1]=t,a=p[0]+"commenttext="+p[1],jQuery("#href-"+e).attr("href",a),jQuery("#href-"+e).css("display","inline")}function wppaInitMagick(t){var e,a,p;wppaCropper[t]||(e=document.querySelector("#fs-img-"+t),a=document.getElementById("button-"+t),p="ratio"==wppaImageMagickDefaultAspect?e.naturalWidth/e.naturalHeight:"NaN"==wppaImageMagickDefaultAspect?"":wppaImageMagickDefaultAspect,wppaCropper[t]=new Cropper(e,{zoomable:!1,viewMode:2,background:!1,dragMode:"move",responsive:!0,movable:!1,aspectRatio:p}),a.onclick=function(){var e=wppaCropper[t].getData(!0),e=e.width+"x"+e.height+(e.x<0?"-":"+")+e.x+(e.y<0?"-":"+")+e.y;wppaTryMagick(t,"crop",e)})}jQuery(document).ready(function(){var e;document.getElementById("wppa-bulk-action")&&(e=wppa_getCookie("wppa_bulk_action"),"wppa-bulk-move-to"!=(document.getElementById("wppa-bulk-action").value=e)&&"wppa-bulk-copy-to"!=e||(jQuery("#wppa-bulk-album").css("display","inline"),document.getElementById("wppa-bulk-album").value=wppa_getCookie("wppa_bulk_album")),"wppa-bulk-status"==e&&(jQuery("#wppa-bulk-status").css("display","inline"),document.getElementById("wppa-bulk-status").value=wppa_getCookie("wppa_bulk_status")),"wppa-bulk-owner"==e&&(jQuery("#wppa-bulk-owner").css("display","inline"),document.getElementById("wppa-bulk-owner").value=wppa_getCookie("wppa_bulk_owner")))}),jQuery(document).ready(function(){setTimeout("wppaTestAdminReady()",200)});
wppa-admin-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -550,6 +550,54 @@ function _wppa_sanitze_files( $root ) {
550
  return $count;
551
  }
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
554
  function wppa_update_single_photo( $file, $id, $name ) {
555
  global $wpdb;
@@ -932,45 +980,42 @@ global $wpdb;
932
  $pendingcount = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'pending'" );
933
  $schedulecount = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'scheduled'" );
934
 
935
- $result = '
936
- <div style="clear:both;display:block">' .
937
- sprintf( __( 'There are <strong>%d</strong> albums and <strong>%d</strong> photos in the system.', 'wp-photo-album-plus' ), $albcount, $photocount );
938
- if ( $pendingcount ) {
939
- $result .= ' ' . sprintf( __( '<strong>%d</strong> photos are pending moderation.', 'wp-photo-album-plus' ), $pendingcount );
940
- }
941
- if ( $schedulecount ) {
942
- $result .= ' ' . sprintf( __( '<strong>%d</strong> photos are scheduled for later publishing.', 'wp-photo-album-plus' ), $pendingcount );
943
- }
944
 
945
- $lastalbum = $wpdb->get_row( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY id DESC LIMIT 1", ARRAY_A );
946
- if ( $lastalbum ) {
947
- $result .= '<br>' . sprintf( __( 'The most recently added album is <strong>%s</strong> (%d).', 'wp-photo-album-plus' ), sanitize_text_field( $lastalbum['name'] ), $lastalbum['id'] );
948
- }
949
- $lastphoto = $wpdb->get_row( "SELECT id, name, album FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 1", ARRAY_A );
950
- if ( ! $lastphoto ) {
951
- $result .= '<br>' . __( 'There are no photos yet', 'wp-photo-album-plus' );
952
- return $result;
953
- }
954
- if ( $lastphoto['album'] < '1' ) {
955
- $trashed = true;
956
- $album = - ( $lastphoto['album'] + '9' );
957
- }
958
- else {
959
- $trashed = false;
960
- $album = $lastphoto['album'];
 
 
 
 
 
 
961
  }
962
- $lastphotoalbum = $wpdb->get_row( $wpdb->prepare( "SELECT id, name FROM $wpdb->wppa_albums WHERE id = %s", $album ), ARRAY_A );
963
- if ( $lastphoto ) {
964
- $result .= '<br>' . sprintf( __( 'The most recently added photo is <strong>%s</strong> (%d)', 'wp-photo-album-plus' ), sanitize_text_field( $lastphoto['name'] ), $lastphoto['id'] );
965
- if ( $lastphotoalbum ) {
966
- $result .= ' ' . sprintf( __( 'in album <strong>%s</strong> (%d).', 'wp-photo-album-plus' ), sanitize_text_field( $lastphotoalbum['name'] ), $lastphotoalbum['id'] );
967
- }
968
- if ( $trashed ) {
969
- $result .= ' <span style="color:red" >' . __( 'Deleted', 'wp-photo-album-plus' ) . '</span>';
970
- }
971
  }
972
- $result .= '</div>';
973
-
974
  return $result;
975
  }
976
 
@@ -1067,395 +1112,3 @@ function wppa_make_360( $id, $degs ) {
1067
  // All done
1068
  return true;
1069
  }
1070
-
1071
- // Admin pagelinks
1072
- // @1: string, from where slug
1073
- // @2: int, current pagesize
1074
- // @3: int, current page
1075
- // @4: int: total count
1076
- // @5: string: reload url without '@paged=...'
1077
- // @6: bool: return if true, else output directly
1078
- function wppa_admin_pagination( $pagesize, $current, $total_items, $url, $which = 'bottom' ) {
1079
-
1080
- // Need pagination?
1081
- if ( $total_items < '21' ) {
1082
- return '';
1083
- }
1084
-
1085
- // Init
1086
- if ( $which != 'top' ) {
1087
- $which = 'bottom';
1088
- }
1089
- $output = '';
1090
- $link = $url . '&paged=';
1091
- $total_pages = $pagesize ? ceil( $total_items / $pagesize ) : '1';
1092
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1093
- $current_url = remove_query_arg( 'paged', $current_url );
1094
-
1095
- $page_links = array();
1096
-
1097
- $disable_first = false;
1098
- $disable_last = false;
1099
- $disable_prev = false;
1100
- $disable_next = false;
1101
-
1102
- if ( 1 == $current ) {
1103
- $disable_first = true;
1104
- $disable_prev = true;
1105
- }
1106
- if ( $total_pages == $current ) {
1107
- $disable_last = true;
1108
- $disable_next = true;
1109
- }
1110
-
1111
- // Overall wrapper, for bottom only
1112
- if ( $which == 'bottom' ) {
1113
- $output .= '<div class="test" style="line-height:2.1em;margin-top:6px;">';
1114
- }
1115
-
1116
- // Inner wrapper
1117
- $output .= '<div class="wppa-admin-pagination">';
1118
-
1119
- // Total number of items
1120
- $output .= '
1121
- <span class="displaying-num">' .
1122
- sprintf(
1123
- /* translators: %s: Number of items. */
1124
- _n( '%s item', '%s items', $total_items ),
1125
- number_format_i18n( $total_items ) ) . '
1126
- </span>';
1127
-
1128
- // Start pagination links
1129
- $output .= "\n".'<span class="pagination-links">';
1130
-
1131
- // First indicator / button
1132
- if ( $disable_first ) {
1133
- $output .= "\n".'<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
1134
- } else {
1135
- $output .= "\n" . sprintf(
1136
- '<a class="first-page button" href="%s"><span class="screen-reader-text">%s</span><span aria-hidden="true">&laquo;</span></a>',
1137
- esc_url( add_query_arg( 'paged', 1, $current_url ) ),
1138
- __( 'First page' ),
1139
- );
1140
- }
1141
-
1142
- // Prev indicator / button
1143
- if ( $disable_prev ) {
1144
- $output .= "\n".'<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>';
1145
- } else {
1146
- $output .= "\n".sprintf(
1147
- '<a class="prev-page button" href="%s"><span class="screen-reader-text">%s</span><span aria-hidden="true">&lsaquo;</span></a>',
1148
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
1149
- __( 'Previous page' ),
1150
- );
1151
- }
1152
-
1153
- // Current page bottom
1154
- if ( 'bottom' === $which ) {
1155
- $html_current_page = $current;
1156
- $total_pages_before = '
1157
- <span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
1158
- }
1159
-
1160
- // Current page top
1161
- else {
1162
- $html_current_page = sprintf(
1163
- '%s<input
1164
- class="current-page pietje"
1165
- id="current-page-selector"
1166
- type="text"
1167
- name="paged"
1168
- value="%s"
1169
- size="%d"
1170
- aria-describedby="table-paging"
1171
- onchange="document.location.href=\'%s&paged=\'+Math.min(Math.max(parseInt(this.value)||1,1),'.$total_pages.')"
1172
- /><span class="tablenav-paging-text">',
1173
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
1174
- $current,
1175
- strlen( $total_pages ),
1176
- esc_url( remove_query_arg( 'paged' ) )
1177
- );
1178
- $total_pages_before = '<span class="paging-input">';
1179
- }
1180
-
1181
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
1182
- $output .= $total_pages_before . sprintf(
1183
-
1184
- /* translators: 1: Current page, 2: Total pages. */
1185
- _x( '%1$s of %2$s', 'wp-photo-album-plus' ),
1186
- $html_current_page,
1187
- $html_total_pages
1188
- ) . '</span></span>';
1189
-
1190
- // Next button / indicator
1191
- if ( $disable_next ) {
1192
- $output .= "\n".'<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>';
1193
- } else {
1194
- $output .= "\n". sprintf(
1195
- '<a class="next-page button" href="%s"><span class="screen-reader-text">%s</span><span aria-hidden="true">&rsaquo;</span></a>',
1196
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
1197
- __( 'Next page' )
1198
- );
1199
- }
1200
-
1201
- // Last button / indicator
1202
- if ( $disable_last ) {
1203
- $output .= '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&raquo;</span>';
1204
- } else {
1205
- $output .= sprintf(
1206
- '<a class="last-page button" href="%s"><span class="screen-reader-text">%s</span><span aria-hidden="true">&raquo;</span></a>',
1207
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
1208
- __( 'Last page' )
1209
- );
1210
- }
1211
-
1212
- // The pagesize selectionbox
1213
- if ( $which == 'top' ) {
1214
- $output .= ' ' .
1215
- __( 'Pagesize', 'wp-photo-album-plus' ) . '
1216
- <select style="vertical-align:top"
1217
- onchange="jQuery( \'#wppa-admin-spinner\' ).show();document.location.href=\''.$link.'1&wppa-pagesize=\'+this.value;">
1218
- <option value="20"' . ( $pagesize == '20' ? ' selected' : '' ) . '>20</option>
1219
- <option value="50"' . ( $pagesize == '50' ? ' selected' : '' ) . '>50</option>
1220
- <option value="100"' . ( $pagesize == '100' ? ' selected' : '' ) . '>100</option>
1221
- <option value="200"' . ( $pagesize == '200' ? ' selected' : '' ) . '>200</option>
1222
- <option value="500"' . ( $pagesize == '500' ? ' selected' : '' ) . '>500</option>
1223
- <option value="1000"' . ( $pagesize == '1000' ? ' selected' : '' ) . '>1000</option>
1224
- </select>';
1225
- }
1226
-
1227
- // Close pagination links
1228
- $output .= '</span>';
1229
-
1230
- // Close overall inner
1231
- $output .= '</div>';
1232
-
1233
- // Close overall wrapper, bottom only
1234
- if ( $which == 'bottom' ) {
1235
- $output .= '</div>';
1236
- }
1237
-
1238
- // Done
1239
- wppa_echo( $output, false, false, false, true );
1240
- }
1241
-
1242
- // Get paging parameters
1243
- function wppa_get_paging_parms( $slug, $save = true ) {
1244
-
1245
- // Init
1246
- $result = array();
1247
- $defdesc = false;;
1248
-
1249
- /* Order by */
1250
- switch( $slug ) {
1251
- case 'edit_email':
1252
-
1253
- // Default
1254
- $result['order'] = 'ID';
1255
-
1256
- // Query arg?
1257
- $order_new = wppa_get( 'order-by', '', 'text' );
1258
- if ( in_array( $order_new, ['ID','user_login', 'display_name'] ) ) {
1259
- $result['order'] = $order_new;
1260
- $new = true;
1261
- }
1262
- else {
1263
- $new = false;
1264
- }
1265
- break;
1266
-
1267
- case 'album_admin':
1268
-
1269
- // Default
1270
- $result['order'] = 'id';
1271
-
1272
- // Query arg?
1273
- $order_new = wppa_get( 'order-by', '', 'text' );
1274
- if ( in_array( $order_new, ['id','name','description','owner','a_order','a_parent'] ) ) {
1275
- $result['order'] = $order_new;
1276
- $new = true;
1277
- }
1278
- else {
1279
- $new = false;
1280
- }
1281
- break;
1282
-
1283
- case 'comment_admin':
1284
-
1285
- // Default
1286
- $result['order'] = 'timestamp';
1287
-
1288
- // Query arg?
1289
- $order_new = wppa_get( 'order-by', '', 'text' );
1290
- if ( in_array( $order_new, ['id','timestamp','photo','user'] ) ) {
1291
- $result['order'] = $order_new;
1292
- $new = true;
1293
- }
1294
- else {
1295
- $new = false;
1296
- }
1297
- break;
1298
-
1299
- case 'photo_admin':
1300
- case 'photo_quick':
1301
- case 'photo_bulk':
1302
-
1303
- // Default
1304
- $result['order'] = '';
1305
- $new = true;
1306
- break;
1307
-
1308
- default:
1309
-
1310
- // Should never get here
1311
- wppa_log( 'err', 'Unimplemented slug in wppa_get_paging_parms(): ' . $slug);
1312
- $result['order'] = false;
1313
- $new = true;
1314
- }
1315
-
1316
- // Used before?
1317
- if ( ! $new ) {
1318
- $order_old = get_transient( 'wppa_' . $slug . '_seq-' . wppa_get_user() );
1319
- if ( $order_old ) {
1320
- $result['order'] = $order_old;
1321
- }
1322
- }
1323
-
1324
- // Save ?
1325
- if ( $save && $result['order'] ) {
1326
- set_transient( 'wppa_' . $slug . '_seq-' . wppa_get_user(), $result['order'] );
1327
- }
1328
-
1329
- /* dir */
1330
- $result['dir'] = $defdesc ? 'DESC' : 'ASC';
1331
-
1332
- // Query arg?
1333
- $dir_new = wppa_get( 'dir', '', 'text' );
1334
- if ( in_array( $dir_new, ['ASC', 'DESC'] ) ) {
1335
- $result['dir'] = $dir_new;
1336
- }
1337
-
1338
- // Used before?
1339
- elseif ( get_transient( 'wppa_' . $slug . '_dir-' . wppa_get_user() ) == 'DESC' ) {
1340
- $result['dir'] = 'DESC';
1341
- }
1342
-
1343
- // Save ?
1344
- if ( $save && $result['order'] ) {
1345
- set_transient( 'wppa_' . $slug . '_dir-' . wppa_get_user(), $result['dir'] );
1346
- }
1347
-
1348
- /* Page */
1349
- $result['page'] = wppa_get( 'paged', '', 'int' );
1350
-
1351
- // Nothing yet?
1352
- if ( ! $result['page'] ) {
1353
- $result['page'] = '1';
1354
- }
1355
-
1356
- /* Pagesize */
1357
- $result['pagesize'] = wppa_get( 'wppa-pagesize', '', 'int' );
1358
-
1359
- // Used before?
1360
- if ( ! wppa_is_int( $result['pagesize'] ) ) {
1361
- $result['pagesize'] = get_transient( 'wppa_' . $slug . '_pagesize-' . wppa_get_user() );
1362
- }
1363
-
1364
- // Nothing yet?
1365
- if ( ! $result['pagesize'] ) {
1366
- $result['pagesize'] = '20';
1367
- }
1368
-
1369
- // Save ?
1370
- if ( $save ) {
1371
- set_transient( 'wppa_' . $slug . '_pagesize-' . wppa_get_user(), $result['pagesize'] );
1372
- }
1373
-
1374
- return $result;
1375
- }
1376
-
1377
- // Get admin page reload url
1378
- // arg1: string. where slug
1379
- // arg2: string. a vailt order column
1380
- function wppa_admin_reload_url( $slug, $for ) {
1381
-
1382
- // Init
1383
- $err = false;
1384
-
1385
- // Validate args
1386
- switch( $slug ) {
1387
- case 'edit_email':
1388
- if ( ! in_array( $for, ['ID', 'user_login', 'display_name'] ) ) {
1389
- $err = true;
1390
- }
1391
- break;
1392
- case 'album_admin':
1393
- if ( ! in_array( $for, ['id', 'name', 'description', 'owner', 'a_order', 'a_parent'] ) ) {
1394
- $err = true;
1395
- }
1396
- break;
1397
- default:
1398
- $err = true;
1399
- }
1400
-
1401
- if ( $err ) {
1402
- wppa_log( 'err', 'Invalid for in wppa_admin_reload_url('.$slug.','.$for.')');
1403
- return '';
1404
- }
1405
-
1406
- // Do it
1407
- $parms = wppa_get_paging_parms( $slug, false );
1408
- if ( $for == $parms['order'] ) {
1409
- if ( $parms['dir'] == 'ASC' ) {
1410
- $dir = 'DESC';
1411
- }
1412
- else {
1413
- $dir = 'ASC';
1414
- }
1415
- $page = $parms['page'];
1416
- }
1417
- else {
1418
- $dir = 'ASC';
1419
- $page = '1';
1420
- }
1421
-
1422
- switch( $slug ) {
1423
-
1424
- case 'edit_email':
1425
- $url = get_admin_url() . 'admin.php?page=wppa_edit_email&wppa-order-by=' . $for . '&wppa-dir=' . $dir . '&paged=' . $page;
1426
- break;
1427
-
1428
- case 'album_admin':
1429
- $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&wppa-order-by=' . $for . '&wppa-dir=' . $dir . '&paged=' . $page;
1430
- break;
1431
-
1432
- default:
1433
- $url = '';
1434
- }
1435
-
1436
- return $url;
1437
- }
1438
-
1439
- function wppa_status_display_name( $status ) {
1440
- static $wppa_statarray;
1441
-
1442
- if ( ! $wppa_statarray ) {
1443
- $wppa_statarray = [
1444
- 'pending' => __( 'Pending', 'wp-photo-album-plus' ),
1445
- 'publish' => __( 'Publish', 'wp-photo-album-plus' ),
1446
- 'featured' => __( 'Featured', 'wp-photo-album-plus' ),
1447
- 'gold' => __( 'Gold', 'wp-photo-album-plus' ),
1448
- 'silver' => __( 'Silver', 'wp-photo-album-plus' ),
1449
- 'bronze' => __( 'Bronze', 'wp-photo-album-plus' ),
1450
- 'scheduled' => __( 'Scheduled', 'wp-photo-album-plus' ),
1451
- 'private' => __( 'Private', 'wp-photo-album-plus' ),
1452
- ];
1453
- }
1454
- if ( isset( $wppa_statarray[$status] ) ) {
1455
- return $wppa_statarray[$status];
1456
- }
1457
- else {
1458
- wppa_log( 'err', "Uniplemented status found in wppa_status_display_name( $status )" );
1459
- return '';
1460
- }
1461
- }
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
+ * Version 8.2.07.002
7
  *
8
  */
9
 
550
  return $count;
551
  }
552
 
553
+ function wppa_admin_page_links( $curpage, $pagesize, $count, $link, $extra = '' ) {
554
+
555
+ if ( $pagesize < '1' ) return; // Pagination is off
556
+
557
+ $prevpage = $curpage - '1';
558
+ $nextpage = $curpage + '1';
559
+ $prevurl = $link.'&wppa-page='.$prevpage.$extra;
560
+ $pagurl = $link.'&wppa-page=';
561
+ $nexturl = $link.'&wppa-page='.$nextpage.$extra;
562
+ $npages = ceil( $count / $pagesize );
563
+ $lastpagecount = $count % $pagesize;
564
+ if ( ! $lastpagecount ) {
565
+ $lastpagecount = $pagesize;
566
+ }
567
+
568
+ $result = '';
569
+ if ( $npages > '1' ) {
570
+ $result .= '<div style="line-height:1.5em">';
571
+ if ( $curpage != '1' ) {
572
+ $result .= '<a href="' . esc_url( $prevurl ) . '">' . esc_html__( 'Prev page', 'wp-photo-album-plus' ) . '</a>';
573
+ }
574
+
575
+ $result .= '<select onchange="document.location=jQuery(this).val()">';
576
+
577
+ $i = '1';
578
+ while ( $i <= $npages ) {
579
+ if ( $i == $curpage ) {
580
+ $result .= '<option selected>' . $i . '</option>';
581
+ }
582
+ else {
583
+ $result .= '<option value="' . esc_url( $pagurl . $i . $extra ) . '"' . ( $i == $npages ? ' title="' . esc_attr( $lastpagecount ) . '"' : '' ) . '>' . $i . '</option>';
584
+ }
585
+ $i++;
586
+ }
587
+ $result .= '</select>';
588
+
589
+
590
+ if ( $curpage != $npages ) {
591
+ $result .=
592
+ ' <a href="' . esc_url( $nexturl ) . '" >' .
593
+ esc_html__( 'Next page', 'wp-photo-album-plus' ) .
594
+ '</a>';
595
+ }
596
+ $result .= '</div><br>&nbsp;';
597
+
598
+ wppa_echo( $result );
599
+ }
600
+ }
601
 
602
  function wppa_update_single_photo( $file, $id, $name ) {
603
  global $wpdb;
980
  $pendingcount = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'pending'" );
981
  $schedulecount = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'scheduled'" );
982
 
983
+ $result =
984
+ sprintf( __( 'There are <strong>%d</strong> albums and <strong>%d</strong> photos in the system.', 'wp-photo-album-plus' ), $albcount, $photocount );
985
+ if ( $pendingcount ) {
986
+ $result .= ' ' . sprintf( __( '<strong>%d</strong> photos are pending moderation.', 'wp-photo-album-plus' ), $pendingcount );
987
+ }
988
+ if ( $schedulecount ) {
989
+ $result .= ' ' . sprintf( __( '<strong>%d</strong> photos are scheduled for later publishing.', 'wp-photo-album-plus' ), $pendingcount );
990
+ }
 
991
 
992
+ $lastalbum = $wpdb->get_row( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY id DESC LIMIT 1", ARRAY_A );
993
+ if ( $lastalbum ) {
994
+ $result .= '<br>' . sprintf( __( 'The most recently added album is <strong>%s</strong> (%d).', 'wp-photo-album-plus' ), sanitize_text_field( $lastalbum['name'] ), $lastalbum['id'] );
995
+ }
996
+ $lastphoto = $wpdb->get_row( "SELECT id, name, album FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 1", ARRAY_A );
997
+ if ( ! $lastphoto ) {
998
+ $result .= '<br>' . __( 'There are no photos yet', 'wp-photo-album-plus' );
999
+ return $result;
1000
+ }
1001
+ if ( $lastphoto['album'] < '1' ) {
1002
+ $trashed = true;
1003
+ $album = - ( $lastphoto['album'] + '9' );
1004
+ }
1005
+ else {
1006
+ $trashed = false;
1007
+ $album = $lastphoto['album'];
1008
+ }
1009
+ $lastphotoalbum = $wpdb->get_row( $wpdb->prepare( "SELECT id, name FROM $wpdb->wppa_albums WHERE id = %s", $album ), ARRAY_A );
1010
+ if ( $lastphoto ) {
1011
+ $result .= '<br>' . sprintf( __( 'The most recently added photo is <strong>%s</strong> (%d)', 'wp-photo-album-plus' ), sanitize_text_field( $lastphoto['name'] ), $lastphoto['id'] );
1012
+ if ( $lastphotoalbum ) {
1013
+ $result .= ' ' . sprintf( __( 'in album <strong>%s</strong> (%d).', 'wp-photo-album-plus' ), sanitize_text_field( $lastphotoalbum['name'] ), $lastphotoalbum['id'] );
1014
  }
1015
+ if ( $trashed ) {
1016
+ $result .= ' <span style="color:red" >' . __( 'Deleted', 'wp-photo-album-plus' ) . '</span>';
 
 
 
 
 
 
 
1017
  }
1018
+ }
 
1019
  return $result;
1020
  }
1021
 
1112
  // All done
1113
  return true;
1114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wppa-admin-local-js.php DELETED
@@ -1,335 +0,0 @@
1
- <?php
2
- /* wppa-admin-local-js.php
3
- * Package: wp-photo-album-plus
4
- *
5
- * local js code for admin pages
6
- * Version 8.3.01.005
7
- *
8
- */
9
-
10
- function wppa_add_local_js( $slug ) {
11
-
12
- switch( $slug ) {
13
-
14
- case 'wppa_album_photos':
15
- {
16
- $the_js = "
17
- function wppaTryMove( id, video ) {
18
-
19
- var query;
20
-
21
- if ( ! jQuery( '#target-' + id ).val() ) {
22
- alert( '" . esc_js( __( 'Please select an album to move to first.', 'wp-photo-album-plus' ) ) . "' );
23
- return false;
24
- }
25
-
26
- if ( video ) {
27
- query = '" . esc_js( __( 'Are you sure you want to move this video?', 'wp-photo-album-plus' ) ) . "';
28
- }
29
- else {
30
- query = '" . esc_js( __( 'Are you sure you want to move this photo?', 'wp-photo-album-plus' ) ) . "';
31
- }
32
-
33
- if ( confirm( query ) ) {
34
- wppaAjaxUpdatePhoto( id, 'moveto', document.getElementById( 'target-' + id ).value );
35
- }
36
- }
37
-
38
- function wppaTryCopy( id, video ) {
39
-
40
- var query;
41
-
42
- if ( ! jQuery( '#target-' + id ).val() ) {
43
- alert( '" . esc_js( __( 'Please select an album to copy to first.', 'wp-photo-album-plus' ) ) . "' );
44
- return false;
45
- }
46
-
47
- if ( video ) {
48
- query = '" . esc_js( __( 'Are you sure you want to copy this video?', 'wp-photo-album-plus' ) ) . "';
49
- }
50
- else {
51
- query = '" . esc_js( __( 'Are you sure you want to copy this photo?', 'wp-photo-album-plus' ) ) . "';
52
- }
53
-
54
- if ( confirm( query ) ) {
55
- wppaAjaxUpdatePhoto( id, 'copyto', document.getElementById( 'target-' + id ).value );
56
- }
57
- }
58
-
59
- function wppaTryDelete( id, video, perm ) {
60
-
61
- var query;
62
-
63
- if ( perm ) {
64
- if ( video ) {
65
- query = '" . esc_js( __( 'Are you sure you want to remove this video permanently?', 'wp-photo-album-plus' ) ) . "';
66
- }
67
- else {
68
- query = '" . esc_js( __( 'Are you sure you want to remove this photo permanently?', 'wp-photo-album-plus' ) ) . "';
69
- }
70
- }
71
- else {
72
- if ( video ) {
73
- query = '" . esc_js( __( 'Are you sure you want to delete this video?', 'wp-photo-album-plus' ) ) . "';
74
- }
75
- else {
76
- query = '" . esc_js( __( 'Are you sure you want to delete this photo?', 'wp-photo-album-plus' ) ) . "';
77
- }
78
- }
79
-
80
- if ( confirm( query ) ) {
81
- if ( perm ) {
82
- wppaAjaxDeletePhoto( id, '', '', true );
83
- }
84
- else {
85
- wppaAjaxDeletePhoto( id );
86
- }
87
- jQuery( window ).trigger( 'scroll' );
88
- }
89
- }
90
-
91
- function wppaTryUndelete ( id ) {
92
- wppaAjaxUndeletePhoto( id );
93
- }
94
-
95
- function wppaTryRotLeft( id ) {
96
-
97
- var query = '" . esc_js( __( 'Are you sure you want to rotate this photo left?', 'wp-photo-album-plus' ) ) . "';
98
-
99
- if ( confirm( query ) ) {
100
- wppaAjaxUpdatePhoto( id, 'rotleft', 0 );
101
- }
102
- }
103
-
104
- function wppaTryRot180( id ) {
105
-
106
- var query = '" . esc_js( __( 'Are you sure you want to rotate this photo 180&deg;?', 'wp-photo-album-plus' ) ) . "';
107
-
108
- if ( confirm( query ) ) {
109
- wppaAjaxUpdatePhoto( id, 'rot180', 0 );
110
- }
111
- }
112
-
113
- function wppaTryRotRight( id ) {
114
-
115
- var query = '" . esc_js( __( 'Are you sure you want to rotate this photo right?', 'wp-photo-album-plus' ) ) . "';
116
-
117
- if ( confirm( query ) ) {
118
- wppaAjaxUpdatePhoto( id, 'rotright', 0 );
119
- }
120
- }
121
-
122
- function wppaTryFlip( id ) {
123
-
124
- var query = '" . esc_js( __( 'Are you sure you want to flip this photo?', 'wp-photo-album-plus' ) ) . "';
125
-
126
- if ( confirm( query ) ) {
127
- wppaAjaxUpdatePhoto( id, 'flip', 0 );
128
- }
129
- }
130
-
131
- function wppaTryFlop( id ) {
132
-
133
- var query = '" . esc_js( __( 'Are you sure you want to flip this photo?', 'wp-photo-album-plus' ) ) . "';
134
-
135
- if ( confirm( query ) ) {
136
- wppaAjaxUpdatePhoto( id, 'flop', 0 );
137
- }
138
- }
139
-
140
- function wppaTryWatermark( id, hasSource, canRemove ) {
141
-
142
- var query;
143
- var wmFile = jQuery( '#wmfsel_' + id ).val();
144
- if ( wmFile == '--- none ---' ) {
145
- alert( '" . esc_js( __( 'No watermark selected', 'wp-photo-album-plus' ) ) . "' );
146
- return;
147
- }
148
- if ( hasSource ) {
149
- query = '" . esc_js( __( 'Are you sure?', 'wp-photo-album-plus' ) ) . "';
150
- query += '. ';
151
- query += '" . esc_js( __( 'To revert to the default watermark setting afterwards: select Watermark: --- default --- and press the Remake files button', 'wp-photo-album-plus' ) ) . "';
152
- if ( canRemove ) {
153
- query += '. ';
154
- query += '" . esc_js( __( 'To remove: select Watermark: --- none --- and press the Remake files button', 'wp-photo-album-plus' ) ) . "';
155
- }
156
- }
157
- else {
158
- query = '" . esc_js( __( 'Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus' ) ) . "';
159
- query += '. ';
160
- query += '" . esc_js( __( 'And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus' ) ) . "';
161
- }
162
-
163
- if ( confirm( query ) ) {
164
- wppaAjaxApplyWatermark( id, document.getElementById( 'wmfsel_' + id ).value, document.getElementById( 'wmpsel_' + id ).value );
165
- }
166
- }
167
-
168
- function wppaTryMagick( id, slug, value ) {
169
-
170
- if ( ! value ) {
171
- value = 0;
172
- }
173
-
174
- var query = '" . esc_js( __( 'Are you sure you want to magically process this photo?', 'wp-photo-album-plus' ) ) . "';
175
-
176
- if ( true || confirm( query ) ) {
177
- jQuery( '#wppa-admin-spinner' ).css( 'display', 'inline' );
178
- wppaAjaxUpdatePhoto( id, slug, value );
179
- }
180
- }
181
-
182
- wppaHor = false;
183
- function wppaToggleHorizon() {
184
- if ( wppaHor ) {
185
- jQuery( '#wppa-horizon' ).css( 'display', 'none' );
186
- wppaHor = false;
187
- }
188
- else {
189
- jQuery( '#wppa-horizon' ).css( 'display', 'inline' );
190
- wppaHor = true;
191
- }
192
- }
193
-
194
- function wppaTryScheduledel( id ) {
195
- wppaPhotoStatusChange( id );
196
- if ( ! jQuery( '#scheduledel-' + id ).prop( 'checked' ) ) {
197
- wppaAjaxUpdatePhoto( id, 'removescheduledel', 0 );
198
- }
199
- }
200
- ";
201
-
202
- // The script for the tabs to operate
203
- $the_js .= '
204
- function wppaChangePhotoAdminTab(elm,tabId,itemId) {
205
- jQuery(".wppa-photoadmin-tab-"+itemId).removeClass(\'active\');
206
- jQuery(elm).addClass(\'active\');
207
- jQuery(".wppa-tabcontent-"+itemId).hide();
208
- jQuery(tabId).show();
209
- }';
210
-
211
- break;
212
- }
213
-
214
- case 'wppa_album_photos_bulk':
215
- {
216
- $the_js = "
217
- function wppaTryMove( id, video ) {
218
-
219
- var query;
220
-
221
- if ( ! jQuery( '#target-' + id ).val() ) {
222
- alert( '" . esc_js( __( 'Please select an album to move to first.', 'wp-photo-album-plus' ) ) . "' );
223
- return false;
224
- }
225
-
226
- if ( video ) {
227
- query = '" . esc_js( __( 'Are you sure you want to move this video?', 'wp-photo-album-plus' ) ) . "';
228
- }
229
- else {
230
- query = '" . esc_js( __( 'Are you sure you want to move this photo?', 'wp-photo-album-plus' ) ) . "';
231
- }
232
-
233
- if ( ! jQuery('#confirm-move').prop('checked') || confirm( query ) ) {
234
- jQuery( '#moving-' + id ).html( '". __( 'Moving...', 'wp-photo-album-plus' ) . "' );
235
- wppaAjaxUpdatePhoto( id, 'moveto', jQuery( '#target-' + id ).val(), false, '<td colspan=\'8\' >', '</td>' );
236
- }
237
- }" . '
238
- jQuery(document).ready( function() {
239
- wppaSetConfirmDelete( "confirm-delete" );
240
- wppaSetConfirmMove( "confirm-move" );
241
- });
242
- function wppaConfirmAndDelete(id, immediate) {
243
- if ( ! jQuery("#confirm-delete").prop("checked") ||
244
- confirm( "' . esc_js( __( 'Are you sure you want to delete this photo?', 'wp-photo-album-plus' ) ) . '" ) ) {
245
- jQuery("#wppa-delete-"+id).html( "' . esc_js( __('Deleting...', 'wp-photo-album-plus' ) ) . '" );
246
- wppaAjaxDeletePhoto(id, "<td colspan=8 >", "</td>", immediate);
247
- }
248
- }';
249
-
250
- break;
251
- }
252
-
253
- case 'wppa_album_photos_sequence':
254
- {
255
- $the_js = '
256
- jQuery( function() {
257
- jQuery( "#sortable" ).sortable( {
258
- cursor: "move",
259
- placeholder: "sortable-placeholder-photos",
260
- stop: function( event, ui ) {
261
- var ids = jQuery( ".wppa-sort-item" );
262
- var seq = jQuery( ".wppa-sort-seqn" );
263
- var idx = 0;
264
- while ( idx < ids.length ) {
265
- var newvalue;
266
- if ( wppaSeqnoDesc ) {
267
- newvalue = ids.length - idx;
268
- }
269
- else newvalue = idx + 1;
270
- var oldvalue = seq[idx].value;
271
- var photo = ids[idx].value;
272
- if ( newvalue != oldvalue ) {
273
- wppaDoSeqUpdate( photo, newvalue );
274
- }
275
- idx++;
276
- }
277
- },
278
- delay: 100,
279
- opacity: 0.5,
280
- scroll: false,
281
- cursorAt: { left: 90, top: 90 }
282
- });
283
- jQuery( "#sortable" ).disableSelection();
284
- });
285
- var wppaAjaxRequests = 0;
286
- function wppaDoSeqUpdate( photo, seqno ) {
287
- if ( wppaAjaxRequests >=10 ) {
288
- setTimeout(function(){wppaDoSeqUpdate( photo, seqno );},500);
289
- return;
290
- }
291
- var data = "action=wppa&wppa-action=update-photo&photo-id="+photo+"&item=p_order&wppa-nonce="+document.getElementById(\'photo-nonce-\'+photo).value+"&value="+seqno;
292
- var xmlhttp = new XMLHttpRequest();
293
-
294
- xmlhttp.onreadystatechange = function() {
295
- if ( xmlhttp.readyState == 4 && xmlhttp.status != 404 ) {
296
- var ArrValues = xmlhttp.responseText.split( "||" );
297
- if ( ArrValues[0] != "" ) {
298
- alert("The server returned unexpected output:\n"+ArrValues[0]);
299
- }
300
- switch ( ArrValues[1] ) {
301
- case "0": // No error
302
- jQuery("#wppa-seqno-"+photo).html(seqno);
303
- break;
304
- case "99": // Photo is gone
305
- jQuery("#wppa-seqno-"+photo).html(\'<span style="color:red">deleted</span>\');
306
- break;
307
- default: // Any error
308
- jQuery("#wppa-seqno-"+photo).html(\'<span style="color:red">Err:"+ArrValues[1]+"</span>\');
309
- break;
310
- }
311
- wppaAjaxRequests--;
312
- wppaConsoleLog("Pending ajax requests = "+wppaAjaxRequests);
313
- }
314
- }
315
- xmlhttp.open("POST",wppaAjaxUrl,true);
316
- xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
317
- xmlhttp.send( data );
318
- wppaAjaxRequests++;
319
- wppaConsoleLog("Pending ajax requests = "+wppaAjaxRequests);
320
- jQuery("#wppa-sort-seqn-"+photo).val(seqno); // set hidden value to new value to prevent duplicate action
321
- var spinnerhtml = \'<img src="\'+wppaImageDirectory+\'spinner.gif" />\';
322
- jQuery("#wppa-seqno-"+photo).html(spinnerhtml);
323
- }';
324
- break;
325
- }
326
-
327
- default:
328
-
329
- wppa_log( 'err', "No local js for $slug in wppa_add_local_js()" );
330
- return;
331
- break;
332
- }
333
-
334
- wppa_add_inline_script( 'wppa-admin', $the_js );
335
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wppa-admin-styles.css CHANGED
@@ -1,7 +1,7 @@
1
  /* admin-styles.css
2
  *
3
  * wp-photo-album-plus
4
- * version 8.3.01.004
5
  */
6
  #files_list, #files_list2
7
  {
@@ -119,11 +119,7 @@ ul.wppa_nav
119
  }
120
  .wppa-table input {
121
  height: 20px !important;
122
- padding-left:6px;
123
- }
124
- .wppa-table .wppa-doit-button {
125
- padding-left:6px;
126
- padding-right:6px;
127
  }
128
  .wppa-table textarea {
129
  padding:0 !important;
@@ -164,11 +160,7 @@ ul.wppa_nav
164
  .photoitem, .albumtable, .table_wrapper {
165
  margin: 7px 0;
166
  padding: 5px;
167
- border: 1px solid;
168
- }
169
-
170
- .photoitem td {
171
- border-bottom:1px solid #555;
172
  }
173
 
174
  .photoitem .deletelink
@@ -626,7 +618,7 @@ details.hidden {
626
  border: 1px solid #8c8f94;
627
  color: #2c3338;
628
  padding: 8px;
629
- max-width: 100%;
630
  }
631
  .left {
632
  float:left;
@@ -657,32 +649,44 @@ details.hidden {
657
  color: rgba(44, 51, 56, 0.5);
658
  }
659
 
660
- .wppa-tabcontent {
661
- min-height: 530px;
 
 
 
 
 
 
 
 
 
 
662
  }
663
 
664
- .wppa-table-header-box {
665
- margin-top:12px;
666
- margin-bottom: 9px;
667
- display:block;
668
  }
669
 
670
- #wppa-action-container {
671
- display: inline-block;
672
  }
673
 
 
 
 
 
674
 
675
- #wppa-action-container input,
676
- #wppa-action-container select {
677
- margin-right: 8px;
 
678
  }
679
 
680
- #wppa-action-container input:last-of-type {
681
- margin-right: 0;
682
  }
683
 
684
- .wppa-admin-pagination {
685
- display:block;
686
- float:right;
687
- margin-bottom:6px;
688
  }
1
  /* admin-styles.css
2
  *
3
  * wp-photo-album-plus
4
+ * version 8.2.04.008
5
  */
6
  #files_list, #files_list2
7
  {
119
  }
120
  .wppa-table input {
121
  height: 20px !important;
122
+ padding:0 !important;
 
 
 
 
123
  }
124
  .wppa-table textarea {
125
  padding:0 !important;
160
  .photoitem, .albumtable, .table_wrapper {
161
  margin: 7px 0;
162
  padding: 5px;
163
+ border: 1px #ccc solid;
 
 
 
 
164
  }
165
 
166
  .photoitem .deletelink
618
  border: 1px solid #8c8f94;
619
  color: #2c3338;
620
  padding: 8px;
621
+ max-width: 900px;
622
  }
623
  .left {
624
  float:left;
649
  color: rgba(44, 51, 56, 0.5);
650
  }
651
 
652
+ #wppa-action-container {
653
+ margin-top: 8px;
654
+ display: flex;
655
+ flex-flow: row wrap;
656
+ justify-content: space-between;
657
+ }
658
+
659
+ #wppa-action-container-left {
660
+ display: flex;
661
+ flex-basis: 50%;
662
+ align-items: flex-start;
663
+ margin-bottom: 8px;
664
  }
665
 
666
+ #wppa-action-container-left input,
667
+ #wppa-action-container-left select {
668
+ margin-right: 8px;
 
669
  }
670
 
671
+ #wppa-action-container-left input:last-of-type {
672
+ margin-right: 0;
673
  }
674
 
675
+ #wppa-action-container-right {
676
+ display: flex;
677
+ align-items: flex-end;
678
+ }
679
 
680
+ #wppa-action-container-right input,
681
+ #wppa-action-container-right select {
682
+ margin-left: 8px;
683
+ align-self:baseline;
684
  }
685
 
686
+ #wppa-action-container-right select:first-of-type {
687
+ margin-left: 0;
688
  }
689
 
690
+ .wppa-tabcontent {
691
+ min-height: 530px;
 
 
692
  }
wppa-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -38,170 +38,61 @@ function wppa_add_admin() {
38
  // See if there are comments pending moderation
39
  $com_pending = '';
40
  $com_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE status = 'pending' OR status = 'spam' OR status = ''" );
41
- if ( $com_pending_count ) $com_pending = '<span class="update-plugins"><span class="plugin-count">' . $com_pending_count . '</span></span>';
42
 
43
  // See if there are uploads pending moderation
44
  $upl_pending = '';
45
  $upl_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'pending' AND album > 0" );
46
- if ( $upl_pending_count ) $upl_pending = '<span class="update-plugins"><span class="plugin-count">' . $upl_pending_count . '</span></span>';
47
 
48
  // Compute total pending moderation
49
  $tot_pending = '';
50
  $tot_pending_count = '0';
51
  if ( current_user_can('wppa_comments') || current_user_can('wppa_moderate') ) $tot_pending_count += $com_pending_count;
52
- if ( current_user_can('wppa_admin') || current_user_can('wppa_moderate') ) $tot_pending_count += $upl_pending_count;
53
- if ( $tot_pending_count ) $tot_pending = '<span class="update-plugins"><span class="plugin-count"><b>' . $tot_pending_count . '</b></span></span>';
54
 
55
- // Add wppa menu
56
  $icon_url = WPPA_URL . '/img/camera16.png';
57
 
58
- // Main menu Photo Albums
59
- add_menu_page( 'WP Photo Album', // page_title
60
- __( 'Photo&thinsp;Albums', 'wp-photo-album-plus' ) . $tot_pending, // menu_title
61
- 'wppa_admin', // capability
62
- 'wppa_admin_menu', // menu_slug
63
- 'wppa_admin', // function
64
- $icon_url ); // icon_url
65
-
66
- // Albums
67
- add_submenu_page( 'wppa_admin_menu', // parent_slug
68
- __( 'Albums', 'wp-photo-album-plus' ), // page_title
69
- __( 'Albums', 'wp-photo-album-plus' ) . $upl_pending, // menu_title
70
- 'wppa_admin', // capability
71
- 'wppa_admin_menu', // menu_slug
72
- 'wppa_admin' ); // function
73
-
74
- // Upload *
75
- add_submenu_page( 'wppa_admin_menu',
76
- __( 'Upload', 'wp-photo-album-plus' ), // page_title
77
- __( 'Upload', 'wp-photo-album-plus' ), // menu_title
78
- 'wppa_upload',
79
- 'wppa_upload_photos',
80
- 'wppa_page_upload' ); // function
81
-
82
- // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos *
83
- if ( ! current_user_can( 'wppa_admin' ) && wppa_opt( 'upload_edit' ) != '-none-' ) {
84
- add_submenu_page( 'wppa_admin_menu',
85
- __( 'Edit photos', 'wp-photo-album-plus' ), // page_title
86
- __( 'Edit photos', 'wp-photo-album-plus' ), // menu_title
87
- 'wppa_upload',
88
- 'wppa_edit_photo',
89
- 'wppa_edit_photo' );
90
- }
91
 
92
- // Import *
93
- add_submenu_page( 'wppa_admin_menu',
94
- __( 'Import', 'wp-photo-album-plus' ), // page_title
95
- __( 'Import', 'wp-photo-album-plus' ), // menu_title
96
- 'wppa_import',
97
- 'wppa_import_photos',
98
- 'wppa_page_import' );
99
-
100
- // Export *
101
- add_submenu_page( 'wppa_admin_menu',
102
- __( 'Export', 'wp-photo-album-plus' ), // page_title
103
- __( 'Export', 'wp-photo-album-plus' ), // menu_title
104
- 'wppa_export',
105
- 'wppa_export_photos',
106
- 'wppa_page_export' );
107
-
108
- // Comments, only if enabled *
109
  if ( wppa_switch( 'show_comments' ) ) {
110
- add_submenu_page( 'wppa_admin_menu',
111
- __( 'Comments', 'wp-photo-album-plus' ), // page_title
112
- __( 'Comments', 'wp-photo-album-plus' ) . $com_pending, // menu_title
113
- 'wppa_comments',
114
- 'wppa_manage_comments',
115
- 'wppa_comment_admin' );
116
  }
117
-
118
- // Moderate uploads *
119
- add_submenu_page( 'wppa_admin_menu',
120
- __( 'Moderate', 'wp-photo-album-plus' ), // page_title
121
- __( 'Moderate', 'wp-photo-album-plus' ) . ( wppa_switch( 'moderate_bulk' ) ? $upl_pending : $tot_pending ),
122
- 'wppa_moderate',
123
- 'wppa_moderate_photos',
124
- 'wppa_page_moderate' );
125
-
126
- // Settings *
127
- add_submenu_page( 'wppa_admin_menu',
128
- __( 'Settings', 'wp-photo-album-plus' ), // page_title
129
- __( 'Settings', 'wp-photo-album-plus' ),
130
- 'wppa_settings',
131
- 'wppa_options',
132
- 'wppa_page_options' );
133
-
134
- // Search *
135
  if ( wppa_switch( 'opt_menu_search' ) ) {
136
- add_submenu_page( 'wppa_admin_menu',
137
- __( 'Search', 'wp-photo-album-plus' ),
138
- __( 'Search', 'wp-photo-album-plus' ),
139
- 'wppa_admin',
140
- 'wppa_search',
141
- 'wppa_search' );
142
  }
143
-
144
- // Tags *
145
  if ( wppa_switch( 'opt_menu_edit_tags' ) ) {
146
- add_submenu_page( 'wppa_admin_menu',
147
- __( 'Tags', 'wp-photo-album-plus' ),
148
- __( 'Tags', 'wp-photo-album-plus' ),
149
- 'wppa_edit_tags',
150
- 'wppa_edit_tags',
151
- 'wppa_edit_tags' );
152
  }
153
-
154
- // Sequence *
155
  if ( wppa_switch( 'opt_menu_edit_sequence' ) ) {
156
- add_submenu_page( 'wppa_admin_menu',
157
- __( 'Sequence', 'wp-photo-album-plus' ),
158
- __( 'Sequence', 'wp-photo-album-plus' ),
159
- 'wppa_edit_sequence',
160
- 'wppa_edit_sequence',
161
- 'wppa_edit_sequence' );
162
-
163
  }
164
-
165
- // Email *
166
  if ( wppa_switch( 'opt_menu_edit_email' ) ) {
167
- add_submenu_page( 'wppa_admin_menu',
168
- __( 'Manage email subscriptions', 'wp-photo-album-plus' ),
169
- __( 'Email', 'wp-photo-album-plus' ),
170
- 'wppa_edit_email',
171
- 'wppa_edit_email',
172
- 'wppa_edit_email' );
173
  }
174
-
175
- // Documentation *
176
  if ( wppa_switch( 'opt_menu_doc' ) ) {
177
- add_submenu_page( 'wppa_admin_menu',
178
- __( 'Documentation', 'wp-photo-album-plus' ),
179
- __( 'Documentation', 'wp-photo-album-plus' ),
180
- 'wppa_help',
181
- 'wppa_help',
182
- 'wppa_page_help' );
183
  }
184
-
185
- // Logfile *
186
  if ( wppa_switch( 'logfile_on_menu' ) ) {
187
- add_submenu_page( 'wppa_admin_menu',
188
- __( 'Logfile', 'wp-photo-album-plus' ),
189
- __( 'Logfile', 'wp-photo-album-plus' ),
190
- 'administrator',
191
- 'wppa_log',
192
- 'wppa_log_page' );
193
  }
194
-
195
- // Cache *
196
  $hits = wppa_get_option( 'wppa_cache_hits', '0' );
197
  $miss = wppa_get_option( 'wppa_cache_misses', '1' );
198
  $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
199
- add_submenu_page( 'wppa_admin_menu',
200
- __( 'Cache', 'wp-photo-album-plus' ),
201
- __( 'Cache', 'wp-photo-album-plus' ) . ' ' . $perc . '%',
202
- 'wppa_admin',
203
- 'wppa_cache',
204
- 'wppa_page_cache' );
205
  }
206
 
207
  /* ADMIN STYLES */
@@ -303,8 +194,6 @@ global $wppa_version;
303
  wp_enqueue_script( 'wppa-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js' );
304
  }
305
 
306
- require_once 'wppa-admin-local-js.php';
307
-
308
  /* ADMIN PAGE PHP's */
309
 
310
  // Album admin page
@@ -316,7 +205,6 @@ function wppa_admin() {
316
  wppa_publish_scheduled();
317
  _wppa_admin();
318
  }
319
-
320
  // Upload admin page
321
  function wppa_page_upload() {
322
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Uploading is temporary disabled for you' , 'wp-photo-album-plus' ) );
@@ -324,7 +212,6 @@ function wppa_page_upload() {
324
  require_once 'wppa-upload.php';
325
  _wppa_page_upload();
326
  }
327
-
328
  // Edit photo(s)
329
  function wppa_edit_photo() {
330
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Editing is temporary disabled for you' , 'wp-photo-album-plus' ) );
@@ -332,7 +219,6 @@ function wppa_edit_photo() {
332
  wppa_publish_scheduled();
333
  _wppa_edit_photo();
334
  }
335
-
336
  // Import admin page
337
  function wppa_page_import() {
338
 
@@ -349,7 +235,6 @@ function wppa_page_import() {
349
  require_once 'wppa-import.php';
350
  _wppa_page_import();
351
  }
352
-
353
  // Moderate admin page
354
  function wppa_page_moderate() {
355
  require_once 'wppa-photo-admin-autosave.php';
@@ -378,7 +263,6 @@ function wppa_page_options() {
378
  }
379
  // Comments admin page
380
  function wppa_comment_admin() {
381
- require_once 'wppa-listtable.php';
382
  require_once 'wppa-comment-admin.php';
383
  _wppa_comment_admin();
384
  }
@@ -398,7 +282,7 @@ function wppa_page_help() {
398
  }
399
 
400
  // Edit tags
401
- function wppa_edit_tags() {
402
  require_once 'wppa-edit-tags.php';
403
  _wppa_edit_tags();
404
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 8.2.09.001
7
  *
8
  */
9
 
38
  // See if there are comments pending moderation
39
  $com_pending = '';
40
  $com_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE status = 'pending' OR status = 'spam' OR status = ''" );
41
+ if ( $com_pending_count ) $com_pending = '<span class="update-plugins"><span class="plugin-count">'.$com_pending_count.'</span></span>';
42
 
43
  // See if there are uploads pending moderation
44
  $upl_pending = '';
45
  $upl_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'pending' AND album > 0" );
46
+ if ( $upl_pending_count ) $upl_pending = '<span class="update-plugins"><span class="plugin-count">'.$upl_pending_count.'</span></span>';
47
 
48
  // Compute total pending moderation
49
  $tot_pending = '';
50
  $tot_pending_count = '0';
51
  if ( current_user_can('wppa_comments') || current_user_can('wppa_moderate') ) $tot_pending_count += $com_pending_count;
52
+ if ( current_user_can('wppa_admin') || current_user_can('wppa_moderate') ) $tot_pending_count+= $upl_pending_count;
53
+ if ( $tot_pending_count ) $tot_pending = '<span class="update-plugins"><span class="plugin-count">'.'<b>'.$tot_pending_count.'</b>'.'</span></span>';
54
 
 
55
  $icon_url = WPPA_URL . '/img/camera16.png';
56
 
57
+ // page_title menu_title capability menu_slug function icon_url position
58
+ add_menu_page( 'WP Photo Album', __('Photo&thinsp;Albums', 'wp-photo-album-plus' ).$tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url ); //,'10' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ // parent_slug page_title menu_title capability menu_slug function
61
+ add_submenu_page( 'wppa_admin_menu', __('Album Admin', 'wp-photo-album-plus' ), __('Album Admin', 'wp-photo-album-plus' ).$upl_pending,'wppa_admin', 'wppa_admin_menu', 'wppa_admin' );
62
+ add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus' ), __('Upload Photos', 'wp-photo-album-plus' ), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload' );
63
+ // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
64
+ if ( ! current_user_can('wppa_admin') && wppa_opt( 'upload_edit') != '-none-' ) {
65
+ add_submenu_page( 'wppa_admin_menu', __('Edit Photos', 'wp-photo-album-plus' ), __('Edit Photos', 'wp-photo-album-plus' ), 'wppa_upload', 'wppa_edit_photo', 'wppa_edit_photo' );
66
+ }
67
+ add_submenu_page( 'wppa_admin_menu', __('Import Photos', 'wp-photo-album-plus' ), __('Import Photos', 'wp-photo-album-plus' ), 'wppa_import', 'wppa_import_photos', 'wppa_page_import' );
68
+ add_submenu_page( 'wppa_admin_menu', __('Moderate Photos', 'wp-photo-album-plus' ), __('Moderate Photos', 'wp-photo-album-plus' ).(wppa_switch('moderate_bulk')?$upl_pending:$tot_pending), 'wppa_moderate', 'wppa_moderate_photos', 'wppa_page_moderate' );
69
+ add_submenu_page( 'wppa_admin_menu', __('Export Photos', 'wp-photo-album-plus' ), __('Export Photos', 'wp-photo-album-plus' ), 'wppa_export', 'wppa_export_photos', 'wppa_page_export' );
70
+ add_submenu_page( 'wppa_admin_menu', __('Settings', 'wp-photo-album-plus' ), __('Settings', 'wp-photo-album-plus' ), 'wppa_settings', 'wppa_options', 'wppa_page_options' );
 
 
 
 
 
 
71
  if ( wppa_switch( 'show_comments' ) ) {
72
+ add_submenu_page( 'wppa_admin_menu', __('Manage comments', 'wp-photo-album-plus' ), __('Comments', 'wp-photo-album-plus' ).$com_pending, 'wppa_comments', 'wppa_manage_comments', 'wppa_comment_admin' );
 
 
 
 
 
73
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  if ( wppa_switch( 'opt_menu_search' ) ) {
75
+ add_submenu_page( 'wppa_admin_menu', __('Search', 'wp-photo-album-plus' ), __('Search', 'wp-photo-album-plus' ), 'wppa_admin', 'wppa_search', 'wppa_search' );
 
 
 
 
 
76
  }
 
 
77
  if ( wppa_switch( 'opt_menu_edit_tags' ) ) {
78
+ add_submenu_page( 'wppa_admin_menu', __('Edit tags', 'wp-photo-album-plus' ), __('Edit tags', 'wp-photo-album-plus' ), 'wppa_edit_tags', 'wppa_edit_tags', 'wppa_tag_editor' );
 
 
 
 
 
79
  }
 
 
80
  if ( wppa_switch( 'opt_menu_edit_sequence' ) ) {
81
+ add_submenu_page( 'wppa_admin_menu', __('Edit Photo Sequence', 'wp-photo-album-plus' ), __('Edit Photo Sequence', 'wp-photo-album-plus' ), 'wppa_edit_sequence', 'wppa_edit_sequence', 'wppa_edit_sequence' );
 
 
 
 
 
 
82
  }
 
 
83
  if ( wppa_switch( 'opt_menu_edit_email' ) ) {
84
+ add_submenu_page( 'wppa_admin_menu', __('Manage Email subscriptions', 'wp-photo-album-plus' ), __('Email admin', 'wp-photo-album-plus' ), 'wppa_edit_email', 'wppa_edit_email', 'wppa_edit_email' );
 
 
 
 
 
85
  }
 
 
86
  if ( wppa_switch( 'opt_menu_doc' ) ) {
87
+ add_submenu_page( 'wppa_admin_menu', __('Help &amp; Info', 'wp-photo-album-plus' ), __('Documentation', 'wp-photo-album-plus' ), 'wppa_help', 'wppa_help', 'wppa_page_help' );
 
 
 
 
 
88
  }
 
 
89
  if ( wppa_switch( 'logfile_on_menu' ) ) {
90
+ add_submenu_page( 'wppa_admin_menu', __('Logfile', 'wp-photo-album-plus' ), __('Logfile', 'wp-photo-album-plus' ), 'administrator', 'wppa_log', 'wppa_log_page' );
 
 
 
 
 
91
  }
 
 
92
  $hits = wppa_get_option( 'wppa_cache_hits', '0' );
93
  $miss = wppa_get_option( 'wppa_cache_misses', '1' );
94
  $perc = sprintf( '%5.2f', 100 * $hits / ( $hits + $miss ) );
95
+ add_submenu_page( 'wppa_admin_menu', __('Cache', 'wp-photo-album-plus' ), __('Cache', 'wp-photo-album-plus' ).' '. $perc . '%', 'wppa_admin', 'wppa_cache', 'wppa_page_cache' );
 
 
 
 
 
96
  }
97
 
98
  /* ADMIN STYLES */
194
  wp_enqueue_script( 'wppa-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js' );
195
  }
196
 
 
 
197
  /* ADMIN PAGE PHP's */
198
 
199
  // Album admin page
205
  wppa_publish_scheduled();
206
  _wppa_admin();
207
  }
 
208
  // Upload admin page
209
  function wppa_page_upload() {
210
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Uploading is temporary disabled for you' , 'wp-photo-album-plus' ) );
212
  require_once 'wppa-upload.php';
213
  _wppa_page_upload();
214
  }
 
215
  // Edit photo(s)
216
  function wppa_edit_photo() {
217
  if ( wppa_is_user_blacklisted() ) wp_die(__( 'Editing is temporary disabled for you' , 'wp-photo-album-plus' ) );
219
  wppa_publish_scheduled();
220
  _wppa_edit_photo();
221
  }
 
222
  // Import admin page
223
  function wppa_page_import() {
224
 
235
  require_once 'wppa-import.php';
236
  _wppa_page_import();
237
  }
 
238
  // Moderate admin page
239
  function wppa_page_moderate() {
240
  require_once 'wppa-photo-admin-autosave.php';
263
  }
264
  // Comments admin page
265
  function wppa_comment_admin() {
 
266
  require_once 'wppa-comment-admin.php';
267
  _wppa_comment_admin();
268
  }
282
  }
283
 
284
  // Edit tags
285
+ function wppa_tag_editor() {
286
  require_once 'wppa-edit-tags.php';
287
  _wppa_edit_tags();
288
  }
wppa-adminbar.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * enhances the admin bar with wppa+ menu
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -37,20 +37,20 @@ function wppa_admin_bar_menu() {
37
  if ( current_user_can( 'wppa_admin' ) ) {
38
  $menu_items['admin'] = array(
39
  'parent' => $wppaplus,
40
- 'title' => __( 'Albums', 'wp-photo-album-plus' ) . $upl_pending,
41
  'href' => admin_url( 'admin.php?page=wppa_admin_menu' )
42
  );
43
  }
44
  if ( current_user_can( 'wppa_upload' ) ) {
45
  $menu_items['upload'] = array(
46
  'parent' => $wppaplus,
47
- 'title' => __( 'Upload', 'wp-photo-album-plus' ),
48
  'href' => admin_url( 'admin.php?page=wppa_upload_photos' )
49
  );
50
  if ( ! current_user_can( 'wppa_admin' ) && wppa_opt( 'upload_edit' ) != 'none' ) {
51
  $menu_items['edit'] = array(
52
  'parent' => $wppaplus,
53
- 'title' => __( 'Edit' , 'wp-photo-album-plus' ),
54
  'href' => admin_url( 'admin.php?page=wppa_edit_photo' )
55
  );
56
  }
@@ -58,31 +58,24 @@ function wppa_admin_bar_menu() {
58
  if ( current_user_can( 'wppa_import' ) ) {
59
  $menu_items['import'] = array(
60
  'parent' => $wppaplus,
61
- 'title' => __( 'Import', 'wp-photo-album-plus' ),
62
  'href' => admin_url( 'admin.php?page=wppa_import_photos' )
63
  );
64
  }
65
- if ( current_user_can( 'wppa_export' ) ) {
66
- $menu_items['export'] = array(
67
- 'parent' => $wppaplus,
68
- 'title' => __( 'Export', 'wp-photo-album-plus' ),
69
- 'href' => admin_url( 'admin.php?page=wppa_export_photos' )
70
- );
71
- }
72
- if ( current_user_can( 'wppa_comments' ) && wppa_switch( 'show_comments' ) ) {
73
- $menu_items['comments'] = array(
74
- 'parent' => $wppaplus,
75
- 'title' => __( 'Comments', 'wp-photo-album-plus' ) . $com_pending,
76
- 'href' => admin_url( 'admin.php?page=wppa_manage_comments' )
77
- );
78
- }
79
  if ( current_user_can( 'wppa_moderate' ) ) {
80
  $menu_items['moderate'] = array(
81
  'parent' => $wppaplus,
82
- 'title' => __( 'Moderate', 'wp-photo-album-plus' ) . $tot_pending,
83
  'href' => admin_url( 'admin.php?page=wppa_moderate_photos' )
84
  );
85
  }
 
 
 
 
 
 
 
86
  if ( current_user_can( 'wppa_settings' ) ) {
87
  $menu_items['settings'] = array(
88
  'parent' => $wppaplus,
@@ -90,10 +83,17 @@ function wppa_admin_bar_menu() {
90
  'href' => admin_url( 'admin.php?page=wppa_options' )
91
  );
92
  }
 
 
 
 
 
 
 
93
  if ( current_user_can( 'wppa_admin' ) && wppa_switch( 'opt_menu_search' ) ) {
94
  $menu_items['search'] = array(
95
  'parent' => $wppaplus,
96
- 'title' => __( 'Search', 'wp-photo-album-plus' ),
97
  'href' => admin_url( 'admin.php?page=wppa_search' )
98
  );
99
  }
@@ -101,21 +101,21 @@ function wppa_admin_bar_menu() {
101
  if ( current_user_can( 'wppa_edit_tags' ) && wppa_switch( 'opt_menu_edit_tags' ) ) {
102
  $menu_items['edit_tags'] = array(
103
  'parent' => $wppaplus,
104
- 'title' => __( 'Tags', 'wp-photo-album-plus' ),
105
  'href' => admin_url( 'admin.php?page=wppa_edit_tags' )
106
  );
107
  }
108
  if ( current_user_can( 'wppa_edit_sequence' ) && wppa_switch( 'opt_menu_edit_sequence' ) ) {
109
  $menu_items['edit_squence'] = array(
110
  'parent' => $wppaplus,
111
- 'title' => __( 'Sequence', 'wp-photo-album-plus' ),
112
  'href' => admin_url( 'admin.php?page=wppa_edit_sequence' )
113
  );
114
  }
115
  if ( current_user_can( 'wppa_edit_email' ) && wppa_switch( 'opt_menu_edit_email' ) ) {
116
  $menu_items['edit_email'] = array(
117
  'parent' => $wppaplus,
118
- 'title' => __( 'Email', 'wp-photo-album-plus' ),
119
  'href' => admin_url( 'admin.php?page=wppa_edit_email' )
120
  );
121
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * enhances the admin bar with wppa+ menu
6
+ * Version 8.2.09.001
7
  *
8
  */
9
 
37
  if ( current_user_can( 'wppa_admin' ) ) {
38
  $menu_items['admin'] = array(
39
  'parent' => $wppaplus,
40
+ 'title' => __( 'Album Admin', 'wp-photo-album-plus' ) . $upl_pending,
41
  'href' => admin_url( 'admin.php?page=wppa_admin_menu' )
42
  );
43
  }
44
  if ( current_user_can( 'wppa_upload' ) ) {
45
  $menu_items['upload'] = array(
46
  'parent' => $wppaplus,
47
+ 'title' => __( 'Upload Photos', 'wp-photo-album-plus' ),
48
  'href' => admin_url( 'admin.php?page=wppa_upload_photos' )
49
  );
50
  if ( ! current_user_can( 'wppa_admin' ) && wppa_opt( 'upload_edit' ) != 'none' ) {
51
  $menu_items['edit'] = array(
52
  'parent' => $wppaplus,
53
+ 'title' => __( 'Edit Photos' , 'wp-photo-album-plus' ),
54
  'href' => admin_url( 'admin.php?page=wppa_edit_photo' )
55
  );
56
  }
58
  if ( current_user_can( 'wppa_import' ) ) {
59
  $menu_items['import'] = array(
60
  'parent' => $wppaplus,
61
+ 'title' => __( 'Import Photos', 'wp-photo-album-plus' ),
62
  'href' => admin_url( 'admin.php?page=wppa_import_photos' )
63
  );
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  if ( current_user_can( 'wppa_moderate' ) ) {
66
  $menu_items['moderate'] = array(
67
  'parent' => $wppaplus,
68
+ 'title' => __( 'Moderate Photos', 'wp-photo-album-plus' ) . $tot_pending,
69
  'href' => admin_url( 'admin.php?page=wppa_moderate_photos' )
70
  );
71
  }
72
+ if ( current_user_can( 'wppa_export' ) ) {
73
+ $menu_items['export'] = array(
74
+ 'parent' => $wppaplus,
75
+ 'title' => __( 'Export Photos', 'wp-photo-album-plus' ),
76
+ 'href' => admin_url( 'admin.php?page=wppa_export_photos' )
77
+ );
78
+ }
79
  if ( current_user_can( 'wppa_settings' ) ) {
80
  $menu_items['settings'] = array(
81
  'parent' => $wppaplus,
83
  'href' => admin_url( 'admin.php?page=wppa_options' )
84
  );
85
  }
86
+ if ( current_user_can( 'wppa_comments' ) && wppa_switch( 'show_comments' ) ) {
87
+ $menu_items['comments'] = array(
88
+ 'parent' => $wppaplus,
89
+ 'title' => __( 'Comments', 'wp-photo-album-plus' ) . $com_pending,
90
+ 'href' => admin_url( 'admin.php?page=wppa_manage_comments' )
91
+ );
92
+ }
93
  if ( current_user_can( 'wppa_admin' ) && wppa_switch( 'opt_menu_search' ) ) {
94
  $menu_items['search'] = array(
95
  'parent' => $wppaplus,
96
+ 'title' => __( 'Search', 'wp-photo-album-plus' ) . $com_pending,
97
  'href' => admin_url( 'admin.php?page=wppa_search' )
98
  );
99
  }
101
  if ( current_user_can( 'wppa_edit_tags' ) && wppa_switch( 'opt_menu_edit_tags' ) ) {
102
  $menu_items['edit_tags'] = array(
103
  'parent' => $wppaplus,
104
+ 'title' => __( 'Edit tags', 'wp-photo-album-plus' ),
105
  'href' => admin_url( 'admin.php?page=wppa_edit_tags' )
106
  );
107
  }
108
  if ( current_user_can( 'wppa_edit_sequence' ) && wppa_switch( 'opt_menu_edit_sequence' ) ) {
109
  $menu_items['edit_squence'] = array(
110
  'parent' => $wppaplus,
111
+ 'title' => __( 'Edit Photo Sequence', 'wp-photo-album-plus' ),
112
  'href' => admin_url( 'admin.php?page=wppa_edit_sequence' )
113
  );
114
  }
115
  if ( current_user_can( 'wppa_edit_email' ) && wppa_switch( 'opt_menu_edit_email' ) ) {
116
  $menu_items['edit_email'] = array(
117
  'parent' => $wppaplus,
118
+ 'title' => __( 'Email admin', 'wp-photo-album-plus' ),
119
  'href' => admin_url( 'admin.php?page=wppa_edit_email' )
120
  );
121
  }
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 8.3.01.005
6
  *
7
  */
8
 
@@ -1749,7 +1749,7 @@ global $wppa;
1749
  }
1750
  }
1751
  else {
1752
- wppa_echo( '||0||' . __( 'No sub albums found to process', 'wp-photo-album-plus' ) );
1753
  wppa_exit();
1754
  }
1755
  }
@@ -1848,7 +1848,7 @@ global $wppa;
1848
  $itemname = __( 'Categories' , 'wp-photo-album-plus' );
1849
  break;
1850
  case 'suba_order_by':
1851
- $itemname = __( 'Sub albums sort order' , 'wp-photo-album-plus' );
1852
  break;
1853
 
1854
  case 'year':
@@ -3037,7 +3037,8 @@ global $wppa;
3037
  }
3038
  if ( current_user_can( 'wppa_edit_email' ) ) {
3039
  if ( in_array( wppa_get( 'option' ),
3040
- ['newalbumnotify',
 
3041
  'feuploadnotify',
3042
  'commentnotify',
3043
  'commentprevious',
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 8.2.09.001
6
  *
7
  */
8
 
1749
  }
1750
  }
1751
  else {
1752
+ wppa_echo( '||0||' . __( 'No subalbums found to process', 'wp-photo-album-plus' ) );
1753
  wppa_exit();
1754
  }
1755
  }
1848
  $itemname = __( 'Categories' , 'wp-photo-album-plus' );
1849
  break;
1850
  case 'suba_order_by':
1851
+ $itemname = __( 'Subalbums sort order' , 'wp-photo-album-plus' );
1852
  break;
1853
 
1854
  case 'year':
3037
  }
3038
  if ( current_user_can( 'wppa_edit_email' ) ) {
3039
  if ( in_array( wppa_get( 'option' ),
3040
+ ['email_admin_pagesize',
3041
+ 'newalbumnotify',
3042
  'feuploadnotify',
3043
  'commentnotify',
3044
  'commentprevious',
wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -14,78 +14,50 @@ global $wpdb;
14
  global $q_config;
15
  global $wppa_revno;
16
 
17
- // From search page or from menu?
18
  $from = wppa_get_option( 'wppa_search_page', 'wppa_admin_menu' );
19
  delete_option( 'wppa_search_page' );
20
 
21
- // Create the back to ... link and top of page link html
22
- {
23
- if ( $from == 'wppa_admin_menu' ) {
24
- $back_url = get_admin_url() . 'admin.php?page=wppa_admin_menu';
25
- $back_title = __( 'Back to album table', 'wp-photo-album-plus' );
26
- }
27
- elseif ( $from == 'wppa_search' ) {
28
- $back_url = get_admin_url() . 'admin.php?page=wppa_search';
29
- $back_title = __( 'Back to search form', 'wp-photo-album-plus' );
30
 
31
- if ( wppa_get( 'edit-id' ) == 'search' ) {
32
 
33
- if ( wppa_get( 'searchstring' ) ) {
34
- $back_url .= '&wppa-searchstring=' . wppa_get( 'searchstring' );
35
- }
36
- $back_url .= '#wppa-edit-search-tag';
37
- }
38
  }
39
- $back_link_html = '
40
- <div style="position:fixed;right:20px;background-color:lightblue;top:50px;z-index:3;">
41
- &nbsp;
42
- <a href="' . $back_url . '"
43
- style=""
44
- >' .
45
- $back_title . '
46
- </a>
47
- &nbsp;
48
- </div>';
49
-
50
- $top_link_html = '
51
- <div style="position:fixed;right:20px;background-color:lightblue;bottom:30px;z-index:3;" >
52
- &nbsp;
53
- <a href="#manage-photos">' .
54
- __( 'Top of page', 'wp-photo-album-plus' ) . '
55
- </a>
56
- &nbsp;
57
- </div>';
58
  }
 
 
 
 
 
 
 
 
 
 
59
 
60
- // Add local javascript
61
- {
62
- $the_js = '
63
- function wppaGoEditAlbNo() {
64
- var id = parseInt(document.getElementById("wppa-edit-albid").value);
65
- if (id > 0) {
66
- var nonce = "' . wp_create_nonce( 'wppa-nonce' ) .'";
67
- var href = "' . get_admin_url() . 'admin.php?page=wppa_admin_menu&wppa-nonce="+nonce+"&tab=edit&edit-id="+id;
68
- document.location.href=href;
69
- }
70
- else {
71
- alert("' . __( 'Please enter a valid album id', 'wp-photo-album-plus' ) . '");
72
- }
73
- };
74
- function wppaGoApplyFilter() {
75
- var filter = document.getElementById("wppa-edit-filter").value;
76
- if(filter) {
77
- document.location.href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&switchto=flat&filter="+filter;
78
- }
79
- else {
80
- alert("' . __( 'Please select a filter token', 'wp-photo-album-plus' ) . '");
81
- }
82
- };';
83
- wppa_add_inline_script( 'wppa-admin', $the_js );
84
- }
85
 
86
  // Delete trashed comments
87
  $wpdb->query( "DELETE FROM $wpdb->wppa_comments WHERE status = 'trash'" );
88
 
 
 
89
  // warn if the uploads directory is no writable
90
  if ( ! is_writable( WPPA_UPLOAD_PATH ) ) {
91
  wppa_error_message(
@@ -123,34 +95,29 @@ global $wppa_revno;
123
  }
124
  }
125
 
126
- // 'tab' set? If so, check nonce and see what we are going to do
127
  if ( wppa_get( 'tab' ) ) {
128
 
129
- // Check nonce field
130
- if ( ! wp_verify_nonce( wppa_get( 'nonce' ), 'wppa-nonce' ) ) {
131
- wp_die('Security check failure 1');
132
- }
133
-
134
  // album edit page
135
  if ( wppa_get( 'tab' ) == 'edit' ) {
136
 
137
  // Edit any album, check for type is implemented c.q. existence and rights
138
  if ( wppa_get( 'edit-id' ) ) {
139
 
140
- // Validate input
141
  $ei = wppa_get( 'edit-id' );
142
  if ( $ei != 'new' && $ei != 'search' && $ei != 'trash' && $ei != 'single' && ! is_numeric( $ei ) ) {
143
  wppa_error_message( sprintf( __( 'Album edit id %s is not implemented', 'wp-photo-album-plus' ), $ei ) );
144
  return;
145
  }
146
-
 
 
147
  if ( is_numeric( $ei ) ) {
148
  if ( ! $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id=%d", $ei ), ARRAY_A ) ) {
149
  wppa_error_message( sprintf( __( 'Album %d does not exist', 'wp-photo-album-plus' ), $ei ) );
150
  return;
151
  }
152
  if ( ! wppa_have_access( $ei ) ) {
153
- wppa_error_message( sprintf( __( 'You do not have sufficient rights to edit album %d', 'wp-photo-album-plus' ), $ei ) );
154
  return;
155
  }
156
  }
@@ -159,9 +126,9 @@ global $wppa_revno;
159
  // Edit single photo
160
  if ( wppa_get( 'edit-id' ) == 'single' ) {
161
 
162
- $page_title = wppa_get( 'just-edit', __( 'Edit Single media item', 'wp-photo-album-plus' ) );
163
 
164
- wppa_echo( '<div class="wrap" ><h1 class="wp-heading-inline">' . $page_title . '</h1>' );
165
  wppa_album_photos( $ei );
166
  wppa_echo( '</div>' );
167
  return;
@@ -170,35 +137,30 @@ global $wppa_revno;
170
  // Edit by search token
171
  if ( wppa_get( 'edit-id' ) == 'search' ) {
172
 
173
- $bulk = wppa_get( 'bulk' );
 
 
 
 
 
 
174
 
175
  wppa_echo ( '
176
  <a name="manage-photos" id="manage-photos" ></a>
177
- <div class="wrap">' );
178
-
179
- // The page title
180
- if ( $bulk ) {
181
- $page_title = sprintf( __( 'Bulk edit media items searched by %s', 'wp-photo-album-plus' ), '<i>' . wppa_get( 'searchstring', '', 'text' ) . '</i>' );
182
- }
183
- else {
184
- $page_title = sprintf( __( 'Edit media items searched by %s', 'wp-photo-album-plus' ), '<i>' . wppa_get( 'searchstring', '', 'text' ) . '</i>' );
185
- }
186
 
187
- wppa_echo( '
188
- <h1 class="wp-heading-inline">' . $page_title . '</h1>' .
189
- $back_link_html . '
190
- <br><br>' );
191
-
192
- // Do the dirty work
193
- if ( $bulk ) {
194
- wppa_album_photos_bulk( $ei );
195
- }
196
- else {
197
- wppa_album_photos( $ei );
198
- }
199
 
200
- wppa_echo( $top_link_html );//. '<br>' . $back_link_html );
201
- wppa_echo( '</div>' );
202
  return;
203
  }
204
 
@@ -207,7 +169,7 @@ global $wppa_revno;
207
 
208
  $h2 = __( 'Manage Trashed Photos', 'wp-photo-album-plus' );
209
  $task = __( 'Edit photo information', 'wp-photo-album-plus' );
210
- wppa_echo( '<div class="wrap"><a name="manage-photos" id="manage-photos" ></a><h1>' . $h2 . ' - <small><i>' . $task . '</i></small></h1>' );
211
  if ( wppa_get( 'bulk' ) ) {
212
  wppa_album_photos_bulk( $ei );
213
  }
@@ -227,7 +189,7 @@ global $wppa_revno;
227
  }
228
  $id = wppa_nextkey( WPPA_ALBUMS );
229
 
230
- // Creating a sub album of a given parent?
231
  if ( wppa_get( 'parent_id' ) ) {
232
  $parent = wppa_get( 'parent_id' );
233
  $name = wppa_get_album_name( $parent ) . '-#' . $id;
@@ -248,7 +210,7 @@ global $wppa_revno;
248
  wppa_update_option( 'wppa_default_parent', '0' );
249
  $parent = '0';
250
  }
251
- $name = __( 'New album', 'wp-photo-album-plus' );
252
  if ( $parent == '0' && ! wppa_can_create_top_album() ) {
253
  wp_die( __( 'You have insufficient rights to create a top-level album', 'wp-photo-album-plus' ) );
254
  }
@@ -486,7 +448,7 @@ global $wppa_revno;
486
  $the_js = '
487
  function wppaTryInheritCats( id ) {
488
 
489
- var query = "' . esc_js( __( 'Are you sure you want to inherit categories to all (sub-)sub albums of this album?', 'wp-photo-album-plus' ) ) . '";
490
  if ( confirm( query ) ) {
491
  wppaAjaxUpdateAlbum( id, \'inherit_cats\', Math.random() );
492
  }
@@ -494,7 +456,7 @@ global $wppa_revno;
494
 
495
  function wppaTryAddCats( id ) {
496
 
497
- var query = "' . esc_js( __( 'Are you sure you want to add the categories to all (sub-)sub albums of this album?', 'wp-photo-album-plus' ) ) . '";
498
  if ( confirm( query ) ) {
499
  wppaAjaxUpdateAlbum( id, \'inhadd_cats\', Math.random() );
500
  }
@@ -595,26 +557,14 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
595
  wppa_echo( '<input type="hidden" id="album-nonce-' . $id . '" value="' . wp_create_nonce( 'wppa-nonce_' . $id ) . '" />' );
596
 
597
  // The header
598
- if ( wppa_get( 'bulk', '0', 'int' ) ) {
599
- $page_title = __( 'Albums -> Bulk edit -> %s', 'wp-photo-album-plus' );
600
- }
601
- elseif ( wppa_get( 'quick', '0', 'int' ) ) {
602
- $page_title = __( 'Albums -> Quick edit -> %s', 'wp-photo-album-plus' );
603
- }
604
- elseif ( wppa_get( 'seq', '0', 'int' ) ) {
605
- $page_title = __( 'Albums -> Sequence edit -> %s', 'wp-photo-album-plus' );
606
- }
607
- else {
608
- $page_title = __( 'Albums -> Edit -> %s', 'wp-photo-album-plus' );
609
- }
610
- wppa_echo( '<h1 class="wp-heading-inline">' . esc_html( sprintf( $page_title, __( wppa_get_album_name( $id ) ) ) ) . '</h1>' );
611
-
612
 
613
  wppa_echo( $back_link_html );
614
 
615
  /* Start header buttons */
616
- $result = '
617
- <div id="wppa-action-container">';
 
618
 
619
  // Goto Upload
620
  if ( current_user_can( 'wppa_upload' ) ) {
@@ -628,13 +578,13 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
628
  __( 'Upload to this album', 'wp-photo-album-plus' ) . ( $a > '0' ? ' ' . sprintf( __( '(max %d)', 'wp-photo-album-plus' ), $a ) : '' )
629
  );
630
 
631
- $result .= '
632
  <input
633
  type="button"
634
  class="wppa-admin-button button"
635
  onclick="' . $onc . '"
636
  value="' . $val .'"
637
- />';
638
  }
639
 
640
  // Goto Import
@@ -643,19 +593,21 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
643
  $onc = 'document.location = \''.get_admin_url().'admin.php?page=wppa_import_photos&wppa-set-album='.$id.'\'';
644
  $val = __( 'Import to this album', 'wp-photo-album-plus' ) . ( $a > '0' ? ' ' . sprintf( __( '(max %d)', 'wp-photo-album-plus' ), $a ) : '' );
645
 
646
- $result .= '
647
  <input
648
  type="button"
649
  class="wppa-admin-button button"
650
  onclick="' . $onc . '"
651
  value="' . $val .'"
652
- />';
653
  }
 
 
654
 
655
  // Download album
656
  if ( wppa_switch( 'allow_download_album' ) && ( ! wppa_switch( 'download_album_is_restricted' ) || wppa_user_is_admin() ) ) {
657
-
658
- $result .= '
659
  <input
660
  type="button"
661
  class="wppa-admin-button button"
@@ -667,12 +619,11 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
667
  src="' . wppa_get_imgdir() . 'spinner.gif"
668
  style="margin-left:6px;display:none;height:18px;position:relative;bottom:-6px"
669
  alt="spinner"
670
- />';
 
671
  }
672
-
673
- $result .= '
674
- </div>'; // end action-container
675
- wppa_echo( $result );
676
  /* End header */
677
 
678
  /* Main body album admin */
@@ -829,7 +780,7 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
829
  wppa_echo( '
830
  <div class="left">
831
  <label>' .
832
- __( 'Inc sub albums', 'wp-photo-album-plus' ) . '
833
  </label><br>
834
  <div class="wppa-ldi">' .
835
  $tpviews . '
@@ -936,7 +887,7 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
936
 
937
  // Status
938
  {
939
- $title = __( 'Set the frontend visibility of the album cover and items not including sub albums.', 'wp-photo-album-plus' ) . ' ' .
940
  __( 'Publish: visible for all, Private: visible for logged in only, Hidden: visible for admin only', 'wp-photo-album-plus' );
941
 
942
  wppa_echo( '
@@ -1123,12 +1074,12 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1123
  style="max-width: 200px;margin-right: 4px;">
1124
  <label
1125
  for="altthumb">' .
1126
- __( 'Max sub albums', 'wp-photo-album-plus' ) . '
1127
  </label><br>
1128
  <select
1129
  id="maxchild"
1130
  onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'max_children\', this )"
1131
- title="' . esc_attr( 'This setting can only llimit the creation of sub albums at the frontend and looks at direct sub albums only', 'wp-photo-album-plus' ) . '"
1132
  >
1133
  <option value="0"' . ( $val == '0' ? $sel : '' ) . ' >' .
1134
  __( 'unlimited', 'wp-photo-album-plus' ) . '
@@ -1208,8 +1159,8 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1208
 
1209
  // Tree limit
1210
  {
1211
- $title = __( 'The upload limit for this album and all its (sub-)sub albums.', 'wp-photo-album-plus' ) . ' ' .
1212
- __( 'This setting overrules all other limits that may apply to this album or its (sub-)sub albums.', 'wp-photo-album-plus' ) . ' ' .
1213
  __( '0 means no limit.', 'wp-photo-album-plus' );
1214
  wppa_echo( '
1215
  <div class="left">
@@ -1460,17 +1411,17 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1460
  __( 'The following buttons perform actions on albums related to this album', 'wp-photo-album-plus' ) . '
1461
  </h2>' );
1462
 
1463
- // Create sub album
1464
  if ( wppa_can_create_album() ) {
1465
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $albuminfo['id'] . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
1466
- $onc = 'if (confirm(\''.__( 'Are you sure you want to create a sub album?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
1467
 
1468
  wppa_echo( '
1469
  <input
1470
  type="button"
1471
  class="wppa-admin-button button"
1472
  onclick="' . $onc . '"
1473
- value="' . esc_attr( __( 'Create sub album', 'wp-photo-album-plus' ) ) . '"
1474
  />' );
1475
  }
1476
 
@@ -1485,7 +1436,7 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1485
  '&amp;parent_id=' . $albuminfo['a_parent'] .
1486
  '&amp;is-sibling-of=' . $albuminfo['id'] .
1487
  '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
1488
- $onc = 'if (confirm(\''.__( 'Are you sure you want to create a sub album?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
1489
 
1490
  wppa_echo( '
1491
  <input
@@ -1515,20 +1466,20 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1515
  <input
1516
  type="button"
1517
  class="wppa-admin-button button"
1518
- title="' . esc_attr( __( 'Apply categories to all (sub-)sub albums.', 'wp-photo-album-plus' ) ) . '"
1519
  onclick="wppaTryInheritCats( ' . $id . ' )"
1520
- value="' . esc_attr( __( 'Apply Cats to sub albums', 'wp-photo-album-plus' ) ) . '"
1521
  />
1522
  <input
1523
  type="button"
1524
  class="wppa-admin-button button"
1525
- title="' . esc_attr( __( 'Add categories to all (sub-)sub albums.', 'wp-photo-album-plus' ) ) . '"
1526
  onclick="wppaTryAddCats( ' . $id . ' )"
1527
- value="' . esc_attr( __( 'Add Cats to sub albums', 'wp-photo-album-plus' ) ) . '"
1528
  />' );
1529
  }
1530
 
1531
- // Sub albums sequence
1532
  if ( $has_children ) {
1533
  wppa_album_sequence( $edit_id );
1534
  }
@@ -1838,8 +1789,8 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
1838
  <select
1839
  title="' . esc_attr( $title ) . '"
1840
  onchange="wppaAjaxUpdateAlbum( '. $id . ', \'cover_linktype\', this )" >
1841
- <option value="content"' . ( $lt == 'content' ? $sel : '' ) . ' >' . __( 'the sub albums and thumbnails', 'wp-photo-album-plus' ) . '</option>
1842
- <option value="albums"' . ( $lt == 'albums' ? $sel : '' ) . ' >' . __( 'the sub albums', 'wp-photo-album-plus' ) . '</option>
1843
  <option value="thumbs"' . ( $lt == 'thumbs' ? $sel : '' ) . ' >' . __( 'the thumbnails', 'wp-photo-album-plus' ) . '</option>
1844
  <option value="slide"' . ( $lt == 'slide' ? $sel : '' ) . ' >' . __( 'the album photos as slideshow', 'wp-photo-album-plus' ) . '</option>
1845
  <option value="page"' . ( $lt == 'page' ? $sel : '' ) . ' >' . __( 'the link page with a clean url', 'wp-photo-album-plus' ) . '</option>
@@ -2122,9 +2073,28 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2122
 
2123
  /* Manage photos section */
2124
  {
2125
- wppa_echo( '<div class="wppa-table-wrap" style="margin-top:20px;clear:both;position:relative;border:none;">' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2126
 
2127
- wppa_echo( '<a name="manage-photos" id="manage-photos" ></a>' );
 
 
 
2128
 
2129
  if ( wppa_get( 'bulk' ) )
2130
  wppa_album_photos_bulk( $edit_id );
@@ -2133,16 +2103,19 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2133
  else
2134
  wppa_album_photos( $edit_id );
2135
 
2136
- wppa_echo( '</div>' );
2137
-
 
2138
  }
2139
 
2140
  /* Footer of the page */
2141
  wppa_echo( '
2142
  <br>' .
 
2143
  $top_link_html . '
2144
  </div>' );
2145
 
 
2146
  } // End tab is Edit
2147
 
2148
  // Comment moderate
@@ -2152,9 +2125,9 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2152
  if ( current_user_can( 'wppa_comments' ) && wppa_have_access( $alb ) ) {
2153
  $result = '
2154
  <div class="wrap">
2155
- <h1 class="wp-heading-inline">' .
2156
- __( 'Moderate comment', 'wp-photo-album-plus' ) . '
2157
- </h1>' .
2158
  wppa_album_photos( '', $photo ) . '
2159
  </div>';
2160
  wppa_echo( $result );
@@ -2172,7 +2145,7 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2172
  $result = '
2173
  <div class="wrap">
2174
  <img src="' . WPPA_URL . '/img/page_green.png" />
2175
- <h1 class="wp-heading-inline">' . ( wppa_get( 'tab' ) == 'pmod' ?
2176
  __( 'Moderate photo', 'wp-photo-album-plus' ) :
2177
  __( 'Edit photo', 'wp-photo-album-plus' ) ) . '
2178
  </h1>
@@ -2196,7 +2169,8 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2196
 
2197
  $result = '
2198
  <div class="wrap">
2199
- <h1 class="wp-heading-inline">' . __( 'Delete Album', 'wp-photo-album-plus' ) . '</h1>
 
2200
 
2201
  <p>' . __( 'Album', 'wp-photo-album-plus' ) . '<b>' . htmlspecialchars( wppa_get_album_name( wppa_get( 'edit-id' ) ) ) . '</b></p>
2202
  <p>' . __( 'Are you sure you want to delete this album?', 'wp-photo-album-plus' ) . '<br>' .
@@ -2241,8 +2215,6 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2241
  </div>';
2242
  wppa_echo( $result );
2243
  }
2244
-
2245
- // Unimplemented
2246
  else {
2247
  wppa_error_message( sprintf( __( 'Album admin action %s is not implemented', 'wp-photo-album-plus' ),
2248
  '<b>' . wppa_get( 'tab' ) ) . '</b>' );
@@ -2252,16 +2224,16 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2252
  // 'tab' not set. default, album manage page.
2253
  else {
2254
 
2255
- // Delete album
2256
  if ( wppa_get( 'del-confirm' ) ) {
2257
 
2258
  if ( ! wp_verify_nonce( wppa_get( 'nonce' ), 'wppa-nonce' ) ) {
2259
- wp_die( 'Security check failure' );
2260
  }
2261
 
2262
  $album_owner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_albums WHERE id = %s", wppa_get( 'del-id' ) ) );
2263
- if ( ( $album_owner == '--- public ---' && ! current_user_can( 'administrator' ) ) || ! wppa_have_access( wppa_get( 'del-id' ) ) ) {
2264
- wp_die( 'You do not have the rights to delete this album' );
2265
  }
2266
 
2267
  if ( wppa_get( 'del-photos' ) == 'move' ) {
@@ -2277,18 +2249,18 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2277
  }
2278
  }
2279
 
2280
- // Switch to flat / collapsable table
2281
  if ( wppa_get( 'switchto' ) ) {
2282
  wppa_update_option( 'wppa_album_table_'.wppa_get_user(), wppa_get( 'switchto' ) );
2283
  }
2284
- $style = wppa_get_option('wppa_album_table_'.wppa_get_user(), 'flat'); // 'flat' or 'collapsible'
2285
- if ( $style != 'flat' ) $style = 'collapsible';
 
2286
 
2287
  /* The album admin table of albums page start */
2288
  wppa_echo( '
2289
  <div class="wrap">' .
2290
  wppa_admin_spinner() . '
2291
- <h1 class="wp-heading-inline">' . get_admin_page_title() . '</h1>' );
2292
 
2293
  // The Create new album button
2294
  if ( wppa_can_create_top_album() ) {
@@ -2301,38 +2273,38 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2301
  class="page-title-action">' .
2302
  __( 'Add New', 'wp-photo-album-plus' ) . '
2303
  </a>
2304
- ' );
2305
  }
2306
 
2307
- /* The header buttons / selection boxes */
2308
  {
2309
- $header = '
2310
- <div class=="wppa-table-header-box">
2311
- <div id="wppa-action-container">';
2312
 
2313
  // The switch to flat/collapsable button(s)
2314
  if ( $style == 'flat' ) {
2315
- $header .= '
2316
  <input
2317
  type="button"
2318
  class="button"
2319
  onclick="document.location=\'' . get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;switchto=collapsible\'"
2320
  value="' . esc_attr__( 'Switch to Collapsable table', 'wp-photo-album-plus' ) . '"
2321
- />';
2322
  }
2323
  else {
2324
- $header .= '
2325
  <input
2326
  type="button"
2327
  class="button"
2328
  onclick="document.location=\'' . get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;switchto=flat\'"
2329
  value="' . esc_attr__( 'Switch to Flat table', 'wp-photo-album-plus' ) . '"
2330
- />';
2331
  }
2332
 
2333
  // The open all/close all buttons
2334
  if ( $style != 'flat' ) {
2335
- $header .= '
2336
  <input
2337
  type="button"
2338
  class="button"
@@ -2356,12 +2328,16 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2356
  jQuery(\'.alb-arrow-off\').css(\'display\',\'none\');
2357
  "
2358
  value="' . esc_attr__( 'Close all', 'wp-photo-album-plus' ) . '"
2359
- />';
2360
  }
2361
 
 
 
 
 
2362
  // Edit by id
2363
  if ( wppa_has_many_albums() ) {
2364
- $header .= '
2365
  <input
2366
  id="wppa-edit-albid"
2367
  type="number"
@@ -2369,7 +2345,7 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2369
  placeholder="' . __( 'Album id', 'wp-photo-album-plus' ) . '"
2370
  title="' . __( 'Enter the number of the album you want to edit', 'wp-photo-album-plus' ) . '"
2371
  style="width:120px;cursor:pointer"
2372
- />';
2373
  }
2374
  else {
2375
  $albids = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums ORDER BY id" );
@@ -2378,69 +2354,89 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2378
  unset( $albids[$key] );
2379
  }
2380
  }
2381
- $header .= '
2382
  <select
2383
  id="wppa-edit-albid"
2384
  title="' . __( 'Select the number of the album you want to edit', 'wp-photo-album-plus' ) . '"
2385
  styles="width:120px;cursor:pointer;vertical-align:baseline"
2386
  />
2387
- <option value="" selected disabled>' . __( 'Album id', 'wp-photo-album-plus' ) . '</option>';
2388
  foreach( $albids as $alb ) {
2389
- $header .= '<option value="' . $alb . '">' . $alb . '</option>';
2390
  }
2391
- $header .= '
2392
- </select>';
2393
  }
2394
- $header .= '
2395
  <input
2396
  type="button"
2397
  class="button"
2398
  value="' . __( 'Edit album', 'wp-photo-album-plus' ) . '"
2399
  onclick="wppaGoEditAlbNo();"
2400
- />';
2401
 
2402
  // Filter by searchword
2403
  $opts = $wpdb->get_col( "SELECT slug FROM $wpdb->wppa_index WHERE albums <> '' ORDER BY slug" );
2404
  $f = wppa_get( 'filter' );
2405
- $header .= '
2406
  <select
2407
  id="wppa-edit-filter"
2408
  title="' . __( 'Select an album search word', 'wp-photo-album-plus' ) . '"
2409
  >
2410
- <option value="" selected disabled>' . __( 'Filter by', 'wp-photo-album-plus' ) . '</option>';
2411
  foreach( $opts as $opt ) {
2412
- $header .= '<option value="' . $opt . '"' . ( $f == $opt ? ' selected ' : '' ) . '>' . $opt . '</option>';
2413
  }
2414
- $header .= '
2415
  </select>
2416
  <input
2417
  type="button"
2418
  class="button"
2419
  onclick="wppaGoApplyFilter();"
2420
  value="' . __( 'Apply filter', 'wp-photo-album-plus' ) . '"
2421
- />';
2422
-
2423
- // Close action container
2424
- $header .= '
2425
- </div>';
2426
- wppa_echo( $header );
2427
-
2428
- /* End header buttons / selection boxes */
2429
  }
2430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2431
 
2432
- // The table of existing albums. $style = 'flat' or 'collapsible'
2433
- if ( in_array( $style, ['flat', 'collapsible'] ) ) {
2434
- call_user_func( 'wppa_admin_albums_' . $style );
 
 
 
2435
  }
2436
 
2437
- wppa_echo( '<hr style="background-color:#777;height:3px;margin:20px 0;">' );
2438
 
2439
- // The drag-drop sequence editor for toplevel albums
2440
  wppa_album_sequence( '0' );
2441
 
2442
  wppa_echo( '</div>' );
2443
- /* The album admin table of albums page end */
2444
  }
2445
  }
2446
 
@@ -2448,17 +2444,39 @@ jQuery(document).ready(function(){wppaGetCoverPreview( '.$id.', "cover-preview-"
2448
  function wppa_admin_albums_flat() {
2449
  global $wpdb;
2450
 
2451
- // Get paging parameters
2452
- $parms = wppa_get_paging_parms( 'album_admin' );
2453
-
2454
- $pagesize = $parms['pagesize'];
2455
- $page = $parms['page'];
2456
  $skips = ( $page - 1 ) * $pagesize;
2457
- $order_by = $parms['order'];
2458
- $dir = $parms['dir'];
2459
 
2460
  // Read all albums, pre-ordered
2461
- $albums = $wpdb->get_results( "SELECT * FROM `$wpdb->wppa_albums` ORDER BY `$order_by` $dir", ARRAY_A );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2462
 
2463
  // Remove non accessible albums
2464
  $temp = $albums;
@@ -2473,7 +2491,7 @@ global $wpdb;
2473
  $filter = wppa_get( 'filter' );
2474
 
2475
  if ( $filter ) {
2476
- $filter_albs = $wpdb->get_var( $wpdb->prepare( "SELECT albums FROM `$wpdb->wppa_index` WHERE `slug` = %s LIMIT 1", $filter ) );
2477
  $filter_albs = wppa_index_string_to_array( $filter_albs );
2478
 
2479
  foreach( array_keys( $albums ) as $key ) {
@@ -2483,82 +2501,148 @@ global $wpdb;
2483
  }
2484
  }
2485
 
2486
- // Potentially total albums
2487
- $total = count( $albums );
2488
 
2489
  // If paging: Make new array with selected albums only
2490
  if ( $pagesize ) {
2491
- $albums = array_slice( $albums, $skips, $pagesize );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2492
  }
2493
 
2494
- // Do the dirty work
2495
  if ( ! empty( $albums ) ) {
2496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2497
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
2498
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
2499
- $useimg = $parms['dir'] == 'DESC' ? $upimg : $downimg;
2500
  $show_nl = wppa_opt( 'user_create_max_level' ) != '99';
2501
- $reload_url = get_admin_url() . 'admin.php?page=wppa_admin_menu'; // &paged=';
2502
- $order = $parms['order'];
2503
-
2504
- wppa_admin_pagination( $pagesize, $page, $total, $reload_url, 'top' );
2505
 
2506
- wppa_echo( '</div>' ); // Close action contatiner
2507
-
2508
- $result = '
2509
  <table
2510
  class="wppa-table widefat wppa-setting-table striped"
2511
- style="margin:12px 0;"
2512
  >
2513
  <thead>';
2514
  $thead_body = '
2515
  <tr>
2516
  <td
2517
- style="min-width:75px;cursor:pointer;"
2518
  title="' . ( $show_nl ? esc_attr( __( 'The album id (the nesting level)', 'wp-photo-album-plus' ) ) :
2519
  esc_attr( __( 'The album id', 'wp-photo-album-plus' ) ) ) . '"
2520
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'id' ) . '\'"
2521
- >' .
2522
- ( $show_nl ? __( 'ID(nl)', 'wp-photo-album-plus' ) : __( 'ID', 'wp-photo-album-plus' ) ) .
2523
- ( $order == 'id' ? $useimg : '' ) . '
 
2524
  </td>
2525
  <td
2526
- style="min-width: 120px;cursor:pointer;"
2527
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'name' ) . '\'"
2528
- >' .
2529
- __( 'Name', 'wp-photo-album-plus' ) .
2530
- ( $order == 'name' ? $useimg : '' ) . '
 
2531
  </td>
2532
- <td
2533
- style="cursor:pointer;"
2534
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'description' ) . '\'"
2535
- >' .
2536
- __( 'Description', 'wp-photo-album-plus' ) .
2537
- ( $order == 'description' ? $useimg : '' ) . '
2538
  </td>';
2539
  if ( current_user_can( 'administrator' ) ) {
2540
  $thead_body .= '
2541
- <td style="min-width: 100px;cursor:pointer;"
2542
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'owner' ) . '\'"
2543
- >' .
2544
- __( 'Owner', 'wp-photo-album-plus' ) .
2545
- ( $order == 'owner' ? $useimg : '' ) . '
2546
  </td>';
2547
  }
2548
  $thead_body .= '
2549
  <td
2550
- style="min-width: 100px;cursor:pointer;"
2551
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'a_order' ) . '\'"
2552
- >' .
2553
- __( 'Order', 'wp-photo-album-plus' ) .
2554
- ( $order == 'a_order' ? $useimg : '' ) . '
 
2555
  </td>
2556
  <td
2557
- style="width: 120px;cursor:pointer;"
2558
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'a_parent' ) . '\'"
2559
- >' .
2560
- __( 'Parent', 'wp-photo-album-plus' ) .
2561
- ( $order == 'a_parent' ? $useimg : '' ) . '
 
2562
  </td>
2563
  <td
2564
  title="' . esc_attr( __( 'Albums/Photos/Moderation required/Scheduled', 'wp-photo-album-plus' ) ) . '"
@@ -2587,8 +2671,8 @@ global $wpdb;
2587
  $result = '<tbody>';
2588
  $mayseq = ! wppa_switch( 'porder_restricted' ) || wppa_user_is_admin();
2589
 
2590
- foreach ( $albums as $album ) {
2591
-
2592
  $id = $album['id'];
2593
  $counts = wppa_get_treecounts_a( $id, true );
2594
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=' . $id;
@@ -2604,7 +2688,7 @@ global $wpdb;
2604
  $url = wppa_ea_url( $id );
2605
  $delurl = wppa_ea_url( $id, 'del' );
2606
  $creurl = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $id . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
2607
- $creonc = 'if (confirm(\''.esc_js(__( 'Are you sure you want to create a sub album?', 'wp-photo-album-plus' )).'\')) document.location=\''.$creurl.'\';';
2608
 
2609
  $result .= '
2610
  <tr ' . $alt . ( $pendcount ? 'style="background-color:#ffdddd"' : '' ) . '>
@@ -2649,20 +2733,15 @@ global $wpdb;
2649
  <tfoot>' .
2650
  $thead_body . '
2651
  </tfoot>
2652
- </table>';
 
2653
 
2654
- // Display the album table footer
2655
  wppa_echo( $result );
2656
 
2657
- // Display pagination
2658
- wppa_admin_pagination( $pagesize, $page, $total, $reload_url, 'bottom' );
2659
-
2660
- // Display footer
2661
  wppa_echo( wppa_album_admin_footer() );
2662
 
2663
  }
2664
  else {
2665
- wppa_echo( '</div>' ); // Close action contatiner
2666
  wppa_echo( '<h2>' . __( 'No albums yet.', 'wp-photo-album-plus' ) . '</h2>' );
2667
  }
2668
  }
@@ -2671,36 +2750,39 @@ global $wpdb;
2671
  function wppa_admin_albums_collapsible() {
2672
  global $wpdb;
2673
 
2674
- // Add local javascript
2675
- {
2676
- $the_js = '
2677
- function checkArrows() {
2678
- elms = jQuery(".alb-arrow-off");
2679
- for(i=0;i<elms.length;i++) {
2680
- elm = elms[i];
2681
- if ( elm.parentNode.parentNode.style.display == "none" ) elm.style.display = "none";
2682
- }
2683
- elms = jQuery(".alb-arrow-on");
2684
- for(i=0;i<elms.length;i++) {
2685
- elm = elms[i];
2686
- if ( elm.parentNode.parentNode.style.display == "none" ) elm.style.display = "";
2687
- }
2688
- }';
2689
- wppa_add_inline_script( 'wppa-admin', $the_js );
2690
- }
2691
-
2692
- // Get paging parameters
2693
- {
2694
- $parms = wppa_get_paging_parms( 'album_admin' );
2695
- $pagesize = $parms['pagesize'];
2696
- $page = $parms['page'];
2697
  $skips = ( $page - 1 ) * $pagesize;
2698
- $order_by = $parms['order'];
2699
- $dir = $parms['dir'];
2700
- }
2701
 
2702
  // Read all albums, pre-ordered
2703
- $albums = $wpdb->get_results( "SELECT * FROM `$wpdb->wppa_albums` ORDER BY `$order_by` $dir", ARRAY_A );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2704
 
2705
  // Remove non accessible albums
2706
  $temp = $albums;
@@ -2710,29 +2792,21 @@ global $wpdb;
2710
  $albums[] = $temp[$idx];
2711
  }
2712
  }
 
2713
 
2714
- // If filter, filter
2715
- $filter = wppa_get( 'filter' );
2716
-
2717
- if ( $filter ) {
2718
- $filter_albs = $wpdb->get_var( $wpdb->prepare( "SELECT albums FROM `$wpdb->wppa_index` WHERE `slug` = %s LIMIT 1", $filter ) );
2719
- $filter_albs = wppa_index_string_to_array( $filter_albs );
2720
-
2721
- foreach( array_keys( $albums ) as $key ) {
2722
- if ( ! in_array( $albums[$key]['id'], $filter_albs ) ) {
2723
- unset( $albums[$key] );
2724
  }
 
2725
  }
2726
  }
2727
 
2728
- // Potentially total albums
2729
- $total = count( $albums );
2730
-
2731
- // If paging: Make new array with selected albums only
2732
- if ( $pagesize ) {
2733
- $albums = array_slice( $albums, $skips, $pagesize );
2734
- }
2735
-
2736
  // Make sure all (grand)parents are in
2737
  $done = false;
2738
  while ( ! $done ) {
@@ -2769,14 +2843,31 @@ global $wpdb;
2769
  WHERE id in (" . implode( ',', $all_ids ) . ")", ARRAY_A );
2770
  }
2771
 
2772
- // If any albums left, do trhe dirty work
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2773
  if ( ! empty( $albums ) ) {
2774
 
2775
  // Setup the sequence array
2776
  $seq = false;
2777
  $num = false;
2778
  foreach( $albums as $album ) {
2779
- switch ( $order_by ) {
2780
  case 'name':
2781
  $seq[] = strtolower( __( stripslashes( $album['name'] ) ) );
2782
  break;
@@ -2805,7 +2896,7 @@ global $wpdb;
2805
  else asort( $seq, SORT_REGULAR );
2806
 
2807
  // Reverse ?
2808
- if ( $dir == 'DESC' ) {
2809
  $t = $seq;
2810
  $c = count($t);
2811
  $tmp = array_keys($t);
@@ -2817,70 +2908,67 @@ global $wpdb;
2817
 
2818
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
2819
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
2820
- $useimg = $dir == 'DESC' ? $upimg : $downimg;
2821
- $show_nl = wppa_opt( 'user_create_max_level' ) != '99';
2822
- $reload_url = get_admin_url() . 'admin.php?page=wppa_admin_menu';
2823
- $order = $parms['order'];
2824
 
2825
- wppa_admin_pagination( $pagesize, $page, $total, $reload_url, 'top' );
2826
-
2827
- wppa_echo( '</div>' ); // Close action contatiner
2828
-
2829
- $result = '
2830
- <table class="widefat wppa-table wppa-setting-table" style="margin:12px 0">
2831
  <thead>';
2832
  $thead_body = '
2833
  <tr>
2834
- <td style="width:40px">
2835
- <img src="' . wppa_get_imgdir() . 'backarrow.gif" style="height:16px;" title="' . __( 'Collapse subalbums', 'wp-photo-album-plus' ) . '" />&thinsp;
2836
  <img src="' . wppa_get_imgdir() . 'arrow.gif" style="height:16px;" title="' . __( 'Expand subalbums', 'wp-photo-album-plus' ) . '" />
2837
  </td>
2838
- <td colspan="6"
2839
- style="min-width:75px;cursor:pointer;"
2840
  title="' . ( $show_nl ? esc_attr( __( 'The album id (the nesting level)', 'wp-photo-album-plus' ) ) :
2841
  esc_attr( __( 'The album id', 'wp-photo-album-plus' ) ) ) . '"
2842
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'id' ) . '\'"
2843
- >' .
2844
- ( $show_nl ? __( 'ID(nl)', 'wp-photo-album-plus' ) : __( 'ID', 'wp-photo-album-plus' ) ) .
2845
- ( $order == 'id' ? $useimg : '' ) . '
 
2846
  </td>
2847
  <td
2848
- style="min-width: 120px;cursor:pointer;"
2849
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'name' ) . '\'"
2850
- >' .
2851
- __( 'Name', 'wp-photo-album-plus' ) .
2852
- ( $order == 'name' ? $useimg : '' ) . '
 
2853
  </td>
2854
- <td
2855
- style="cursor:pointer;"
2856
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'description' ) . '\'"
2857
- >' .
2858
- __( 'Description', 'wp-photo-album-plus' ) .
2859
- ( $order == 'description' ? $useimg : '' ) . '
2860
  </td>';
2861
  if ( current_user_can( 'administrator' ) ) {
2862
  $thead_body .= '
2863
- <td style="min-width: 100px;cursor:pointer;"
2864
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'owner' ) . '\'"
2865
- >' .
2866
- __( 'Owner', 'wp-photo-album-plus' ) .
2867
- ( $order == 'owner' ? $useimg : '' ) . '
2868
  </td>';
2869
  }
2870
  $thead_body .= '
2871
  <td
2872
- style="min-width: 100px;cursor:pointer;"
2873
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'a_order' ) . '\'"
2874
- >' .
2875
- __( 'Order', 'wp-photo-album-plus' ) .
2876
- ( $order == 'a_order' ? $useimg : '' ) . '
 
2877
  </td>
2878
  <td
2879
- style="width: 120px;cursor:pointer;"
2880
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'album_admin', 'a_parent' ) . '\'"
2881
- >' .
2882
- __( 'Parent', 'wp-photo-album-plus' ) .
2883
- ( $order == 'a_parent' ? $useimg : '' ) . '
 
2884
  </td>
2885
  <td
2886
  title="' . esc_attr( __( 'Albums/Photos/Moderation required/Scheduled', 'wp-photo-album-plus' ) ) . '"
@@ -2914,7 +3002,7 @@ global $wpdb;
2914
  if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = '-1'" ) > 0 ) {
2915
  $result = '
2916
  <tr>
2917
- <td colspan="' . ( '20' + ( current_user_can( 'wppa_upload' ) ? '1' : '0' ) + ( current_user_can( 'wppa_import' ) ? '1' : '0' ) ) . '" >
2918
  <em>' .
2919
  __( 'The following albums are ---separate--- and do not show up in the generic album display', 'wp-photo-album-plus' ) . '
2920
  </em>
@@ -2938,27 +3026,36 @@ global $wpdb;
2938
  <tfoot>' .
2939
  $thead_body . '
2940
  </tfoot>
2941
- </table>';
 
2942
 
2943
- // Display the album table footer
2944
  wppa_echo( $result );
2945
 
2946
- // Display the pagination
2947
- wppa_admin_pagination( $pagesize, $page, $total, $reload_url, 'bottom' );
2948
-
2949
- // Display the footer
2950
  wppa_echo( wppa_album_admin_footer() );
2951
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2952
  }
2953
  else {
2954
- wppa_echo( '</div>' ); // Close action contatiner
2955
  wppa_echo( '<h2>' . __( 'No albums yet.', 'wp-photo-album-plus' ) . '</h2>' );
2956
  }
2957
  }
2958
 
2959
  // The adnin Search field
2960
  function wppa_search_edit( $collapsible = false ) {
2961
- global $plugin_page;
2962
 
2963
  $doit = false;
2964
  if ( current_user_can( 'wppa_admin' ) && current_user_can( 'wppa_moderate' ) ) $doit = true;
@@ -2968,23 +3065,17 @@ global $plugin_page;
2968
 
2969
  $value = wppa_get( 'searchstring' );
2970
 
2971
- $result = '';
2972
-
2973
- if ( $plugin_page == 'wppa_options' ) {
2974
- $result = '
2975
- <tr>
2976
- <td colspan="' . ( ( $collapsible ? '20' : '14' ) + ( current_user_can( 'wppa_upload' ) ? '1' : '0' ) + ( current_user_can( 'wppa_import' ) ? '1' : '0' ) ) . '" >
2977
- <em>' .
2978
- __( 'Search for photos to edit', 'wp-photo-album-plus' ) . '
2979
- </em>
2980
- <small>' .
2981
- __( 'Enter search words seperated by commas. Photos will meet all search words by their names, descriptions, translated keywords and/or tags.', 'wp-photo-album-plus' ) . '
2982
- </small>
2983
- </td>
2984
- </tr>';
2985
- }
2986
-
2987
- $result .= '
2988
  <tr class="alternate" >' .
2989
  ( $collapsible ? '<td></td>' : '' ) . '
2990
  <td id="src-alb" >' .
@@ -3044,12 +3135,13 @@ global $wpdb;
3044
  <tr>' .
3045
  ( $collapsible ? '<td></td>' : '' ) . '
3046
  <td>' . __( 'Any', 'wp-photo-album-plus' ) . '</td>' .
3047
- ( $collapsible ? '<td colspan="5">' : '' ) . '
3048
  <td colspan="4" >' .
3049
  sprintf( __( 'There are %s trashed photos that can be rescued', 'wp-photo-album-plus' ), $trashed ) . '
3050
  </td>
3051
- <td colspan="2">
3052
  </td>
 
3053
  <td>
3054
  <a class="wppaedit" onclick="wppaEditTrash( \'' . wppa_ea_url( 'trash' ) . '\' );">
3055
  <span style="font-weight:bold">' . __( 'Edit', 'wp-photo-album-plus' ) . '</span>
@@ -3074,6 +3166,60 @@ global $wpdb;
3074
  return $result;
3075
  }
3076
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3077
  // The albumlist
3078
  function wppa_do_albumlist( $parent, $nestinglevel, $albums, $seq ) {
3079
  global $wpdb;
@@ -3150,7 +3296,7 @@ global $wpdb;
3150
  style="height:16px;display:none"
3151
  src="' . wppa_get_imgdir() . 'backarrow.gif' . '"
3152
  onclick="' . $onclickoff . '"
3153
- title="' . esc_attr( __( 'Collapse sub albums', 'wp-photo-album-plus' ) ) . '"
3154
  />
3155
  <img
3156
  id="alb-arrow-on-' . $id . '"
@@ -3158,10 +3304,10 @@ global $wpdb;
3158
  style="height:16px;"
3159
  src="' . wppa_get_imgdir() . 'arrow.gif' . '"
3160
  onclick="' . $onclickon . '"
3161
- title="' . esc_attr( __( 'Expand sub albums', 'wp-photo-album-plus' ) ) . '"
3162
  />';
3163
 
3164
- // Open sub albums by clicking the open button if it was before (cookie), and if it is visible (!)
3165
  if ( wppa_get_cookie( 'alb-arrow-' . $id ) == 'on' ) {
3166
  $the_js = '
3167
  jQuery(document).ready(function(){
@@ -3197,26 +3343,11 @@ global $wpdb;
3197
  $nm = $counts['pendselfphotos'];
3198
  $ns = $counts['scheduledselfphotos'];
3199
 
3200
- // The album name and description
3201
  $result .= '
3202
  <td>' . esc_html( stripslashes( $album['name'] ) ) . '</td>
3203
- <td><small>' . esc_html( stripslashes( $album['description'] ) ) . '</small></td>';
3204
-
3205
- // The owner. Make sure he exists
3206
- if ( current_user_can( 'administrator' ) ) {
3207
- $album_owner = $album['owner'];
3208
- if ( $album_owner == '--- public ---' || get_user_by( 'login', $album_owner ) ) {
3209
- $result .= '
3210
- <td>' . $album_owner . '</td>';
3211
- }
3212
- else {
3213
- $result .= '
3214
- <td>' . __( '--- unknown ---', 'wp-photo-album-plus' ) . '</td>';
3215
- }
3216
- }
3217
-
3218
- // Order
3219
- $result .= '
3220
  <td>' . $album['a_order'] . '</td>
3221
  <td>' . esc_html( stripslashes( wppa_get_album_name( $album['a_parent'], ['extended' => true] ) ) ) . '</td>
3222
  <td>' . $na . '/' . $np . '/' . $nm . '/' . $ns . '</td>';
@@ -3260,7 +3391,7 @@ global $wpdb;
3260
  }
3261
  if ( wppa_can_create_album() ) {
3262
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $id . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
3263
- $onc = 'if (confirm(\''.__( 'Are you sure you want to create a sub album?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
3264
  $result .= '<td><a onclick="' . $onc . '" class="wppacreate">' . __( 'Create', 'wp-photo-album-plus' ) . '</a></td>';
3265
  }
3266
  }
@@ -3282,7 +3413,7 @@ global $wpdb;
3282
  }
3283
  }
3284
 
3285
- // Find accessable sub albums
3286
  function wppa_have_accessible_children( $alb ) {
3287
  global $wpdb;
3288
 
@@ -3346,7 +3477,7 @@ global $wpdb;
3346
  wppa_clear_cache( array( 'album' => $id ) );
3347
  wppa_childlist_remove( $id );
3348
 
3349
- $msg = __( 'Album deleted.' , 'wp-photo-album-plus' );
3350
  if ( wppa( 'ajax' ) ) {
3351
  wppa_echo( $msg );
3352
  }
@@ -3371,8 +3502,8 @@ global $wpdb;
3371
  $opts = array( __( '--- random ---', 'wp-photo-album-plus' ),
3372
  __( '--- random featured ---', 'wp-photo-album-plus' ),
3373
  __( '--- most recent added ---', 'wp-photo-album-plus' ),
3374
- __( '--- random from (sub-)sub albums ---', 'wp-photo-album-plus' ),
3375
- __( '--- most recent from (sub-)sub albums ---', 'wp-photo-album-plus' ),
3376
  __( '--- according to albums photo sequence ---', 'wp-photo-album-plus' ),
3377
  );
3378
  $vals = array( '-9', '-1', '-2', '-3', '-4', '-5' );
@@ -3498,7 +3629,7 @@ global $wpdb;
3498
  }
3499
  }
3500
 
3501
- // Sub album order
3502
  if ( $parent ) {
3503
 
3504
  $sel = ' selected';
@@ -3528,7 +3659,7 @@ global $wpdb;
3528
  <div style="margin-left:6px">
3529
  <label
3530
  for="subalbumorder">' .
3531
- __( 'Sub album sequence method', 'wp-photo-album-plus' ) . '
3532
  </label><br>
3533
  <select
3534
  id="subalbumorder"
@@ -3564,7 +3695,7 @@ global $wpdb;
3564
  else {
3565
  $result = '
3566
  <br>' .
3567
- esc_html__( 'You can edit sub album sequence number here when you set the album sequence to "Sequence #" or "Sequence # descending" in the "Sub album sequence method" selection box above.' );
3568
  }
3569
  $result .= '<br>';
3570
 
@@ -3912,15 +4043,10 @@ function _wppa_search() {
3912
 
3913
  $result = '
3914
  <div class="wrap" >
3915
- <h1 class="wp-heading-inline">' .
3916
- get_admin_page_title() . '
3917
- </h1>
3918
  <div style="clear:both">&nbsp;</div>
3919
- <h3>' .
3920
- esc_html__( 'Search for photos to edit', 'wp-photo-album-plus' ) . '
3921
- </h3>' .
3922
- esc_html__( 'Enter search words seperated by commas. Photos will meet all search words by their names, descriptions, translated keywords and/or tags.', 'wp-photo-album-plus' ) . '
3923
- <br>
3924
  <table class="wppa-table widefat wppa-setting-table" style="margin-top:12px">
3925
  <thead>
3926
  </thead>
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 8.2.05.002
7
  *
8
  */
9
 
14
  global $q_config;
15
  global $wppa_revno;
16
 
 
17
  $from = wppa_get_option( 'wppa_search_page', 'wppa_admin_menu' );
18
  delete_option( 'wppa_search_page' );
19
 
20
+ if ( $from == 'wppa_admin_menu' ) {
21
+ $back_url = get_admin_url() . 'admin.php?page=wppa_admin_menu';
22
+ $back_title = __( 'Back to album table', 'wp-photo-album-plus' );
23
+ }
24
+ elseif ( $from == 'wppa_search' ) {
25
+ $back_url = get_admin_url() . 'admin.php?page=wppa_search';
26
+ $back_title = __( 'Back to search form', 'wp-photo-album-plus' );
 
 
27
 
28
+ if ( wppa_get( 'edit-id' ) == 'search' ) {
29
 
30
+ if ( wppa_get( 'searchstring' ) ) {
31
+ $back_url .= '&wppa-searchstring=' . wppa_get( 'searchstring' );
32
+ }
33
+ $back_url .= '#wppa-edit-search-tag';
 
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
+ $back_link_html = '
37
+ <div style="float:right;background-color:lightblue;">
38
+ &nbsp;
39
+ <a href="' . $back_url . '"
40
+ style=""
41
+ >' .
42
+ $back_title . '
43
+ </a>
44
+ &nbsp;
45
+ </div>';
46
 
47
+ $top_link_html = '
48
+ <div style="position:fixed;right:20px;bottom:30px;background-color:lightblue;float:right" >
49
+ &nbsp;
50
+ <a href="#manage-photos">' .
51
+ __( 'Top of page', 'wp-photo-album-plus' ) . '
52
+ </a>
53
+ &nbsp;
54
+ </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  // Delete trashed comments
57
  $wpdb->query( "DELETE FROM $wpdb->wppa_comments WHERE status = 'trash'" );
58
 
59
+ $sel = 'selected';
60
+
61
  // warn if the uploads directory is no writable
62
  if ( ! is_writable( WPPA_UPLOAD_PATH ) ) {
63
  wppa_error_message(
95
  }
96
  }
97
 
 
98
  if ( wppa_get( 'tab' ) ) {
99
 
 
 
 
 
 
100
  // album edit page
101
  if ( wppa_get( 'tab' ) == 'edit' ) {
102
 
103
  // Edit any album, check for type is implemented c.q. existence and rights
104
  if ( wppa_get( 'edit-id' ) ) {
105
 
 
106
  $ei = wppa_get( 'edit-id' );
107
  if ( $ei != 'new' && $ei != 'search' && $ei != 'trash' && $ei != 'single' && ! is_numeric( $ei ) ) {
108
  wppa_error_message( sprintf( __( 'Album edit id %s is not implemented', 'wp-photo-album-plus' ), $ei ) );
109
  return;
110
  }
111
+ if ( ! wp_verify_nonce( wppa_get( 'nonce' ), 'wppa-nonce' ) ) {
112
+ wp_die('Security check failure');
113
+ }
114
  if ( is_numeric( $ei ) ) {
115
  if ( ! $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id=%d", $ei ), ARRAY_A ) ) {
116
  wppa_error_message( sprintf( __( 'Album %d does not exist', 'wp-photo-album-plus' ), $ei ) );
117
  return;
118
  }
119
  if ( ! wppa_have_access( $ei ) ) {
120
+ wppa_error_message( sprintf( __( 'You do not have sufficient rights to edit Album %d', 'wp-photo-album-plus' ), $ei ) );
121
  return;
122
  }
123
  }
126
  // Edit single photo
127
  if ( wppa_get( 'edit-id' ) == 'single' ) {
128
 
129
+ $txt = wppa_get( 'just-edit', __( 'Edit Single Photo', 'wp-photo-album-plus' ) );
130
 
131
+ wppa_echo( '<div class="wrap" ><h2>' . $txt . '</h2>' );
132
  wppa_album_photos( $ei );
133
  wppa_echo( '</div>' );
134
  return;
137
  // Edit by search token
138
  if ( wppa_get( 'edit-id' ) == 'search' ) {
139
 
140
+ $task = __( 'Edit photo information', 'wp-photo-album-plus' );
141
+ if ( wppa_get( 'bulk' ) ) {
142
+ $task = __( 'Copy / move / delete / edit name / edit description / change status', 'wp-photo-album-plus' );
143
+ }
144
+ elseif ( wppa_get( 'quick' ) ) {
145
+ __( 'Edit photo information except copy and move', 'wp-photo-album-plus' );
146
+ }
147
 
148
  wppa_echo ( '
149
  <a name="manage-photos" id="manage-photos" ></a>
150
+ <h2>' .
151
+ __( 'Manage Photos', 'wp-photo-album-plus' ) . ' - <small><i>' . $task . '</i></small>
152
+ </h2>' .
153
+ $back_link_html . '
154
+ <br><br>' );
 
 
 
 
155
 
156
+ if ( wppa_get( 'bulk' ) ) {
157
+ wppa_album_photos_bulk( $ei );
158
+ }
159
+ else {
160
+ wppa_album_photos( $ei );
161
+ }
 
 
 
 
 
 
162
 
163
+ wppa_echo( $top_link_html . '<br>' . $back_link_html );
 
164
  return;
165
  }
166
 
169
 
170
  $h2 = __( 'Manage Trashed Photos', 'wp-photo-album-plus' );
171
  $task = __( 'Edit photo information', 'wp-photo-album-plus' );
172
+ wppa_echo( '<div class="wrap"><a name="manage-photos" id="manage-photos" ></a><h2>' . $h2 . ' - <small><i>' . $task . '</i></small></h2>' );
173
  if ( wppa_get( 'bulk' ) ) {
174
  wppa_album_photos_bulk( $ei );
175
  }
189
  }
190
  $id = wppa_nextkey( WPPA_ALBUMS );
191
 
192
+ // Creating a subalbum of a given parent?
193
  if ( wppa_get( 'parent_id' ) ) {
194
  $parent = wppa_get( 'parent_id' );
195
  $name = wppa_get_album_name( $parent ) . '-#' . $id;
210
  wppa_update_option( 'wppa_default_parent', '0' );
211
  $parent = '0';
212
  }
213
+ $name = __( 'New Album', 'wp-photo-album-plus' );
214
  if ( $parent == '0' && ! wppa_can_create_top_album() ) {
215
  wp_die( __( 'You have insufficient rights to create a top-level album', 'wp-photo-album-plus' ) );
216
  }
448
  $the_js = '
449
  function wppaTryInheritCats( id ) {
450
 
451
+ var query = "' . esc_js( __( 'Are you sure you want to inherit categories to all (sub-)subalbums of this album?', 'wp-photo-album-plus' ) ) . '";
452
  if ( confirm( query ) ) {
453
  wppaAjaxUpdateAlbum( id, \'inherit_cats\', Math.random() );
454
  }
456
 
457
  function wppaTryAddCats( id ) {
458
 
459
+ var query = "' . esc_js( __( 'Are you sure you want to add the categories to all (sub-)subalbums of this album?', 'wp-photo-album-plus' ) ) . '";
460
  if ( confirm( query ) ) {
461
  wppaAjaxUpdateAlbum( id, \'inhadd_cats\', Math.random() );
462
  }
557
  wppa_echo( '<input type="hidden" id="album-nonce-' . $id . '" value="' . wp_create_nonce( 'wppa-nonce_' . $id ) . '" />' );
558
 
559
  // The header
560
+ wppa_echo( '<h1 style="display:inline">' . __( wppa_get_album_name( $id ) ) . '</h1>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
561
 
562
  wppa_echo( $back_link_html );
563
 
564
  /* Start header buttons */
565
+ wppa_echo( '
566
+ <div id="wppa-action-container">
567
+ <div id="wppa-action-container-left">');
568
 
569
  // Goto Upload
570
  if ( current_user_can( 'wppa_upload' ) ) {
578
  __( 'Upload to this album', 'wp-photo-album-plus' ) . ( $a > '0' ? ' ' . sprintf( __( '(max %d)', 'wp-photo-album-plus' ), $a ) : '' )
579
  );
580
 
581
+ wppa_echo( '
582
  <input
583
  type="button"
584
  class="wppa-admin-button button"
585
  onclick="' . $onc . '"
586
  value="' . $val .'"
587
+ />' );
588
  }
589
 
590
  // Goto Import
593
  $onc = 'document.location = \''.get_admin_url().'admin.php?page=wppa_import_photos&wppa-set-album='.$id.'\'';
594
  $val = __( 'Import to this album', 'wp-photo-album-plus' ) . ( $a > '0' ? ' ' . sprintf( __( '(max %d)', 'wp-photo-album-plus' ), $a ) : '' );
595
 
596
+ wppa_echo( '
597
  <input
598
  type="button"
599
  class="wppa-admin-button button"
600
  onclick="' . $onc . '"
601
  value="' . $val .'"
602
+ />' );
603
  }
604
+ wppa_echo( '
605
+ </div>' ); // end action-container-left
606
 
607
  // Download album
608
  if ( wppa_switch( 'allow_download_album' ) && ( ! wppa_switch( 'download_album_is_restricted' ) || wppa_user_is_admin() ) ) {
609
+ wppa_echo( '
610
+ <div id="wppa-action-container-right">
611
  <input
612
  type="button"
613
  class="wppa-admin-button button"
619
  src="' . wppa_get_imgdir() . 'spinner.gif"
620
  style="margin-left:6px;display:none;height:18px;position:relative;bottom:-6px"
621
  alt="spinner"
622
+ />
623
+ </div>' ); // end action-container-right
624
  }
625
+ wppa_echo( '
626
+ </div>'); // end action-container
 
 
627
  /* End header */
628
 
629
  /* Main body album admin */
780
  wppa_echo( '
781
  <div class="left">
782
  <label>' .
783
+ __( 'Inc subalbums', 'wp-photo-album-plus' ) . '
784
  </label><br>
785
  <div class="wppa-ldi">' .
786
  $tpviews . '
887
 
888
  // Status
889
  {
890
+ $title = __( 'Set the frontend visibility of the album cover and items not including subalbums.', 'wp-photo-album-plus' ) . ' ' .
891
  __( 'Publish: visible for all, Private: visible for logged in only, Hidden: visible for admin only', 'wp-photo-album-plus' );
892
 
893
  wppa_echo( '
1074
  style="max-width: 200px;margin-right: 4px;">
1075
  <label
1076
  for="altthumb">' .
1077
+ __( 'Max subalbums', 'wp-photo-album-plus' ) . '
1078
  </label><br>
1079
  <select
1080
  id="maxchild"
1081
  onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'max_children\', this )"
1082
+ title="' . esc_attr( 'This setting can only llimit the creation of subalbums at the frontend and looks at direct subalbums only', 'wp-photo-album-plus' ) . '"
1083
  >
1084
  <option value="0"' . ( $val == '0' ? $sel : '' ) . ' >' .
1085
  __( 'unlimited', 'wp-photo-album-plus' ) . '
1159
 
1160
  // Tree limit
1161
  {
1162
+ $title = __( 'The upload limit for this album and all its (sub-)subalbums.', 'wp-photo-album-plus' ) . ' ' .
1163
+ __( 'This setting overrules all other limits that may apply to this album or its (sub-)subalbums.', 'wp-photo-album-plus' ) . ' ' .
1164
  __( '0 means no limit.', 'wp-photo-album-plus' );
1165
  wppa_echo( '
1166
  <div class="left">
1411
  __( 'The following buttons perform actions on albums related to this album', 'wp-photo-album-plus' ) . '
1412
  </h2>' );
1413
 
1414
+ // Create subalbum
1415
  if ( wppa_can_create_album() ) {
1416
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $albuminfo['id'] . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
1417
+ $onc = 'if (confirm(\''.__( 'Are you sure you want to create a subalbum?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
1418
 
1419
  wppa_echo( '
1420
  <input
1421
  type="button"
1422
  class="wppa-admin-button button"
1423
  onclick="' . $onc . '"
1424
+ value="' . esc_attr( __( 'Create subalbum', 'wp-photo-album-plus' ) ) . '"
1425
  />' );
1426
  }
1427
 
1436
  '&amp;parent_id=' . $albuminfo['a_parent'] .
1437
  '&amp;is-sibling-of=' . $albuminfo['id'] .
1438
  '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
1439
+ $onc = 'if (confirm(\''.__( 'Are you sure you want to create a subalbum?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
1440
 
1441
  wppa_echo( '
1442
  <input
1466
  <input
1467
  type="button"
1468
  class="wppa-admin-button button"
1469
+ title="' . esc_attr( __( 'Apply categories to all (sub-)subalbums.', 'wp-photo-album-plus' ) ) . '"
1470
  onclick="wppaTryInheritCats( ' . $id . ' )"
1471
+ value="' . esc_attr( __( 'Apply Cats to subalbums', 'wp-photo-album-plus' ) ) . '"
1472
  />
1473
  <input
1474
  type="button"
1475
  class="wppa-admin-button button"
1476
+ title="' . esc_attr( __( 'Add categories to all (sub-)subalbums.', 'wp-photo-album-plus' ) ) . '"
1477
  onclick="wppaTryAddCats( ' . $id . ' )"
1478
+ value="' . esc_attr( __( 'Add Cats to subalbums', 'wp-photo-album-plus' ) ) . '"
1479
  />' );
1480
  }
1481
 
1482
+ // Subalbums sequence
1483
  if ( $has_children ) {
1484
  wppa_album_sequence( $edit_id );
1485
  }
1789
  <select
1790
  title="' . esc_attr( $title ) . '"
1791
  onchange="wppaAjaxUpdateAlbum( '. $id . ', \'cover_linktype\', this )" >
1792
+ <option value="content"' . ( $lt == 'content' ? $sel : '' ) . ' >' . __( 'the subalbums and thumbnails', 'wp-photo-album-plus' ) . '</option>
1793
+ <option value="albums"' . ( $lt == 'albums' ? $sel : '' ) . ' >' . __( 'the subalbums', 'wp-photo-album-plus' ) . '</option>
1794
  <option value="thumbs"' . ( $lt == 'thumbs' ? $sel : '' ) . ' >' . __( 'the thumbnails', 'wp-photo-album-plus' ) . '</option>
1795
  <option value="slide"' . ( $lt == 'slide' ? $sel : '' ) . ' >' . __( 'the album photos as slideshow', 'wp-photo-album-plus' ) . '</option>
1796
  <option value="page"' . ( $lt == 'page' ? $sel : '' ) . ' >' . __( 'the link page with a clean url', 'wp-photo-album-plus' ) . '</option>
2073
 
2074
  /* Manage photos section */
2075
  {
2076
+ wppa_echo( '
2077
+ <div class="wppa-table-wrap" style="margin-top:20px;clear:both;position:relative;">' );
2078
+
2079
+ wppa_echo( '<a name="manage-photos" id="manage-photos" ></a><h2 style="padding-left:12px">' );
2080
+
2081
+ if ( wppa_get( 'bulk' ) )
2082
+ $result = __( 'Copy / move / delete / edit name / edit description / change status', 'wp-photo-album-plus' );
2083
+ elseif ( wppa_get( 'seq' ) )
2084
+ $result = __( 'Change item sequence by drag and drop', 'wp-photo-album-plus' );
2085
+ elseif ( wppa_get( 'quick' ) )
2086
+ $result = __( 'Edit photo information except copy and move', 'wp-photo-album-plus' );
2087
+ elseif ( is_numeric( wppa_get( 'edit-id' ) ) ) {
2088
+ $result = sprintf( __( 'Edit/Moderate photos from album %s by %s', 'wp-photo-album-plus' ),
2089
+ '<i>' . sanitize_text_field( wppa_get_album_name( $id ) ) . '</i>',
2090
+ '<i>' . sanitize_user( wppa_get_album_item( $id, 'owner' ) ) . '</i>' );
2091
+ }
2092
+ else $result = '';
2093
 
2094
+ $result .= '
2095
+ </h2>
2096
+ <div style="clear:both"></div>';
2097
+ wppa_echo( $result );
2098
 
2099
  if ( wppa_get( 'bulk' ) )
2100
  wppa_album_photos_bulk( $edit_id );
2103
  else
2104
  wppa_album_photos( $edit_id );
2105
 
2106
+ wppa_echo( '
2107
+ </div>
2108
+ </details>' );
2109
  }
2110
 
2111
  /* Footer of the page */
2112
  wppa_echo( '
2113
  <br>' .
2114
+ $back_link_html .
2115
  $top_link_html . '
2116
  </div>' );
2117
 
2118
+
2119
  } // End tab is Edit
2120
 
2121
  // Comment moderate
2125
  if ( current_user_can( 'wppa_comments' ) && wppa_have_access( $alb ) ) {
2126
  $result = '
2127
  <div class="wrap">
2128
+ <img src="' . WPPA_URL . '/img/page_green.png" />
2129
+ <h1 style="display:inline">' . __( 'Moderate comment', 'wp-photo-album-plus' ) . '</h1>
2130
+ <div style="clear:both"></div>' .
2131
  wppa_album_photos( '', $photo ) . '
2132
  </div>';
2133
  wppa_echo( $result );
2145
  $result = '
2146
  <div class="wrap">
2147
  <img src="' . WPPA_URL . '/img/page_green.png" />
2148
+ <h1 style="display:inline">' . ( wppa_get( 'tab' ) == 'pmod' ?
2149
  __( 'Moderate photo', 'wp-photo-album-plus' ) :
2150
  __( 'Edit photo', 'wp-photo-album-plus' ) ) . '
2151
  </h1>
2169
 
2170
  $result = '
2171
  <div class="wrap">
2172
+ <img src="' . WPPA_URL . '/img/albumdel32.png" />
2173
+ <h1 style="display:inline">' . __( 'Delete Album', 'wp-photo-album-plus' ) . '</h1>
2174
 
2175
  <p>' . __( 'Album', 'wp-photo-album-plus' ) . '<b>' . htmlspecialchars( wppa_get_album_name( wppa_get( 'edit-id' ) ) ) . '</b></p>
2176
  <p>' . __( 'Are you sure you want to delete this album?', 'wp-photo-album-plus' ) . '<br>' .
2215
  </div>';
2216
  wppa_echo( $result );
2217
  }
 
 
2218
  else {
2219
  wppa_error_message( sprintf( __( 'Album admin action %s is not implemented', 'wp-photo-album-plus' ),
2220
  '<b>' . wppa_get( 'tab' ) ) . '</b>' );
2224
  // 'tab' not set. default, album manage page.
2225
  else {
2226
 
2227
+ // if album deleted
2228
  if ( wppa_get( 'del-confirm' ) ) {
2229
 
2230
  if ( ! wp_verify_nonce( wppa_get( 'nonce' ), 'wppa-nonce' ) ) {
2231
+ wp_die('Security check failure');
2232
  }
2233
 
2234
  $album_owner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_albums WHERE id = %s", wppa_get( 'del-id' ) ) );
2235
+ if ( ( $album_owner == '--- public ---' && ! current_user_can('administrator') ) || ! wppa_have_access( wppa_get( 'del-id' ) ) ) {
2236
+ wp_die('You do not have the rights to delete this album');
2237
  }
2238
 
2239
  if ( wppa_get( 'del-photos' ) == 'move' ) {
2249
  }
2250
  }
2251
 
 
2252
  if ( wppa_get( 'switchto' ) ) {
2253
  wppa_update_option( 'wppa_album_table_'.wppa_get_user(), wppa_get( 'switchto' ) );
2254
  }
2255
+ $style = wppa_get_option('wppa_album_table_'.wppa_get_user(), 'flat');
2256
+
2257
+
2258
 
2259
  /* The album admin table of albums page start */
2260
  wppa_echo( '
2261
  <div class="wrap">' .
2262
  wppa_admin_spinner() . '
2263
+ <h1 class="wp-heading-inline">' . __( 'Manage Albums', 'wp-photo-album-plus' ) . '</h1>' );
2264
 
2265
  // The Create new album button
2266
  if ( wppa_can_create_top_album() ) {
2273
  class="page-title-action">' .
2274
  __( 'Add New', 'wp-photo-album-plus' ) . '
2275
  </a>
2276
+ <br>' );
2277
  }
2278
 
2279
+ /* The header buttons / sewlection boxes */
2280
  {
2281
+ wppa_echo( '
2282
+ <div id="wppa-action-container">
2283
+ <div id="wppa-action-container-left">' );
2284
 
2285
  // The switch to flat/collapsable button(s)
2286
  if ( $style == 'flat' ) {
2287
+ wppa_echo( '
2288
  <input
2289
  type="button"
2290
  class="button"
2291
  onclick="document.location=\'' . get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;switchto=collapsible\'"
2292
  value="' . esc_attr__( 'Switch to Collapsable table', 'wp-photo-album-plus' ) . '"
2293
+ />' );
2294
  }
2295
  else {
2296
+ wppa_echo( '
2297
  <input
2298
  type="button"
2299
  class="button"
2300
  onclick="document.location=\'' . get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;switchto=flat\'"
2301
  value="' . esc_attr__( 'Switch to Flat table', 'wp-photo-album-plus' ) . '"
2302
+ />' );
2303
  }
2304
 
2305
  // The open all/close all buttons
2306
  if ( $style != 'flat' ) {
2307
+ wppa_echo( '
2308
  <input
2309
  type="button"
2310
  class="button"
2328
  jQuery(\'.alb-arrow-off\').css(\'display\',\'none\');
2329
  "
2330
  value="' . esc_attr__( 'Close all', 'wp-photo-album-plus' ) . '"
2331
+ />' );
2332
  }
2333
 
2334
+ wppa_echo( '
2335
+ </div>
2336
+ <div id= "wppa-action-container-right">' );
2337
+
2338
  // Edit by id
2339
  if ( wppa_has_many_albums() ) {
2340
+ wppa_echo( '
2341
  <input
2342
  id="wppa-edit-albid"
2343
  type="number"
2345
  placeholder="' . __( 'Album id', 'wp-photo-album-plus' ) . '"
2346
  title="' . __( 'Enter the number of the album you want to edit', 'wp-photo-album-plus' ) . '"
2347
  style="width:120px;cursor:pointer"
2348
+ />' );
2349
  }
2350
  else {
2351
  $albids = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums ORDER BY id" );
2354
  unset( $albids[$key] );
2355
  }
2356
  }
2357
+ wppa_echo( '
2358
  <select
2359
  id="wppa-edit-albid"
2360
  title="' . __( 'Select the number of the album you want to edit', 'wp-photo-album-plus' ) . '"
2361
  styles="width:120px;cursor:pointer;vertical-align:baseline"
2362
  />
2363
+ <option value="" selected disabled>' . __( 'Album id', 'wp-photo-album-plus' ) . '</option>' );
2364
  foreach( $albids as $alb ) {
2365
+ wppa_echo( '<option value="' . $alb . '">' . $alb . '</option>' );
2366
  }
2367
+ wppa_echo( '
2368
+ </select>' );
2369
  }
2370
+ wppa_echo( '
2371
  <input
2372
  type="button"
2373
  class="button"
2374
  value="' . __( 'Edit album', 'wp-photo-album-plus' ) . '"
2375
  onclick="wppaGoEditAlbNo();"
2376
+ />' );
2377
 
2378
  // Filter by searchword
2379
  $opts = $wpdb->get_col( "SELECT slug FROM $wpdb->wppa_index WHERE albums <> '' ORDER BY slug" );
2380
  $f = wppa_get( 'filter' );
2381
+ wppa_echo( '
2382
  <select
2383
  id="wppa-edit-filter"
2384
  title="' . __( 'Select an album search word', 'wp-photo-album-plus' ) . '"
2385
  >
2386
+ <option value="" selected disabled>' . __( 'Filter by', 'wp-photo-album-plus' ) . '</option>' );
2387
  foreach( $opts as $opt ) {
2388
+ wppa_echo( '<option value="' . $opt . '"' . ( $f == $opt ? ' selected ' : '' ) . '>' . $opt . '</option>' );
2389
  }
2390
+ wppa_echo( '
2391
  </select>
2392
  <input
2393
  type="button"
2394
  class="button"
2395
  onclick="wppaGoApplyFilter();"
2396
  value="' . __( 'Apply filter', 'wp-photo-album-plus' ) . '"
2397
+ />' );
2398
+ wppa_echo( '
2399
+ </div>
2400
+ </div>' );
2401
+ /* End header buttons / seecion boxes */
 
 
 
2402
  }
2403
 
2404
+ $the_js = '
2405
+ function wppaGoEditAlbNo() {
2406
+ var id = parseInt(document.getElementById("wppa-edit-albid").value);
2407
+ if (id > 0) {
2408
+ var nonce = "' . wp_create_nonce( 'wppa-nonce' ) .'";
2409
+ var href = "' . get_admin_url() . 'admin.php?page=wppa_admin_menu&wppa-nonce="+nonce+"&tab=edit&edit-id="+id;
2410
+ document.location.href=href;
2411
+ }
2412
+ else {
2413
+ alert("' . __( 'Please enter a valid album id', 'wp-photo-album-plus' ) . '");
2414
+ }
2415
+ };
2416
+ function wppaGoApplyFilter() {
2417
+ var filter = document.getElementById("wppa-edit-filter").value;
2418
+ if(filter) {
2419
+ document.location.href="' . get_admin_url() . 'admin.php?page=wppa_admin_menu&switchto=flat&filter="+filter;
2420
+ }
2421
+ else {
2422
+ alert("' . __( 'Please select a filter token', 'wp-photo-album-plus' ) . '");
2423
+ }
2424
+ };';
2425
+ wppa_add_inline_script( 'wppa-admin', $the_js );
2426
 
2427
+ // The table of existing albums
2428
+ if ( $style == 'flat' ) {
2429
+ wppa_admin_albums_flat();
2430
+ }
2431
+ else {
2432
+ wppa_admin_albums_collapsible();
2433
  }
2434
 
2435
+ wppa_echo( '<br>' );
2436
 
 
2437
  wppa_album_sequence( '0' );
2438
 
2439
  wppa_echo( '</div>' );
 
2440
  }
2441
  }
2442
 
2444
  function wppa_admin_albums_flat() {
2445
  global $wpdb;
2446
 
2447
+ // Init
2448
+ $pagesize = wppa_opt( 'album_admin_pagesize' );
2449
+ $page = wppa_get( 'album-page-no', '1' );
 
 
2450
  $skips = ( $page - 1 ) * $pagesize;
 
 
2451
 
2452
  // Read all albums, pre-ordered
2453
+ $order_by = wppa_get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
2454
+ $order_desc = wppa_get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' );
2455
+
2456
+ switch( $order_by ) {
2457
+ case 'name':
2458
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name";
2459
+ break;
2460
+ case 'description':
2461
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description";
2462
+ break;
2463
+ case 'owner':
2464
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner";
2465
+ break;
2466
+ case 'a_order':
2467
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order";
2468
+ break;
2469
+ case 'a_parent':
2470
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent";
2471
+ break;
2472
+ default:
2473
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id";
2474
+ }
2475
+ if ( $order_desc == 'yes' ) {
2476
+ $query .= " DESC";
2477
+ }
2478
+
2479
+ $albums = $wpdb->get_results( $query, ARRAY_A );
2480
 
2481
  // Remove non accessible albums
2482
  $temp = $albums;
2491
  $filter = wppa_get( 'filter' );
2492
 
2493
  if ( $filter ) {
2494
+ $filter_albs = $wpdb->get_var( $wpdb->prepare( "SELECT albums FROM $wpdb->wppa_index WHERE slug = %s LIMIT 1", $filter ) );
2495
  $filter_albs = wppa_index_string_to_array( $filter_albs );
2496
 
2497
  foreach( array_keys( $albums ) as $key ) {
2501
  }
2502
  }
2503
 
2504
+ $count = count( $albums );
 
2505
 
2506
  // If paging: Make new array with selected albums only
2507
  if ( $pagesize ) {
2508
+ $temp = $albums;
2509
+ $albums = array();
2510
+ $i = 0;
2511
+ foreach( $temp as $item ) {
2512
+ if ( $i >= $skips && $i < ( $skips + $pagesize ) ) {
2513
+ $albums[] = $item;
2514
+ }
2515
+ $i++;
2516
+ }
2517
+ }
2518
+
2519
+ // Find the final ordering method
2520
+ $reverse = false;
2521
+ $order = wppa_get( 'order_by' );
2522
+ if ( ! $order ) {
2523
+ $order = wppa_get_option('wppa_album_order_'.wppa_get_user(), 'id');
2524
+ $reverse = (wppa_get_option('wppa_album_order_'.wppa_get_user().'_reverse') == 'yes');
2525
+ }
2526
+ else {
2527
+ $old_order = wppa_get_option('wppa_album_order_'.wppa_get_user(), 'id');
2528
+ $reverse = (wppa_get_option('wppa_album_order_'.wppa_get_user().'_reverse') == 'yes');
2529
+ if ( $old_order == $order ) {
2530
+ $reverse = ! $reverse;
2531
+ }
2532
+ else $reverse = false;
2533
+ wppa_update_option('wppa_album_order_'.wppa_get_user(), $order);
2534
+ if ( $reverse ) wppa_update_option('wppa_album_order_'.wppa_get_user().'_reverse', 'yes');
2535
+ else wppa_update_option('wppa_album_order_'.wppa_get_user().'_reverse', 'no');
2536
  }
2537
 
 
2538
  if ( ! empty( $albums ) ) {
2539
 
2540
+ // Setup the sequence array
2541
+ $seq = false;
2542
+ $num = false;
2543
+ foreach( $albums as $album ) {
2544
+ switch ( $order ) {
2545
+ case 'name':
2546
+ $seq[] = strtolower(__(stripslashes($album['name'])));
2547
+ break;
2548
+ case 'description':
2549
+ $seq[] = strtolower(__(stripslashes($album['description'])));
2550
+ break;
2551
+ case 'owner':
2552
+ $seq[] = strtolower($album['owner']);
2553
+ break;
2554
+ case 'a_order':
2555
+ $seq[] = $album['a_order'];
2556
+ $num = true;
2557
+ break;
2558
+ case 'a_parent':
2559
+ $seq[] = strtolower(wppa_get_album_name($album['a_parent'], array( 'extended' => true )));
2560
+ break;
2561
+ default:
2562
+ $seq[] = $album['id'];
2563
+ $num = true;
2564
+ break;
2565
+ }
2566
+ }
2567
+
2568
+ // Sort the seq array
2569
+ if ( $num ) asort( $seq, SORT_NUMERIC );
2570
+ else asort( $seq, SORT_REGULAR );
2571
+
2572
+ // Reverse ?
2573
+ if ( $reverse ) {
2574
+ $t = $seq;
2575
+ $c = count($t);
2576
+ $tmp = array_keys($t);
2577
+ $seq = false;
2578
+ for ( $i = $c-1; $i >=0; $i-- ) {
2579
+ $seq[$tmp[$i]] = '0';
2580
+ }
2581
+ }
2582
+
2583
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
2584
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
2585
+ $useimg = $reverse ? $upimg : $downimg;
2586
  $show_nl = wppa_opt( 'user_create_max_level' ) != '99';
2587
+ $url = get_admin_url().'admin.php?page=wppa_admin_menu&amp;order_by=';
 
 
 
2588
 
2589
+ $result = wppa_album_table_pagination( $page, $count ) . '
 
 
2590
  <table
2591
  class="wppa-table widefat wppa-setting-table striped"
2592
+ style="margin-top:12px;"
2593
  >
2594
  <thead>';
2595
  $thead_body = '
2596
  <tr>
2597
  <td
2598
+ style="min-width:75px;"
2599
  title="' . ( $show_nl ? esc_attr( __( 'The album id (the nesting level)', 'wp-photo-album-plus' ) ) :
2600
  esc_attr( __( 'The album id', 'wp-photo-album-plus' ) ) ) . '"
2601
+ >
2602
+ <a href="' . $url . 'id">' .
2603
+ ( $show_nl ? __( 'ID(nl)', 'wp-photo-album-plus' ) : __( 'ID', 'wp-photo-album-plus' ) ) .
2604
+ ( $order == 'id' ? $useimg : '' ) . '
2605
+ </a>
2606
  </td>
2607
  <td
2608
+ style="min-width: 120px;"
2609
+ >
2610
+ <a href="' . $url . 'name">' .
2611
+ __( 'Name', 'wp-photo-album-plus' ) .
2612
+ ( $order == 'name' ? $useimg : '' ) . '
2613
+ </a>
2614
  </td>
2615
+ <td>
2616
+ <a href="' . $url . 'description">' .
2617
+ __( 'Description', 'wp-photo-album-plus' ) .
2618
+ ( $order == 'description' ? $useimg : '' ) . '
2619
+ </a>
 
2620
  </td>';
2621
  if ( current_user_can( 'administrator' ) ) {
2622
  $thead_body .= '
2623
+ <td style="min-width: 100px;">
2624
+ <a href="' . $url . 'owner">' .
2625
+ __( 'Owner', 'wp-photo-album-plus' ) .
2626
+ ( $order == 'owner' ? $useimg : '' ) . '
2627
+ </a>
2628
  </td>';
2629
  }
2630
  $thead_body .= '
2631
  <td
2632
+ style="min-width: 100px;"
2633
+ >
2634
+ <a href="' . $url . 'a_order">' .
2635
+ __( 'Order', 'wp-photo-album-plus' ) .
2636
+ ( $order == 'a_order' ? $useimg : '' ) . '
2637
+ </a>
2638
  </td>
2639
  <td
2640
+ style="width: 120px;"
2641
+ >
2642
+ <a href="' . $url . 'a_parent">' .
2643
+ __( 'Parent', 'wp-photo-album-plus' ) .
2644
+ ( $order == 'a_parent' ? $useimg : '' ) . '
2645
+ </a>
2646
  </td>
2647
  <td
2648
  title="' . esc_attr( __( 'Albums/Photos/Moderation required/Scheduled', 'wp-photo-album-plus' ) ) . '"
2671
  $result = '<tbody>';
2672
  $mayseq = ! wppa_switch( 'porder_restricted' ) || wppa_user_is_admin();
2673
 
2674
+ foreach ( array_keys( $seq ) as $s ) {
2675
+ $album = $albums[$s];
2676
  $id = $album['id'];
2677
  $counts = wppa_get_treecounts_a( $id, true );
2678
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=' . $id;
2688
  $url = wppa_ea_url( $id );
2689
  $delurl = wppa_ea_url( $id, 'del' );
2690
  $creurl = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $id . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
2691
+ $creonc = 'if (confirm(\''.esc_js(__( 'Are you sure you want to create a subalbum?', 'wp-photo-album-plus' )).'\')) document.location=\''.$creurl.'\';';
2692
 
2693
  $result .= '
2694
  <tr ' . $alt . ( $pendcount ? 'style="background-color:#ffdddd"' : '' ) . '>
2733
  <tfoot>' .
2734
  $thead_body . '
2735
  </tfoot>
2736
+ </table>' .
2737
+ wppa_album_table_pagination( $page, $count );
2738
 
 
2739
  wppa_echo( $result );
2740
 
 
 
 
 
2741
  wppa_echo( wppa_album_admin_footer() );
2742
 
2743
  }
2744
  else {
 
2745
  wppa_echo( '<h2>' . __( 'No albums yet.', 'wp-photo-album-plus' ) . '</h2>' );
2746
  }
2747
  }
2750
  function wppa_admin_albums_collapsible() {
2751
  global $wpdb;
2752
 
2753
+ // Init
2754
+ $pagesize = wppa_opt( 'album_admin_pagesize' );
2755
+ $page = wppa_get( 'album-page-no', '1' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2756
  $skips = ( $page - 1 ) * $pagesize;
2757
+ $show_nl = wppa_opt( 'user_create_max_level' ) != '99';
 
 
2758
 
2759
  // Read all albums, pre-ordered
2760
+ $order_by = wppa_get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
2761
+ $order_desc = wppa_get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' );
2762
+
2763
+ switch( $order_by ) {
2764
+ case 'name':
2765
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name";
2766
+ break;
2767
+ case 'description':
2768
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description";
2769
+ break;
2770
+ case 'owner':
2771
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner";
2772
+ break;
2773
+ case 'a_order':
2774
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order";
2775
+ break;
2776
+ case 'a_parent':
2777
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent";
2778
+ break;
2779
+ default:
2780
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id";
2781
+ }
2782
+ if ( $order_desc == 'yes' ) {
2783
+ $query .= " DESC";
2784
+ }
2785
+ $albums = $wpdb->get_results( $query, ARRAY_A );
2786
 
2787
  // Remove non accessible albums
2788
  $temp = $albums;
2792
  $albums[] = $temp[$idx];
2793
  }
2794
  }
2795
+ $count = count( $albums );
2796
 
2797
+ // If pagination: Make new array with selected albums only
2798
+ if ( $pagesize ) {
2799
+ $temp = $albums;
2800
+ $albums = array();
2801
+ $i = 0;
2802
+ foreach( $temp as $item ) {
2803
+ if ( $i >= $skips && $i < ( $skips + $pagesize ) ) {
2804
+ $albums[] = $item;
 
 
2805
  }
2806
+ $i++;
2807
  }
2808
  }
2809
 
 
 
 
 
 
 
 
 
2810
  // Make sure all (grand)parents are in
2811
  $done = false;
2812
  while ( ! $done ) {
2843
  WHERE id in (" . implode( ',', $all_ids ) . ")", ARRAY_A );
2844
  }
2845
 
2846
+ // Find the ordering method
2847
+ $reverse = wppa_get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse', 'no' ) == 'yes';
2848
+
2849
+ $order = wppa_get( 'order_by' );
2850
+ if ( ! $order ) {
2851
+ $order = wppa_get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
2852
+ }
2853
+ else {
2854
+ $old_order = wppa_get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
2855
+ if ( $old_order == $order ) {
2856
+ $reverse = ! $reverse;
2857
+ }
2858
+ else $reverse = false;
2859
+ wppa_update_option( 'wppa_album_order_' . wppa_get_user(), $order );
2860
+ if ( $reverse ) wppa_update_option( 'wppa_album_order_' . wppa_get_user() . '_reverse', 'yes' );
2861
+ else wppa_update_option( 'wppa_album_order_' . wppa_get_user() . '_reverse', 'no' );
2862
+ }
2863
+
2864
  if ( ! empty( $albums ) ) {
2865
 
2866
  // Setup the sequence array
2867
  $seq = false;
2868
  $num = false;
2869
  foreach( $albums as $album ) {
2870
+ switch ( $order ) {
2871
  case 'name':
2872
  $seq[] = strtolower( __( stripslashes( $album['name'] ) ) );
2873
  break;
2896
  else asort( $seq, SORT_REGULAR );
2897
 
2898
  // Reverse ?
2899
+ if ( $reverse ) {
2900
  $t = $seq;
2901
  $c = count($t);
2902
  $tmp = array_keys($t);
2908
 
2909
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
2910
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
2911
+ $useimg = $reverse ? $upimg : $downimg;
2912
+ $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;order_by=';
 
 
2913
 
2914
+ $result = wppa_album_table_pagination( $page, $count ) . '
2915
+ <table class="widefat wppa-table wppa-setting-table" style="margin-top:12px">
 
 
 
 
2916
  <thead>';
2917
  $thead_body = '
2918
  <tr>
2919
+ <td colspan="6" >
2920
+ <img src="' . wppa_get_imgdir() . 'backarrow.gif" style="height:16px;" title="' . __( 'Collapse subalbums', 'wp-photo-album-plus' ) . '" />
2921
  <img src="' . wppa_get_imgdir() . 'arrow.gif" style="height:16px;" title="' . __( 'Expand subalbums', 'wp-photo-album-plus' ) . '" />
2922
  </td>
2923
+ <td
2924
+ style="min-width:75px;"
2925
  title="' . ( $show_nl ? esc_attr( __( 'The album id (the nesting level)', 'wp-photo-album-plus' ) ) :
2926
  esc_attr( __( 'The album id', 'wp-photo-album-plus' ) ) ) . '"
2927
+ >
2928
+ <a href="' . $url . 'id">' .
2929
+ ( $show_nl ? __( 'ID(nl)', 'wp-photo-album-plus' ) : __( 'ID', 'wp-photo-album-plus' ) ) .
2930
+ ( $order == 'id' ? $useimg : '' ) . '
2931
+ </a>
2932
  </td>
2933
  <td
2934
+ style="min-width: 120px;"
2935
+ >
2936
+ <a href="' . $url . 'name">' .
2937
+ __( 'Name', 'wp-photo-album-plus' ) .
2938
+ ( $order == 'name' ? $useimg : '' ) . '
2939
+ </a>
2940
  </td>
2941
+ <td>
2942
+ <a href="' . $url . 'description">' .
2943
+ __( 'Description', 'wp-photo-album-plus' ) .
2944
+ ( $order == 'description' ? $useimg : '' ) . '
2945
+ </a>
 
2946
  </td>';
2947
  if ( current_user_can( 'administrator' ) ) {
2948
  $thead_body .= '
2949
+ <td style="min-width: 100px;">
2950
+ <a href="' . $url . 'owner">' .
2951
+ __( 'Owner', 'wp-photo-album-plus' ) .
2952
+ ( $order == 'owner' ? $useimg : '' ) . '
2953
+ </a>
2954
  </td>';
2955
  }
2956
  $thead_body .= '
2957
  <td
2958
+ style="min-width: 100px;"
2959
+ >
2960
+ <a href="' . $url . 'a_order">' .
2961
+ __( 'Sequence', 'wp-photo-album-plus' ) .
2962
+ ( $order == 'a_order' ? $useimg : '' ) . '
2963
+ </a>
2964
  </td>
2965
  <td
2966
+ style="width: 120px;"
2967
+ >
2968
+ <a href="' . $url . 'a_parent">' .
2969
+ __( 'Parent', 'wp-photo-album-plus' ) .
2970
+ ( $order == 'a_parent' ? $useimg : '' ) . '
2971
+ </a>
2972
  </td>
2973
  <td
2974
  title="' . esc_attr( __( 'Albums/Photos/Moderation required/Scheduled', 'wp-photo-album-plus' ) ) . '"
3002
  if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = '-1'" ) > 0 ) {
3003
  $result = '
3004
  <tr>
3005
+ <td colspan="' . ( '19' + ( current_user_can( 'wppa_upload' ) ? '1' : '0' ) + ( current_user_can( 'wppa_import' ) ? '1' : '0' ) ) . '" >
3006
  <em>' .
3007
  __( 'The following albums are ---separate--- and do not show up in the generic album display', 'wp-photo-album-plus' ) . '
3008
  </em>
3026
  <tfoot>' .
3027
  $thead_body . '
3028
  </tfoot>
3029
+ </table>' .
3030
+ wppa_album_table_pagination( $page, $count );
3031
 
 
3032
  wppa_echo( $result );
3033
 
 
 
 
 
3034
  wppa_echo( wppa_album_admin_footer() );
3035
 
3036
+ $the_js = '
3037
+ function checkArrows() {
3038
+ elms = jQuery(".alb-arrow-off");
3039
+ for(i=0;i<elms.length;i++) {
3040
+ elm = elms[i];
3041
+ if ( elm.parentNode.parentNode.style.display == "none" ) elm.style.display = "none";
3042
+ }
3043
+ elms = jQuery(".alb-arrow-on");
3044
+ for(i=0;i<elms.length;i++) {
3045
+ elm = elms[i];
3046
+ if ( elm.parentNode.parentNode.style.display == "none" ) elm.style.display = "";
3047
+ }
3048
+ }';
3049
+
3050
+ wppa_add_inline_script( 'wppa-admin', $the_js );
3051
  }
3052
  else {
 
3053
  wppa_echo( '<h2>' . __( 'No albums yet.', 'wp-photo-album-plus' ) . '</h2>' );
3054
  }
3055
  }
3056
 
3057
  // The adnin Search field
3058
  function wppa_search_edit( $collapsible = false ) {
 
3059
 
3060
  $doit = false;
3061
  if ( current_user_can( 'wppa_admin' ) && current_user_can( 'wppa_moderate' ) ) $doit = true;
3065
 
3066
  $value = wppa_get( 'searchstring' );
3067
 
3068
+ $result = '
3069
+ <tr>
3070
+ <td colspan="' . ( ( $collapsible ? '20' : '14' ) + ( current_user_can( 'wppa_upload' ) ? '1' : '0' ) + ( current_user_can( 'wppa_import' ) ? '1' : '0' ) ) . '" >
3071
+ <em>' .
3072
+ __( 'Search for photos to edit', 'wp-photo-album-plus' ) . '
3073
+ </em>
3074
+ <small>' .
3075
+ __( 'Enter search words seperated by commas. Photos will meet all search words by their names, descriptions, translated keywords and/or tags.', 'wp-photo-album-plus' ) . '
3076
+ </small>
3077
+ </td>
3078
+ </tr>
 
 
 
 
 
 
3079
  <tr class="alternate" >' .
3080
  ( $collapsible ? '<td></td>' : '' ) . '
3081
  <td id="src-alb" >' .
3135
  <tr>' .
3136
  ( $collapsible ? '<td></td>' : '' ) . '
3137
  <td>' . __( 'Any', 'wp-photo-album-plus' ) . '</td>' .
3138
+ ( $collapsible ? '<td></td><td></td><td></td><td></td><td></td>' : '' ) . '
3139
  <td colspan="4" >' .
3140
  sprintf( __( 'There are %s trashed photos that can be rescued', 'wp-photo-album-plus' ), $trashed ) . '
3141
  </td>
3142
+ <td>
3143
  </td>
3144
+ <td></td>
3145
  <td>
3146
  <a class="wppaedit" onclick="wppaEditTrash( \'' . wppa_ea_url( 'trash' ) . '\' );">
3147
  <span style="font-weight:bold">' . __( 'Edit', 'wp-photo-album-plus' ) . '</span>
3166
  return $result;
3167
  }
3168
 
3169
+ // The album table pagination
3170
+ function wppa_album_table_pagination( $page, $count ) {
3171
+ global $wpdb;
3172
+
3173
+ // Init
3174
+ $result = '';
3175
+ $pagesize = wppa_opt( 'album_admin_pagesize' );
3176
+
3177
+ // Paging on?
3178
+ if ( ! $pagesize ) {
3179
+ return;
3180
+ }
3181
+
3182
+ $npages = ceil( $count / $pagesize );
3183
+
3184
+ // Just one page?
3185
+ if ( $npages == '1' ) {
3186
+ return;
3187
+ }
3188
+
3189
+ $link = get_admin_url().'admin.php?page=wppa_admin_menu&album-page-no=';
3190
+
3191
+ $result .= '<div style="line-height:1.7em">';
3192
+
3193
+ // The links
3194
+ if ( $page != '1' ) {
3195
+ $result .= '<a href="' . $link . ( $page - '1') . '" >' . __( 'Previous page', 'wp-photo-album-plus' ) . '</a> ';
3196
+ }
3197
+
3198
+ $p = '1';
3199
+ while ( $p <= $npages ) {
3200
+ if ( $p == $page ) {
3201
+ $result .= '<span style="padding:0 0,25em">' . $page . '</span> ';
3202
+ }
3203
+ else {
3204
+ $result .= '<a' .
3205
+ ' href="' . $link . $p . '"' .
3206
+ ' style="border:1px solid;padding:0 0.25em;"' .
3207
+ ' >' .
3208
+ $p .
3209
+ '</a> ';
3210
+ }
3211
+ $p++;
3212
+ }
3213
+
3214
+ if ( $page != $npages ) {
3215
+ $result .= '<a href="' . $link . ( $page + '1') . '" >' . __( 'Next page', 'wp-photo-album-plus' ) . '</a>';
3216
+ }
3217
+
3218
+ $result .= '</div>';
3219
+
3220
+ return $result;
3221
+ }
3222
+
3223
  // The albumlist
3224
  function wppa_do_albumlist( $parent, $nestinglevel, $albums, $seq ) {
3225
  global $wpdb;
3296
  style="height:16px;display:none"
3297
  src="' . wppa_get_imgdir() . 'backarrow.gif' . '"
3298
  onclick="' . $onclickoff . '"
3299
+ title="' . esc_attr( __( 'Collapse subalbums', 'wp-photo-album-plus' ) ) . '"
3300
  />
3301
  <img
3302
  id="alb-arrow-on-' . $id . '"
3304
  style="height:16px;"
3305
  src="' . wppa_get_imgdir() . 'arrow.gif' . '"
3306
  onclick="' . $onclickon . '"
3307
+ title="' . esc_attr( __( 'Expand subalbums', 'wp-photo-album-plus' ) ) . '"
3308
  />';
3309
 
3310
+ // Open subalbums by clicking the open button if it was before (cookie), and if it is visible (!)
3311
  if ( wppa_get_cookie( 'alb-arrow-' . $id ) == 'on' ) {
3312
  $the_js = '
3313
  jQuery(document).ready(function(){
3343
  $nm = $counts['pendselfphotos'];
3344
  $ns = $counts['scheduledselfphotos'];
3345
 
3346
+ // The album name
3347
  $result .= '
3348
  <td>' . esc_html( stripslashes( $album['name'] ) ) . '</td>
3349
+ <td><small>' . esc_html( stripslashes( $album['description'] ) ) . '</small></td>' .
3350
+ ( current_user_can( 'administrator' ) ? '<td>' . __( $album['owner'], 'wp-photo-album-plus' ) . '</td>' : '' ) . '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3351
  <td>' . $album['a_order'] . '</td>
3352
  <td>' . esc_html( stripslashes( wppa_get_album_name( $album['a_parent'], ['extended' => true] ) ) ) . '</td>
3353
  <td>' . $na . '/' . $np . '/' . $nm . '/' . $ns . '</td>';
3391
  }
3392
  if ( wppa_can_create_album() ) {
3393
  $url = get_admin_url() . 'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit-id=new&amp;parent_id=' . $id . '&amp;wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
3394
+ $onc = 'if (confirm(\''.__( 'Are you sure you want to create a subalbum?', 'wp-photo-album-plus' ).'\')) document.location=\''.$url.'\';';
3395
  $result .= '<td><a onclick="' . $onc . '" class="wppacreate">' . __( 'Create', 'wp-photo-album-plus' ) . '</a></td>';
3396
  }
3397
  }
3413
  }
3414
  }
3415
 
3416
+ // Find accessable subalbums
3417
  function wppa_have_accessible_children( $alb ) {
3418
  global $wpdb;
3419
 
3477
  wppa_clear_cache( array( 'album' => $id ) );
3478
  wppa_childlist_remove( $id );
3479
 
3480
+ $msg = __( 'Album Deleted.' , 'wp-photo-album-plus' );
3481
  if ( wppa( 'ajax' ) ) {
3482
  wppa_echo( $msg );
3483
  }
3502
  $opts = array( __( '--- random ---', 'wp-photo-album-plus' ),
3503
  __( '--- random featured ---', 'wp-photo-album-plus' ),
3504
  __( '--- most recent added ---', 'wp-photo-album-plus' ),
3505
+ __( '--- random from (sub-)subalbums ---', 'wp-photo-album-plus' ),
3506
+ __( '--- most recent from (sub-)subalbums ---', 'wp-photo-album-plus' ),
3507
  __( '--- according to albums photo sequence ---', 'wp-photo-album-plus' ),
3508
  );
3509
  $vals = array( '-9', '-1', '-2', '-3', '-4', '-5' );
3629
  }
3630
  }
3631
 
3632
+ // Subalbum order
3633
  if ( $parent ) {
3634
 
3635
  $sel = ' selected';
3659
  <div style="margin-left:6px">
3660
  <label
3661
  for="subalbumorder">' .
3662
+ __( 'Subalbum sequence method', 'wp-photo-album-plus' ) . '
3663
  </label><br>
3664
  <select
3665
  id="subalbumorder"
3695
  else {
3696
  $result = '
3697
  <br>' .
3698
+ esc_html__( 'You can edit subalbum sequence number here when you set the album sequence to "Sequence #" or "Sequence # descending" in the "Subalbum sequence method" selection box above.' );
3699
  }
3700
  $result .= '<br>';
3701
 
4043
 
4044
  $result = '
4045
  <div class="wrap" >
4046
+ <img src="' . WPPA_URL . '/img/magnifier-large.png' . '" />
4047
+ <h1 style="display:inline">' . __( 'Search photos', 'wp-photo-album-plus' ) . '</h1>
 
4048
  <div style="clear:both">&nbsp;</div>
4049
+
 
 
 
 
4050
  <table class="wppa-table widefat wppa-setting-table" style="margin-top:12px">
4051
  <thead>
4052
  </thead>
wppa-album-covers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -891,10 +891,8 @@ global $wpdb;
891
  return;
892
  }
893
 
894
- $id = $image['id'];
895
-
896
- if ( wppa_has_audio( $id ) ) {
897
- $src = wppa_fix_poster_ext( $src, $id );
898
  }
899
 
900
  if ( $is_grid ) {
@@ -913,8 +911,8 @@ global $wpdb;
913
  }
914
 
915
  // Find the posterurl if mm and exists
916
- $thumburl = wppa_get_thumb_url( $id );
917
- if ( wppa_is_file( wppa_get_thumb_path( $id ) ) && wppa_is_multi( $id ) ) {
918
  $posterurl = $thumburl;
919
  }
920
  else {
@@ -979,186 +977,173 @@ global $wpdb;
979
  $photoframestyle .
980
  ' >' );
981
 
982
- // The indiv thumbnail wrapper
983
- wppa_out( '<div style="display:inline-block;margin:0 4px;">' );
984
-
985
- // The medal if at the top
986
- wppa_out( wppa_get_medal_html_a( array( 'id' => $id, 'size' => wppa_opt( 'icon_size_multimedia' ), 'where' => 'top', 'thumb' => true ) ) );
987
-
988
-
989
- // The link from the coverphoto
990
- if ( $photolink ) {
991
 
992
- // If lightbox, we need all the album photos to set up a lightbox set
993
- if ( $photolink['is_lightbox'] ) {
994
- $thumbs = $wpdb->get_results( $wpdb->prepare(
995
- "SELECT * FROM $wpdb->wppa_photos WHERE album = %s " .
996
- wppa_get_photo_order( $albumid ), $albumid
997
- ), ARRAY_A );
998
 
999
- wppa_cache_photo( 'add', $thumbs ); // Save rsult in 2nd level cache
1000
 
1001
- if ( $thumbs ) foreach ( $thumbs as $thumb ) {
1002
- $id = $thumb['id'];
1003
- $title = wppa_get_lbtitle( 'cover', $id );
1004
- if ( wppa_is_video( $id ) ) {
1005
- $siz['0'] = wppa_get_videox( $id );
1006
- $siz['1'] = wppa_get_videoy( $id );
1007
- }
1008
- else {
1009
- $siz['0'] = wppa_get_photox( $id );
1010
- $siz['1'] = wppa_get_photoy( $id );
1011
- }
1012
- $link = wppa_get_photo_url( $id, true, '', $siz['0'], $siz['1'] );
1013
- $is_video = wppa_is_video( $id );
1014
- $has_audio = wppa_has_audio( $id );
1015
- $is_pdf = wppa_is_pdf( $id );
1016
-
1017
- // Open the anchor tag for lightbox
1018
- wppa_out( "\n\t" .
1019
- '<a' .
1020
- ' data-id="' . wppa_encrypt_photo( $id ) . '"' .
1021
- ' href="' . $link . '"' .
1022
- ' style="border:0;color:transparent;"' .
1023
- ( $is_video ? ' data-videohtml="' . esc_attr( wppa_get_video_body( $id ) ) . '"' .
1024
- ' data-videonatwidth="'.wppa_get_videox( $id ).'"' .
1025
- ' data-videonatheight="'.wppa_get_videoy( $id ).'"' : '' ) .
1026
- ( $has_audio ? ' data-audiohtml="' . esc_attr( wppa_get_audio_body( $id ) ) . '"' : '' ) .
1027
- ( $is_pdf ? ' data-pdfhtml="' . esc_attr( wppa_get_pdf_html( $id ) ) .'"' : '' ) .
1028
- ' data-rel="wppa[alw-' . wppa( 'mocc' ) . '-' . $albumid . ']"' .
1029
- ' ' . 'data-lbtitle' . '="' . $title . '"' .
1030
- wppa_get_lb_panorama_full_html( $id ) .
1031
- ' data-alt="' . esc_attr( wppa_get_imgalt( $id, true ) ) . '"' .
1032
- ' style="cursor:' . wppa_wait() . ';"' .
1033
- ' onclick="return false;"' .
1034
- ' >' );
1035
-
1036
- // the cover image
1037
- if ( $id == $id ) {
1038
- if ( wppa_is_video( $id ) ) {
1039
- wppa_out(
1040
- '<video preload="metadata" class="image wppa-img" id="i-' . $id . '-' .
1041
- wppa( 'mocc' ) . '" title="' . wppa_zoom_in( $id ) .
1042
- '" style="' . $imgattr . '" ' .
1043
- $events . ' >' .
1044
- wppa_get_video_body( $id ) . '</video>'
1045
- );
1046
- }
1047
- else {
1048
- wppa_out(
1049
- '<img class="image wppa-img" id="i-' . $id . '-' .
1050
- wppa( 'mocc' ) . '" title="' . wppa_zoom_in( $id ) .
1051
- '" src="' . $src . '" style="' . $imgattr . '" ' .
1052
- $events . ' ' . wppa_get_imgalt( $id ) . ' />'
1053
- );
1054
- }
1055
- }
1056
-
1057
- // Close the lightbox anchor tag
1058
- wppa_out( "\n\t" . '</a>' );
1059
- }
1060
  }
1061
-
1062
- // Link is NOT lightbox
1063
  else {
1064
- $href = $photolink['url'] == '#' ? '' : 'href="' . wppa_convert_to_pretty( $photolink['url'] ) . '" ';
1065
- wppa_out( '<a' .
1066
- ' style="border:0;color:transparent;"' .
1067
- ' ' . $href .
1068
- ' target="' . $photolink['target'] . '"' .
1069
- ' title="' . $photolink['title'] . '"' .
1070
- ' onclick="' . $photolink['onclick'] . '"' .
1071
- ' >'
1072
- );
1073
-
1074
- // A video?
1075
- if ( wppa_is_video( $id ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1076
  wppa_out(
1077
- '<video' .
1078
- ' preload="metadata"' .
1079
- ' title="' . $title . '"' .
1080
- ' class="image wppa-img"' .
1081
- ' style="' . $imgattr . '"' .
1082
- ' ' . $events .
1083
- ' ' . ( $posterurl ? 'poster="' . esc_url( $posterurl ) . '"' : '' ) .
1084
- ' >' .
1085
- wppa_get_video_body( $id ) .
1086
- '</video>'
1087
  );
1088
  }
1089
-
1090
- // A photo
1091
  else {
1092
  wppa_out(
1093
- '<img' .
1094
- ' src="' . $src . '"' .
1095
- ' ' . wppa_get_imgalt( $id ) .
1096
- ' class="image wppa-img"' .
1097
- ' style="' . $imgattr . '"' .
1098
- ' ' . $events .
1099
- ' />'
1100
  );
1101
  }
1102
- wppa_out( '</a>' );
1103
  }
1104
- }
1105
 
1106
- // No link on coverphoto
1107
- else {
 
 
1108
 
1109
- // A video?
1110
- if ( wppa_is_video( $id ) ) {
1111
- wppa_out(
1112
- '<video' .
1113
- ' preload="metadata"' .
1114
- ' class="image wppa-img"' .
1115
- ' style="' . $imgattr . '"' .
1116
- ' ' . $events .
1117
- ' ' . ( $posterurl ? 'poster="' . esc_url( $posterurl ) . '"' : '' ) .
1118
- ' >' .
1119
- wppa_get_video_body( $id ) .
1120
- '</video>'
1121
  );
1122
- }
1123
 
1124
- // A photo
1125
- else {
1126
- wppa_out(
1127
- '<img' .
1128
- ' src="' . $src . '"' .
1129
- ' ' . wppa_get_imgalt( $id ) .
1130
- ' class="image wppa-img"' .
1131
- ' style="' . $imgattr . '"' .
1132
- ' ' . $events .
1133
- ' />'
1134
- );
1135
- }
 
 
1136
  }
1137
 
1138
- // The medals if near the bottom
1139
- wppa_out( wppa_get_medal_html_a( array( 'id' => $id, 'size' => wppa_opt( 'icon_size_multimedia' ), 'where' => 'bot', 'thumb' => true ) ) );
1140
-
1141
- // Close the indiv wrapper
1142
- wppa_out( '</div>' );
1143
-
1144
- // Viewcount on coverphoto?
1145
- if ( wppa_opt( 'viewcount_on_cover' ) != '-none-' ) {
1146
- $treecounts = wppa_get_treecounts_a( $albumid, true );
1147
- if ( wppa_opt( 'viewcount_on_cover' ) == 'self' || $treecounts['selfphotoviews'] == $treecounts['treephotoviews'] ) {
1148
- $count = $treecounts['selfphotoviews'];
1149
- $title = __( 'Number of photo views in this album', 'wp-photo-album-plus' );
1150
- }
1151
  else {
1152
- $count = $treecounts['treephotoviews'];
1153
- $title = __( 'Number of photo views in this album and its sub albums', 'wp-photo-album-plus' );
 
 
 
 
 
 
 
1154
  }
1155
- wppa_out( '<div
1156
- class="wppa-album-cover-viewcount"
1157
- title="' . esc_attr( $title ) . '"
1158
- style="cursor:pointer">' .
1159
- __( 'Views:', 'wp-photo-album-plus' ) . ' ' . $count .
1160
- '</div>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1161
  }
 
 
 
 
 
 
 
1162
 
1163
  // Close the coverphoto frame
1164
  wppa_out( '</div>' );
@@ -1188,10 +1173,9 @@ global $wpdb;
1188
 
1189
  $image = $images[$idx];
1190
  $src = $srcs[$idx];
1191
- $id = $image['id'];
1192
 
1193
- if ( wppa_has_audio( $id ) ) {
1194
- $src = wppa_fix_poster_ext( $src, $id );
1195
  }
1196
 
1197
  $imgattr = $imgattrs_a[$idx]['style'];
@@ -1212,161 +1196,145 @@ global $wpdb;
1212
  $imgattr = 'width:' . $width . '%;height:auto;box-sizing:content-box;';
1213
  }
1214
 
1215
- // The indiv thumbnail wrapper
1216
- wppa_out( '<div style="display:inline-block;margin:0 4px;">' );
1217
-
1218
- // The medal if at the top
1219
- wppa_out( wppa_get_medal_html_a( array( 'id' => $id, 'size' => wppa_opt( 'icon_size_multimedia' ), 'where' => 'top', 'thumb' => true ) ) );
1220
-
1221
-
1222
- if ( $photolink ) {
1223
- if ( $photolink['is_lightbox'] ) {
1224
- $thumb = $image;
1225
- $title = wppa_get_lbtitle( 'cover', $thumb['id'] );
1226
- if ( wppa_is_video( $thumb['id'] ) ) {
1227
- $siz['0'] = wppa_get_videox( $thumb['id'] );
1228
- $siz['1'] = wppa_get_videoy( $thumb['id'] );
1229
- }
1230
- else {
1231
- $siz['0'] = wppa_get_photox( $thumb['id'] );
1232
- $siz['1'] = wppa_get_photoy( $thumb['id'] );
1233
- }
1234
-
1235
- $link = wppa_get_photo_url( $thumb['id'], true, '', $siz['0'], $siz['1'] );
1236
- $is_video = wppa_is_video( $thumb['id'] );
1237
- $has_audio = wppa_has_audio( $thumb['id'] );
1238
- $is_pdf = wppa_is_pdf( $thumb['id'] );
1239
-
1240
- wppa_out(
1241
- '<a' .
1242
- ' data-id="' . wppa_encrypt_photo( $thumb['id'] ) . '"' .
1243
- ' href="' . $link . '"' .
1244
- ' style="border:0;color:transparent;cursor:wait;"' .
1245
- ( $is_video ? ' data-videohtml="' . esc_attr( wppa_get_video_body( $thumb['id'] ) ) . '"' .
1246
- ' data-videonatwidth="' . wppa_get_videox( $thumb['id'] ) . '"' .
1247
- ' data-videonatheight="' . wppa_get_videoy( $thumb['id'] ) . '"' : '' ) .
1248
- ( $has_audio ? ' data-audiohtml="' . esc_attr( wppa_get_audio_body( $thumb['id'] ) ) . '"' : '' ) .
1249
- ( $is_pdf ? ' data-pdfhtml="' . esc_attr( wppa_get_pdf_html( $thumb['id'] ) ) .'"' : '' ) .
1250
- ' data-rel="wppa[alw-' . wppa( 'mocc' ) . '-' . $albumid . ']"' .
1251
- ( $title ? ' ' . 'data-lbtitle' . '="' . $title . '"' : '' ) .
1252
- wppa_get_lb_panorama_full_html( $thumb['id'] ) .
1253
- ' data-alt="' . esc_attr( wppa_get_imgalt( $thumb['id'], true ) ) . '"' .
1254
- ' >'
1255
- );
1256
-
1257
- // the cover image
1258
- if ( $thumb['id'] == $id ) {
1259
- if ( wppa_is_video( $id ) ) {
1260
- wppa_out( "\n\t\t" .
1261
- '<video' .
1262
- ' preload="metadata"' .
1263
- ' class="image wppa-img"' .
1264
- ' id="i-' . $id . '-' . wppa( 'mocc' ) . '"' .
1265
- ' title="' . wppa_zoom_in( $id ) . '"' .
1266
- ' style="' . $imgattr . '"' .
1267
- ' ' . $events .
1268
- ' >' .
1269
- wppa_get_video_body( $id ) .
1270
- '</video>'
1271
- );
1272
- }
1273
- else {
1274
- wppa_out( "\n\t\t" .
1275
- '<img' .
1276
- ' class="image wppa-img"' .
1277
- ' id="i-' . $id . '-' . wppa( 'mocc' ) . '"' .
1278
- ' title="' . wppa_zoom_in( $id ) . '"' .
1279
- ' src="' . $src . '"' .
1280
- ' style="' . $imgattr . '"' .
1281
- ' ' . $events .
1282
- ' ' . wppa_get_imgalt( $id ) .
1283
- ' />'
1284
- );
1285
- }
1286
- }
1287
- wppa_out( '</a> ' );
1288
  }
1289
 
1290
- else { // Link is NOT lightbox
1291
- $href = $photolink['url'] == '#' ? '' : 'href="' . $photolink['url'] . '" ';
 
 
1292
 
1293
- wppa_out(
1294
- '<a ' .
1295
- $href .
1296
- ' style="border:0;color:transparent;"' .
1297
- ' target="' . $photolink['target'] . '"' .
1298
- ' title="' . $photolink['title'] . '"' .
1299
- ' onclick="' . $photolink['onclick'] . '"' .
1300
- ' >' );
1301
-
1302
- if ( wppa_is_video( $id ) ) {
 
 
 
 
 
 
1303
 
1304
- wppa_out(
 
 
 
1305
  '<video' .
1306
- ' preload="metadata" ' .
1307
  ' class="image wppa-img"' .
 
 
1308
  ' style="' . $imgattr . '"' .
1309
  ' ' . $events .
1310
  ' >' .
1311
- wppa_get_video_body( $id ) .
1312
  '</video>'
1313
  );
1314
  }
1315
  else {
1316
-
1317
- wppa_out(
1318
  '<img' .
1319
- ' src="' . $src . '"' .
1320
- ' ' . wppa_get_imgalt( $id ) .
1321
  ' class="image wppa-img"' .
 
 
 
1322
  ' style="' . $imgattr . '"' .
1323
  ' ' . $events .
 
1324
  ' />'
1325
  );
1326
  }
1327
- wppa_out( '</a> ' );
1328
  }
 
1329
  }
1330
 
1331
- // No link on coverphoto
1332
- else {
1333
 
1334
- // A video?
1335
- if ( wppa_is_video( $id ) ) {
1336
- wppa_out( '<video' .
1337
- ' preload="metadata"' .
1338
- ' class="image wppa-img"' .
1339
- ' style="' . $imgattr . '"' .
1340
- ' ' . $events .
1341
- ' >' .
1342
- wppa_get_video_body( $id ) .
1343
- '</video>'
 
 
 
 
 
 
 
 
 
 
1344
  );
1345
  }
1346
-
1347
- // A photo
1348
  else {
1349
- wppa_out( '<img' .
1350
- ' src="' . $src . '"' .
1351
- ' ' . wppa_get_imgalt( $id ) .
1352
- ' class="image wppa-img"' .
1353
- ' style="' . $imgattr . '"' .
1354
- ' ' . $events .
1355
- ' />'
 
 
1356
  );
1357
  }
 
1358
  }
 
1359
 
1360
- // The medals if near the bottom
1361
- wppa_out( wppa_get_medal_html_a( array( 'id' => $id, 'size' => wppa_opt( 'icon_size_multimedia' ), 'where' => 'bot', 'thumb' => true ) ) );
1362
 
1363
- // Close the indiv wrapper
1364
- wppa_out( '</div>' );
 
 
 
 
 
 
 
 
 
 
1365
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
  }
1367
 
1368
-
1369
-
1370
  // Close the coverphoto frame
1371
  wppa_out( '</div>' );
1372
  }
@@ -2032,7 +2000,7 @@ global $wpdb;
2032
 
2033
  /**/
2034
 
2035
- // Only if there are sub albums
2036
  if ( ! empty( $subs ) ) {
2037
 
2038
  wppa_out( '<div class="wppa-cover-sublist-container" >' );
@@ -2055,13 +2023,13 @@ global $wpdb;
2055
  wppa_out( '<div style="clear:both"></div>' );
2056
  }
2057
 
2058
- // Process the sub albums
2059
  foreach( $subs as $album ) {
2060
 
2061
  // The album id
2062
  $albumid = $album['id'];
2063
 
2064
- // This sub album visible for this user?
2065
  if ( wppa_is_album_visible( $albumid ) ) {
2066
 
2067
  // What is in there visible?
@@ -2080,7 +2048,7 @@ global $wpdb;
2080
  $albumid = $album['id'];
2081
  $photocount = $pc;
2082
 
2083
- // Thumbnails and covers, show sub album covers
2084
  // in case slideshow is requested on an empty album
2085
  if ( wppa_opt( 'cover_sublinks' ) == 'content' || ! $photocount ) {
2086
  $href_content = wppa_get_album_url( array( 'album' => $albumid,
@@ -2105,7 +2073,7 @@ global $wpdb;
2105
  $title = esc_attr( __( 'View the album', 'wp-photo-album-plus' ) . ': ' . wppa_get_album_name( $albumid ) );
2106
  }
2107
 
2108
- // Sub album title link
2109
  elseif ( wppa_opt( 'cover_sublinks' ) == 'title' ) {
2110
  $sub_attr = wppa_get_album_title_attr_a( $albumid,
2111
  $album['cover_linktype'],
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
+ * Version 8.2.05.001
7
  *
8
  */
9
 
891
  return;
892
  }
893
 
894
+ if ( wppa_has_audio( $image['id'] ) ) {
895
+ $src = wppa_fix_poster_ext( $src, $image['id'] );
 
 
896
  }
897
 
898
  if ( $is_grid ) {
911
  }
912
 
913
  // Find the posterurl if mm and exists
914
+ $thumburl = wppa_get_thumb_url( $image['id'] );
915
+ if ( wppa_is_file( wppa_get_thumb_path( $image['id'] ) ) && wppa_is_multi( $image['id'] ) ) {
916
  $posterurl = $thumburl;
917
  }
918
  else {
977
  $photoframestyle .
978
  ' >' );
979
 
980
+ // The link from the coverphoto
981
+ if ( $photolink ) {
 
 
 
 
 
 
 
982
 
983
+ // If lightbox, we need all the album photos to set up a lightbox set
984
+ if ( $photolink['is_lightbox'] ) {
985
+ $thumbs = $wpdb->get_results( $wpdb->prepare(
986
+ "SELECT * FROM $wpdb->wppa_photos WHERE album = %s " .
987
+ wppa_get_photo_order( $albumid ), $albumid
988
+ ), ARRAY_A );
989
 
990
+ wppa_cache_photo( 'add', $thumbs ); // Save rsult in 2nd level cache
991
 
992
+ if ( $thumbs ) foreach ( $thumbs as $thumb ) {
993
+ $id = $thumb['id'];
994
+ $title = wppa_get_lbtitle( 'cover', $id );
995
+ if ( wppa_is_video( $id ) ) {
996
+ $siz['0'] = wppa_get_videox( $id );
997
+ $siz['1'] = wppa_get_videoy( $id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
998
  }
 
 
999
  else {
1000
+ $siz['0'] = wppa_get_photox( $id );
1001
+ $siz['1'] = wppa_get_photoy( $id );
1002
+ }
1003
+ $link = wppa_get_photo_url( $id, true, '', $siz['0'], $siz['1'] );
1004
+ $is_video = wppa_is_video( $id );
1005
+ $has_audio = wppa_has_audio( $id );
1006
+ $is_pdf = wppa_is_pdf( $id );
1007
+
1008
+ // Open the anchor tag for lightbox
1009
+ wppa_out( "\n\t" .
1010
+ '<a' .
1011
+ ' data-id="' . wppa_encrypt_photo( $id ) . '"' .
1012
+ ' href="' . $link . '"' .
1013
+ ' style="border:0;color:transparent;"' .
1014
+ ( $is_video ? ' data-videohtml="' . esc_attr( wppa_get_video_body( $id ) ) . '"' .
1015
+ ' data-videonatwidth="'.wppa_get_videox( $id ).'"' .
1016
+ ' data-videonatheight="'.wppa_get_videoy( $id ).'"' : '' ) .
1017
+ ( $has_audio ? ' data-audiohtml="' . esc_attr( wppa_get_audio_body( $id ) ) . '"' : '' ) .
1018
+ ( $is_pdf ? ' data-pdfhtml="' . esc_attr( wppa_get_pdf_html( $id ) ) .'"' : '' ) .
1019
+ ' data-rel="wppa[alw-' . wppa( 'mocc' ) . '-' . $albumid . ']"' .
1020
+ ' ' . 'data-lbtitle' . '="' . $title . '"' .
1021
+ wppa_get_lb_panorama_full_html( $id ) .
1022
+ ' data-alt="' . esc_attr( wppa_get_imgalt( $id, true ) ) . '"' .
1023
+ ' style="cursor:' . wppa_wait() . ';"' .
1024
+ ' onclick="return false;"' .
1025
+ ' >' );
1026
+
1027
+ // the cover image
1028
+ if ( $id == $image['id'] ) {
1029
+ if ( wppa_is_video( $image['id'] ) ) {
1030
  wppa_out(
1031
+ '<video preload="metadata" class="image wppa-img" id="i-' . $image['id'] . '-' .
1032
+ wppa( 'mocc' ) . '" title="' . wppa_zoom_in( $image['id'] ) .
1033
+ '" style="' . $imgattr . '" ' .
1034
+ $events . ' >' .
1035
+ wppa_get_video_body( $image['id'] ) . '</video>'
 
 
 
 
 
1036
  );
1037
  }
 
 
1038
  else {
1039
  wppa_out(
1040
+ '<img class="image wppa-img" id="i-' . $image['id'] . '-' .
1041
+ wppa( 'mocc' ) . '" title="' . wppa_zoom_in( $image['id'] ) .
1042
+ '" src="' . $src . '" style="' . $imgattr . '" ' .
1043
+ $events . ' ' . wppa_get_imgalt( $image['id'] ) . ' />'
 
 
 
1044
  );
1045
  }
 
1046
  }
 
1047
 
1048
+ // Close the lightbox anchor tag
1049
+ wppa_out( "\n\t" . '</a>' );
1050
+ }
1051
+ }
1052
 
1053
+ // Link is NOT lightbox
1054
+ else {
1055
+ $href = $photolink['url'] == '#' ? '' : 'href="' . wppa_convert_to_pretty( $photolink['url'] ) . '" ';
1056
+ wppa_out( '<a' .
1057
+ ' style="border:0;color:transparent;"' .
1058
+ ' ' . $href .
1059
+ ' target="' . $photolink['target'] . '"' .
1060
+ ' title="' . $photolink['title'] . '"' .
1061
+ ' onclick="' . $photolink['onclick'] . '"' .
1062
+ ' >'
 
 
1063
  );
 
1064
 
1065
+ // A video?
1066
+ if ( wppa_is_video( $image['id'] ) ) {
1067
+ wppa_out(
1068
+ '<video' .
1069
+ ' preload="metadata"' .
1070
+ ' title="' . $title . '"' .
1071
+ ' class="image wppa-img"' .
1072
+ ' style="' . $imgattr . '"' .
1073
+ ' ' . $events .
1074
+ ' ' . ( $posterurl ? 'poster="' . esc_url( $posterurl ) . '"' : '' ) .
1075
+ ' >' .
1076
+ wppa_get_video_body( $image['id'] ) .
1077
+ '</video>'
1078
+ );
1079
  }
1080
 
1081
+ // A photo
 
 
 
 
 
 
 
 
 
 
 
 
1082
  else {
1083
+ wppa_out(
1084
+ '<img' .
1085
+ ' src="' . $src . '"' .
1086
+ ' ' . wppa_get_imgalt( $image['id'] ) .
1087
+ ' class="image wppa-img"' .
1088
+ ' style="' . $imgattr . '"' .
1089
+ ' ' . $events .
1090
+ ' />'
1091
+ );
1092
  }
1093
+ wppa_out( '</a>' );
1094
+ }
1095
+ }
1096
+
1097
+ // No link on coverphoto
1098
+ else {
1099
+
1100
+ // A video?
1101
+ if ( wppa_is_video( $image['id'] ) ) {
1102
+ wppa_out(
1103
+ '<video' .
1104
+ ' preload="metadata"' .
1105
+ ' class="image wppa-img"' .
1106
+ ' style="' . $imgattr . '"' .
1107
+ ' ' . $events .
1108
+ ' ' . ( $posterurl ? 'poster="' . esc_url( $posterurl ) . '"' : '' ) .
1109
+ ' >' .
1110
+ wppa_get_video_body( $image['id'] ) .
1111
+ '</video>'
1112
+ );
1113
+ }
1114
+
1115
+ // A photo
1116
+ else {
1117
+ wppa_out(
1118
+ '<img' .
1119
+ ' src="' . $src . '"' .
1120
+ ' ' . wppa_get_imgalt( $image['id'] ) .
1121
+ ' class="image wppa-img"' .
1122
+ ' style="' . $imgattr . '"' .
1123
+ ' ' . $events .
1124
+ ' />'
1125
+ );
1126
+ }
1127
+ }
1128
+
1129
+ // Viewcount on coverphoto?
1130
+ if ( wppa_opt( 'viewcount_on_cover' ) != '-none-' ) {
1131
+ $treecounts = wppa_get_treecounts_a( $albumid, true );
1132
+ if ( wppa_opt( 'viewcount_on_cover' ) == 'self' || $treecounts['selfphotoviews'] == $treecounts['treephotoviews'] ) {
1133
+ $count = $treecounts['selfphotoviews'];
1134
+ $title = __( 'Number of photo views in this album', 'wp-photo-album-plus' );
1135
+ }
1136
+ else {
1137
+ $count = $treecounts['treephotoviews'];
1138
+ $title = __( 'Number of photo views in this album and its subalbums', 'wp-photo-album-plus' );
1139
  }
1140
+ wppa_out( '<div
1141
+ class="wppa-album-cover-viewcount"
1142
+ title="' . esc_attr( $title ) . '"
1143
+ style="cursor:pointer">' .
1144
+ __( 'Views:', 'wp-photo-album-plus' ) . ' ' . $count .
1145
+ '</div>' );
1146
+ }
1147
 
1148
  // Close the coverphoto frame
1149
  wppa_out( '</div>' );
1173
 
1174
  $image = $images[$idx];
1175
  $src = $srcs[$idx];
 
1176
 
1177
+ if ( wppa_has_audio( $image['id'] ) ) {
1178
+ $src = wppa_fix_poster_ext( $src, $image['id'] );
1179
  }
1180
 
1181
  $imgattr = $imgattrs_a[$idx]['style'];
1196
  $imgattr = 'width:' . $width . '%;height:auto;box-sizing:content-box;';
1197
  }
1198
 
1199
+ if ( $photolink ) {
1200
+ if ( $photolink['is_lightbox'] ) {
1201
+ $thumb = $image;
1202
+ $title = wppa_get_lbtitle( 'cover', $thumb['id'] );
1203
+ if ( wppa_is_video( $thumb['id'] ) ) {
1204
+ $siz['0'] = wppa_get_videox( $thumb['id'] );
1205
+ $siz['1'] = wppa_get_videoy( $thumb['id'] );
1206
+ }
1207
+ else {
1208
+ $siz['0'] = wppa_get_photox( $thumb['id'] );
1209
+ $siz['1'] = wppa_get_photoy( $thumb['id'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
  }
1211
 
1212
+ $link = wppa_get_photo_url( $thumb['id'], true, '', $siz['0'], $siz['1'] );
1213
+ $is_video = wppa_is_video( $thumb['id'] );
1214
+ $has_audio = wppa_has_audio( $thumb['id'] );
1215
+ $is_pdf = wppa_is_pdf( $thumb['id'] );
1216
 
1217
+ wppa_out(
1218
+ '<a' .
1219
+ ' data-id="' . wppa_encrypt_photo( $thumb['id'] ) . '"' .
1220
+ ' href="' . $link . '"' .
1221
+ ' style="border:0;color:transparent;cursor:wait;"' .
1222
+ ( $is_video ? ' data-videohtml="' . esc_attr( wppa_get_video_body( $thumb['id'] ) ) . '"' .
1223
+ ' data-videonatwidth="' . wppa_get_videox( $thumb['id'] ) . '"' .
1224
+ ' data-videonatheight="' . wppa_get_videoy( $thumb['id'] ) . '"' : '' ) .
1225
+ ( $has_audio ? ' data-audiohtml="' . esc_attr( wppa_get_audio_body( $thumb['id'] ) ) . '"' : '' ) .
1226
+ ( $is_pdf ? ' data-pdfhtml="' . esc_attr( wppa_get_pdf_html( $thumb['id'] ) ) .'"' : '' ) .
1227
+ ' data-rel="wppa[alw-' . wppa( 'mocc' ) . '-' . $albumid . ']"' .
1228
+ ( $title ? ' ' . 'data-lbtitle' . '="' . $title . '"' : '' ) .
1229
+ wppa_get_lb_panorama_full_html( $thumb['id'] ) .
1230
+ ' data-alt="' . esc_attr( wppa_get_imgalt( $thumb['id'], true ) ) . '"' .
1231
+ ' >'
1232
+ );
1233
 
1234
+ // the cover image
1235
+ if ( $thumb['id'] == $image['id'] ) {
1236
+ if ( wppa_is_video( $image['id'] ) ) {
1237
+ wppa_out( "\n\t\t" .
1238
  '<video' .
1239
+ ' preload="metadata"' .
1240
  ' class="image wppa-img"' .
1241
+ ' id="i-' . $image['id'] . '-' . wppa( 'mocc' ) . '"' .
1242
+ ' title="' . wppa_zoom_in( $image['id'] ) . '"' .
1243
  ' style="' . $imgattr . '"' .
1244
  ' ' . $events .
1245
  ' >' .
1246
+ wppa_get_video_body( $image['id'] ) .
1247
  '</video>'
1248
  );
1249
  }
1250
  else {
1251
+ wppa_out( "\n\t\t" .
 
1252
  '<img' .
 
 
1253
  ' class="image wppa-img"' .
1254
+ ' id="i-' . $image['id'] . '-' . wppa( 'mocc' ) . '"' .
1255
+ ' title="' . wppa_zoom_in( $image['id'] ) . '"' .
1256
+ ' src="' . $src . '"' .
1257
  ' style="' . $imgattr . '"' .
1258
  ' ' . $events .
1259
+ ' ' . wppa_get_imgalt( $image['id'] ) .
1260
  ' />'
1261
  );
1262
  }
 
1263
  }
1264
+ wppa_out( '</a> ' );
1265
  }
1266
 
1267
+ else { // Link is NOT lightbox
1268
+ $href = $photolink['url'] == '#' ? '' : 'href="' . $photolink['url'] . '" ';
1269
 
1270
+ wppa_out(
1271
+ '<a ' .
1272
+ $href .
1273
+ ' style="border:0;color:transparent;"' .
1274
+ ' target="' . $photolink['target'] . '"' .
1275
+ ' title="' . $photolink['title'] . '"' .
1276
+ ' onclick="' . $photolink['onclick'] . '"' .
1277
+ ' >' );
1278
+
1279
+ if ( wppa_is_video( $image['id'] ) ) {
1280
+
1281
+ wppa_out(
1282
+ '<video' .
1283
+ ' preload="metadata" ' .
1284
+ ' class="image wppa-img"' .
1285
+ ' style="' . $imgattr . '"' .
1286
+ ' ' . $events .
1287
+ ' >' .
1288
+ wppa_get_video_body( $image['id'] ) .
1289
+ '</video>'
1290
  );
1291
  }
 
 
1292
  else {
1293
+
1294
+ wppa_out(
1295
+ '<img' .
1296
+ ' src="' . $src . '"' .
1297
+ ' ' . wppa_get_imgalt( $image['id'] ) .
1298
+ ' class="image wppa-img"' .
1299
+ ' style="' . $imgattr . '"' .
1300
+ ' ' . $events .
1301
+ ' />'
1302
  );
1303
  }
1304
+ wppa_out( '</a> ' );
1305
  }
1306
+ }
1307
 
1308
+ // No link on coverphoto
1309
+ else {
1310
 
1311
+ // A video?
1312
+ if ( wppa_is_video( $image['id'] ) ) {
1313
+ wppa_out( '<video' .
1314
+ ' preload="metadata"' .
1315
+ ' class="image wppa-img"' .
1316
+ ' style="' . $imgattr . '"' .
1317
+ ' ' . $events .
1318
+ ' >' .
1319
+ wppa_get_video_body( $image['id'] ) .
1320
+ '</video>'
1321
+ );
1322
+ }
1323
 
1324
+ // A photo
1325
+ else {
1326
+ wppa_out( '<img' .
1327
+ ' src="' . $src . '"' .
1328
+ ' ' . wppa_get_imgalt( $image['id'] ) .
1329
+ ' class="image wppa-img"' .
1330
+ ' style="' . $imgattr . '"' .
1331
+ ' ' . $events .
1332
+ ' />'
1333
+ );
1334
+ }
1335
+ }
1336
  }
1337
 
 
 
1338
  // Close the coverphoto frame
1339
  wppa_out( '</div>' );
1340
  }
2000
 
2001
  /**/
2002
 
2003
+ // Only if there are subalbums
2004
  if ( ! empty( $subs ) ) {
2005
 
2006
  wppa_out( '<div class="wppa-cover-sublist-container" >' );
2023
  wppa_out( '<div style="clear:both"></div>' );
2024
  }
2025
 
2026
+ // Process the subalbums
2027
  foreach( $subs as $album ) {
2028
 
2029
  // The album id
2030
  $albumid = $album['id'];
2031
 
2032
+ // This subalbum visible for this user?
2033
  if ( wppa_is_album_visible( $albumid ) ) {
2034
 
2035
  // What is in there visible?
2048
  $albumid = $album['id'];
2049
  $photocount = $pc;
2050
 
2051
+ // Thumbnails and covers, show subalbum covers
2052
  // in case slideshow is requested on an empty album
2053
  if ( wppa_opt( 'cover_sublinks' ) == 'content' || ! $photocount ) {
2054
  $href_content = wppa_get_album_url( array( 'album' => $albumid,
2073
  $title = esc_attr( __( 'View the album', 'wp-photo-album-plus' ) . ': ' . wppa_get_album_name( $albumid ) );
2074
  }
2075
 
2076
+ // Subalbum title link
2077
  elseif ( wppa_opt( 'cover_sublinks' ) == 'title' ) {
2078
  $sub_attr = wppa_get_album_title_attr_a( $albumid,
2079
  $album['cover_linktype'],
wppa-album-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
- * Version 8.3.01.001
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -82,7 +82,7 @@ class AlbumWidget extends WP_Widget {
82
 
83
  $albums = wppa_strip_void_albums( $albums );
84
 
85
- // Add sub albums if required
86
  if ( $parent != 'all' && ! empty( $albums ) && $subs ) {
87
  $ids = '';
88
 
@@ -440,8 +440,8 @@ class AlbumWidget extends WP_Widget {
440
 
441
  wppa_widget_selection( $this, 'parent', $instance['parent'], __( 'Album selection or Parent album', 'wp-photo-album-plus' ), $options, $values, $disabled );
442
 
443
- // Include sub albums
444
- wppa_widget_checkbox( $this, 'subs', $instance['subs'], __( 'Include sub albums', 'wp-photo-album-plus' ) );
445
 
446
  // Show album name?
447
  wppa_widget_checkbox( $this, 'name', $instance['name'], __( 'Show album names', 'wp-photo-album-plus' ) );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
+ * Version 8.2.05.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
82
 
83
  $albums = wppa_strip_void_albums( $albums );
84
 
85
+ // Add subalbums if required
86
  if ( $parent != 'all' && ! empty( $albums ) && $subs ) {
87
  $ids = '';
88
 
440
 
441
  wppa_widget_selection( $this, 'parent', $instance['parent'], __( 'Album selection or Parent album', 'wp-photo-album-plus' ), $options, $values, $disabled );
442
 
443
+ // Include subalbums
444
+ wppa_widget_checkbox( $this, 'subs', $instance['subs'], __( 'Include subalbums', 'wp-photo-album-plus' ) );
445
 
446
  // Show album name?
447
  wppa_widget_checkbox( $this, 'name', $instance['name'], __( 'Show album names', 'wp-photo-album-plus' ) );
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -49,7 +49,7 @@ function wppa_thumb_area( $action ) {
49
  $result .= '<div class="wppa-nicewrap" >';
50
  }
51
 
52
- // Display create sub album and upload photo links conditionally
53
  if ( ! wppa_is_virtual() && wppa_opt( 'upload_link_thumbs' ) == 'top' ) {
54
 
55
  $alb = wppa( 'current_album' );
@@ -61,7 +61,7 @@ function wppa_thumb_area( $action ) {
61
  // Close thumbnail area box
62
  elseif ( $action == 'close' ) {
63
 
64
- // Display create sub album and upload photo links conditionally
65
  if ( ! wppa_is_virtual() && wppa_opt( 'upload_link_thumbs' ) == 'bottom' ) {
66
 
67
  $alb = wppa( 'current_album' );
@@ -2500,7 +2500,7 @@ function wppa_get_user_create_html( $alb, $width, $where = '', $mcr = false ) {
2500
  return '';
2501
  }
2502
 
2503
- // Basic users are not allowed to create sub albums
2504
  if ( wppa_user_is_basic() ) {
2505
  return '';
2506
  }
@@ -2574,7 +2574,7 @@ function wppa_get_user_create_html( $alb, $width, $where = '', $mcr = false ) {
2574
  elseif ( $where == 'thumb' ) {
2575
  $returnurl .= 'wppa-album=' . $parent . '&amp;wppa-cover=0&amp;wppa-occur=' . $occur;
2576
  }
2577
- if ( wppa( 'page' ) ) $returnurl .= '&amp;paged=' . wppa( 'page' );
2578
  $returnurl = trim( $returnurl, '?' );
2579
  $returnurl = wppa_trim_wppa_( $returnurl );
2580
  $t = $mcr ? 'mcr-' : '';
@@ -2592,7 +2592,7 @@ function wppa_get_user_create_html( $alb, $width, $where = '', $mcr = false ) {
2592
  jQuery( \'#_wppa-cr-'.$a.'-'.$mocc.'\' ).css( \'display\',\'block\' );
2593
  window.dispatchEvent(new Event(\'resize\'))"
2594
  style="float:left;cursor:pointer"> ' .
2595
- ( $alb ? __( 'Create sub album', 'wp-photo-album-plus' ) : __( 'Create album', 'wp-photo-album-plus' ) ) . '
2596
  </a>
2597
  <a id="_wppa-cr-' . $a . '-' . $mocc . '" class="wppa-create-' . $where . ' wppa-album-cover-link" onclick="
2598
  jQuery( \'#wppa-create-'.$t.$a.'-'.$mocc.'\' ).css( \'display\',\'none\' );
@@ -2765,7 +2765,7 @@ static $albums_granted;
2765
  if ( ! in_array( $xalb, (array) $albums_granted, true ) ) {
2766
 
2767
  // This function will check if $xalb is a grant parent,
2768
- // and make my sub album if it does not already exist.
2769
  $ta = wppa_grant_albums( $xalb );
2770
  if ( ! empty( $ta ) ) {
2771
  $albums_created = array_merge( $albums_created, $ta );
@@ -2955,7 +2955,7 @@ static $albums_granted;
2955
  window.dispatchEvent(new Event(\'resize\'));
2956
  " style="float:left; cursor:pointer"
2957
  >' .
2958
- __( 'Upload photo', 'wp-photo-album-plus' ) . '
2959
  </a>
2960
  <a id="_wppa-up-' . $a . '-' . $mocc . '" class="wppa-upload-'.$where.' wppa-album-cover-link" onclick="
2961
  jQuery( \'#wppa-file-'.$t.$a.'-'.$mocc.'\' ).css( \'display\',\'none\' );
@@ -3666,7 +3666,7 @@ function wppa_user_albumedit_html( $alb, $width, $where = '', $mcr = false ) {
3666
  }
3667
  // elseif ( $where == 'widget' || $where == 'uploadbox' ) {
3668
  // }
3669
- if ( wppa( 'page' ) ) $returnurl .= '&amp;paged=' . wppa( 'page' );
3670
  $returnurl = trim( $returnurl, '?' );
3671
 
3672
  $returnurl = wppa_encrypt_url( $returnurl );
@@ -3683,7 +3683,7 @@ function wppa_user_albumedit_html( $alb, $width, $where = '', $mcr = false ) {
3683
  'jQuery( \'#_wppa-ea-'.$a.'-'.wppa( 'mocc' ).'\' ).css( \'display\',\'block\' );'. // Show backlink
3684
  '_wppaDoAutocol( ' . wppa( 'mocc' ) . ' )' . // Trigger autocol
3685
  '" style="float:left; cursor:pointer">
3686
- '.__( 'Edit album info', 'wp-photo-album-plus' ).'
3687
  </a>
3688
  <a id="_wppa-ea-'.$a.'-'.wppa( 'mocc' ).'" class="wppa-aedit-'.$where.' wppa-album-'.$where.'-link" onclick="'.
3689
  'jQuery( \'#wppa-fe-div-'.$a.'-'.wppa( 'mocc' ).'\' ).css( \'display\',\'none\' );'. // Hide the Edit form
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 8.2.08.006
7
  *
8
  */
9
 
49
  $result .= '<div class="wppa-nicewrap" >';
50
  }
51
 
52
+ // Display create subalbum and upload photo links conditionally
53
  if ( ! wppa_is_virtual() && wppa_opt( 'upload_link_thumbs' ) == 'top' ) {
54
 
55
  $alb = wppa( 'current_album' );
61
  // Close thumbnail area box
62
  elseif ( $action == 'close' ) {
63
 
64
+ // Display create subalbum and upload photo links conditionally
65
  if ( ! wppa_is_virtual() && wppa_opt( 'upload_link_thumbs' ) == 'bottom' ) {
66
 
67
  $alb = wppa( 'current_album' );
2500
  return '';
2501
  }
2502
 
2503
+ // Basic users are not allowed to create subalbums
2504
  if ( wppa_user_is_basic() ) {
2505
  return '';
2506
  }
2574
  elseif ( $where == 'thumb' ) {
2575
  $returnurl .= 'wppa-album=' . $parent . '&amp;wppa-cover=0&amp;wppa-occur=' . $occur;
2576
  }
2577
+ if ( wppa( 'page' ) ) $returnurl .= '&amp;wppa-page=' . wppa( 'page' );
2578
  $returnurl = trim( $returnurl, '?' );
2579
  $returnurl = wppa_trim_wppa_( $returnurl );
2580
  $t = $mcr ? 'mcr-' : '';
2592
  jQuery( \'#_wppa-cr-'.$a.'-'.$mocc.'\' ).css( \'display\',\'block\' );
2593
  window.dispatchEvent(new Event(\'resize\'))"
2594
  style="float:left;cursor:pointer"> ' .
2595
+ ( $alb ? __( 'Create Subalbum', 'wp-photo-album-plus' ) : __( 'Create Album', 'wp-photo-album-plus' ) ) . '
2596
  </a>
2597
  <a id="_wppa-cr-' . $a . '-' . $mocc . '" class="wppa-create-' . $where . ' wppa-album-cover-link" onclick="
2598
  jQuery( \'#wppa-create-'.$t.$a.'-'.$mocc.'\' ).css( \'display\',\'none\' );
2765
  if ( ! in_array( $xalb, (array) $albums_granted, true ) ) {
2766
 
2767
  // This function will check if $xalb is a grant parent,
2768
+ // and make my subalbum if it does not already exist.
2769
  $ta = wppa_grant_albums( $xalb );
2770
  if ( ! empty( $ta ) ) {
2771
  $albums_created = array_merge( $albums_created, $ta );
2955
  window.dispatchEvent(new Event(\'resize\'));
2956
  " style="float:left; cursor:pointer"
2957
  >' .
2958
+ __( 'Upload Photo', 'wp-photo-album-plus' ) . '
2959
  </a>
2960
  <a id="_wppa-up-' . $a . '-' . $mocc . '" class="wppa-upload-'.$where.' wppa-album-cover-link" onclick="
2961
  jQuery( \'#wppa-file-'.$t.$a.'-'.$mocc.'\' ).css( \'display\',\'none\' );
3666
  }
3667
  // elseif ( $where == 'widget' || $where == 'uploadbox' ) {
3668
  // }
3669
+ if ( wppa( 'page' ) ) $returnurl .= '&amp;wppa-page=' . wppa( 'page' );
3670
  $returnurl = trim( $returnurl, '?' );
3671
 
3672
  $returnurl = wppa_encrypt_url( $returnurl );
3683
  'jQuery( \'#_wppa-ea-'.$a.'-'.wppa( 'mocc' ).'\' ).css( \'display\',\'block\' );'. // Show backlink
3684
  '_wppaDoAutocol( ' . wppa( 'mocc' ) . ' )' . // Trigger autocol
3685
  '" style="float:left; cursor:pointer">
3686
+ '.__( 'Edit Album Info', 'wp-photo-album-plus' ).'
3687
  </a>
3688
  <a id="_wppa-ea-'.$a.'-'.wppa( 'mocc' ).'" class="wppa-aedit-'.$where.' wppa-album-'.$where.'-link" onclick="'.
3689
  'jQuery( \'#wppa-fe-div-'.$a.'-'.wppa( 'mocc' ).'\' ).css( \'display\',\'none\' );'. // Hide the Edit form
wppa-breadcrumb.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for breadcrumbs
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -226,7 +226,7 @@ global $wppa_session;
226
  }
227
  $albtxt = wppa( 'is_rootsearch' ) ?
228
  ' <span style="cursor:pointer" title="'.
229
- esc_attr( sprintf( __( 'Searchresults from album %s and its sub albums' , 'wp-photo-album-plus' ),
230
  wppa_display_root( $searchroot ) ) ).'">*</span> ' :
231
  '';
232
 
@@ -552,7 +552,7 @@ global $wppa_session;
552
  // 'Go to thumbnail display' - icon
553
  if ( wppa( 'is_slide' ) && ! wppa( 'calendar' ) ) {
554
  if ( wppa_switch( 'bc_slide_thumblink' ) ) {
555
- $pg = ( ( wppa_opt( 'thumb_page_size' ) == wppa_opt( 'slideshow_pagesize' ) ) && wppa_get_curpage() != '1' ) ? '&paged='.wppa_get_curpage() : '&paged=1';
556
  $thumbhref .= $pg;
557
 
558
  if ( $virtual ) {
@@ -584,7 +584,7 @@ global $wppa_session;
584
  ' title="' . __( 'Thumbnail view', 'wp-photo-album-plus' ) . '"' .
585
  ' class="wppa-nav-text"' .
586
  ' style="float:right; cursor:pointer"' .
587
- ' onclick="wppaDoAjaxRender('.wppa('mocc').', \''.$ajax_url.$s.'&paged=\'+wppaThumbPage['.$mocc.']+\'&wppa-hilite=\'+_wppaId['.$mocc.'][_wppaCurIdx['.$mocc.']], \''.$href_url.$s.'&paged=\'+wppaThumbPage['.$mocc.']+\'&wppa-hilite=\'+_wppaId['.$mocc.'][_wppaCurIdx['.$mocc.']],true)"' .
588
  ' >' .
589
  wppa_get_svghtml( 'Content-View', wppa_icon_size( '1.5em' ), false, false, '10', '10', '10', '10' ) .
590
  '</span>' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for breadcrumbs
6
+ * Version 8.2.05.002
7
  *
8
  */
9
 
226
  }
227
  $albtxt = wppa( 'is_rootsearch' ) ?
228
  ' <span style="cursor:pointer" title="'.
229
+ esc_attr( sprintf( __( 'Searchresults from album %s and its subalbums' , 'wp-photo-album-plus' ),
230
  wppa_display_root( $searchroot ) ) ).'">*</span> ' :
231
  '';
232
 
552
  // 'Go to thumbnail display' - icon
553
  if ( wppa( 'is_slide' ) && ! wppa( 'calendar' ) ) {
554
  if ( wppa_switch( 'bc_slide_thumblink' ) ) {
555
+ $pg = ( ( wppa_opt( 'thumb_page_size' ) == wppa_opt( 'slideshow_pagesize' ) ) && wppa_get_curpage() != '1' ) ? '&wppa-page='.wppa_get_curpage() : '&wppa-page=1';
556
  $thumbhref .= $pg;
557
 
558
  if ( $virtual ) {
584
  ' title="' . __( 'Thumbnail view', 'wp-photo-album-plus' ) . '"' .
585
  ' class="wppa-nav-text"' .
586
  ' style="float:right; cursor:pointer"' .
587
+ ' onclick="wppaDoAjaxRender('.wppa('mocc').', \''.$ajax_url.$s.'&wppa-page=\'+wppaThumbPage['.$mocc.']+\'&wppa-hilite=\'+_wppaId['.$mocc.'][_wppaCurIdx['.$mocc.']], \''.$href_url.$s.'&wppa-page=\'+wppaThumbPage['.$mocc.']+\'&wppa-hilite=\'+_wppaId['.$mocc.'][_wppaCurIdx['.$mocc.']],true)"' .
588
  ' >' .
589
  wppa_get_svghtml( 'Content-View', wppa_icon_size( '1.5em' ), false, false, '10', '10', '10', '10' ) .
590
  '</span>' );
wppa-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
- /* Version 8.3.01.001
7
  */
8
 
9
  // Test for caching
@@ -30,7 +30,7 @@ global $wppa_lang;
30
  if ( wppa( 'cache' ) ) {
31
 
32
  // No querystring?
33
- if ( ! $_SERVER['REQUEST_URI'] ) {
34
  $caching = true;
35
  }
36
 
@@ -463,6 +463,8 @@ global $wpdb;
463
  wp_die( 'You have no rights to do this' );
464
  }
465
 
 
 
466
  $sc_files = array();
467
  $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
468
  if ( wppa_is_dir( $root ) ) {
@@ -480,7 +482,6 @@ global $wpdb;
480
  if ( $count ) {
481
  $result = '
482
  <div class="wrap" >
483
- <h1>' . get_admin_page_title() . '</h1>
484
  <table class="wppa-table widefat wppa-setting-table striped" style="margin-top:12px">
485
  <thead style="font-weight:bold">
486
  <tr>
3
  /*
4
  /* Contains all wppa smart cache functions
5
  /*
6
+ /* Version 8.2.05.002
7
  */
8
 
9
  // Test for caching
30
  if ( wppa( 'cache' ) ) {
31
 
32
  // No querystring?
33
+ if ( /* ! wppa_in_widget() && */ ! $_SERVER['REQUEST_URI'] ) {
34
  $caching = true;
35
  }
36
 
463
  wp_die( 'You have no rights to do this' );
464
  }
465
 
466
+ wppa_echo( '<h1>' . __( 'WPPA Cache', 'wp-photo-album-plus' ) . '</h1>' );
467
+
468
  $sc_files = array();
469
  $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
470
  if ( wppa_is_dir( $root ) ) {
482
  if ( $count ) {
483
  $result = '
484
  <div class="wrap" >
 
485
  <table class="wppa-table widefat wppa-setting-table striped" style="margin-top:12px">
486
  <thead style="font-weight:bold">
487
  <tr>
wppa-comment-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -14,7 +14,7 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
14
  }
15
 
16
  // CREATE A PACKAGE CLASS *****************************
17
- class WPPA_Comment_table extends WPPA_List_Table {
18
 
19
  var $data;
20
 
@@ -277,9 +277,7 @@ class WPPA_Comment_table extends WPPA_List_Table {
277
  function prepare_items() {
278
  global $wpdb;
279
 
280
- $parms = wppa_get_paging_parms( 'comment_admin' );
281
-
282
- $per_page = $parms['pagesize'];
283
  $columns = $this->get_columns();
284
  $hidden = array();
285
  $sortable = $this->get_sortable_columns();
@@ -316,19 +314,14 @@ class WPPA_Comment_table extends WPPA_List_Table {
316
  $data = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_comments " . $filter . " ORDER BY timestamp DESC", ARRAY_A );
317
 
318
  function usort_reorder( $a, $b ) {
319
-
320
- $parms = wppa_get_paging_parms( 'comment_admin' );
321
-
322
- $orderby = $parms['order']; // wppa_get( 'orderby' ) ? wppa_get( 'orderby' ) : 'timestamp'; // If no sort, default to title
323
- $order = strtolower($parms['dir']); //wppa_get( 'order' ) ? wppa_get( 'order' ) : 'desc'; // If no order, default to asc
324
  $result = strcmp( $a[$orderby], $b[$orderby] ); // Determine sort order
325
  return ( $order === 'asc' ) ? $result : -$result; // Send final sort direction to usort
326
  }
327
  usort( $data, 'usort_reorder' );
328
 
329
-
330
-
331
- $current_page = $parms['page']; //$this->get_pagenum();
332
  $total_items = count( $data );
333
  if ( $per_page ) {
334
  $data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
@@ -343,16 +336,11 @@ class WPPA_Comment_table extends WPPA_List_Table {
343
  }
344
  }
345
 
 
346
  // The command admin page
347
  function _wppa_comment_admin() {
348
  global $wpdb;
349
 
350
- $wppa_page = wppa_get( 'paged', 1, 'int' );
351
- if ( $wppa_page > '1' ) {
352
- $_REQUEST['paged'] = $wppa_page;
353
- }
354
- // $parms = wppa_get_paging_parms( 'comment_admin' );
355
-
356
  // Create an instance of our package class...
357
  $testListTable = new WPPA_Comment_table();
358
 
@@ -365,9 +353,10 @@ function _wppa_comment_admin() {
365
  // Open page
366
  wppa_echo( '
367
  <div class="wrap">
368
- <h1 class="wp-heading-inline">' .
369
- get_admin_page_title() . '
370
- </h1>' );
 
371
  if ( $moderating ) {
372
  $status_show = array( 'pending', 'spam' );
373
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
+ * Version 8.1.09.003
7
  *
8
  */
9
 
14
  }
15
 
16
  // CREATE A PACKAGE CLASS *****************************
17
+ class WPPA_Comment_table extends WP_List_Table {
18
 
19
  var $data;
20
 
277
  function prepare_items() {
278
  global $wpdb;
279
 
280
+ $per_page = wppa_opt( 'comment_admin_pagesize' );
 
 
281
  $columns = $this->get_columns();
282
  $hidden = array();
283
  $sortable = $this->get_sortable_columns();
314
  $data = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_comments " . $filter . " ORDER BY timestamp DESC", ARRAY_A );
315
 
316
  function usort_reorder( $a, $b ) {
317
+ $orderby = wppa_get( 'orderby' ) ? wppa_get( 'orderby' ) : 'timestamp'; // If no sort, default to title
318
+ $order = wppa_get( 'order' ) ? wppa_get( 'order' ) : 'desc'; // If no order, default to asc
 
 
 
319
  $result = strcmp( $a[$orderby], $b[$orderby] ); // Determine sort order
320
  return ( $order === 'asc' ) ? $result : -$result; // Send final sort direction to usort
321
  }
322
  usort( $data, 'usort_reorder' );
323
 
324
+ $current_page = $this->get_pagenum();
 
 
325
  $total_items = count( $data );
326
  if ( $per_page ) {
327
  $data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
336
  }
337
  }
338
 
339
+
340
  // The command admin page
341
  function _wppa_comment_admin() {
342
  global $wpdb;
343
 
 
 
 
 
 
 
344
  // Create an instance of our package class...
345
  $testListTable = new WPPA_Comment_table();
346
 
353
  // Open page
354
  wppa_echo( '
355
  <div class="wrap">
356
+ <h1>' .
357
+ ( $moderating ? esc_html__( 'Photo Albums -> Moderate Comment', 'wp-photo-album-plus' ) :
358
+ esc_html__( 'Photo Albums -> Comment admin', 'wp-photo-album-plus' ) ) .
359
+ '</h1>' );
360
  if ( $moderating ) {
361
  $status_show = array( 'pending', 'spam' );
362
  }
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.3.01.001
6
  *
7
  */
8
 
@@ -310,7 +310,7 @@ global $wppa_randseed_modified;
310
  if ( $wppa_randseed_modified ) $renew = false; // Already renewed this pageload
311
  if ( wppa( 'ajax' ) ) $renew = false; // Not during ajax call
312
  if ( strpos( $_SERVER['REQUEST_URI'], 'wp-content' ) !== false ) $renew = false; // Url to a content item needs no renew
313
- if ( wppa_get( 'paged', '0' ) ) $renew = false; // A subsequent wppa page needs the same sequence
314
  if ( isset( $wppa_session['randseedtime'] ) && $wppa_session['randseedtime'] > ( time() - 10 ) ) $renew = false; // Not within 10 seconds
315
 
316
  // Still renew if the current wp page differs from the last
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 8.2.05.005
6
  *
7
  */
8
 
310
  if ( $wppa_randseed_modified ) $renew = false; // Already renewed this pageload
311
  if ( wppa( 'ajax' ) ) $renew = false; // Not during ajax call
312
  if ( strpos( $_SERVER['REQUEST_URI'], 'wp-content' ) !== false ) $renew = false; // Url to a content item needs no renew
313
+ if ( wppa_get( 'wppa-page', '0' ) ) $renew = false; // A subsequent wppa page needs the same sequence
314
  if ( isset( $wppa_session['randseedtime'] ) && $wppa_session['randseedtime'] > ( time() - 10 ) ) $renew = false; // Not within 10 seconds
315
 
316
  // Still renew if the current wp page differs from the last
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -941,7 +941,11 @@ horizrailenabled:false,";
941
  'wppa_meta_page' => 'yes', // 9
942
  'wppa_meta_all' => 'yes', // 10
943
  'wppa_alt_type' => 'fullname',
 
 
944
  'wppa_photo_admin_max_albums' => '500',
 
 
945
  'wppa_jpeg_quality' => '95',
946
  'wppa_geo_edit' => 'no',
947
  'wppa_adminbarmenu_admin' => 'yes',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 8.2.09.001
7
  *
8
  */
9
 
941
  'wppa_meta_page' => 'yes', // 9
942
  'wppa_meta_all' => 'yes', // 10
943
  'wppa_alt_type' => 'fullname',
944
+ 'wppa_album_admin_pagesize' => '100',
945
+ 'wppa_photo_admin_pagesize' => '20',
946
  'wppa_photo_admin_max_albums' => '500',
947
+ 'wppa_comment_admin_pagesize' => '10',
948
+ 'wppa_email_admin_pagesize' => '20',
949
  'wppa_jpeg_quality' => '95',
950
  'wppa_geo_edit' => 'no',
951
  'wppa_adminbarmenu_admin' => 'yes',
wppa-edit-email.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -24,21 +24,33 @@ global $wpdb;
24
  );
25
  $url = get_admin_url().'admin.php?page=wppa_edit_email';
26
 
27
- // Get paging parameters
28
- $parms = wppa_get_paging_parms( 'edit_email' );
 
 
 
 
 
 
 
 
29
 
30
  // Icon to use
31
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
32
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
33
- $useimg = $parms['dir'] == 'DESC' ? $upimg : $downimg;
34
 
35
  // Get users
36
  $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" ); // get_users( ['count_total'=>true] );
37
- $users = get_users( ['ID','user_login','display_name',
38
- 'orderby'=>$parms['order'],
39
- 'order'=>$parms['dir'],
40
- 'number'=>$parms['pagesize'],
41
- 'paged'=>$parms['page']] );
 
 
 
 
42
 
43
  // Get mailinglist user ids
44
  foreach( array_keys( $email_types ) as $type ) {
@@ -87,53 +99,55 @@ global $wpdb;
87
 
88
  // General header
89
  wppa_echo( '
 
90
  <h1 style="display:inline;">' .
91
- get_admin_page_title() .
92
  '</h1>' );
93
  if ( ! wppa_switch( 'email_on' ) ) {
94
  wppa_echo( '
95
  <span style="color:red;display:inline">' .
96
- esc_html__( 'Email is not enabled', 'wp-photo-album-plus' ) .
97
  ( current_user_can( 'wppa_settings' ) ? wppa_see_also( 'general', '1', '7' ) : '' ) . '
98
  </span>' );
99
  }
100
 
101
- wppa_admin_pagination( $parms['pagesize'], $parms['page'], $total, $url );
102
 
103
  wppa_echo( '
 
104
  <table
105
  class="wppa-table widefat wppa-setting-table striped"
106
  style="margin-top:12px;"
107
  >
108
  <colgroup>
109
- <col style="width:70px">
110
- <col style="width:132px">
111
- <col style="width:200px">
112
- <col style="">
113
- <col style="">
114
- <col style="">
115
- <col style="">
116
- <col style="">
117
- <col style="">
118
- <col style="">
119
- <col style="">
120
  </colgroup>
121
  <thead>
122
  <tr>
123
  <td
124
  style="cursor:pointer"
125
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'edit_email', 'ID' ) . '\'">' .
126
- ( $parms['order'] == 'ID' ? $useimg : '' ) . esc_html__( 'Id', 'wp-photo-album-plus' ) . '
127
  </td>
128
  <td
129
  style="cursor:pointer"
130
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'edit_email', 'user_login' ) . '\'">' .
131
- ( $parms['order'] == 'user_login' ? $useimg : '' ) . esc_html__( 'User login', 'wp-photo-album-plus' ) . '
132
  </td>
133
  <td
134
  style="cursor:pointer"
135
- onclick="document.location.href=\'' . wppa_admin_reload_url( 'edit_email', 'display_name' ) . '\'">' .
136
- ( $parms['order'] == 'display_name' ? $useimg : '' ) . esc_html__( 'User display name', 'wp-photo-album-plus' ) . '
137
  </td>' );
138
  foreach( array_keys( $email_types ) as $type ) {
139
  wppa_echo( '
@@ -169,6 +183,25 @@ global $wpdb;
169
  wppa_echo( '
170
  </tr>
171
  </thead>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  <tbody>' );
173
  foreach( $users as $user ) {
174
  wppa_echo( '
@@ -224,11 +257,171 @@ global $wpdb;
224
  }
225
  wppa_echo( '
226
  </tbody>
227
- </table>' );
 
228
 
229
- wppa_admin_pagination( $parms['pagesize'], $parms['page'], $total, $url );
230
 
231
  wppa_echo( '
232
  </div>' );
233
  }
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
+ * Version 8.2.09.002
7
  *
8
  */
9
 
24
  );
25
  $url = get_admin_url().'admin.php?page=wppa_edit_email';
26
 
27
+ // Display sequence
28
+ $order = wppa_edit_email_order();
29
+ $dir = wppa_edit_email_dir();
30
+ $page = wppa_edit_email_page();
31
+ $reverse = $dir == 'DESC';
32
+
33
+ // Save sequence data for later
34
+ set_transient( 'wppa_edit_email_seq-' . wppa_get_user(), $order, MONTH_IN_SECONDS );
35
+ set_transient( 'wppa_edit_email_dir-' . wppa_get_user(), $dir, MONTH_IN_SECONDS );
36
+ set_transient( 'wppa_edit_email_page-' . wppa_get_user(), $page, MONTH_IN_SECONDS );
37
 
38
  // Icon to use
39
  $downimg = '<img src="'.wppa_get_imgdir().'down.png" alt="down" style="height:12px;position:relative;top:2px" />';
40
  $upimg = '<img src="'.wppa_get_imgdir().'up.png" alt="up" style="height:12px;position:relative;top:2px" />';
41
+ $useimg = $reverse ? $upimg : $downimg;
42
 
43
  // Get users
44
  $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" ); // get_users( ['count_total'=>true] );
45
+ $pagesize = wppa_opt( 'email_admin_pagesize' );
46
+ $users = get_users( ['ID','user_login','display_name','orderby'=>$order,'order'=>($reverse?'DESC':'ASC'),'number'=>$pagesize,'paged'=>$page] );
47
+
48
+ // After a change in pagesize (up) current page may contain no items. In that case, go to page 1 and retry finding users
49
+ if ( ! count( $users ) ) {
50
+ $page = '1';
51
+ set_transient( 'wppa_edit_email_page-' . wppa_get_user(), $page, MONTH_IN_SECONDS );
52
+ $users = get_users( ['ID','user_login','display_name','orderby'=>$order,'order'=>($reverse?'DESC':'ASC'),'number'=>$pagesize,'paged'=>$page] );
53
+ }
54
 
55
  // Get mailinglist user ids
56
  foreach( array_keys( $email_types ) as $type ) {
99
 
100
  // General header
101
  wppa_echo( '
102
+ <img id="icon-album" src="' . WPPA_URL.'/img/settings32.png" />
103
  <h1 style="display:inline;">' .
104
+ esc_html__('Manage Email subscriptions', 'wp-photo-album-plus' ) .
105
  '</h1>' );
106
  if ( ! wppa_switch( 'email_on' ) ) {
107
  wppa_echo( '
108
  <span style="color:red;display:inline">' .
109
+ esc_html( 'Email is not enabled', 'wp-photo-album-plus' ) .
110
  ( current_user_can( 'wppa_settings' ) ? wppa_see_also( 'general', '1', '7' ) : '' ) . '
111
  </span>' );
112
  }
113
 
114
+ wppa_user_email_table_pagination( $pagesize, $page, $total, $url );
115
 
116
  wppa_echo( '
117
+ <div>
118
  <table
119
  class="wppa-table widefat wppa-setting-table striped"
120
  style="margin-top:12px;"
121
  >
122
  <colgroup>
123
+ <col style="width:5%">
124
+ <col style="width:15%">
125
+ <col style="width:15%">
126
+ <col style="width:8%">
127
+ <col style="width:8%">
128
+ <col style="width:8%">
129
+ <col style="width:8%">
130
+ <col style="width:8%">
131
+ <col style="width:8%">
132
+ <col style="width:8%">
133
+ <col style="width:8%">
134
  </colgroup>
135
  <thead>
136
  <tr>
137
  <td
138
  style="cursor:pointer"
139
+ onclick="document.location.href=\'' . wppa_edit_reload_url( 'ID' ) . '\'">' .
140
+ ( $order == 'ID' ? $useimg : '' ) . esc_html__( 'Id', 'wp-photo-album-plus' ) . '
141
  </td>
142
  <td
143
  style="cursor:pointer"
144
+ onclick="document.location.href=\'' . wppa_edit_reload_url( 'user_login' ) . '\'">' .
145
+ ( $order == 'user_login' ? $useimg : '' ) . esc_html__( 'User login', 'wp-photo-album-plus' ) . '
146
  </td>
147
  <td
148
  style="cursor:pointer"
149
+ onclick="document.location.href=\'' . wppa_edit_reload_url( 'display_name' ) . '\'">' .
150
+ ( $order == 'display_name' ? $useimg : '' ) . esc_html__( 'User display name', 'wp-photo-album-plus' ) . '
151
  </td>' );
152
  foreach( array_keys( $email_types ) as $type ) {
153
  wppa_echo( '
183
  wppa_echo( '
184
  </tr>
185
  </thead>
186
+ </table>
187
+ </div>
188
+ <div style="max-height:600px;overflow:auto;margin-bottom:20px;border-bottom:1px solid #c3c4c7;">
189
+ <table
190
+ class="wppa-table widefat wppa-setting-table striped"
191
+ >
192
+ <colgroup>
193
+ <col style="width:5%">
194
+ <col style="width:15%">
195
+ <col style="width:15%">
196
+ <col style="width:8%">
197
+ <col style="width:8%">
198
+ <col style="width:8%">
199
+ <col style="width:8%">
200
+ <col style="width:8%">
201
+ <col style="width:8%">
202
+ <col style="width:8%">
203
+ <col style="width:8%">
204
+ </colgroup>
205
  <tbody>' );
206
  foreach( $users as $user ) {
207
  wppa_echo( '
257
  }
258
  wppa_echo( '
259
  </tbody>
260
+ </table>
261
+ </div>' );
262
 
263
+ wppa_user_email_table_pagination( $pagesize, $page, $total, $url );
264
 
265
  wppa_echo( '
266
  </div>' );
267
  }
268
 
269
+ // The user table pagination
270
+ // Prints the pagelinks
271
+ function wppa_user_email_table_pagination( $pagesize, $page, $count, $url ) {
272
+
273
+ // Init
274
+ $result = '';
275
+ $link = $url . '&wppa-page=';
276
+
277
+ // Paging on?
278
+ if ( ! $pagesize ) {
279
+ return;
280
+ }
281
+
282
+ $npages = ceil( $count / $pagesize );
283
+
284
+ // Just one page?
285
+ if ( $npages == '1' ) {
286
+ return;
287
+ }
288
+
289
+ $result .= '<div style="line-height:1.7em">';
290
+
291
+ // The links
292
+ if ( $page != '1' ) {
293
+ $result .= '<a style="padding:0 0.25em" href="' . $link . ( $page - '1') . '" >' . __( 'Previous page', 'wp-photo-album-plus' ) . '</a> ';
294
+ }
295
+
296
+ $p = '1';
297
+ $result .= '<select onchange="document.location.href=\'' . $link . '\'+this.value;">';
298
+ while ( $p <= $npages ) {
299
+ if ( $p == $page ) {
300
+ $sel = ' selected';
301
+ }
302
+ else {
303
+ $sel = '';
304
+ }
305
+ $result .= '<option value="' . $p . '"' . $sel . '>' . $p . '</option>';
306
+ $p++;
307
+ }
308
+ $result .= '</select>';
309
+
310
+ if ( $page != $npages ) {
311
+ $result .= '<a style="padding:0 0.25em" href="' . $link . ( $page + '1') . '" >' . __( 'Next page', 'wp-photo-album-plus' ) . '</a>';
312
+ }
313
+
314
+ $result .= '
315
+ <span style="float:right">' .
316
+ __( 'Pagesize', 'wp-photo-album-plus' ) . '
317
+ <select onchange="_wppaRefreshAfter=true;wppaAjaxUpdateOptionValue(\'email_admin_pagesize\', this);">
318
+ <option value="20"' . ( $pagesize == '20' ? ' selected' : '' ) . '>20</option>
319
+ <option value="50"' . ( $pagesize == '50' ? ' selected' : '' ) . '>50</option>
320
+ <option value="100"' . ( $pagesize == '100' ? ' selected' : '' ) . '>100</option>
321
+ <option value="200"' . ( $pagesize == '200' ? ' selected' : '' ) . '>200</option>
322
+ <option value="500"' . ( $pagesize == '500' ? ' selected' : '' ) . '>500</option>
323
+ <option value="1000"' . ( $pagesize == '1000' ? ' selected' : '' ) . '>1000</option>
324
+ </select>
325
+ </span>';
326
+
327
+ $result .= '</div>';
328
+
329
+ wppa_echo( $result );
330
+ }
331
+
332
+ // The list order method
333
+ // Returns 'ID', 'user_login' or 'display_name'
334
+ function wppa_edit_email_order() {
335
+
336
+ // Init
337
+ $order = 'ID';
338
+
339
+ // Query arg?
340
+ $order_new = wppa_get( 'order-by', '', 'text' );
341
+ if ( in_array( $order_new, ['ID','user_login', 'display_name'] ) ) {
342
+ $order = $order_new;
343
+ }
344
+
345
+ // Used before?
346
+ else {
347
+ $order_old = get_transient( 'wppa_edit_email_seq-' . wppa_get_user() );
348
+ if ( $order_old ) {
349
+ $order = $order_old;
350
+ }
351
+ }
352
+
353
+ // Done
354
+ return $order;
355
+ }
356
+
357
+ // The list order asc or desc
358
+ // Returns 'ASC' or 'DESC'
359
+ function wppa_edit_email_dir() {
360
+
361
+ // Init
362
+ $dir = 'ASC';
363
+
364
+ // Query arg?
365
+ $desc = wppa_get( 'dir', '', 'text' );
366
+ if ( in_array( $desc, ['ASC', 'DESC'] ) ) {
367
+ $dir = $desc;
368
+ }
369
+
370
+ // Used before?
371
+ elseif ( get_transient( 'wppa_edit_email_dir-' . wppa_get_user() ) == 'DESC' ) {
372
+ $dir = 'DESC';
373
+ }
374
+
375
+ // Done
376
+ return $dir;
377
+ }
378
+
379
+ // The page no
380
+ // Returns query arg wppa-page, defaults to 1
381
+ function wppa_edit_email_page() {
382
+
383
+ // Query arg?
384
+ $page = wppa_get( 'wppa-page', '', 'int' );
385
+
386
+ // Used before?
387
+ if ( ! wppa_is_int( $page ) ) {
388
+ $page = get_transient( 'wppa_edit_email_page-' . wppa_get_user() );
389
+ }
390
+
391
+ // Nothing yet?
392
+ if ( ! $page ) {
393
+ $page = '1';
394
+ }
395
+
396
+ // Done
397
+ return $page;
398
+ }
399
+
400
+ // Get admin page reload url
401
+ // arg1: one out of 'ID', 'user_login' or 'display_name'
402
+ function wppa_edit_reload_url( $for ) {
403
+
404
+ if ( in_array( $for, ['ID', 'user_login', 'display_name'] ) ) {
405
+ $order_now = wppa_edit_email_order();
406
+ $dir_now = wppa_edit_email_dir();
407
+ $page = wppa_edit_email_page();
408
+ if ( $for == $order_now ) {
409
+ if ( $dir_now == 'ASC' ) {
410
+ $dir = 'DESC';
411
+ }
412
+ else {
413
+ $dir = 'ASC';
414
+ }
415
+ }
416
+ else {
417
+ $dir = 'ASC';
418
+ $page = '1';
419
+ }
420
+ $url = get_admin_url() . 'admin.php?page=wppa_edit_email&wppa-order-by=' . $for . '&wppa-dir=' . $dir . '&wppa-page=' . $page;
421
+ }
422
+ else {
423
+ $url = get_admin_url() . 'admin.php?page=wppa_edit_email';
424
+ }
425
+
426
+ return $url;
427
+ }
wppa-edit-sequence.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
- * Version 8.3.01.002
7
  *
8
  */
9
 
@@ -12,11 +12,15 @@ if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
12
  function _wppa_edit_sequence() {
13
 
14
  $album = wppa_get( 'album', '0' );
15
-
 
16
  $result = '
17
  <div class="wrap">
18
 
19
- <h1>' . get_admin_page_title() . '</h1><br>
 
 
 
20
 
21
  <select
22
  id="wppa-edit-sequence-album"
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 8.1.10.001
7
  *
8
  */
9
 
12
  function _wppa_edit_sequence() {
13
 
14
  $album = wppa_get( 'album', '0' );
15
+ $iconurl = WPPA_URL.'/img/camera32.png';
16
+
17
  $result = '
18
  <div class="wrap">
19
 
20
+ <img id="icon-photos" src="' . $iconurl . '" />
21
+ <h1>' . esc_html__( 'Edit Photo Sequence', 'wp-photo-album-plus' ) . '
22
+ <span style="font-size:0.5em">' . esc_html( __( 'A subset of Album Admin page', 'wp-photo-album-plus' ) ) . '</span>
23
+ </h1>
24
 
25
  <select
26
  id="wppa-edit-sequence-album"
wppa-edit-tags.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-edit-tags.php
3
  * Package: wp-photo-album-plus
4
  *
5
- * Version 8.3.01.002
6
  *
7
  */
8
 
@@ -15,6 +15,9 @@ function _wppa_edit_tags() {
15
  wp_die( 'Insuffucient rights' );
16
  }
17
 
 
 
 
18
  // Prepare taglist
19
  $tags = wppa_get_taglist();
20
  $opts = array( __( '-select a tag-', 'wp-photo-album-plus' ) );
@@ -41,27 +44,31 @@ function _wppa_edit_tags() {
41
 
42
  $result = '
43
  <div class="wrap">
44
- <h1 style="display:inline">' . get_admin_page_title() . '</h1>
45
- <br><br>
 
 
46
  <input type="hidden" id="wppa-nonce" name="wppa-nonce" value="' . wp_create_nonce( 'wppa-nonce' ) . '" />
47
  <input type="hidden" name="wppa-key" id="wppa-key" value="" />
48
  <input type="hidden" name="wppa-sub" id="wppa-sub" value="" />
49
  <table class="widefat wppa-table wppa-setting-table">
50
  <thead style="font-weight: bold; " class="wppa_table_8">
51
  <tr>
52
- <td>' . esc_html__( 'Name', 'wp-photo-album-plus' ) . '</td>
53
- <td>' . esc_html__( 'Description', 'wp-photo-album-plus' ) . '</td>
54
- <td>' . esc_html__( 'Tag to change', 'wp-photo-album-plus' ) . '</td>
55
- <td>' . esc_html__( 'Change into', 'wp-photo-album-plus' ) . '</td>
56
- <td>' . esc_html__( 'Do it!', 'wp-photo-album-plus' ) . '</td>
57
- <td>' . esc_html__( 'Status', 'wp-photo-album-plus' ) . '</td>
58
- <td>' . esc_html__( 'To Go', 'wp-photo-album-plus' ) . '</td>
59
  </tr>
60
  </thead>
61
  <tbody class="wppa_table_8">
62
- <tr class="wppa-setting" style="color:#333;">
63
- <td>' . esc_html__( 'Edit tag', 'wp-photo-album-plus' ) . '</td>
64
- <td>' . esc_html__( 'Globally change a tagname.', 'wp-photo-album-plus' ) . '</td>
 
 
65
  <td>' .
66
  wppa_tag_select( $opts, $vals, '', '', false, '', '600') . '
67
  </td>
@@ -69,7 +76,7 @@ function _wppa_edit_tags() {
69
  <input
70
  id="new_tag_value"
71
  type="text"
72
- style="float:left;width:75%;height:20px;font-size:11px;margin:0;"
73
  value="' . esc_attr( trim( wppa_get_option( 'wppa_new_tag_value' ), ',' ) ) . '"
74
  onchange="wppaAjaxUpdateOptionValue(\'new_tag_value\',this);"
75
  />
@@ -117,7 +124,7 @@ function _wppa_edit_tags() {
117
  function wppa_tag_select( $options, $values ) {
118
 
119
  if ( ! is_array( $options ) ) {
120
- $result = __( 'There is nothing to select.', 'wp-photo-album-plus' );
121
  return $result;
122
  }
123
 
2
  /* wppa-edit-tags.php
3
  * Package: wp-photo-album-plus
4
  *
5
+ * Version 8.2.05.002
6
  *
7
  */
8
 
15
  wp_die( 'Insuffucient rights' );
16
  }
17
 
18
+ // Init
19
+ $iconurl = WPPA_URL . '/img/settings32.png';
20
+
21
  // Prepare taglist
22
  $tags = wppa_get_taglist();
23
  $opts = array( __( '-select a tag-', 'wp-photo-album-plus' ) );
44
 
45
  $result = '
46
  <div class="wrap">
47
+ <img id="icon-album" src="' . esc_url( $iconurl ) . '" />
48
+ <h1 style="display:inline">' . __( 'Edit Photo Tag', 'wp-photo-album-plus' ) . '
49
+ <span style="font-size:0.5em">' . __( 'A subset of WP Photo Album Plus Settings', 'wp-photo-album-plus' ) . '</span>
50
+ </h1>
51
  <input type="hidden" id="wppa-nonce" name="wppa-nonce" value="' . wp_create_nonce( 'wppa-nonce' ) . '" />
52
  <input type="hidden" name="wppa-key" id="wppa-key" value="" />
53
  <input type="hidden" name="wppa-sub" id="wppa-sub" value="" />
54
  <table class="widefat wppa-table wppa-setting-table">
55
  <thead style="font-weight: bold; " class="wppa_table_8">
56
  <tr>
57
+ <td>' . __('Name', 'wp-photo-album-plus' ) . '</td>
58
+ <td>' . __('Description', 'wp-photo-album-plus' ) . '</td>
59
+ <td>' . __('Tag to change', 'wp-photo-album-plus' ) . '</td>
60
+ <td>' . __('Change into', 'wp-photo-album-plus' ) . '</td>
61
+ <td>' . __('Do it!', 'wp-photo-album-plus' ) . '</td>
62
+ <td>' . __('Status', 'wp-photo-album-plus' ) . '</td>
63
+ <td>' . __('To Go', 'wp-photo-album-plus' ) . '</td>
64
  </tr>
65
  </thead>
66
  <tbody class="wppa_table_8">
67
+ <tr
68
+ class="wppa-setting" style="color:#333;"
69
+ >
70
+ <td>' . __( 'Edit tag', 'wp-photo-album-plus' ) . '</td>
71
+ <td>' . __( 'Globally change a tagname.', 'wp-photo-album-plus' ) . '</td>
72
  <td>' .
73
  wppa_tag_select( $opts, $vals, '', '', false, '', '600') . '
74
  </td>
76
  <input
77
  id="new_tag_value"
78
  type="text"
79
+ style="float:left;width:75%;height:20px;font-size:11px;margin:0;padding:0 0 0 6px;"
80
  value="' . esc_attr( trim( wppa_get_option( 'wppa_new_tag_value' ), ',' ) ) . '"
81
  onchange="wppaAjaxUpdateOptionValue(\'new_tag_value\',this);"
82
  />
124
  function wppa_tag_select( $options, $values ) {
125
 
126
  if ( ! is_array( $options ) ) {
127
+ $result = __('There is nothing to select.', 'wp-photo-album-plus' );
128
  return $result;
129
  }
130
 
wppa-export.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -31,9 +31,9 @@ global $wppa_try_continue;
31
  // Open the page
32
  wppa_echo( '
33
  <div class="wrap">
34
- <h1>' .
35
- get_admin_page_title() . '
36
- </h1>' );
37
 
38
  // Do the export if requested
39
  if ( wppa_get( 'export-submit' ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
+ * Version 8.2.09.002
7
  *
8
  */
9
 
31
  // Open the page
32
  wppa_echo( '
33
  <div class="wrap">
34
+ <h2>' .
35
+ __( 'Export Photos', 'wp-photo-album-plus' ) . '
36
+ </h2>' );
37
 
38
  // Do the export if requested
39
  if ( wppa_get( 'export-submit' ) ) {
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -132,7 +132,7 @@ global $other_deps;
132
  wppa( 'photos_only', true );
133
  }
134
 
135
- wppa( 'page', wppa_get( 'paged', '1' ) );
136
 
137
  if ( wppa_get( 'superview' ) ) {
138
  $wppa_session['superview'] = wppa( 'is_slide' ) ? 'slide': 'thumbs';
@@ -3758,7 +3758,7 @@ function wppa_get_curpage() {
3758
  if ( wppa( 'mocc' ) == wppa_get( 'occur', '1' ) ) {
3759
 
3760
  // page may be in qstring
3761
- $curpage = wppa_get( 'paged', '1' );
3762
  }
3763
  else {
3764
 
@@ -4675,9 +4675,6 @@ function wppa_is_photo_new( $id ) {
4675
  }
4676
 
4677
  $thumb = wppa_cache_photo( $id );
4678
- if ( ! $thumb ) { // Photo vanished?
4679
- return false;
4680
- }
4681
 
4682
  $birthtime = $thumb['timestamp'];
4683
  $timnow = time();
@@ -4694,9 +4691,6 @@ function wppa_is_photo_modified( $id ) {
4694
  }
4695
 
4696
  $thumb = wppa_cache_photo( $id );
4697
- if ( ! $thumb ) { // Photo vanished?
4698
- return false;
4699
- }
4700
 
4701
  $cretime = $thumb['timestamp'];
4702
  $modtime = $thumb['modified'];
@@ -5756,26 +5750,40 @@ function wppa_get_lbtitle( $type, $id ) {
5756
  'nobpdomain' => wppa_opt( 'art_monkey_display' ) == 'button' && $do_download,
5757
  ) );
5758
 
5759
- $result = '';
5760
  if ( $do_download ) {
 
 
5761
  if ( wppa_opt( 'art_monkey_display' ) == 'button' ) {
5762
  $result .= '
 
 
 
 
5763
  <input
5764
  type="button"
5765
  title="' . __( 'Download', 'wp-photo-album-plus' ) . '"
5766
  style="cursor:pointer; margin-bottom:0px; max-width:500px;"
5767
- class="wppa-download-button wppa-ovl-button"
5768
- onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( ' . wppa( 'mocc' ) . ', \'' . wppa_encrypt_photo( $id ) . '\' );"
5769
- value="' . rtrim( __( 'Download', 'wp-photo-album-plus' ) . ' ' . $dl_name ) . '"
5770
- />';
 
 
 
 
5771
  }
5772
  else {
5773
  $result .= '
5774
  <a
 
 
5775
  title="' . __( 'Download', 'wp-photo-album-plus' ) . '"
5776
  style="cursor:pointer"
5777
- onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( '.wppa( 'mocc' ).', \''.wppa_encrypt_photo($id).'\' );"
5778
- >' .
 
 
5779
  rtrim( __( 'Download', 'wp-photo-album-plus' ) . ' ' . $dl_name ) . '
5780
  </a>';
5781
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.2.08.006
7
  *
8
  */
9
 
132
  wppa( 'photos_only', true );
133
  }
134
 
135
+ wppa( 'page', wppa_get( 'wppa-page', '1' ) );
136
 
137
  if ( wppa_get( 'superview' ) ) {
138
  $wppa_session['superview'] = wppa( 'is_slide' ) ? 'slide': 'thumbs';
3758
  if ( wppa( 'mocc' ) == wppa_get( 'occur', '1' ) ) {
3759
 
3760
  // page may be in qstring
3761
+ $curpage = wppa_get( 'wppa-page', '1' );
3762
  }
3763
  else {
3764
 
4675
  }
4676
 
4677
  $thumb = wppa_cache_photo( $id );
 
 
 
4678
 
4679
  $birthtime = $thumb['timestamp'];
4680
  $timnow = time();
4691
  }
4692
 
4693
  $thumb = wppa_cache_photo( $id );
 
 
 
4694
 
4695
  $cretime = $thumb['timestamp'];
4696
  $modtime = $thumb['modified'];
5750
  'nobpdomain' => wppa_opt( 'art_monkey_display' ) == 'button' && $do_download,
5751
  ) );
5752
 
5753
+ $result = '';
5754
  if ( $do_download ) {
5755
+ $dl_name = wppa_strip_ext( wppa_get_photo_name( $id ) ) . '.' . wppa_get_ext( wppa_get_photo_path( $id ) );
5756
+ $dl_url = wppa_switch( 'artmonkey_use_source' ) ? wppa_get_hires_url( $id ) : wppa_get_photo_url( $id );
5757
  if ( wppa_opt( 'art_monkey_display' ) == 'button' ) {
5758
  $result .= '
5759
+ <a
5760
+ href="' . $dl_url . '"
5761
+ download="' . $dl_name . '"
5762
+ >
5763
  <input
5764
  type="button"
5765
  title="' . __( 'Download', 'wp-photo-album-plus' ) . '"
5766
  style="cursor:pointer; margin-bottom:0px; max-width:500px;"
5767
+ class="wppa-download-button wppa-ovl-button"' .
5768
+
5769
+
5770
+ // onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( ' . wppa( 'mocc' ) . ', \'' . wppa_encrypt_photo( $id ) . '\' );"
5771
+
5772
+ ' value="' . rtrim( __( 'Download', 'wp-photo-album-plus' ) . ' ' . $dl_name ) . '"
5773
+ />
5774
+ </a>';
5775
  }
5776
  else {
5777
  $result .= '
5778
  <a
5779
+ href="' . $dl_url . '"
5780
+ download="' . $dl_name . '"
5781
  title="' . __( 'Download', 'wp-photo-album-plus' ) . '"
5782
  style="cursor:pointer"
5783
+ >'.
5784
+
5785
+ // onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( '.wppa( 'mocc' ).', \''.wppa_encrypt_photo($id).'\' );"
5786
+ // >' .
5787
  rtrim( __( 'Download', 'wp-photo-album-plus' ) . ' ' . $dl_name ) . '
5788
  </a>';
5789
  }
wppa-gutenberg-wppa.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-gutenberg-wppa.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
- * Version 8.3.01.001
6
  */
7
 
8
  function wppa_gutenberg_wppa_block() {
@@ -98,7 +98,7 @@ global $wpdb;
98
  <option value="" selected disabled style="color:#700 !important;">-- ' . __( 'Please select a gallery type', 'wp-photo-album-plus' ) . ' --</option>
99
  <option value="cover">' . __( 'The cover(s) of specific album(s)', 'wp-photo-album-plus' ) . '</option>
100
  <option value="content">' . __( 'The content of specific album(s)', 'wp-photo-album-plus' ) . '</option>
101
- <option value="covers">' . __( 'The covers of the sub albums of specific album(s)', 'wp-photo-album-plus' ) . '</option>
102
  <option value="thumbs">' . __( 'The thumbnails of specific album(s)', 'wp-photo-album-plus' ) . '</option>
103
  </select>
104
  </td>
2
  /* wppa-gutenberg-wppa.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
+ * Version 8.2.05.001
6
  */
7
 
8
  function wppa_gutenberg_wppa_block() {
98
  <option value="" selected disabled style="color:#700 !important;">-- ' . __( 'Please select a gallery type', 'wp-photo-album-plus' ) . ' --</option>
99
  <option value="cover">' . __( 'The cover(s) of specific album(s)', 'wp-photo-album-plus' ) . '</option>
100
  <option value="content">' . __( 'The content of specific album(s)', 'wp-photo-album-plus' ) . '</option>
101
+ <option value="covers">' . __( 'The covers of the subalbums of specific album(s)', 'wp-photo-album-plus' ) . '</option>
102
  <option value="thumbs">' . __( 'The thumbnails of specific album(s)', 'wp-photo-album-plus' ) . '</option>
103
  </select>
104
  </td>
wppa-help.php CHANGED
@@ -3,7 +3,7 @@
3
  * Pachkage: wp-photo-album-plus
4
  *
5
  * admin help page
6
- * version 8.3.01.001
7
  */
8
 
9
  function _wppa_page_help() {
@@ -11,9 +11,7 @@ global $wppa_revno;
11
 
12
  $result = '
13
  <div class="wrap">
14
- <h1 style="display:inline;">' .
15
- get_admin_page_title() . '
16
- </h1>
17
  <h3>' . sprintf( __( 'You will find all information and examples on the new %s%s%s site', 'wp-photo-album-plus' ), '<a href="https://wppa.nl/" target="_blank" >', __( 'Docs & Demos', 'wp-photo-album-plus' ) , '</a>' ) . '</h3>
18
 
19
  <h3>' . __( 'About and credits', 'wp-photo-album-plus' ) . '</h3>
3
  * Pachkage: wp-photo-album-plus
4
  *
5
  * admin help page
6
+ * version 8.2.01.004
7
  */
8
 
9
  function _wppa_page_help() {
11
 
12
  $result = '
13
  <div class="wrap">
14
+
 
 
15
  <h3>' . sprintf( __( 'You will find all information and examples on the new %s%s%s site', 'wp-photo-album-plus' ), '<a href="https://wppa.nl/" target="_blank" >', __( 'Docs & Demos', 'wp-photo-album-plus' ) , '</a>' ) . '</h3>
16
 
17
  <h3>' . __( 'About and credits', 'wp-photo-album-plus' ) . '</h3>
wppa-import.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -197,11 +197,7 @@ global $wppa_session;
197
  }
198
 
199
  // Open the Form
200
- wppa_echo( '
201
- <div class="wrap">
202
- <h1>' .
203
- get_admin_page_title() . '
204
- </h1>' );
205
 
206
  // See if our depot dir has been created
207
  if ( ! wppa_is_dir( WPPA_DEPOT_PATH ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 8.2.07.002
7
  *
8
  */
9
 
197
  }
198
 
199
  // Open the Form
200
+ wppa_echo( '<div class="wrap"><h2>' . __( 'Import Photos', 'wp-photo-album-plus' ) . '</h2>' );
 
 
 
 
201
 
202
  // See if our depot dir has been created
203
  if ( ! wppa_is_dir( WPPA_DEPOT_PATH ) ) {
wppa-init.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
- * Version 8.3.01.001
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
@@ -461,7 +461,7 @@ global $_gallery;
461
 
462
  $wppa_album_gallery_texts_albums = array(
463
  __( 'of the album', 'wp-photo-album-plus' ),
464
- __( 'Renew album', 'wp-photo-album-plus' ),
465
  __( 'renew album', 'wp-photo-album-plus' ),
466
  __( 'A new album', 'wp-photo-album-plus' ),
467
  __( 'This album', 'wp-photo-album-plus' ),
@@ -484,7 +484,7 @@ global $_gallery;
484
 
485
  $wppa_album_gallery_texts_gallery = array(
486
  __( 'of the gallery', 'wp-photo-album-plus' ),
487
- __( 'Renew gallery', 'wp-photo-album-plus' ),
488
  __( 'renew gallery', 'wp-photo-album-plus' ),
489
  __( 'A new gallery', 'wp-photo-album-plus' ),
490
  __( 'This gallery', 'wp-photo-album-plus' ),
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
+ * Version 8.2.08.001
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
461
 
462
  $wppa_album_gallery_texts_albums = array(
463
  __( 'of the album', 'wp-photo-album-plus' ),
464
+ __( 'Renew Album', 'wp-photo-album-plus' ),
465
  __( 'renew album', 'wp-photo-album-plus' ),
466
  __( 'A new album', 'wp-photo-album-plus' ),
467
  __( 'This album', 'wp-photo-album-plus' ),
484
 
485
  $wppa_album_gallery_texts_gallery = array(
486
  __( 'of the gallery', 'wp-photo-album-plus' ),
487
+ __( 'Renew Gallery', 'wp-photo-album-plus' ),
488
  __( 'renew gallery', 'wp-photo-album-plus' ),
489
  __( 'A new gallery', 'wp-photo-album-plus' ),
490
  __( 'This gallery', 'wp-photo-album-plus' ),
wppa-input.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -58,7 +58,7 @@ function wppa_get_get_filter( $name ) {
58
  case 'comten':
59
  case 'featen':
60
  case 'relcount':
61
- case 'paged':
62
  case 'page_id':
63
  case 'size':
64
  case 'fromp':
@@ -238,7 +238,6 @@ function wppa_get_get_filter( $name ) {
238
  case 'shortcode':
239
  case 'subsearch':
240
  case 'rootsearch':
241
- case 'page':
242
  $result = 'text';
243
  break;
244
 
@@ -291,6 +290,14 @@ global $wpdb;
291
  $default = $default ? sanitize_text_field( $default ) : false;
292
  $filter = sanitize_text_field( $filter );
293
 
 
 
 
 
 
 
 
 
294
  // Ajax call ?
295
  if ( $xname == 'wppa-action' ) {
296
  if ( isset( $_REQUEST['wppa-action'] ) ) {
@@ -299,6 +306,14 @@ global $wpdb;
299
  else return $default;
300
  }
301
 
 
 
 
 
 
 
 
 
302
  // Normalize $name and $xname
303
  if ( substr( $xname, 0, 5 ) == 'wppa-' ) {
304
  $name = substr( $xname, 5 );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
58
  case 'comten':
59
  case 'featen':
60
  case 'relcount':
61
+ case 'page':
62
  case 'page_id':
63
  case 'size':
64
  case 'fromp':
238
  case 'shortcode':
239
  case 'subsearch':
240
  case 'rootsearch':
 
241
  $result = 'text';
242
  break;
243
 
290
  $default = $default ? sanitize_text_field( $default ) : false;
291
  $filter = sanitize_text_field( $filter );
292
 
293
+ // Check for wppa page no first
294
+ if ( $xname == 'wppa-page' ) {
295
+ if ( isset( $_REQUEST['wppa-page'] ) ) {
296
+ return strval( intval( $_REQUEST['wppa-page'] ) );
297
+ }
298
+ else return $default;
299
+ }
300
+
301
  // Ajax call ?
302
  if ( $xname == 'wppa-action' ) {
303
  if ( isset( $_REQUEST['wppa-action'] ) ) {
306
  else return $default;
307
  }
308
 
309
+ // Admin page ?
310
+ if ( $xname == 'page' ) {
311
+ if ( isset( $_REQUEST['page'] ) ) {
312
+ return sanitize_text_field( $_REQUEST['page'] );
313
+ }
314
+ else return $default;
315
+ }
316
+
317
  // Normalize $name and $xname
318
  if ( substr( $xname, 0, 5 ) == 'wppa-' ) {
319
  $name = substr( $xname, 5 );
wppa-lasten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the last uploaded photos
6
- * Version 8.3.01.001
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
@@ -233,8 +233,8 @@ class LasTenWidget extends WP_Widget {
233
  // Album enumeration
234
  wppa_widget_input( $this, 'albumenum', $instance['albumenum'], __( 'Albums', 'wp-photo-album-plus' ), __( 'Select --- multiple see below --- in the Album selection box. Then enter album numbers seperated by commas', 'wp-photo-album-plus' ) );
235
 
236
- // Include sub albums
237
- wppa_widget_checkbox( $this, 'includesubs', $instance['includesubs'], __( 'Include sub albums', 'wp-photo-album-plus' ) );
238
 
239
  // Display type
240
  $options = array( __( 'thumbnail images', 'wp-photo-album-plus' ),
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the last uploaded photos
6
+ * Version 8.2.05.002
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
233
  // Album enumeration
234
  wppa_widget_input( $this, 'albumenum', $instance['albumenum'], __( 'Albums', 'wp-photo-album-plus' ), __( 'Select --- multiple see below --- in the Album selection box. Then enter album numbers seperated by commas', 'wp-photo-album-plus' ) );
235
 
236
+ // Include subalbums
237
+ wppa_widget_checkbox( $this, 'includesubs', $instance['includesubs'], __( 'Include subalbums', 'wp-photo-album-plus' ) );
238
 
239
  // Display type
240
  $options = array( __( 'thumbnail images', 'wp-photo-album-plus' ),
wppa-links.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Frontend links
6
  *
7
- * Version 8.3.01.001
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -360,7 +360,7 @@ function wppa_convert_from_pretty( $uri ) {
360
  // process 'arguments'
361
  if ( is_array( $args ) && count( $args ) > 0 ) {
362
  $first = true;
363
- $possible_conflicts = array( 'paged=' );
364
 
365
  foreach ( $args as $arg ) {
366
  if ( $first ) $newuri .= '?'; else $newuri .= '&';
@@ -383,7 +383,7 @@ function wppa_convert_from_pretty( $uri ) {
383
  $deltauri = 'wppa-occur=';
384
  break;
385
  case 'pg':
386
- $deltauri = 'paged=';
387
  break;
388
  case 'ss':
389
  $deltauri = 'wppa-searchstring=';
@@ -1104,7 +1104,7 @@ global $previous_page_last_id;
1104
  <a' .
1105
  ' style="cursor:pointer"' .
1106
  ' title="' . esc_attr( __( 'Previous page', 'wp-photo-album-plus' ) ) . '"' .
1107
- ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . ( $curpage - 1 ) . '\', \'' . wppa_convert_to_pretty ( $link_url . '&amp;paged=' . ( $curpage - 1 ) ) . '\' )"' .
1108
  ' >' .
1109
  wppa_get_svghtml( 'Prev-Button', $iconsize ) .
1110
  '</a>
@@ -1119,7 +1119,7 @@ global $previous_page_last_id;
1119
  ' id="wppa-next-pagelink-' . $mocc . '"' .
1120
  ' style="cursor:pointer"' .
1121
  ' title="' . esc_attr( __( 'Next page', 'wp-photo-album-plus' ) ) . '"' .
1122
- ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . ( $curpage + 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=' . ( $curpage + 1 ) ) . '\')"' .
1123
  ' >' .
1124
  wppa_get_svghtml( 'Next-Button', $iconsize ) .
1125
  '</a>
@@ -1150,7 +1150,7 @@ global $previous_page_last_id;
1150
  '<a' .
1151
  ' id="wppa-pagelink-' . $mocc . '-' . $i . '"' .
1152
  ' style="cursor:pointer"' .
1153
- ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . $i . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=' . $i ) . '\')"' .
1154
  ' >' .
1155
  '&nbsp;' . $i . '&nbsp;' .
1156
  '</a>';
@@ -1170,7 +1170,7 @@ global $previous_page_last_id;
1170
  $result .= '
1171
  <a
1172
  id="wppa-first-pagelink-' . $mocc . '"
1173
- onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=1\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=1' ) . '\')"
1174
  >
1175
  </a>
1176
  <a
@@ -1211,7 +1211,7 @@ global $previous_page_last_id;
1211
  </span>
1212
  <a
1213
  style="cursor:pointer"
1214
- onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . ( $curpage - 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=' . ( $curpage - 1 ) ) . '\')"
1215
  >' .
1216
  __( 'Previous', 'wp-photo-album-plus' ) . '
1217
  </a>
@@ -1225,7 +1225,7 @@ global $previous_page_last_id;
1225
  <a
1226
  id="wppa-next-pagelink-' . $mocc . '"
1227
  style="cursor:pointer"
1228
- onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . ( $curpage + 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=' . ( $curpage + 1 ) ) . '\')"
1229
  >' .
1230
  __( 'Next', 'wp-photo-album-plus' ) . '
1231
  </a>
@@ -1258,7 +1258,7 @@ global $previous_page_last_id;
1258
  <a
1259
  id="wppa-pagelink-' . $mocc . '-' . $i . '"
1260
  style="cursor:pointer"
1261
- onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=' . $i . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=' . $i ) . '\')"
1262
  >&nbsp;'.$i.'&nbsp;</a
1263
  >
1264
  </div>';
@@ -1274,7 +1274,7 @@ global $previous_page_last_id;
1274
  $result .= '
1275
  <a
1276
  id="wppa-first-pagelink-' . $mocc . '"
1277
- onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;paged=1\', \'' . wppa_convert_to_pretty( $link_url . '&amp;paged=1' ) . '\')"
1278
  >
1279
  </a>
1280
  <a
@@ -1310,7 +1310,7 @@ function wppa_album_download_link( $albumid ) {
1310
  class="wppa-album-cover-link"
1311
  title="' . esc_attr( __( 'Download', 'wp-photo-album-plus' ) ) . '"
1312
  >' .
1313
- __( 'Download album', 'wp-photo-album-plus' ) . '
1314
  </a>
1315
  <img
1316
  id="dwnspin-' . $mocc . '-' . wppa_encrypt_album( $albumid ) . '"
@@ -2118,7 +2118,7 @@ global $thumbs_ids;
2118
  $i++;
2119
  }
2120
  if ( $page > '1' ) {
2121
- $thumbhref .= '&amp;paged='.$page;
2122
  }
2123
  }
2124
 
4
  *
5
  * Frontend links
6
  *
7
+ * Version 8.2.05.002
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
360
  // process 'arguments'
361
  if ( is_array( $args ) && count( $args ) > 0 ) {
362
  $first = true;
363
+ $possible_conflicts = array( 'wppa-page=' );
364
 
365
  foreach ( $args as $arg ) {
366
  if ( $first ) $newuri .= '?'; else $newuri .= '&';
383
  $deltauri = 'wppa-occur=';
384
  break;
385
  case 'pg':
386
+ $deltauri = 'wppa-page=';
387
  break;
388
  case 'ss':
389
  $deltauri = 'wppa-searchstring=';
1104
  <a' .
1105
  ' style="cursor:pointer"' .
1106
  ' title="' . esc_attr( __( 'Previous page', 'wp-photo-album-plus' ) ) . '"' .
1107
+ ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . ( $curpage - 1 ) . '\', \'' . wppa_convert_to_pretty ( $link_url . '&amp;wppa-page=' . ( $curpage - 1 ) ) . '\' )"' .
1108
  ' >' .
1109
  wppa_get_svghtml( 'Prev-Button', $iconsize ) .
1110
  '</a>
1119
  ' id="wppa-next-pagelink-' . $mocc . '"' .
1120
  ' style="cursor:pointer"' .
1121
  ' title="' . esc_attr( __( 'Next page', 'wp-photo-album-plus' ) ) . '"' .
1122
+ ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . ( $curpage + 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=' . ( $curpage + 1 ) ) . '\')"' .
1123
  ' >' .
1124
  wppa_get_svghtml( 'Next-Button', $iconsize ) .
1125
  '</a>
1150
  '<a' .
1151
  ' id="wppa-pagelink-' . $mocc . '-' . $i . '"' .
1152
  ' style="cursor:pointer"' .
1153
+ ' onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . $i . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=' . $i ) . '\')"' .
1154
  ' >' .
1155
  '&nbsp;' . $i . '&nbsp;' .
1156
  '</a>';
1170
  $result .= '
1171
  <a
1172
  id="wppa-first-pagelink-' . $mocc . '"
1173
+ onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=1\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=1' ) . '\')"
1174
  >
1175
  </a>
1176
  <a
1211
  </span>
1212
  <a
1213
  style="cursor:pointer"
1214
+ onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . ( $curpage - 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=' . ( $curpage - 1 ) ) . '\')"
1215
  >' .
1216
  __( 'Previous', 'wp-photo-album-plus' ) . '
1217
  </a>
1225
  <a
1226
  id="wppa-next-pagelink-' . $mocc . '"
1227
  style="cursor:pointer"
1228
+ onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . ( $curpage + 1 ) . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=' . ( $curpage + 1 ) ) . '\')"
1229
  >' .
1230
  __( 'Next', 'wp-photo-album-plus' ) . '
1231
  </a>
1258
  <a
1259
  id="wppa-pagelink-' . $mocc . '-' . $i . '"
1260
  style="cursor:pointer"
1261
+ onclick="wppaDoAjaxRender(' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=' . $i . '\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=' . $i ) . '\')"
1262
  >&nbsp;'.$i.'&nbsp;</a
1263
  >
1264
  </div>';
1274
  $result .= '
1275
  <a
1276
  id="wppa-first-pagelink-' . $mocc . '"
1277
+ onclick="wppaDoAjaxRender( ' . wppa( 'mocc' ) . ', \'' . $ajax_url . '&amp;wppa-page=1\', \'' . wppa_convert_to_pretty( $link_url . '&amp;wppa-page=1' ) . '\')"
1278
  >
1279
  </a>
1280
  <a
1310
  class="wppa-album-cover-link"
1311
  title="' . esc_attr( __( 'Download', 'wp-photo-album-plus' ) ) . '"
1312
  >' .
1313
+ __( 'Download Album', 'wp-photo-album-plus' ) . '
1314
  </a>
1315
  <img
1316
  id="dwnspin-' . $mocc . '-' . wppa_encrypt_album( $albumid ) . '"
2118
  $i++;
2119
  }
2120
  if ( $page > '1' ) {
2121
+ $thumbhref .= '&amp;wppa-page='.$page;
2122
  }
2123
  }
2124
 
wppa-listtable.php DELETED
@@ -1,1320 +0,0 @@
1
- <?php
2
- /* wppa-listtable.php
3
- * Package: wp-photo-album-plus
4
- *
5
- * Copy of wp version
6
- * Modified by OpaJaap
7
- * Version 8.3.01.003
8
- *
9
- */
10
-
11
-
12
- class WPPA_List_Table {
13
-
14
- public $items;
15
- protected $_args;
16
- protected $_pagination_args = array();
17
- private $_actions;
18
- private $_pagination;
19
- protected $modes = array();
20
- protected $_column_headers;
21
- protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
22
- protected $compat_methods = array(
23
- 'set_pagination_args',
24
- 'get_views',
25
- 'get_bulk_actions',
26
- 'bulk_actions',
27
- 'row_actions',
28
- 'months_dropdown',
29
- 'view_switcher',
30
- 'comments_bubble',
31
- 'get_items_per_page',
32
- 'pagination',
33
- 'get_sortable_columns',
34
- 'get_column_info',
35
- 'get_table_classes',
36
- 'display_tablenav',
37
- 'extra_tablenav',
38
- 'single_row_columns',
39
- );
40
-
41
- public function __construct( $args = array() ) {
42
- $args = wp_parse_args(
43
- $args,
44
- array(
45
- 'plural' => '',
46
- 'singular' => '',
47
- 'ajax' => false,
48
- 'screen' => null,
49
- )
50
- );
51
-
52
- $this->screen = convert_to_screen( $args['screen'] );
53
-
54
- add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
55
-
56
- if ( ! $args['plural'] ) {
57
- $args['plural'] = $this->screen->base;
58
- }
59
-
60
- $args['plural'] = sanitize_key( $args['plural'] );
61
- $args['singular'] = sanitize_key( $args['singular'] );
62
-
63
- $this->_args = $args;
64
-
65
- if ( $args['ajax'] ) {
66
- // wp_enqueue_script( 'list-table' );
67
- add_action( 'admin_footer', array( $this, '_js_vars' ) );
68
- }
69
-
70
- if ( empty( $this->modes ) ) {
71
- $this->modes = array(
72
- 'list' => ( 'Compact view' ),
73
- 'excerpt' => ( 'Extended view' ),
74
- );
75
- }
76
- }
77
-
78
- // Make private properties readable for backward compatibility.
79
- public function __get( $name ) {
80
- if ( in_array( $name, $this->compat_fields, true ) ) {
81
- return $this->$name;
82
- }
83
- }
84
-
85
- // Make private properties settable for backward compatibility.
86
- public function __set( $name, $value ) {
87
- if ( in_array( $name, $this->compat_fields, true ) ) {
88
- return $this->$name = $value;
89
- }
90
- }
91
-
92
- // Make private properties checkable for backward compatibility.
93
- public function __isset( $name ) {
94
- if ( in_array( $name, $this->compat_fields, true ) ) {
95
- return isset( $this->$name );
96
- }
97
-
98
- return false;
99
- }
100
-
101
- // Make private properties un-settable for backward compatibility.
102
- public function __unset( $name ) {
103
- if ( in_array( $name, $this->compat_fields, true ) ) {
104
- unset( $this->$name );
105
- }
106
- }
107
-
108
- // Make private/protected methods readable for backward compatibility.
109
- public function __call( $name, $arguments ) {
110
- if ( in_array( $name, $this->compat_methods, true ) ) {
111
- return $this->$name( ...$arguments );
112
- }
113
- return false;
114
- }
115
-
116
- // Checks the current user's permissions
117
- public function ajax_user_can() {
118
- die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' );
119
- }
120
-
121
- // Prepares the list of items for displaying.
122
- public function prepare_items() {
123
- die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' );
124
- }
125
-
126
- // An internal method that sets all the necessary pagination arguments
127
- protected function set_pagination_args( $args ) {
128
- $args = wp_parse_args(
129
- $args,
130
- array(
131
- 'total_items' => 0,
132
- 'total_pages' => 0,
133
- 'per_page' => 0,
134
- )
135
- );
136
-
137
- if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
138
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
139
- }
140
-
141
- // Redirect if page number is invalid and headers are not already sent.
142
- if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
143
- wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
144
- exit;
145
- }
146
-
147
- $this->_pagination_args = $args;
148
- }
149
-
150
- // Access the pagination args.
151
- public function get_pagination_arg( $key ) {
152
- if ( 'page' === $key ) {
153
- return $this->get_pagenum();
154
- }
155
-
156
- if ( isset( $this->_pagination_args[ $key ] ) ) {
157
- return $this->_pagination_args[ $key ];
158
- }
159
-
160
- return 0;
161
- }
162
-
163
- // Whether the table has items to display or not
164
- public function has_items() {
165
- return ! empty( $this->items );
166
- }
167
-
168
- // Message to be displayed when there are no items
169
- public function no_items() {
170
- _e( 'No items found.' );
171
- }
172
-
173
- // Displays the search box.
174
- public function search_box( $text, $input_id ) {
175
- if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
176
- return;
177
- }
178
-
179
- $input_id = $input_id . '-search-input';
180
-
181
- if ( ! empty( $_REQUEST['orderby'] ) ) {
182
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
183
- }
184
- if ( ! empty( $_REQUEST['order'] ) ) {
185
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
186
- }
187
- if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
188
- echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
189
- }
190
- if ( ! empty( $_REQUEST['detached'] ) ) {
191
- echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
192
- }
193
- ?>
194
- <p class="search-box">
195
- <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
196
- <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
197
- <?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
198
- </p>
199
- <?php
200
- }
201
-
202
- // Generates views links.
203
- protected function get_views_links( $link_data = array() ) {
204
- if ( ! is_array( $link_data ) ) {
205
- _doing_it_wrong(
206
- __METHOD__,
207
- sprintf(
208
- /* translators: %s: The $link_data argument. */
209
- ( 'The %s argument must be an array.' ),
210
- '<code>$link_data</code>'
211
- ),
212
- '6.1.0'
213
- );
214
-
215
- return array( '' );
216
- }
217
-
218
- $views_links = array();
219
-
220
- foreach ( $link_data as $view => $link ) {
221
- if ( empty( $link['url'] ) || ! is_string( $link['url'] ) || '' === trim( $link['url'] ) ) {
222
- _doing_it_wrong(
223
- __METHOD__,
224
- sprintf(
225
- /* translators: %1$s: The argument name. %2$s: The view name. */
226
- ( 'The %1$s argument must be a non-empty string for %2$s.' ),
227
- '<code>url</code>',
228
- '<code>' . esc_html( $view ) . '</code>'
229
- ),
230
- '6.1.0'
231
- );
232
-
233
- continue;
234
- }
235
-
236
- if ( empty( $link['label'] ) || ! is_string( $link['label'] ) || '' === trim( $link['label'] ) ) {
237
- _doing_it_wrong(
238
- __METHOD__,
239
- sprintf(
240
- /* translators: %1$s: The argument name. %2$s: The view name. */
241
- ( 'The %1$s argument must be a non-empty string for %2$s.' ),
242
- '<code>label</code>',
243
- '<code>' . esc_html( $view ) . '</code>'
244
- ),
245
- '6.1.0'
246
- );
247
-
248
- continue;
249
- }
250
-
251
- $views_links[ $view ] = sprintf(
252
- '<a href="%s"%s>%s</a>',
253
- esc_url( $link['url'] ),
254
- isset( $link['current'] ) && true === $link['current'] ? ' class="current" aria-current="page"' : '',
255
- $link['label']
256
- );
257
- }
258
-
259
- return $views_links;
260
- }
261
-
262
- // Gets the list of views available on this table.
263
- protected function get_views() {
264
- return array();
265
- }
266
-
267
- // Displays the list of views available on this table.
268
- public function views() {
269
- $views = $this->get_views();
270
- /**
271
- * Filters the list of available list table views.
272
- *
273
- * The dynamic portion of the hook name, `$this->screen->id`, refers
274
- * to the ID of the current screen.
275
- *
276
- * @since 3.1.0
277
- *
278
- * @param string[] $views An array of available list table views.
279
- */
280
- $views = apply_filters( "views_{$this->screen->id}", $views );
281
-
282
- if ( empty( $views ) ) {
283
- return;
284
- }
285
-
286
- $this->screen->render_screen_reader_content( 'heading_views' );
287
-
288
- echo "<ul class='subsubsub'>\n";
289
- foreach ( $views as $class => $view ) {
290
- $views[ $class ] = "\t<li class='$class'>$view";
291
- }
292
- echo implode( " |</li>\n", $views ) . "</li>\n";
293
- echo '</ul>';
294
- }
295
-
296
- // Retrieves the list of bulk actions available for this table.
297
- protected function get_bulk_actions() {
298
- return array();
299
- }
300
-
301
- // Displays the bulk actions dropdown.
302
- protected function bulk_actions( $which = '' ) {
303
- if ( is_null( $this->_actions ) ) {
304
- $this->_actions = $this->get_bulk_actions();
305
-
306
- /**
307
- * Filters the items in the bulk actions menu of the list table.
308
- *
309
- * The dynamic portion of the hook name, `$this->screen->id`, refers
310
- * to the ID of the current screen.
311
- *
312
- * @since 3.1.0
313
- * @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup.
314
- *
315
- * @param array $actions An array of the available bulk actions.
316
- */
317
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
318
-
319
- $two = '';
320
- } else {
321
- $two = '2';
322
- }
323
-
324
- if ( empty( $this->_actions ) ) {
325
- return;
326
- }
327
-
328
- echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . ( 'Select bulk action' ) . '</label>';
329
- echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
330
- echo '<option value="-1">' . ( 'Bulk actions' ) . "</option>\n";
331
-
332
- foreach ( $this->_actions as $key => $value ) {
333
- if ( is_array( $value ) ) {
334
- echo "\t" . '<optgroup label="' . esc_attr( $key ) . '">' . "\n";
335
-
336
- foreach ( $value as $name => $title ) {
337
- $class = ( 'edit' === $name ) ? ' class="hide-if-no-js"' : '';
338
-
339
- echo "\t\t" . '<option value="' . esc_attr( $name ) . '"' . $class . '>' . $title . "</option>\n";
340
- }
341
- echo "\t" . "</optgroup>\n";
342
- } else {
343
- $class = ( 'edit' === $key ) ? ' class="hide-if-no-js"' : '';
344
-
345
- echo "\t" . '<option value="' . esc_attr( $key ) . '"' . $class . '>' . $value . "</option>\n";
346
- }
347
- }
348
-
349
- echo "</select>\n";
350
-
351
- submit_button( ( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
352
- echo "\n";
353
- }
354
-
355
- // Gets the current action selected from the bulk actions dropdown.
356
- public function current_action() {
357
- if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
358
- return false;
359
- }
360
-
361
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
362
- return $_REQUEST['action'];
363
- }
364
-
365
- return false;
366
- }
367
-
368
- // Generates the required HTML for a list of row action links.
369
- protected function row_actions( $actions, $always_visible = false ) {
370
- $action_count = count( $actions );
371
-
372
- if ( ! $action_count ) {
373
- return '';
374
- }
375
-
376
- $mode = get_user_setting( 'posts_list_mode', 'list' );
377
-
378
- if ( 'excerpt' === $mode ) {
379
- $always_visible = true;
380
- }
381
-
382
- $output = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
383
-
384
- $i = 0;
385
-
386
- foreach ( $actions as $action => $link ) {
387
- ++$i;
388
-
389
- $separator = ( $i < $action_count ) ? ' | ' : '';
390
-
391
- $output .= "<span class='$action'>{$link}{$separator}</span>";
392
- }
393
-
394
- $output .= '</div>';
395
-
396
- $output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . ( 'Show more details' ) . '</span></button>';
397
-
398
- return $output;
399
- }
400
-
401
- // Displays a dropdown for filtering items in the list table by month.
402
- protected function months_dropdown( $post_type ) {
403
- global $wpdb, $wp_locale;
404
-
405
- /**
406
- * Filters whether to remove the 'Months' drop-down from the post list table.
407
- *
408
- * @since 4.2.0
409
- *
410
- * @param bool $disable Whether to disable the drop-down. Default false.
411
- * @param string $post_type The post type.
412
- */
413
- if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
414
- return;
415
- }
416
-
417
- /**
418
- * Filters whether to short-circuit performing the months dropdown query.
419
- *
420
- * @since 5.7.0
421
- *
422
- * @param object[]|false $months 'Months' drop-down results. Default false.
423
- * @param string $post_type The post type.
424
- */
425
- $months = apply_filters( 'pre_months_dropdown_query', false, $post_type );
426
-
427
- if ( ! is_array( $months ) ) {
428
- $extra_checks = "AND post_status != 'auto-draft'";
429
- if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
430
- $extra_checks .= " AND post_status != 'trash'";
431
- } elseif ( isset( $_GET['post_status'] ) ) {
432
- $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
433
- }
434
-
435
- $months = $wpdb->get_results(
436
- $wpdb->prepare(
437
- "
438
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
439
- FROM $wpdb->posts
440
- WHERE post_type = %s
441
- $extra_checks
442
- ORDER BY post_date DESC
443
- ",
444
- $post_type
445
- )
446
- );
447
- }
448
-
449
- /**
450
- * Filters the 'Months' drop-down results.
451
- *
452
- * @since 3.7.0
453
- *
454
- * @param object[] $months Array of the months drop-down query results.
455
- * @param string $post_type The post type.
456
- */
457
- $months = apply_filters( 'months_dropdown_results', $months, $post_type );
458
-
459
- $month_count = count( $months );
460
-
461
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
462
- return;
463
- }
464
-
465
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
466
- ?>
467
- <label for="filter-by-date" class="screen-reader-text"><?php echo get_post_type_object( $post_type )->labels->filter_by_date; ?></label>
468
- <select name="m" id="filter-by-date">
469
- <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
470
- <?php
471
- foreach ( $months as $arc_row ) {
472
- if ( 0 == $arc_row->year ) {
473
- continue;
474
- }
475
-
476
- $month = zeroise( $arc_row->month, 2 );
477
- $year = $arc_row->year;
478
-
479
- printf(
480
- "<option %s value='%s'>%s</option>\n",
481
- selected( $m, $year . $month, false ),
482
- esc_attr( $arc_row->year . $month ),
483
- /* translators: 1: Month name, 2: 4-digit year. */
484
- sprintf( ( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
485
- );
486
- }
487
- ?>
488
- </select>
489
- <?php
490
- }
491
-
492
- // Displays a view switcher.
493
- protected function view_switcher( $current_mode ) {
494
- ?>
495
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
496
- <div class="view-switch">
497
- <?php
498
- foreach ( $this->modes as $mode => $title ) {
499
- $classes = array( 'view-' . $mode );
500
- $aria_current = '';
501
-
502
- if ( $current_mode === $mode ) {
503
- $classes[] = 'current';
504
- $aria_current = ' aria-current="page"';
505
- }
506
-
507
- printf(
508
- "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
509
- esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ),
510
- implode( ' ', $classes ),
511
- $title
512
- );
513
- }
514
- ?>
515
- </div>
516
- <?php
517
- }
518
-
519
- // Displays a comment count bubble.
520
- protected function comments_bubble( $post_id, $pending_comments ) {
521
- $approved_comments = get_comments_number();
522
-
523
- $approved_comments_number = number_format_i18n( $approved_comments );
524
- $pending_comments_number = number_format_i18n( $pending_comments );
525
-
526
- $approved_only_phrase = sprintf(
527
- /* translators: %s: Number of comments. */
528
- _n( '%s comment', '%s comments', $approved_comments ),
529
- $approved_comments_number
530
- );
531
-
532
- $approved_phrase = sprintf(
533
- /* translators: %s: Number of comments. */
534
- _n( '%s approved comment', '%s approved comments', $approved_comments ),
535
- $approved_comments_number
536
- );
537
-
538
- $pending_phrase = sprintf(
539
- /* translators: %s: Number of comments. */
540
- _n( '%s pending comment', '%s pending comments', $pending_comments ),
541
- $pending_comments_number
542
- );
543
-
544
- if ( ! $approved_comments && ! $pending_comments ) {
545
- // No comments at all.
546
- printf(
547
- '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
548
- ( 'No comments' )
549
- );
550
- } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
551
- // Don't link the comment bubble for a trashed post.
552
- printf(
553
- '<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
554
- $approved_comments_number,
555
- $pending_comments ? $approved_phrase : $approved_only_phrase
556
- );
557
- } elseif ( $approved_comments ) {
558
- // Link the comment bubble to approved comments.
559
- printf(
560
- '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
561
- esc_url(
562
- add_query_arg(
563
- array(
564
- 'p' => $post_id,
565
- 'comment_status' => 'approved',
566
- ),
567
- admin_url( 'edit-comments.php' )
568
- )
569
- ),
570
- $approved_comments_number,
571
- $pending_comments ? $approved_phrase : $approved_only_phrase
572
- );
573
- } else {
574
- // Don't link the comment bubble when there are no approved comments.
575
- printf(
576
- '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
577
- $approved_comments_number,
578
- $pending_comments ? ( 'No approved comments' ) : ( 'No comments' )
579
- );
580
- }
581
-
582
- if ( $pending_comments ) {
583
- printf(
584
- '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
585
- esc_url(
586
- add_query_arg(
587
- array(
588
- 'p' => $post_id,
589
- 'comment_status' => 'moderated',
590
- ),
591
- admin_url( 'edit-comments.php' )
592
- )
593
- ),
594
- $pending_comments_number,
595
- $pending_phrase
596
- );
597
- } else {
598
- printf(
599
- '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
600
- $pending_comments_number,
601
- $approved_comments ? ( 'No pending comments' ) : ( 'No comments' )
602
- );
603
- }
604
- }
605
-
606
- // Gets the current page number.
607
- public function get_pagenum() {
608
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
609
-
610
- if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
611
- $pagenum = $this->_pagination_args['total_pages'];
612
- }
613
-
614
- return max( 1, $pagenum );
615
- }
616
-
617
- // Gets the number of items to display on a single page.
618
- protected function get_items_per_page( $option, $default_value = 20 ) {
619
- $per_page = (int) get_user_option( $option );
620
- if ( empty( $per_page ) || $per_page < 1 ) {
621
- $per_page = $default_value;
622
- }
623
-
624
- /**
625
- * Filters the number of items to be displayed on each page of the list table.
626
- *
627
- * The dynamic hook name, `$option`, refers to the `per_page` option depending
628
- * on the type of list table in use. Possible filter names include:
629
- *
630
- * - `edit_comments_per_page`
631
- * - `sites_network_per_page`
632
- * - `site_themes_network_per_page`
633
- * - `themes_network_per_page'`
634
- * - `users_network_per_page`
635
- * - `edit_post_per_page`
636
- * - `edit_page_per_page'`
637
- * - `edit_{$post_type}_per_page`
638
- * - `edit_post_tag_per_page`
639
- * - `edit_category_per_page`
640
- * - `edit_{$taxonomy}_per_page`
641
- * - `site_users_network_per_page`
642
- * - `users_per_page`
643
- *
644
- * @since 2.9.0
645
- *
646
- * @param int $per_page Number of items to be displayed. Default 20.
647
- */
648
- return (int) apply_filters( "{$option}", $per_page );
649
- }
650
-
651
- /**
652
- * Displays the pagination.
653
- *
654
- * @since 3.1.0
655
- *
656
- * @param string $which
657
- */
658
- protected function pagination( $which ) {
659
- if ( empty( $this->_pagination_args ) ) {
660
- return;
661
- }
662
-
663
- $total_items = $this->_pagination_args['total_items'];
664
-
665
- // By opaJaap, if less than one full page of the smallest kind, ignore baging
666
- if ( $total_items < '21' ) {
667
- return;
668
- } // End mod
669
-
670
- $total_pages = $this->_pagination_args['total_pages'];
671
- $infinite_scroll = false;
672
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
673
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
674
- }
675
-
676
- if ( 'top' === $which && $total_pages > 1 ) {
677
- $this->screen->render_screen_reader_content( 'heading_pagination' );
678
- }
679
-
680
- $output = '<span class="displaying-num">' . sprintf(
681
- /* translators: %s: Number of items. */
682
- _n( '%s item', '%s items', $total_items ),
683
- number_format_i18n( $total_items )
684
- ) . '</span>';
685
-
686
- $current = $this->get_pagenum();
687
- $removable_query_args = wp_removable_query_args();
688
-
689
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
690
-
691
- $current_url = remove_query_arg( $removable_query_args, $current_url );
692
-
693
- $page_links = array();
694
-
695
- $total_pages_before = '<span class="paging-input">';
696
- $total_pages_after = '</span></span>';
697
-
698
- $disable_first = false;
699
- $disable_last = false;
700
- $disable_prev = false;
701
- $disable_next = false;
702
-
703
- if ( 1 == $current ) {
704
- $disable_first = true;
705
- $disable_prev = true;
706
- }
707
- if ( $total_pages == $current ) {
708
- $disable_last = true;
709
- $disable_next = true;
710
- }
711
-
712
- if ( $disable_first ) {
713
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
714
- } else {
715
- $page_links[] = sprintf(
716
- "<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
717
- esc_url( remove_query_arg( 'paged', $current_url ) ),
718
- ( 'First page' ),
719
- '&laquo;'
720
- );
721
- }
722
-
723
- if ( $disable_prev ) {
724
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>';
725
- } else {
726
- $page_links[] = sprintf(
727
- "<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
728
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
729
- ( 'Previous page' ),
730
- '&lsaquo;'
731
- );
732
- }
733
-
734
- if ( 'bottom' === $which ) {
735
- $html_current_page = $current;
736
- $total_pages_before = '<span class="screen-reader-text">' . ( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
737
- } else {
738
- $html_current_page = sprintf(
739
- "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
740
- '<label for="current-page-selector" class="screen-reader-text">' . ( 'Current Page' ) . '</label>',
741
- $current,
742
- strlen( $total_pages )
743
- );
744
- }
745
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
746
- $page_links[] = $total_pages_before . sprintf(
747
- /* translators: 1: Current page, 2: Total pages. */
748
- _x( '%1$s of %2$s', 'paging' ),
749
- $html_current_page,
750
- $html_total_pages
751
- ) . $total_pages_after;
752
-
753
- if ( $disable_next ) {
754
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>';
755
- } else {
756
- $page_links[] = sprintf(
757
- "<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
758
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
759
- ( 'Next page' ),
760
- '&rsaquo;'
761
- );
762
- }
763
-
764
- if ( $disable_last ) {
765
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&raquo;</span>';
766
- } else {
767
- $page_links[] = sprintf(
768
- "<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
769
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
770
- ( 'Last page' ),
771
- '&raquo;'
772
- );
773
- }
774
-
775
- $pagination_links_class = 'pagination-links';
776
- if ( ! empty( $infinite_scroll ) ) {
777
- $pagination_links_class .= ' hide-if-js';
778
- }
779
- $output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
780
-
781
- if ( $total_pages ) {
782
- $page_class = $total_pages < 2 ? ' one-page' : '';
783
- } else {
784
- $page_class = ' no-pages';
785
- }
786
-
787
- /**/
788
- // Added by OpaJaap: page size selector
789
- $ps = $this->_pagination_args['per_page']; // current pagesize
790
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
791
- $current_url = remove_query_arg( 'paged', $current_url );
792
- $output .= '
793
- <span>' . __( 'Page size', 'wp-photo-album-plus' ) . '
794
- <select
795
- style="margin-bottom:3px"
796
- onchange="jQuery( \'#wppa-admin-spinner\' ).show();document.location.href=\''.$current_url.'&paged=1&wppa-pagesize=\'+this.value;"
797
- >
798
- <option value="20" ' . ( $ps == '20' ? 'selected' : '' ) . '>20</option>
799
- <option value="50" ' . ( $ps == '50' ? 'selected' : '' ) . '>50</option>
800
- <option value="100" ' . ( $ps == '100' ? 'selected' : '' ) . '>100</option>
801
- <option value="200" ' . ( $ps == '200' ? 'selected' : '' ) . '>200</option>
802
- <option value="500" ' . ( $ps == '500' ? 'selected' : '' ) . '>500</option>
803
- <option value="1000" ' . ( $ps == '1000' ? 'selected' : '' ) . '>1000</option>
804
- </select>
805
- </span>';
806
- /**/
807
-
808
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
809
-
810
- echo $this->_pagination;
811
- }
812
-
813
- // Gets a list of columns.
814
- public function get_columns() {
815
- die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' );
816
- }
817
-
818
- // Gets a list of sortable columns.
819
- protected function get_sortable_columns() {
820
- return array();
821
- }
822
-
823
- // Gets the name of the default primary column.
824
- protected function get_default_primary_column_name() {
825
- $columns = $this->get_columns();
826
- $column = '';
827
-
828
- if ( empty( $columns ) ) {
829
- return $column;
830
- }
831
-
832
- // We need a primary defined so responsive views show something,
833
- // so let's fall back to the first non-checkbox column.
834
- foreach ( $columns as $col => $column_name ) {
835
- if ( 'cb' === $col ) {
836
- continue;
837
- }
838
-
839
- $column = $col;
840
- break;
841
- }
842
-
843
- return $column;
844
- }
845
-
846
- /**
847
- * Public wrapper for WP_List_Table::get_default_primary_column_name().
848
- *
849
- * @since 4.4.0
850
- *
851
- * @return string Name of the default primary column.
852
- */
853
- public function get_primary_column() {
854
- return $this->get_primary_column_name();
855
- }
856
-
857
- /**
858
- * Gets the name of the primary column.
859
- *
860
- * @since 4.3.0
861
- *
862
- * @return string The name of the primary column.
863
- */
864
- protected function get_primary_column_name() {
865
- $columns = get_column_headers( $this->screen );
866
- $default = $this->get_default_primary_column_name();
867
-
868
- // If the primary column doesn't exist,
869
- // fall back to the first non-checkbox column.
870
- if ( ! isset( $columns[ $default ] ) ) {
871
- $default = self::get_default_primary_column_name();
872
- }
873
-
874
- /**
875
- * Filters the name of the primary column for the current list table.
876
- *
877
- * @since 4.3.0
878
- *
879
- * @param string $default Column name default for the specific list table, e.g. 'name'.
880
- * @param string $context Screen ID for specific list table, e.g. 'plugins'.
881
- */
882
- $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
883
-
884
- if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
885
- $column = $default;
886
- }
887
-
888
- return $column;
889
- }
890
-
891
- /**
892
- * Gets a list of all, hidden, and sortable columns, with filter applied.
893
- *
894
- * @since 3.1.0
895
- *
896
- * @return array
897
- */
898
- protected function get_column_info() {
899
- // $_column_headers is already set / cached.
900
- if (
901
- isset( $this->_column_headers ) &&
902
- is_array( $this->_column_headers )
903
- ) {
904
- /*
905
- * Backward compatibility for `$_column_headers` format prior to WordPress 4.3.
906
- *
907
- * In WordPress 4.3 the primary column name was added as a fourth item in the
908
- * column headers property. This ensures the primary column name is included
909
- * in plugins setting the property directly in the three item format.
910
- */
911
- if ( 4 === count( $this->_column_headers ) ) {
912
- return $this->_column_headers;
913
- }
914
-
915
- $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
916
- foreach ( $this->_column_headers as $key => $value ) {
917
- $column_headers[ $key ] = $value;
918
- }
919
-
920
- $this->_column_headers = $column_headers;
921
-
922
- return $this->_column_headers;
923
- }
924
-
925
- $columns = get_column_headers( $this->screen );
926
- $hidden = get_hidden_columns( $this->screen );
927
-
928
- $sortable_columns = $this->get_sortable_columns();
929
- /**
930
- * Filters the list table sortable columns for a specific screen.
931
- *
932
- * The dynamic portion of the hook name, `$this->screen->id`, refers
933
- * to the ID of the current screen.
934
- *
935
- * @since 3.1.0
936
- *
937
- * @param array $sortable_columns An array of sortable columns.
938
- */
939
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
940
-
941
- $sortable = array();
942
- foreach ( $_sortable as $id => $data ) {
943
- if ( empty( $data ) ) {
944
- continue;
945
- }
946
-
947
- $data = (array) $data;
948
- if ( ! isset( $data[1] ) ) {
949
- $data[1] = false;
950
- }
951
-
952
- $sortable[ $id ] = $data;
953
- }
954
-
955
- $primary = $this->get_primary_column_name();
956
- $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
957
-
958
- return $this->_column_headers;
959
- }
960
-
961
- /**
962
- * Returns the number of visible columns.
963
- *
964
- * @since 3.1.0
965
- *
966
- * @return int
967
- */
968
- public function get_column_count() {
969
- list ( $columns, $hidden ) = $this->get_column_info();
970
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
971
- return count( $columns ) - count( $hidden );
972
- }
973
-
974
- /**
975
- * Prints column headers, accounting for hidden and sortable columns.
976
- *
977
- * @since 3.1.0
978
- *
979
- * @param bool $with_id Whether to set the ID attribute or not
980
- */
981
- public function print_column_headers( $with_id = true ) {
982
- list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
983
-
984
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
985
- $current_url = remove_query_arg( 'paged', $current_url );
986
-
987
- if ( isset( $_GET['orderby'] ) ) {
988
- $current_orderby = $_GET['orderby'];
989
- } else {
990
- $current_orderby = '';
991
- }
992
-
993
- if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
994
- $current_order = 'desc';
995
- } else {
996
- $current_order = 'asc';
997
- }
998
-
999
- if ( ! empty( $columns['cb'] ) ) {
1000
- static $cb_counter = 1;
1001
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . ( 'Select All' ) . '</label>'
1002
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1003
- $cb_counter++;
1004
- }
1005
-
1006
- foreach ( $columns as $column_key => $column_display_name ) {
1007
- $class = array( 'manage-column', "column-$column_key" );
1008
-
1009
- if ( in_array( $column_key, $hidden, true ) ) {
1010
- $class[] = 'hidden';
1011
- }
1012
-
1013
- if ( 'cb' === $column_key ) {
1014
- $class[] = 'check-column';
1015
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
1016
- $class[] = 'num';
1017
- }
1018
-
1019
- if ( $column_key === $primary ) {
1020
- $class[] = 'column-primary';
1021
- }
1022
-
1023
- if ( isset( $sortable[ $column_key ] ) ) {
1024
- list( $orderby, $desc_first ) = $sortable[ $column_key ];
1025
-
1026
- if ( $current_orderby === $orderby ) {
1027
- $order = 'asc' === $current_order ? 'desc' : 'asc';
1028
-
1029
- $class[] = 'sorted';
1030
- $class[] = $current_order;
1031
- } else {
1032
- $order = strtolower( $desc_first );
1033
-
1034
- if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) {
1035
- $order = $desc_first ? 'desc' : 'asc';
1036
- }
1037
-
1038
- $class[] = 'sortable';
1039
- $class[] = 'desc' === $order ? 'asc' : 'desc';
1040
- }
1041
-
1042
- $column_display_name = sprintf(
1043
- '<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
1044
- esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
1045
- $column_display_name
1046
- );
1047
- }
1048
-
1049
- $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
1050
- $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
1051
- $id = $with_id ? "id='$column_key'" : '';
1052
-
1053
- if ( ! empty( $class ) ) {
1054
- $class = "class='" . implode( ' ', $class ) . "'";
1055
- }
1056
-
1057
- echo "<$tag $scope $id $class>$column_display_name</$tag>";
1058
- }
1059
- }
1060
-
1061
- /**
1062
- * Displays the table.
1063
- *
1064
- * @since 3.1.0
1065
- */
1066
- public function display() {
1067
- $singular = $this->_args['singular'];
1068
-
1069
- $this->display_tablenav( 'top' );
1070
-
1071
- $this->screen->render_screen_reader_content( 'heading_list' );
1072
- ?>
1073
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1074
- <thead>
1075
- <tr>
1076
- <?php $this->print_column_headers(); ?>
1077
- </tr>
1078
- </thead>
1079
-
1080
- <tbody id="the-list"
1081
- <?php
1082
- if ( $singular ) {
1083
- echo " data-wp-lists='list:$singular'";
1084
- }
1085
- ?>
1086
- >
1087
- <?php $this->display_rows_or_placeholder(); ?>
1088
- </tbody>
1089
-
1090
- <tfoot>
1091
- <tr>
1092
- <?php $this->print_column_headers( false ); ?>
1093
- </tr>
1094
- </tfoot>
1095
-
1096
- </table>
1097
- <?php
1098
- $this->display_tablenav( 'bottom' );
1099
- }
1100
-
1101
- /**
1102
- * Gets a list of CSS classes for the WP_List_Table table tag.
1103
- *
1104
- * @since 3.1.0
1105
- *
1106
- * @return string[] Array of CSS classes for the table tag.
1107
- */
1108
- protected function get_table_classes() {
1109
- $mode = get_user_setting( 'posts_list_mode', 'list' );
1110
-
1111
- $mode_class = esc_attr( 'table-view-' . $mode );
1112
-
1113
- return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
1114
- }
1115
-
1116
- /**
1117
- * Generates the table navigation above or below the table
1118
- *
1119
- * @since 3.1.0
1120
- * @param string $which
1121
- */
1122
- protected function display_tablenav( $which ) {
1123
- if ( 'top' === $which ) {
1124
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1125
- }
1126
- ?>
1127
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
1128
-
1129
- <?php if ( $this->has_items() ) : ?>
1130
- <div class="alignleft actions bulkactions">
1131
- <?php $this->bulk_actions( $which ); ?>
1132
- </div>
1133
- <?php
1134
- endif;
1135
- $this->extra_tablenav( $which );
1136
- $this->pagination( $which );
1137
- ?>
1138
-
1139
- <br class="clear" />
1140
- </div>
1141
- <?php
1142
- }
1143
-
1144
- /**
1145
- * Extra controls to be displayed between bulk actions and pagination.
1146
- *
1147
- * @since 3.1.0
1148
- *
1149
- * @param string $which
1150
- */
1151
- protected function extra_tablenav( $which ) {}
1152
-
1153
- /**
1154
- * Generates the tbody element for the list table.
1155
- *
1156
- * @since 3.1.0
1157
- */
1158
- public function display_rows_or_placeholder() {
1159
- if ( $this->has_items() ) {
1160
- $this->display_rows();
1161
- } else {
1162
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1163
- $this->no_items();
1164
- echo '</td></tr>';
1165
- }
1166
- }
1167
-
1168
- /**
1169
- * Generates the table rows.
1170
- *
1171
- * @since 3.1.0
1172
- */
1173
- public function display_rows() {
1174
- foreach ( $this->items as $item ) {
1175
- $this->single_row( $item );
1176
- }
1177
- }
1178
-
1179
- /**
1180
- * Generates content for a single row of the table.
1181
- *
1182
- * @since 3.1.0
1183
- *
1184
- * @param object|array $item The current item
1185
- */
1186
- public function single_row( $item ) {
1187
- echo '<tr>';
1188
- $this->single_row_columns( $item );
1189
- echo '</tr>';
1190
- }
1191
-
1192
- /**
1193
- * @param object|array $item
1194
- * @param string $column_name
1195
- */
1196
- protected function column_default( $item, $column_name ) {}
1197
-
1198
- /**
1199
- * @param object|array $item
1200
- */
1201
- protected function column_cb( $item ) {}
1202
-
1203
- /**
1204
- * Generates the columns for a single row of the table.
1205
- *
1206
- * @since 3.1.0
1207
- *
1208
- * @param object|array $item The current item.
1209
- */
1210
- protected function single_row_columns( $item ) {
1211
- list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1212
-
1213
- foreach ( $columns as $column_name => $column_display_name ) {
1214
- $classes = "$column_name column-$column_name";
1215
- if ( $primary === $column_name ) {
1216
- $classes .= ' has-row-actions column-primary';
1217
- }
1218
-
1219
- if ( in_array( $column_name, $hidden, true ) ) {
1220
- $classes .= ' hidden';
1221
- }
1222
-
1223
- // Comments column uses HTML in the display name with screen reader text.
1224
- // Strip tags to get closer to a user-friendly string.
1225
- $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"';
1226
-
1227
- $attributes = "class='$classes' $data";
1228
-
1229
- if ( 'cb' === $column_name ) {
1230
- echo '<th scope="row" class="check-column">';
1231
- echo $this->column_cb( $item );
1232
- echo '</th>';
1233
- } elseif ( method_exists( $this, '_column_' . $column_name ) ) {
1234
- echo call_user_func(
1235
- array( $this, '_column_' . $column_name ),
1236
- $item,
1237
- $classes,
1238
- $data,
1239
- $primary
1240
- );
1241
- } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1242
- echo "<td $attributes>";
1243
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1244
- echo $this->handle_row_actions( $item, $column_name, $primary );
1245
- echo '</td>';
1246
- } else {
1247
- echo "<td $attributes>";
1248
- echo $this->column_default( $item, $column_name );
1249
- echo $this->handle_row_actions( $item, $column_name, $primary );
1250
- echo '</td>';
1251
- }
1252
- }
1253
- }
1254
-
1255
- /**
1256
- * Generates and display row actions links for the list table.
1257
- *
1258
- * @since 4.3.0
1259
- *
1260
- * @param object|array $item The item being acted upon.
1261
- * @param string $column_name Current column name.
1262
- * @param string $primary Primary column name.
1263
- * @return string The row actions HTML, or an empty string
1264
- * if the current column is not the primary column.
1265
- */
1266
- protected function handle_row_actions( $item, $column_name, $primary ) {
1267
- return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . ( 'Show more details' ) . '</span></button>' : '';
1268
- }
1269
-
1270
- /**
1271
- * Handles an incoming ajax request (called from admin-ajax.php)
1272
- *
1273
- * @since 3.1.0
1274
- */
1275
- public function ajax_response() {
1276
- $this->prepare_items();
1277
-
1278
- ob_start();
1279
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1280
- $this->display_rows();
1281
- } else {
1282
- $this->display_rows_or_placeholder();
1283
- }
1284
-
1285
- $rows = ob_get_clean();
1286
-
1287
- $response = array( 'rows' => $rows );
1288
-
1289
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1290
- $response['total_items_i18n'] = sprintf(
1291
- /* translators: Number of items. */
1292
- _n( '%s item', '%s items', $this->_pagination_args['total_items'] ),
1293
- number_format_i18n( $this->_pagination_args['total_items'] )
1294
- );
1295
- }
1296
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1297
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1298
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1299
- }
1300
-
1301
- die( wp_json_encode( $response ) );
1302
- }
1303
-
1304
- /**
1305
- * Sends required variables to JavaScript land.
1306
- *
1307
- * @since 3.1.0
1308
- */
1309
- public function _js_vars() {
1310
- $args = array(
1311
- 'class' => get_class( $this ),
1312
- 'screen' => array(
1313
- 'id' => $this->screen->id,
1314
- 'base' => $this->screen->base,
1315
- ),
1316
- );
1317
-
1318
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1319
- }
1320
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wppa-maintenance.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
- * Version 8.3.01.002
7
  *
8
  */
9
 
@@ -1717,15 +1717,15 @@ function wppa_log_page() {
1717
  <div class="wrap">' .
1718
  wppa_admin_spinner() .
1719
  wp_nonce_field( 'wppa-nonce', 'wppa-nonce', true, false ) . '
1720
-
1721
- <h1 style="display:inline">' . get_admin_page_title() . '
1722
  <input
1723
  class="button button-primary"
1724
  style="float:right;"
1725
  value="Purge logfile"
1726
  onclick="wppaAjaxUpdateOptionValue(\'errorlog_purge\', 0);jQuery(\'#wppa-maintenance-list\').fadeOut(2000);"
1727
  type="button" >
1728
- </h1><br>' .
1729
 
1730
  wp_nonce_field('wppa-nonce', 'wppa-nonce') . '
1731
 
@@ -1737,7 +1737,7 @@ function wppa_log_page() {
1737
  />
1738
  <div id="wppa-logbody" >' .
1739
 
1740
- ltrim( wppa_do_maintenance_popup( 'wppa_list_errorlog' ), '| ' ) .
1741
 
1742
  '</div>
1743
  </div>' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 8.2.06.006
7
  *
8
  */
9
 
1717
  <div class="wrap">' .
1718
  wppa_admin_spinner() .
1719
  wp_nonce_field( 'wppa-nonce', 'wppa-nonce', true, false ) . '
1720
+ <img id="icon-album" src="' . esc_url( WPPA_URL . '/img/page_green.png' ) . '" />
1721
+ <h1 style="display:inline">' . htmlspecialchars( __('WP Photo Album Plus Logfile', 'wp-photo-album-plus' ) ) . '
1722
  <input
1723
  class="button button-primary"
1724
  style="float:right;"
1725
  value="Purge logfile"
1726
  onclick="wppaAjaxUpdateOptionValue(\'errorlog_purge\', 0);jQuery(\'#wppa-maintenance-list\').fadeOut(2000);"
1727
  type="button" >
1728
+ </h1>' .
1729
 
1730
  wp_nonce_field('wppa-nonce', 'wppa-nonce') . '
1731
 
1737
  />
1738
  <div id="wppa-logbody" >' .
1739
 
1740
+ wppa_do_maintenance_popup( 'wppa_list_errorlog' ) .
1741
 
1742
  '</div>
1743
  </div>' );
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.3.01.005
7
  *
8
  */
9
 
@@ -20,14 +20,9 @@ function _wppa_edit_photo() {
20
  $photo = wppa_get( 'photo', '0', 'int' );
21
  $thumb = wppa_cache_photo( $photo );
22
  if ( $thumb['owner'] == wppa_get_user() ) {
23
- wppa_echo( '
24
- <div class="wrap">
25
- <h1 class="wp-heading-inline">' .
26
- get_admin_page_title() . '
27
- </h1>' );
28
  wppa_album_photos( '', $photo );
29
- wppa_echo( '
30
- </div>' );
31
  }
32
  else {
33
  wp_die( 'You do not have the rights to do this' );
@@ -36,14 +31,9 @@ function _wppa_edit_photo() {
36
 
37
  // Edit all photos owned by current user
38
  else {
39
- wppa_echo( '
40
- <div class="wrap">
41
- <h1 class="wp-heading-inline">' .
42
- get_admin_page_title() . '
43
- </h1>' );
44
  wppa_album_photos( '', '', wppa_get_user() );
45
- wppa_echo( '
46
- </div>' );
47
  }
48
  }
49
 
@@ -55,30 +45,19 @@ function _wppa_moderate_photos() {
55
  $just_edit = wppa_get( 'just-edit' );
56
 
57
  if ( $photo && $just_edit && wppa_user_is_admin() ) {
58
- wppa_echo( '
59
- <div class="wrap">
60
- <h1 class="wp-heading-inline">' .
61
- esc_html__( 'Edit', 'wp-photo-album-plus' ) . '
62
- </h1>' .
63
- wppa_get( 'just-edit' ) );
64
  wppa_album_photos( '', $photo, '', false );
65
- wppa_echo( '
66
- </div>' );
67
  }
68
  else {
69
- wppa_echo( '
70
- <div class="wrap">
71
- <h1 class="wp-heading-inline">' .
72
- get_admin_page_title() . '
73
- </h1>' );
74
  if ( wppa_switch( 'moderate_bulk' ) ) {
75
  wppa_album_photos_bulk( 'moderate' );
76
  }
77
  else {
78
  wppa_album_photos( '', $photo, '', true );
79
  }
80
- wppa_echo( '
81
- </div>' );
82
  }
83
  }
84
 
@@ -86,26 +65,11 @@ function _wppa_moderate_photos() {
86
  function wppa_album_photos( $album = '', $photo = '', $owner = '', $moderate = false ) {
87
  global $wpdb;
88
 
89
- // Init
90
- wppa_add_local_js( 'wppa_album_photos' );
91
- $a = wppa_is_int( $album ) ? $album : '0';
92
- $is_empty = false;
93
-
94
- $slug = 'photo_admin';
95
- $quick = wppa_get( 'quick' );
96
- if ( $quick )
97
- $slug = 'photo_quick';
98
-
99
- $parms = wppa_get_paging_parms( $slug );
100
-
101
- $pagesize = $parms['pagesize'];
102
- $page = $parms['page'];
103
-
104
- if ( ! is_numeric( $page ) )
105
- $page = 1;
106
  $skip = ( $page - '1' ) * $pagesize;
107
- $is_album = false;
108
- $photos = array();
109
 
110
  // Edit the photos in a specific album
111
  if ( $album ) {
@@ -114,6 +78,7 @@ global $wpdb;
114
  if ( $album == 'search' ) {
115
  $count = wppa_get_edit_search_photos( '', '', 'count_only' );
116
  $photos = wppa_get_edit_search_photos( $skip, $pagesize );
 
117
  $link = get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit-id=' . $album . '&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' ) . '&wppa-searchstring=' . wppa_get( 'searchstring' );
118
  }
119
 
@@ -138,7 +103,7 @@ global $wpdb;
138
 
139
  // A physical album
140
  else {
141
- $is_album = true;
142
  $counts = wppa_get_treecounts_a( $album, true );
143
  $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
144
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
@@ -184,8 +149,29 @@ global $wpdb;
184
  $link = '';
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  // Are there photos to moderate?
188
- elseif ( empty( $photos ) ) {
189
 
190
  $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
191
  WHERE status = 'pending'
@@ -193,27 +179,36 @@ global $wpdb;
193
  $count = count( $photos );
194
  }
195
 
196
- // Are there photos with pending comments?
 
 
 
 
 
 
 
 
 
 
 
197
 
198
- // Find pending comments
199
- $cmt = $wpdb->get_results( "SELECT photo FROM $wpdb->wppa_comments
200
- WHERE status = 'pending'
201
- OR status = 'spam'", ARRAY_A );
202
 
203
- $cphotos = array();
204
- if ( is_array( $cmt ) && count( $cmt ) ) {
 
205
 
206
- foreach( $cmt as $id ) {
207
- $cphotos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
208
- WHERE id = %d", $id ), ARRAY_A );
209
  }
210
- $count = count( $cphotos );
211
 
212
- if ( $count ) {
213
- $photos = array_merge( $photos, $cphotos );
 
214
  }
215
  }
216
- $link = get_admin_url() . 'admin.php?page=wppa_moderate_photos&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
217
  }
218
 
219
  // If not one of the cases above apply, log error and quit
@@ -222,53 +217,12 @@ global $wpdb;
222
  return;
223
  }
224
 
225
- // No photos to moderate?
226
- if ( empty( $photos ) ) {
227
-
228
- $is_empty = true;
229
-
230
- // Single photo moderate requested
231
- if ( $photo ) {
232
- wppa_echo( '<p>' . esc_html__( 'This photo is no longer awaiting moderation' , 'wp-photo-album-plus' ) . '</p>' );
233
- }
234
-
235
- // Multiple photos to moderate requested
236
- elseif ( $moderate ) {
237
- wppa_echo( '<p>' . esc_html__( 'There are no photos awaiting moderation at this time', 'wp-photo-album-plus' ) . '</p>' );
238
- }
239
-
240
- else {
241
- wppa_echo( '<p>' . esc_html__( 'There are no items matching your search creteria', 'wp-photo-album-plus' ) . '</p>' );
242
- }
243
-
244
- // If i am admin, i can edit all photos here, sorted by timestamp desc
245
- if ( wppa_user_is_admin() ) {
246
-
247
- wppa_echo( '<p>' . esc_html( 'Instead, here is a list of all items ordered by timestamp, most recently first', 'wp-photo-album-plus' ) . '</p>' );
248
- wppa_echo( '<h1>' . esc_html__( 'Manage all photos by timestamp', 'wp-photo-album-plus' ) . '</h1>' );
249
-
250
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
251
- ORDER BY timestamp DESC
252
- LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
253
-
254
- $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos" );
255
- $link = get_admin_url() . 'admin.php?page=wppa_moderate_photos&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
256
- }
257
-
258
- // Nothing to do
259
- else {
260
- return;
261
- }
262
- }
263
-
264
  // Quick edit skips a few time consuming settings like copy and move to other album
265
  $quick = wppa_get( 'quick' );
266
  if ( $link && $quick ) $link .= '&quick=1';
267
 
268
  // In case it is a seaerch and edit, show the search statistics
269
- if ( ! $is_empty ) {
270
- wppa_show_search_statistics();
271
- }
272
 
273
  // If no photos selected produce appropriate message and quit
274
  if ( empty( $photos ) ) {
@@ -289,7 +243,7 @@ global $wpdb;
289
 
290
  // Search
291
  if ( wppa_get( 'searchstring' ) ) {
292
- wppa_echo( '<h1>' . esc_html__( 'No photos matching your search criteria.', 'wp-photo-album-plus' ) . ' 1</h1>' );
293
  }
294
 
295
  // Album
@@ -304,13 +258,204 @@ global $wpdb;
304
  // There are photos to display for editing
305
  else {
306
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  $mvt = esc_attr( __( 'Move video', 'wp-photo-album-plus' ) );
308
  $mpt = esc_attr( __( 'Move photo', 'wp-photo-album-plus' ) );
309
  $cvt = esc_attr( __( 'Copy video', 'wp-photo-album-plus' ) );
310
  $cpt = esc_attr( __( 'Copy photo', 'wp-photo-album-plus' ) );
311
 
312
  // Display the pagelinks
313
- wppa_admin_pagination( $pagesize, $page, $count, $link, 'top' );
314
 
315
  // Horizon
316
  wppa_echo( '<div id="wppa-horizon"><hr></div>' );
@@ -446,8 +591,8 @@ global $wpdb;
446
  wppa_echo( '
447
  <div
448
  id="photoitem-' . $id . '"
449
- class="wppa-table-wrap photoitem"
450
- style="display:block;padding:20px;clear:both;"
451
  >' .
452
 
453
  // Photo specific nonce field
@@ -476,8 +621,7 @@ global $wpdb;
476
  'width' => '160',
477
  'height' => '160' * $videoy / $videox,
478
  'controls' => false,
479
- 'use_thumb' => true,
480
- 'margin_bottom' => '6px;',
481
  ) ) . '
482
  </a>' );
483
 
@@ -521,7 +665,7 @@ global $wpdb;
521
  id="thumburl-' . $id . '"' .
522
  ( wppa_lazy() && $count > '1' ? ' data-' : ' ' ) . 'src="' . esc_url( $src ) . '"
523
  alt="' . esc_attr( $name ) . '"
524
- style="max-width:160px;vertical-align:middle;margin-bottom:6px;"
525
  />
526
  </a>' );
527
 
@@ -558,136 +702,36 @@ global $wpdb;
558
 
559
  wppa_echo( '</div>' );
560
  }
 
561
 
562
- // Name
563
- wppa_echo( '
564
- <fieldset class="wppa-fieldset" style="float:left;margin-right:12px;min-height:72px;margin-bottom:6px;">
565
- <legend class="wppa-legend">' .
566
- __( 'Name', 'wp-photo-album-plus' ) . '
567
- </legend>
568
- <div style="display:inline-block;padding-left:12px;">
569
- <label>' .
570
- __( 'Name slug', 'wp-photo-album-plus' ) . ': ' . $sname . '
571
- </label><br>
572
- <input
573
- type="text"
574
- style="width:100%;height:32px;"
575
- id="pname-' . $id . '"
576
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this.value)"
577
- value="' . esc_attr( stripslashes( $name ) ) . '"
578
- />
579
- </div>
580
- </fieldset>' );
581
-
582
- // Status
583
- if ( $may_edit_status ) {
584
- $sel = ' selected';
585
- if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) {
586
- $dis = ' disabled';
587
- }
588
- else {
589
- $dis = '';
590
- }
591
- wppa_echo( '
592
- <fieldset class="wppa-fieldset" style="float:left;margin-right:12px;min-height:72px;margin-bottom:6px;">
593
- <legend class="wppa-legend">' .
594
- __( 'Status', 'wp-photo-album-plus' ) . '
595
- </legend>
596
- <div style="display:inline-block;padding-left:12px;">
597
- <label>
598
- &nbsp;
599
- </label><br>
600
-
601
- <select
602
- style="vertical-align:inherit;height:32px;"
603
- id="status-' . $id . '"
604
- onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'status\', this.value); wppaPhotoStatusChange( ' . $id . ' )">
605
- <option value="pending"' . ( $status == 'pending' ? $sel : '' ) . ' >' .
606
- __( 'Pending', 'wp-photo-album-plus' ) . '
607
- </option>
608
- <option value="publish"' . ( $status =='publish' ? $sel : '' ) . ' >' .
609
- __( 'Publish', 'wp-photo-album-plus' ) . '
610
- </option>
611
- <option value="featured"' . ( $status == 'featured' ? $sel : '' ) . $dis . ' >' .
612
- __( 'Featured', 'wp-photo-album-plus' ) . '
613
- </option>
614
- <option value="gold"' . ( $status == 'gold' ? $sel : '' ) . $dis . ' >' .
615
- __( 'Gold', 'wp-photo-album-plus' ) . '
616
- </option>
617
- <option value="silver"' . ( $status == 'silver' ? $sel : '' ) . $dis . ' >' .
618
- __( 'Silver', 'wp-photo-album-plus' ) . '
619
- </option>
620
- <option value="bronze"' . ( $status == 'bronze' ? $sel : '' ) . $dis . ' >' .
621
- __( 'Bronze', 'wp-photo-album-plus' ) . '
622
- </option>
623
- <option value="scheduled"' . ( $status == 'scheduled' ? $sel : '' ) . $dis . ' >' .
624
- __( 'Scheduled', 'wp-photo-album-plus' ) . '
625
- </option>
626
- <option value="private"' . ( $status == 'private' ? $sel : '' ) . $dis . ' >' .
627
- __( 'Private', 'wp-photo-album-plus' ) . '
628
- </option>
629
- </select>
630
- ' .
631
- wppa_get_date_time_select_html( 'photo', $id, true ) . '
632
- </div>
633
-
634
-
635
- </fieldset>' );
636
- }
637
- else {
638
-
639
- if ( $status == 'pending' ) $s = __( 'Pending', 'wp-photo-album-plus' );
640
- elseif ( $status == 'publish' ) $s = __( 'Publish', 'wp-photo-album-plus' );
641
- elseif ( $status == 'featured' ) $s = __( 'Featured', 'wp-photo-album-plus' );
642
- elseif ( $status == 'gold' ) $s = __( 'Gold', 'wp-photo-album-plus' );
643
- elseif ( $status == 'silver' ) $s = __( 'Silver', 'wp-photo-album-plus' );
644
- elseif ( $status == 'bronze' ) $s = __( 'Bronze', 'wp-photo-album-plus' );
645
- elseif ( $status == 'scheduled' ) $s = __( 'Scheduled', 'wp-photo-album-plus' );
646
- elseif ( $status == 'private' ) $s = __( 'Private', 'wp-photo-album-plus' );
647
- wppa_echo( '
648
- <fieldset class="wppa-fieldset" style="float:left;margin-right:12px;min-height:72px;margin-bottom:6px;">
649
- <legend class="wppa-legend">' .
650
- __( 'Status', 'wp-photo-album-plus' ) . '
651
- </legend>
652
- <div style="display:inline-block;padding-left:12px;">
653
- <label>
654
- &nbsp;
655
- </label><br>' .
656
- $s . '
657
- </div>
658
- </div>' );
659
- }
660
-
661
- // Get the statistics
662
-
663
- wppa_echo( '
664
- <fieldset class="wppa-fieldset" style="float:left;margin-right:12px;min-height:72px;margin-bottom:6px;">
665
- <legend class="wppa-legend">' .
666
- __( 'Statistics', 'wp-photo-album-plus' ) . '
667
- </legend>' );
668
-
669
-
670
  {
671
- $th = array();
672
- $td = array();
673
 
674
  // Clicks
675
  if ( wppa_switch( 'track_clickcounts' ) ) {
676
- $th[] = __( 'Clicks', 'wp-photo-album-plus' );
677
- $td[] = strval( intval( $clicks ) );
678
  }
679
 
680
  // Views
681
  if ( wppa_switch( 'track_viewcounts' ) ) {
682
- $th[] = __( 'Views', 'wp-photo-album-plus' );
683
- $td[] = strval( intval( $views ) );
684
  }
685
 
686
  // Downloads. Only photos are downloadable
687
  if ( ! wppa_is_multi( $id ) ) {
688
- $th[] = __( 'Downloads', 'wp-photo-album-plus' );
689
- $td[] = strval( intval( $dlcount ) );
690
  }
 
 
 
 
 
 
691
 
692
  // Rating
693
  $entries = wppa_get_rating_count_by_id( $id );
@@ -698,9 +742,7 @@ global $wpdb;
698
  }
699
  else {
700
  $label = __( 'Rating (#, avg)', 'wp-photo-album-plus' );
701
- $count = wppa_get_rating_count_by_id( $id );
702
- $avg = wppa_get_rating_by_id( $id, 'nolabel' );
703
- $value = $count . ', ' . $avg;
704
  }
705
  }
706
  else {
@@ -708,60 +750,48 @@ global $wpdb;
708
  $value = __( 'None', 'wp-photo-album-plus' );
709
  }
710
 
711
- $th[] = $label;
712
- $td[] = $value;
713
 
714
  // Dislikes
715
  $dislikes = wppa_dislike_get( $id );
716
  if ( $dislikes ) {
717
- $th[] = __( 'Dislikes', 'wp-photo-album-plus' );
718
- $td[] = strval( intval( $dislikes ) );
719
  }
720
 
721
  // Pending votes
722
  $pending = wppa_pendrat_get( $id );
723
  if ( $pending ) {
724
- $th[] = __( 'Pending votes', 'wp-photo-album-plus' );
725
- $td[] = strval( intval( $pending ) );
726
  }
727
  }
728
 
729
  // Display the stats
730
- $c = count( $th );
731
- for ( $i = 0; $i < $c; $i++ ) {
732
- wppa_echo( '
733
- <div style="display:inline-block;padding-left:12px;">
734
- <label>' .
735
- $th[$i] . '
736
- </label><br>
737
- <div class="wppa-ldi">' .
738
- $td[$i] . '
739
- </div>
740
- </div>' );
741
- }
742
 
743
- wppa_echo( '</fieldset>' );
744
 
745
- // Update status field
746
- {
747
- wppa_echo( '
748
- <fieldset class="wppa-fieldset" style="float:left;margin-right:12px;min-height:72px;margin-bottom:6px;">
749
- <legend class="wppa-legend">' .
750
- __( 'Remark', 'wp-photo-album-plus' ) . '
751
- </legend>
752
- <div style="display:inline-block;padding-left:12px;">
753
- <label>
754
- &nbsp;
755
- </label><br>
756
- <span
757
- id="remark-' . $id . '"
758
- style="font-weight:bold;color:#00AA00;font-size:1.5em;">' .
759
- ( $is_video ? sprintf( __( 'Video %s is not modified yet', 'wp-photo-album-plus' ), $id ) :
760
- sprintf( __( 'Photo %s is not modified yet', 'wp-photo-album-plus' ), $id ) ) . '
761
- </span>
762
- </div>
763
- </fieldset>' );
764
- }
765
 
766
  wppa_echo( '
767
  </div>' );
@@ -774,11 +804,11 @@ wppa_echo( '</fieldset>' );
774
 
775
  // Open the details area
776
  wppa_echo( '
777
- <details id="wppa-toplevel-details-'.$id.'" class="wppa-toplevel-details" ' . ( $timestamp > time() - 3600 ? 'open' : '' ) . '>
778
  <summary class="toplevel wppa-summary-sublevel"> ' .
779
  $details . '
780
  </summary>' );
781
- /*
782
  // Update status field
783
  {
784
  wppa_echo( '
@@ -792,7 +822,7 @@ wppa_echo( '</fieldset>' );
792
  </span>
793
  </h3>' );
794
  }
795
- */
796
  // The tabs
797
  $ptitle = __( 'Photo', 'wp-photo-album-plus' );
798
  if ( wppa_is_video( $id ) ) $ptitle = __( 'Video', 'wp-photo-album-plus' );
@@ -812,28 +842,15 @@ wppa_echo( '</fieldset>' );
812
  }
813
  if ( ! $quick && ! empty( $exifs ) ) {
814
  $result .= '
815
- <li
816
- class="wppa-photoadmin-tab-'.$id.'"
817
- onclick="wppaChangePhotoAdminTab(this,\'#photoexif-'.$id.'\','.$id.');">' .
818
- __( 'EXIF', 'wp-photo-album-plus' ) . '
819
- </li>';
820
  }
821
  if ( ! $quick && ! empty( $iptcs ) ) {
822
  $result .= '
823
- <li
824
- class="wppa-photoadmin-tab-'.$id.'"
825
- onclick="wppaChangePhotoAdminTab(this,\'#photoiptc-'.$id.'\','.$id.');">' .
826
- __( 'IPTC', 'wp-photo-album-plus' ) . '
827
- </li>';
828
  }
829
  if ( ! $quick && ! empty( $comments ) ) {
830
  $result .= '
831
- <li
832
- id="wppa-photoadmin-tab-'.$id.'"
833
- class="wppa-photoadmin-tab-'.$id.'"
834
- onclick="wppaChangePhotoAdminTab(this,\'#photocomment-'.$id.'\','.$id.');">' .
835
- __( 'Comments', 'wp-photo-album-plus' ) . '
836
- </li>';
837
  }
838
  $result .= '
839
  </ul>
@@ -841,6 +858,20 @@ wppa_echo( '</fieldset>' );
841
  </div>';
842
  wppa_echo( $result );
843
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
844
  // Tab 1 Photo general
845
  wppa_echo( '
846
  <div
@@ -922,7 +953,7 @@ wppa_echo( '</fieldset>' );
922
  }
923
 
924
  // Album. Show album only when it is not evident
925
- if ( ! $is_album ) {
926
  wppa_echo( '
927
  <div class="left" style="margin-right: 4px;">
928
  <label>' .
@@ -992,7 +1023,6 @@ wppa_echo( '</fieldset>' );
992
  }
993
 
994
  // Status
995
- /*
996
  if ( ! $may_edit_status ) {
997
  if ( $status == 'pending' ) $s = __( 'Pending', 'wp-photo-album-plus' );
998
  elseif ( $status == 'publish' ) $s = __( 'Publish', 'wp-photo-album-plus' );
@@ -1012,7 +1042,6 @@ wppa_echo( '</fieldset>' );
1012
  </div>
1013
  </div>' );
1014
  }
1015
- */
1016
 
1017
  // Schedule for delete
1018
  if ( ! wppa_user_is_admin() && $owner != wppa_get_user() ) {
@@ -1069,6 +1098,22 @@ wppa_echo( '</fieldset>' );
1069
 
1070
  // Owner
1071
  if ( $owner_editable ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1072
  if ( wppa_get_user_count() > wppa_opt( 'max_users' ) ) {
1073
  wppa_echo( '
1074
  <div class="left">
@@ -1173,7 +1218,7 @@ wppa_echo( '</fieldset>' );
1173
  }
1174
 
1175
  // Status
1176
- if ( ! $moderate && $may_edit_status ) {
1177
  $sel = ' selected';
1178
  if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) {
1179
  $dis = ' disabled';
@@ -1600,12 +1645,31 @@ wppa_echo( '</fieldset>' );
1600
  wppa_echo( '
1601
  <div class="wppa-flex-column">' );
1602
 
1603
- // Description editable
1604
- if ( ! wppa_switch( 'desc_is_restricted' ) || wppa_user_is_admin() ) {
1605
- wppa_echo( '
1606
- <fieldset class="wppa-fieldset">
1607
- <legend class="wppa-legend">' .
1608
- __( 'Description', 'wp-photo-album-plus' ) . '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1609
  </legend>' );
1610
 
1611
  // WP editor
@@ -1900,372 +1964,357 @@ wppa_echo( '</fieldset>' );
1900
  <div
1901
  id="photofiles-' . $id . '"
1902
  class="wppa-table-wrap wppa-tabcontent-'.$id.'"
1903
- style="position:relative;padding:10px;display:none"
1904
  >' );
1905
 
 
1906
  wppa_echo( '
1907
- <div class="wppa-flex">' );
1908
-
1909
- wppa_echo( '
1910
- <fieldset class="wppa-fieldset">
1911
- <legend class="wppa-legend">' .
1912
- __( 'Available files', 'wp-photo-album-plus' ) . '
1913
- </legend>' );
1914
- {
1915
- wppa_echo( '
1916
- <table class="wppa-table">
1917
- <thead>
1918
- <td>' . __( 'Type', 'wp-photo-album-plus' ) . '</td>
1919
- <td>' . __( 'Size', 'wp-photo-album-plus' ) . '</td>
1920
- <td>' . __( 'Path', 'wp-photo-album-plus' ) . '</td>
1921
- <td>' . __( 'Url', 'wp-photo-album-plus' ) . '</td>
1922
- </thead>
1923
- <tbody>' );
1924
-
1925
- // Video
1926
- if ( $b_is_video ) {
1927
-
1928
- $formats = '';
1929
- $paths = '';
1930
- $urls = '';
1931
- foreach ( $is_video as $fmt ) {
1932
- $formats .= $fmt . ' (' . wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . ')<br>';
1933
- $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
1934
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) );
1935
- $urls .= '<a href="'. $url .'" target="_blank">' . $url . '<br>';
1936
- }
1937
-
1938
- wppa_echo( '
1939
- <tr>
1940
- <td>' .
1941
- $formats . '
1942
- </td>
1943
- <td>' );
1944
-
1945
- // If video sizes are correct and retieved from the file,
1946
- // and possible rotation has been into account, field needs not to be editable
1947
- if ( $photo['videox'] == $videox && $photo['videoy'] == $videoy ) {
1948
- wppa_echo( sprintf( __( 'Width: %d pixels, height: %d pixels', 'wp-photo-album-plus' ), $videox, $videoy ) );
1949
- }
1950
- else {
1951
- wppa_echo( '
1952
- <input
1953
- type="text"
1954
- style="width:50px;margin:0 4px;padding-left:8px!important"
1955
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videox\', this.value)"
1956
- value="' . esc_attr( $videox ) . '"
1957
- />px W' .
1958
- sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_width' ) ) . '
1959
- <input
1960
- type="text"
1961
- style="width:50px;margin:0 4px;padding-left:8px!important"
1962
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videoy\', this.value)"
1963
- value="' . esc_attr( $videoy ) . '"
1964
- />px H' .
1965
- sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_height' ) ) );
1966
- }
1967
- wppa_echo( '
1968
- </td>
1969
- <td>' .
1970
- $paths . '
1971
- </td>
1972
- <td>' .
1973
- $urls . '
1974
- </td>
1975
- </tr>' );
1976
- }
1977
-
1978
- // Audio
1979
- if ( $b_has_audio ) {
1980
-
1981
- $formats = '';
1982
- $sizes = '';
1983
- $paths = '';
1984
- $urls = '';
1985
- foreach ( $has_audio as $fmt ) {
1986
- $formats .= $fmt . '<br>';
1987
- $sizes .= wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
1988
- $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
1989
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) );
1990
- $urls .= '<a href="'. $url .'" target="_blank">' . $url . '<br>';
1991
- }
1992
 
1993
- wppa_echo( '
1994
- <tr>
1995
- <td>' .
1996
- $formats . '
1997
- </td>
1998
- <td>' .
1999
- $sizes . '
2000
- </td>
2001
- <td>' .
2002
- $paths . '
2003
- </td>
2004
- <td>' .
2005
- $urls . '
2006
- </td>
2007
- </tr>' );
2008
  }
2009
 
2010
- // Pdf
2011
- if ( $is_pdf ) {
2012
-
2013
- // Source
2014
- $sp = wppa_get_source_path( $id );
2015
- $fs = wppa_get_filesize( $sp );
2016
- $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp );
2017
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp );
2018
- wppa_echo( '
2019
- <tr>
2020
- <td>' .
2021
- __( 'Document file', 'wp-photo-album-plus' ) . '
2022
- </td>
2023
- <td>' .
2024
- $fs . '
2025
- </td>
2026
- <td>' .
2027
- $path . '
2028
- </td>
2029
- <td>
2030
- <a href="'.$url.'" target="_blank">' .
2031
- $url . '
2032
- </a>
2033
- </td>
2034
- </tr>' );
2035
- }
2036
-
2037
- // Non pdf source_file
2038
- else {
2039
 
2040
- // Source
2041
- $sp = wppa_get_source_path( $id );
2042
- $o1sp = wppa_get_o1_source_path( $id );
2043
- $files = [];
2044
- if ( wppa_is_file( $sp ) || wppa_is_file( $o1sp ) ) {
2045
-
2046
- if ( is_file( $sp ) ) {
2047
- $ima = getimagesize( $sp );
2048
- $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $sp ) . '.';
2049
- $files[] = ['name' => __( 'Source', 'wp-photo-album-plus' ),
2050
- 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp ),
2051
- 'size' => $txt,
2052
- 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp )];
2053
- }
2054
- if ( is_file( $o1sp ) ) {
2055
- $ima = getimagesize( $o1sp );
2056
- $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $o1sp ) . '.';
2057
- $files[] = ['name' => __( 'Oriented source', 'wp-photo-album-plus' ),
2058
- 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $o1sp ),
2059
- 'size' => $txt,
2060
- 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $o1sp )];
2061
  }
2062
-
2063
- foreach( $files as $file ) {
2064
  wppa_echo( '
2065
- <tr>
2066
- <td>' .
2067
- $file['name'] . '
2068
- </td>
2069
- <td>' .
2070
- $file['size'] . '
2071
- </td>
2072
- <td>' .
2073
- $file['path'] . '
2074
- </td>
2075
- <td>
2076
- <a href="'.$file['url'].'" target="_blank">' .
2077
- $file['url'] . '
2078
- </a>
2079
- </td>
2080
- </tr>' );
2081
  }
2082
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2083
  }
2084
 
2085
- // Poster
2086
- if ( $is_pdf || $b_is_video ) {
2087
-
2088
- // Poster
2089
- $sp = wppa_fix_poster_ext( wppa_get_source_path( $id ), $id );
2090
- $dsp = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id );
2091
- $files = [];
2092
- if ( wppa_is_file( $sp ) || wppa_is_file( $dsp ) ) {
2093
-
2094
- if ( wppa_is_file( $sp ) ) {
2095
- $ima = getimagesize( $sp );
2096
- $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $sp ) . '.';
2097
- $files[] = ['name' => __( 'Poster source', 'wp-photo-album-plus' ),
2098
- 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp ),
2099
- 'size' => $txt,
2100
- 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp )];
2101
- }
2102
- if ( wppa_is_file( $dsp ) ) {
2103
- $ima = getimagesize( $dsp );
2104
- $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $dsp ) . '.';
2105
- $files[] = ['name' => __( 'Poster display', 'wp-photo-album-plus' ),
2106
- 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $dsp ),
2107
- 'size' => $txt,
2108
- 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $dsp )];
2109
- }
2110
 
2111
- foreach( $files as $file ) {
2112
- wppa_echo( '
2113
- <tr>
2114
- <td>' .
2115
- $file['name'] . '
2116
- </td>
2117
- <td>' .
2118
- $file['size'] . '
2119
- </td>
2120
- <td>' .
2121
- $file['path'] . '
2122
- </td>
2123
- <td>
2124
- <a href="'.$file['url'].'" target="_blank">' .
2125
- $file['url'] . '
2126
- </a>
2127
- </td>
2128
- </tr>' );
2129
- }
2130
- }
2131
- }
2132
 
2133
- // Non video, non pdf Display
2134
- if ( ! $b_is_video && ! $is_pdf ) {
2135
- $dp = wppa_get_photo_path( $id );
2136
- $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $dp );
2137
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $dp );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2138
 
2139
- if ( is_file( $dp ) ) {
 
2140
 
2141
- $txt = '
2142
- <span id="photox-' . $id . '">' . wppa_get_photox( $id ) . '</span> x
2143
- <span id="photoy-' . $id . '">' . wppa_get_photoy( $id ) . '</span>:
2144
- (<span id="photofilesize-' . $id . '">' . wppa_get_filesize( $dp ) . '</span>)';
 
2145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2146
  wppa_echo( '
2147
  <tr>
2148
  <td>' .
2149
- __( 'Display file', 'wp-photo-album-plus' ) . '
2150
  </td>
2151
  <td>' .
2152
- $txt . '
2153
  </td>
2154
  <td>' .
2155
- $path . '
2156
  </td>
2157
  <td>
2158
- <a href="'.$url.'" target="_blank">' .
2159
- $url . '
2160
  </a>
2161
  </td>
2162
  </tr>' );
2163
  }
2164
  }
 
2165
 
2166
- // Thumbnail
2167
- if ( true ) {
2168
- $tp = wppa_get_thumb_path( $id );
2169
- if ( is_file( $tp ) ) {
2170
- $txt = '
2171
- <span id="thumbx-' . $id . '">' . wppa_get_thumbx( $id ) . '</span> x
2172
- <span id="thumby-' . $id . '">' . wppa_get_thumby( $id ) . '</span>:
2173
- (<span id="thumbfilesize-' . $id . '">' . wppa_get_filesize( $tp ) . '</span>)
2174
- &nbsp;
2175
- <input
2176
- type="checkbox"' .
2177
- ( $thumblock ? ' checked' : '' ) . '
2178
- onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'thumblock\', jQuery(this).prop(\'checked\') ? 1 : 0 )" /> ' .
2179
- __( 'Locked', 'wp-photo-album-plus' );
2180
 
2181
- $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $tp );
2182
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $tp );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2183
 
 
2184
  wppa_echo( '
2185
  <tr>
2186
  <td>' .
2187
- __( 'Thumbnail', 'wp-photo-album-plus' ) . '
2188
  </td>
2189
  <td>' .
2190
- $txt . '
2191
  </td>
2192
  <td>' .
2193
- $path . '
2194
  </td>
2195
  <td>
2196
- <a href="'.$url.'" target="_blank">' .
2197
- $url . '
2198
  </a>
2199
  </td>
2200
  </tr>' );
2201
  }
2202
  }
 
2203
 
2204
- // Local CDN
2205
- if ( wppa_cdn( 'admin' ) == 'local' ) {
 
 
 
2206
 
2207
- $files = wppa_cdn_files( $id );
2208
- if ( !empty( $files ) ) {
2209
 
2210
- $txt = '<span id="cdnfiles-' . $id . '">';
2211
- $paths = '';
2212
- $urls = '';
 
2213
 
2214
- foreach( $files as $file ) {
2215
- if ( basename( $file ) != 'index.php' ) {
2216
- $t = explode( '.', basename( $file ) );
2217
- $t = explode( '-', $t[0] );
2218
- $x = $t[0];
2219
- $y = $t[1];
2220
- $size = filesize( $file );
 
 
 
 
 
 
 
 
 
 
 
 
2221
 
2222
- $txt .=
 
 
 
 
 
 
 
 
 
 
 
 
 
2223
 
2224
- str_replace( '-', ' x ', wppa_strip_ext( basename( $file ) ) ) . ': ' .
 
2225
 
2226
- sprintf( '(%4.2fkB)', $size / 1024 ) . '<br>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2227
 
2228
- $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', $file ) . '<br>';
 
2229
 
2230
- $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file );
2231
- $urls .= '<a href="'.$url.'" target="_blank">' . $url . '</a><br>';
2232
- }
2233
- }
2234
- $txt .= '</span>';
2235
 
2236
- wppa_echo( '
2237
- <tr>
2238
- <td style="line-height:20px">' .
2239
- __( 'Local CDN', 'wp-photo-album-plus' ) . '
2240
- </td>
2241
- <td style="line-height:20px">' .
2242
- $txt . '
2243
- </td>
2244
- <td style="line-height:20px">' .
2245
- $paths . '
2246
- </td>
2247
- <td style="line-height:20px">' .
2248
- $urls . '
2249
- </td>
2250
- </tr>' );
 
 
 
 
 
 
 
 
2251
  }
2252
- }
2253
 
2254
- wppa_echo( '
2255
- </tbody>
2256
- </table>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
2257
  }
2258
 
2259
- wppa_echo( '</fieldset></div>' );
 
 
 
2260
 
2261
- // Remake displayfiles / yhumbnail
2262
  if ( ! $is_video ) {
2263
  wppa_echo( '
2264
- <div class="wppa-flex">
2265
- <fieldset class="wppa-fieldset">
2266
- <legend class="wppa-legend">' .
2267
- __( 'Actions', 'wp-photo-album-plus' ) . '
2268
- </legend>
2269
 
2270
  <input
2271
  type="button"
@@ -2274,6 +2323,13 @@ wppa_echo( '</fieldset>' );
2274
  onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', 0 )"
2275
  value="' . esc_attr( __( 'Remake files', 'wp-photo-album-plus' ) ) . '"
2276
  />
 
 
 
 
 
 
 
2277
  <input
2278
  type="button"
2279
  class="wppa-admin-button button"
@@ -2281,8 +2337,7 @@ wppa_echo( '</fieldset>' );
2281
  onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', 0 )"
2282
  value="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2283
  />
2284
-
2285
- </fieldset></div>' );
2286
  }
2287
 
2288
 
@@ -2297,348 +2352,340 @@ wppa_echo( '</fieldset>' );
2297
  <div
2298
  id="photomagic-' . $id . '"
2299
  class="wppa-table-wrap wppa-tabcontent-'.$id.'"
2300
- style="position:relative;padding:10px;display:none"
2301
  >' );
2302
 
 
 
 
2303
  wppa_echo( '
2304
- <fieldset class="wppa-fieldset">
2305
- <legend class="wppa-legend">' .
2306
- __( 'Magically edit image', 'wp-photo-album-plus' ) . '
2307
- </legend>' );
2308
 
 
 
 
2309
 
2310
  {
2311
-
2312
- // Explanation
2313
  wppa_echo( '
2314
- <h2 class="description" style="margin:1em">' .
2315
- __( 'The operations are executed upon the display file.', 'wp-photo-album-plus' ) . ' ' .
2316
- __( 'A new thumbnail image will be created from the display file.', 'wp-photo-album-plus' ) . '
2317
- </h2>' );
 
 
2318
 
2319
- // --- Actions ---
2320
  wppa_echo( '
2321
- <div class="wppa-flex">' );
2322
-
2323
- {
2324
-
2325
- // Rotate left
2326
- wppa_echo( '
2327
- <input
2328
- type="button"
2329
- class="wppa-admin-button button"
2330
- onclick="wppaTryMagick( ' . $id . ', \'magickrotleft\' )"
2331
- value="' . esc_attr( __( 'Rotate left', 'wp-photo-album-plus' ) ) . '"
2332
- />' );
2333
-
2334
- // Rotat 180
2335
- wppa_echo( '
2336
- <input
2337
- type="button"
2338
- class="wppa-admin-button button"
2339
- onclick="wppaTryMagick( ' . $id . ', \'magickrot180\' )"
2340
- value="' . esc_attr( __( 'Rotate 180&deg;', 'wp-photo-album-plus' ) ) . '"
2341
- />' );
2342
-
2343
- // Rotate right
2344
- wppa_echo( '
2345
- <input
2346
- type="button"
2347
- class="wppa-admin-button button"
2348
- onclick="wppaTryMagick( ' . $id . ', \'magickrotright\' )"
2349
- value="' . esc_attr( __( 'Rotate right', 'wp-photo-album-plus' ) ) . '"
2350
- />' );
2351
-
2352
- // Flip
2353
- wppa_echo( '
2354
- <input
2355
- type="button"
2356
- class="wppa-admin-button button"
2357
- onclick="wppaTryMagick( ' . $id . ', \'magickflip\' )"
2358
- value="' . esc_attr( __( 'Flip', 'wp-photo-album-plus' ) ) . '&thinsp;&#8212;"
2359
- title="-flip"
2360
- />' );
2361
-
2362
- // Flop
2363
- wppa_echo( '
2364
- <input
2365
- type="button"
2366
- class="wppa-admin-button button"
2367
- onclick="wppaTryMagick( ' . $id . ', \'magickflop\' )"
2368
- value="' . esc_attr( __( 'Flop', 'wp-photo-album-plus' ) ) . ' |"
2369
- title="-flop"
2370
- />' );
2371
-
2372
- // Enhance
2373
- wppa_echo( '
2374
- <input
2375
- type="button"
2376
- class="wppa-admin-button button"
2377
- onclick="wppaTryMagick( ' . $id . ', \'enhance\' )"
2378
- value="' . esc_attr( __( 'Enhance', 'wp-photo-album-plus' ) ) . '"
2379
- title="-enhance"
2380
- />' );
2381
-
2382
- // Sharpen
2383
- wppa_echo( '
2384
- <input
2385
- type="button"
2386
- class="wppa-admin-button button"
2387
- onclick="wppaTryMagick( ' . $id . ', \'sharpen\' )"
2388
- value="' . esc_attr( __( 'Sharpen', 'wp-photo-album-plus' ) ) . '"
2389
- title="-sharpen 0x1"
2390
- />' );
2391
-
2392
- // Blur
2393
- wppa_echo( '
2394
- <input
2395
- type="button"
2396
- class="wppa-admin-button button"
2397
- onclick="wppaTryMagick( ' . $id . ', \'blur\' )"
2398
- value="' . esc_attr( __( 'Blur', 'wp-photo-album-plus' ) ) . '"
2399
- title="-blur 0x1"
2400
- />' );
2401
 
2402
- // Auto gamma
2403
- wppa_echo( '
2404
- <input
2405
- type="button"
2406
- class="wppa-admin-button button"
2407
- onclick="wppaTryMagick( ' . $id . ', \'auto-gamma\' )"
2408
- value="' . esc_attr( __( 'Auto Gamma', 'wp-photo-album-plus' ) ) . '"
2409
- title="-auto-gamma"
2410
- />' );
2411
 
2412
- // Auto level
2413
- wppa_echo( '
2414
- <input
2415
- type="button"
2416
- class="wppa-admin-button button"
2417
- onclick="wppaTryMagick( ' . $id . ', \'auto-level\' )"
2418
- value="' . esc_attr( __( 'Auto Level', 'wp-photo-album-plus' ) ) . '"
2419
- title="-auto-level"
2420
- />' );
2421
 
2422
- // Contrast+
2423
- wppa_echo( '
2424
- <input
2425
- type="button"
2426
- class="wppa-admin-button button"
2427
- onclick="wppaTryMagick( ' . $id . ', \'contrast-p\' )"
2428
- value="' . esc_attr( __( 'Contrast+', 'wp-photo-album-plus' ) ) . '"
2429
- title="-brightness-contrast 0x5"
2430
- />' );
2431
 
2432
- // Contrast-
2433
- wppa_echo( '
2434
- <input
2435
- type="button"
2436
- class="wppa-admin-button button"
2437
- onclick="wppaTryMagick( ' . $id . ', \'contrast-m\' )"
2438
- value="' . esc_attr( __( 'Contrast-', 'wp-photo-album-plus' ) ) . '"
2439
- title="-brightness-contrast 0x-5"
2440
- />' );
2441
 
2442
- // Brightness+
2443
- wppa_echo( '
2444
- <input
2445
- type="button"
2446
- class="wppa-admin-button button"
2447
- onclick="wppaTryMagick( ' . $id . ', \'brightness-p\' )"
2448
- value="' . esc_attr( __( 'Brightness+', 'wp-photo-album-plus' ) ) . '"
2449
- title="-brightness-contrast 5"
2450
- />' );
2451
 
2452
- // Brightness-
2453
- wppa_echo( '
2454
- <input
2455
- type="button"
2456
- class="wppa-admin-button button"
2457
- onclick="wppaTryMagick( ' . $id . ', \'brightness-m\' )"
2458
- value="' . esc_attr( __( 'Brightness-', 'wp-photo-album-plus' ) ) . '"
2459
- title="-brightness-contrast -5"
2460
- />' );
2461
 
2462
- // Despeckle
2463
- wppa_echo( '
2464
- <input
2465
- type="button"
2466
- class="wppa-admin-button button"
2467
- onclick="wppaTryMagick( ' . $id . ', \'despeckle\' )"
2468
- value="' . esc_attr( __( 'Despeckle', 'wp-photo-album-plus' ) ) . '"
2469
- title="-despeckle"
2470
- />' );
2471
 
2472
- // Lenear gray
2473
- wppa_echo( '
2474
- <input
2475
- type="button"
2476
- class="wppa-admin-button button"
2477
- onclick="wppaTryMagick( ' . $id . ', \'lineargray\' )"
2478
- value="' . esc_attr( __( 'Linear gray', 'wp-photo-album-plus' ) ) . '"
2479
- title="-colorspace gray"
2480
- />' );
2481
 
2482
- // Non-linear gray
2483
- wppa_echo( '
2484
- <input
2485
- type="button"
2486
- class="wppa-admin-button button"
2487
- onclick="wppaTryMagick( ' . $id . ', \'nonlineargray\' )"
2488
- value="' . esc_attr( __( 'Non-linear gray', 'wp-photo-album-plus' ) ) . '"
2489
- title="-grayscale Rec709Luma"
2490
- />' );
2491
 
2492
- // Charcoal
2493
- wppa_echo( '
2494
- <input
2495
- type="button"
2496
- class="wppa-admin-button button"
2497
- onclick="wppaTryMagick( ' . $id . ', \'charcoal\' )"
2498
- value="' . esc_attr( __( 'Charcoal', 'wp-photo-album-plus' ) ) . '"
2499
- title="-charcoal"
2500
- />' );
2501
 
2502
- // Paint
2503
- wppa_echo( '
2504
- <input
2505
- type="button"
2506
- class="wppa-admin-button button"
2507
- onclick="wppaTryMagick( ' . $id . ', \'paint\' )"
2508
- value="' . esc_attr( __( 'Paint', 'wp-photo-album-plus' ) ) . '"
2509
- title="-paint"
2510
- />' );
2511
 
2512
- // Sepia
2513
- wppa_echo( '
2514
- <input
2515
- type="button"
2516
- class="wppa-admin-button button"
2517
- onclick="wppaTryMagick( ' . $id . ', \'sepia\' )"
2518
- value="' . esc_attr( __( 'Sepia', 'wp-photo-album-plus' ) ) . '"
2519
- title="-sepia-tone 80%"
2520
- />' );
2521
 
2522
- // Show/hide wppa-horizon
2523
- wppa_echo( '
2524
- <input
2525
- type="button"
2526
- class="wppa-admin-button button"
2527
- onclick="wppaToggleHorizon()"
2528
- value="' . esc_attr( 'Show/hide horizon', 'wp-photo-album-plus' ) . '"
2529
- title="' . esc_attr( 'Toggle horizon reference line on/off', 'wp-photo-album-plus' ) . '"
2530
- />' );
2531
 
2532
- // Anticlock 0.5 deg
2533
- wppa_echo( '
2534
- <input
2535
- type="button"
2536
- class="wppa-admin-button button"
2537
- onclick="wppaTryMagick( ' . $id . ', \'skyleft\' )"
2538
- value="' . esc_attr( '0.5&deg;', 'wp-photo-album-plus' ) . '"
2539
- title="' . esc_attr( 'Rotate image by 0.5&deg; anticlockwise', 'wp-photo-album-plus' ) . '"
2540
- />' );
2541
 
2542
- // Clockwise 0.5 deg
2543
- wppa_echo( '
2544
- <input
2545
- type="button"
2546
- class="wppa-admin-button button"
2547
- onclick="wppaTryMagick( ' . $id . ', \'skyright\' )"
2548
- value="' . esc_attr( '-0.5&deg;', 'wp-photo-album-plus' ) . '"
2549
- title="' . esc_attr( 'Rotate image by 0.5&deg; clockwise', 'wp-photo-album-plus' ) . '"
2550
- />' );
2551
 
2552
- // Crop
2553
- wppa_echo( '
2554
- <input
2555
- type="button"
2556
- class="wppa-admin-button button"
2557
- id="button-' . $id . '"
2558
- value="Crop"
2559
- title=""
2560
- />' );
 
 
 
 
 
 
 
 
 
 
2561
 
2562
- // Set cropbox aspect ratio
2563
- $ratio = ( $photoy ? ( $photox / $photoy ) : 'NaN' );
2564
- $dflt = wppa_opt( 'image_magick_ratio' );
 
 
 
 
 
 
2565
 
2566
- wppa_echo( '
2567
- <select
2568
- onchange="wppaCropper[' . $id . '].setAspectRatio(this.value)"
2569
- title="' . __( 'Aspect ratio of cropped image', 'wp-photo-album-plus' ) . '"
2570
- >
2571
- <option value="NaN"' . ( $dflt == 'NaN' ? ' selected' : '' ) . '>' . __( 'free', 'wp-photo-album-plus' ) . '</option>
2572
- <option value="' . $ratio . '"' . ( $dflt == 'ratio' ? ' selected' : '' ) . '>' . __( 'original', 'wp-photo-album-plus' ) . '</option>
2573
- <option value="1"' . ( $dflt == '1' ? ' selected' : '' ) . '>' . __( 'square', 'wp-photo-album-plus' ) . '</option>
2574
- <option value="1.25"' . ( $dflt == '1.25' ? ' selected' : '' ) . '>4:5 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2575
- <option value="1.33333"' . ( $dflt == '1.33333' ? ' selected' : '' ) . '>3:4 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2576
- <option value="1.5"' . ( $dflt == '1.5' ? ' selected' : '' ) . '>2:3 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2577
- <option value="1.6"' . ( $dflt == '1.6' ? ' selected' : '' ) . '>5:8 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2578
- <option value="1.77777"' . ( $dflt == '1.77777' ? ' selected' : '' ) . '>9:16 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2579
- <option value="2"' . ( $dflt == '2' ? ' selected' : '' ) . '>1:2 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2580
- <option value="0.8"' . ( $dflt == '0.8' ? ' selected' : '' ) . '>4:5 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2581
- <option value="0.75"' . ( $dflt == '0.75' ? ' selected' : '' ) . '>3:4 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2582
- <option value="0.66667"' . ( $dflt == '0.66667' ? ' selected' : '' ) . '>2:3 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2583
- <option value="0.625"' . ( $dflt == '0.625' ? ' selected' : '' ) . '>5:8 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2584
- <option value="0.5625"' . ( $dflt == '0.5625' ? ' selected' : '' ) . '>9:16 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2585
- <option value="0.5"' . ( $dflt == '0.5' ? ' selected' : '' ) . '>1:2 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2586
- </select>' . $br );
2587
-
2588
- if ( $dflt == 'ratio' ) {
2589
- $value = $ratio;
2590
- }
2591
- elseif ( $dflt == 'free' ) {
2592
- $value = '';
2593
- }
2594
- else {
2595
- $value = $dflt;
2596
- }
2597
 
2598
- }
 
 
 
 
 
 
 
 
2599
 
2600
- // End flex div
2601
- wppa_echo( '</div>' );
 
 
 
 
 
 
 
2602
 
2603
- // Command stack
2604
  wppa_echo( '
2605
- <h2 class="description" style="margin:1em">' .
2606
- __( '<b>ImageMagick</b> command stack', 'wp-photo-album-plus' ) . ':
2607
- <span
2608
- id="magickstack-' . strval( intval( $id ) ). '"
2609
- style="color:blue"
2610
- >' .
2611
- sanitize_text_field( $magickstack ) . '
2612
- </span>
2613
- <input
2614
- type="button"
2615
- class="wppa-admin-button button"
2616
- id="imstackbutton-' . strval( intval( $id ) ) . '"
2617
- onclick="wppaTryMagick( ' . strval( intval( $id ) ) . ', \'magickundo\' )"
2618
- value="' . esc_attr( __( 'Undo', 'wp-photo-album-plus' ) ) . '"
2619
- title="' . esc_attr( __( 'Undo last Magick command', 'wp-photo-album-plus' ) ) . '"
2620
- style="margin-left:4px;' . ( $magickstack ? 'display:inline;' : 'display:none;' ) . '"
2621
- />
2622
- </h2>' );
2623
 
2624
- // Cropper container
2625
- // Fake 'for social media' to use the local file here, not cloudinary. Files from cloudinary do not reload, even with ?ver=...
2626
- wppa( 'for_sm', true );
2627
  wppa_echo( '
2628
- <div
2629
- class="wppa-cropper-container-wrapper">
2630
- <img
2631
- id="fs-img-' . $id . '"
2632
- src="' . esc_url( wppa_get_photo_url( $id ) ) . '"
2633
- style="float:left;max-width:100%"
2634
- />
2635
- </div>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2636
 
2637
- // Reset switch
2638
- wppa( 'for_sm', false );
2639
  }
2640
 
2641
- wppa_echo( '</fieldset>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2642
 
2643
  // End Tab 3
2644
  wppa_echo( '</div>' );
@@ -2762,7 +2809,6 @@ wppa_echo( '</fieldset>' );
2762
 
2763
 
2764
  // Comments
2765
- $has_pending_comments = false;
2766
  if ( ! $quick && ! empty( $comments ) ) {
2767
 
2768
  wppa_echo( '
@@ -2823,9 +2869,6 @@ wppa_echo( '</fieldset>' );
2823
  }
2824
  wppa_echo( '<td style="padding:0 4px">' . $comment['comment'] . '</td>
2825
  </tr>' );
2826
- if ( $comment['status'] != 'approved' ) {
2827
- $has_pending_comments = true;
2828
- }
2829
  }
2830
 
2831
  wppa_echo( '
@@ -2835,18 +2878,7 @@ wppa_echo( '</fieldset>' );
2835
  </div>' );
2836
  }
2837
 
2838
- // Fix the background color
2839
- $the_js = 'wppaPhotoStatusChange(' . $id . ');';
2840
-
2841
- // When there are moderatable comments, open details and comments tab
2842
- if ( $has_pending_comments && ( current_user_can( 'wppa_comments' ) || current_user_can( 'wppa_moderate' ) || ( ( wppa_get_user() == $photo['owner'] && wppa_switch( 'owner_moderate_comment' ) ) ) ) ) {
2843
- $the_js .= '
2844
- jQuery(document).ready(function(){
2845
- jQuery("#wppa-toplevel-details-'.$id.'").attr("open","open");
2846
- jQuery("#wppa-photoadmin-tab-'.$id.'").trigger("click");
2847
- });';
2848
- }
2849
- wppa_add_inline_script( 'wppa-admin', $the_js );
2850
 
2851
  wppa_echo( '
2852
  <div class="clear"></div>
@@ -2859,7 +2891,7 @@ wppa_echo( '</fieldset>' );
2859
 
2860
  } /* foreach photo */
2861
 
2862
- wppa_admin_pagination( $pagesize, $page, $count, $link, 'bottom' );
2863
 
2864
  } /* photos not empty */
2865
  } /* function */
@@ -2875,7 +2907,6 @@ function wppa_album_photos_bulk( $album ) {
2875
  }
2876
 
2877
  // Init
2878
- wppa_add_local_js( 'wppa_album_photos_bulk' );
2879
  $count = '0';
2880
  $abort = false;
2881
 
@@ -2989,10 +3020,7 @@ function wppa_album_photos_bulk( $album ) {
2989
  }
2990
  else wppa_error_message( 'Unexpected error #2 in wppa_album_photos_bulk().' );
2991
  }
2992
- else {
2993
- wppa_error_message( 'Unexpected error #1 in wppa_album_photos_bulk().' );
2994
- var_dump($_REQUEST);
2995
- }
2996
 
2997
  if ( $count && ! $abort ) {
2998
  switch ( wppa_get( 'bulk-action' ) ) {
@@ -3022,18 +3050,11 @@ function wppa_album_photos_bulk( $album ) {
3022
  }
3023
  }
3024
 
3025
- $slug = 'photo_bulk';
3026
- $a = wppa_is_int( $album ) ? $album : '0';
3027
- if ( ! $a ) {
3028
- $slug .= '_' . $album;
3029
- }
3030
- $parms = wppa_get_paging_parms( $slug );
3031
-
3032
- $pagesize = $parms['pagesize']; // wppa_opt( 'photo_admin_pagesize' ) ? wppa_opt( 'photo_admin_pagesize' ) : '20';
3033
- $next_after = wppa_get( 'next-after', '0' ) ? '1' : '0';
3034
- $p = $parms['page']; // wppa_get( 'paged', '1' );
3035
- $page = $p + $next_after;
3036
- $skip = ( $page - '1' ) * $pagesize;
3037
 
3038
  if ( $album ) {
3039
  if ( $album == 'moderate' ) {
@@ -3078,176 +3099,177 @@ function wppa_album_photos_bulk( $album ) {
3078
 
3079
  if ( $photos ) {
3080
  $plink = $link . '&next-after=' . $next_after;
 
3081
 
3082
- wppa_admin_pagination( $pagesize, $page, $count, $plink, 'top' );
3083
-
3084
- $result = '
3085
- <form action="' . $link . '&paged=' . $page . '#manage-photos" method="post">' .
3086
- wp_nonce_field( 'wppa-bulk', 'wppa-bulk' ) . '
3087
- <div>
3088
- <!-- Bulk action -->
3089
- <select id="wppa-bulk-action" name="wppa-bulk-action" onchange="wppaBulkActionChange( this, \'bulk-album\' )">
3090
- <option value="" disabled selected>' . esc_html__( 'Bulk action', 'wp-photo-album-plus' ) . '</option>';
3091
- if ( $album == 'trash' ) {
3092
- $result .= '
3093
- <option value="wppa-bulk-delete-immediate">' . esc_html__( 'Remove permanently', 'wp-photo-album-plus' ) . '</option>
3094
- <option value="wppa-bulk-undelete">' . esc_html__( 'Undelete', 'wp-photo-album-plus' ) . '</option>';
3095
- }
3096
- else {
3097
- $result .= '
3098
- <option value="wppa-bulk-delete">' . esc_html__( 'Delete', 'wp-photo-album-plus' ) . '</option>';
3099
- }
3100
- $result .= '
3101
- <option value="wppa-bulk-move-to">' . esc_html__( 'Move to', 'wp-photo-album-plus' ) . '</option>
3102
- <option value="wppa-bulk-copy-to">' . esc_html__( 'Copy to', 'wp-photo-album-plus' ) . '</option>';
3103
 
3104
- if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
3105
- $result .= '
3106
- <option value="wppa-bulk-status">' . esc_html__( 'Set status to', 'wp-photo-album-plus' ) . '</option>';
3107
- }
3108
- if ( wppa_user_is_admin() && wppa_switch( 'photo_owner_change' ) ) {
3109
- $result .= '
3110
- <option value="wppa-bulk-owner">' . esc_html__( 'Set owner to', 'wp-photo-album-plus' ) . '</option>';
3111
- }
3112
- $result .= '
3113
- </select>
3114
- <!-- Select album -->' .
3115
-
3116
- wppa_album_select_a( array( 'checkaccess' => true,
3117
- 'path' => true,
3118
- 'exclude' => $album,
3119
- 'selected' => '0',
3120
- 'addpleaseselect' => true,
3121
- 'sort' => true,
3122
- 'tagopen' => '<select' .
3123
- ' name="wppa-bulk-album"' .
3124
- ' id="wppa-bulk-album"' .
3125
- ' style="display:none"' .
3126
- ' onchange="wppa_setCookie( \'wppa_bulk_album\',this.value,365 )"' .
3127
- ' >',
3128
- 'tagname' => 'wppa-bulk-album',
3129
- 'tagid' => 'wppa-bulk-album',
3130
- 'tagonchange' => 'wppa_setCookie( \'wppa_bulk_album\',this.value,365 );',
3131
- 'tagstyle' => 'display:none;cursor:pointer;',
3132
- ) );
3133
-
3134
- if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
3135
- $result .= '
3136
- <!-- Select status -->
3137
- <select
3138
- name="wppa-bulk-status"
3139
- id="wppa-bulk-status"
3140
- style="display:none"
3141
- onchange="wppa_setCookie( \'wppa_bulk_status\',this.value,365 )"
3142
- >
3143
- <option value="">' . esc_html__( '- select a status -' , 'wp-photo-album-plus' ) . '</option>
3144
- <option value="pending">' . esc_html__( 'Pending' , 'wp-photo-album-plus' ) . '</option>
3145
- <option value="publish">' . esc_html__( 'Publish' , 'wp-photo-album-plus' ) . '</option>';
3146
- if ( ! wppa_switch( 'ext_status_restricted' ) || wppa_user_is_admin() ) {
3147
- $result .= '
3148
- <option value="featured">' . esc_html__( 'Featured' , 'wp-photo-album-plus' ) . '</option>
3149
- <option value="gold">' . esc_html__( 'Gold' , 'wp-photo-album-plus' ) . '</option>
3150
- <option value="silver">' . esc_html__( 'Silver' , 'wp-photo-album-plus' ) . '</option>
3151
- <option value="bronze">' . esc_html__( 'Bronze' , 'wp-photo-album-plus' ) . '</option>
3152
- <option value="scheduled">' . esc_html__( 'Scheduled' , 'wp-photo-album-plus' ) . '</option>
3153
- <option value="private">' . esc_html__( 'Private' , 'wp-photo-album-plus' ) . '</option>';
3154
- }
3155
- $result .= '
3156
- </select>';
3157
- }
3158
 
3159
- $users = wppa_get_users();
 
 
 
3160
 
3161
- // Less tha2 250 users
3162
- if ( count( $users ) < 250 ) {
3163
- $result .= '
3164
- <!-- Select user -->
3165
- <select name="wppa-bulk-owner" id="wppa-bulk-owner" style="display:none" onchange="wppa_setCookie( \'wppa_bulk_owner\',this.value,365 )">
3166
- <option value="">' . esc_html__( '- select an owner -' , 'wp-photo-album-plus' ) . '</option>';
3167
- foreach ( $users as $user ) {
3168
- $result .= '<option value="' . esc_attr( $user['user_login'] ) . '">' . htmlspecialchars( $user['display_name'] ) . ' (' . htmlspecialchars( $user['user_login'] ) . ')</option>';
3169
- }
3170
- $result .= '
3171
- </select>';
3172
- }
3173
 
3174
- // Mor ethan 250 users
3175
- else {
3176
- $result .= '
3177
- <!-- Input user_login -->
3178
- <input name="wppa-bulk-owner" id="wppa-bulk-owner" style="display:none" onchange="wppa_setCookie( \'wppa_bulk_owner\',this.value,365 )" />';
3179
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3180
 
3181
- // Submit
 
 
 
 
3182
  $result .= '
3183
- <!-- Submit -->
3184
- <input type="submit" onclick="return wppaBulkDoitOnClick()" class="button-primary" value="' . esc_html__( 'Doit!' , 'wp-photo-album-plus' ) . '"/>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3185
  if ( wppa_is_mobile() ) {
3186
- $result .= '<br>';
3187
  }
3188
-
3189
- // Net page after selection
3190
- $nextafterselhtml = '
3191
- <select name="next-after">
3192
- <option value="-1"' . ( $next_after == '-1' ? ' selected' : '' ) . '>' . esc_html__( 'the previous page', 'wp-photo-album-plus' ) . '</option>
3193
- <option value="0"' . ( $next_after == '0' ? ' selected' : '' ) . '>' . esc_html__( 'the same page', 'wp-photo-album-plus' ) . '</option>
3194
- <option value="1"' . ( $next_after == '1' ? ' selected' : '' ) . '>' . esc_html__( 'the next page', 'wp-photo-album-plus' ) . '</option>
3195
- </select>';
3196
- $result .= sprintf( __( 'Go to %s after Doit!.', 'wp-photo-album-plus' ), $nextafterselhtml );
3197
  if ( wppa_is_mobile() ) {
3198
- $result .= '<br>';
3199
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3200
 
3201
- // Confirm delete
3202
- $result .= '
3203
- <input
3204
- type="checkbox"
3205
- id="confirm-delete"
3206
- name="confirm-delete"
3207
- checked="checked"
3208
- onchange="wppaToggleConfirmDelete(this)"
3209
- />
3210
- <label for="confirm-delete">' .
3211
- esc_html__( 'Confirm delete', 'wp-photo-album-plus' ) . '
3212
- </label>';
3213
-
3214
- // Confirm move
3215
- $result .= '
3216
- <input
3217
- type="checkbox"
3218
- id="confirm-move"
3219
- name="confirm-move"
3220
- checked="checked"
3221
- onchange="wppaToggleConfirmMove(this)"
3222
- />
3223
- <label for="confirm-move">' .
3224
- esc_html__( 'Confirm move', 'wp-photo-album-plus' ) . '
3225
- </label>';
3226
-
3227
- $result .= '
3228
- </div>';
3229
- wppa_echo( $result );
3230
 
3231
- $edit_link = wppa_ea_url( 'single', 'edit' );
3232
-
3233
- // The table of bulk ediatble items
3234
- $thead_body = '
3235
- <td><input type="checkbox" class="wppa-bulk-photo" onchange="jQuery( \'.wppa-bulk-photo\' ).prop( \'checked\', this.checked )" /></td>
3236
- <td>' . esc_html__( 'ID', 'wp-photo-album-plus' ) . '</td>
3237
- <td>' . esc_html__( 'Preview', 'wp-photo-album-plus' ) . '</td>
3238
- <td>' . esc_html__( 'Name', 'wp-photo-album-plus' ) . '</td>
3239
- <td>' . esc_html__( 'Description', 'wp-photo-album-plus' ) . '</td>
3240
- <td>' . esc_html__( 'Status', 'wp-photo-album-plus' ) . '</td>
3241
- <td>' . esc_html__( 'Owner', 'wp-photo-album-plus' ) . '</td>
3242
- <td>' . esc_html__( 'Remark', 'wp-photo-album-plus' ) . '</td>';
3243
- $result = '
3244
  <table class="widefat">
3245
- <thead style="font-weight:bold">' .
3246
- $thead_body . '
 
 
 
 
 
 
 
3247
  </thead>
3248
- <tbody>';
3249
- wppa_echo( $result );
3250
-
3251
  foreach ( $photos as $photo ) {
3252
  $id = $photo['id'];
3253
 
@@ -3269,202 +3291,185 @@ function wppa_album_photos_bulk( $album ) {
3269
  }
3270
  }
3271
 
3272
- $maxsize = wppa_get_minisize();
3273
-
3274
- $result = '
3275
- <tr id="photoitem-' . $id . '" class="photoitem">
3276
  <!-- Checkbox -->
3277
  <td>
3278
- <input type="hidden" id="photo-nonce-' . $id . '" value="' . wp_create_nonce( 'wppa-nonce_' . $id ) . '" />
3279
- <input type="checkbox" name="wppa-bulk-photo[' . $id . ']" class="wppa-bulk-photo" />
3280
  </td>
3281
  <!-- ID and delete link -->
3282
- <td>
3283
- <a
3284
- href="' . $edit_link . '&photo=' . $id . '"
 
3285
  target="_blank"
3286
  >' .
3287
- $id . '
3288
  </a>
3289
  <br>
3290
  <a
3291
- id="wppa-delete-' . $id . '"
3292
- onclick="wppaConfirmAndDelete(' . $id . ', ' . ( $album == 'trash' ? 'true' : 'false' ) . ' )"
3293
  style="color:red;font-weight:bold;cursor:pointer"
3294
  >' .
3295
  ( $album == 'trash' ? __( 'Remove permanently', 'wp-photo-album-plus' ) : __( 'Delete', 'wp-photo-album-plus' ) ) . '
3296
- </a>
 
3297
  </td>
3298
  <!-- Preview -->
3299
- <td style="min-width:240px; text-align:center">';
3300
-
3301
- if ( wppa_is_video( $photo['id'] ) ) {
3302
  $a = false;
3303
  if ( wppa_is_file( wppa_strip_ext( wppa_get_photo_path( $id ) ) . '.mp4' ) ) {
3304
  $a = true;
3305
- $result .= '
3306
  <a
3307
  href="' . esc_url( str_replace( '.jpg', '.mp4', wppa_get_photo_url( $id ) ) ) . '"
3308
  target="_blank"
3309
  title="' . esc_attr( __( 'Click to see fullsize video', 'wp-photo-album-plus' ) ) . '"
3310
- >' ;
3311
  }
3312
 
3313
- $result .= wppa_get_video_html( array(
3314
- 'id' => $id,
3315
- 'height' => '160',
3316
- 'controls' => false,
3317
- 'tagid' => 'pa-id-' . $id,
3318
- 'preload' => 'metadata',
3319
- 'use_thumb' => true,
3320
- ) );
3321
- if ( $a ) {
3322
- $result .= '</a>';
3323
- }
3324
  }
3325
  else {
3326
- $result .= '
3327
- <a
3328
- href="' . esc_url( wppa_get_photo_url( $photo['id'] ) ) . '"
3329
- target="_blank"
3330
- title="' . esc_attr( __( 'Click to see fullsize', 'wp-photo-album-plus' ) ) . '"
3331
- >
3332
- <img
3333
- class="wppa-bulk-thumb"' .
3334
- ( wppa_lazy() ? ' data-' : ' ' ) . 'src="' . esc_url( wppa_get_thumb_url( $id ) ) . '"
3335
- style="max-width:' . $maxsize . 'px;max-height:' . $maxsize . 'px"
3336
- />
3337
- </a>';
3338
  }
3339
- $result .= '
3340
  </td>
3341
  <!-- Name, size, move -->
 
3342
  <td style="width:25%">
3343
- <!-- Name -->
3344
- <input
3345
- type="text"
3346
- style="width:300px"
3347
- id="pname-' . $id . '"
3348
- onchange="wppaAjaxUpdatePhoto(' . $id . ', \'name\', this.value)"
3349
- value="' . esc_attr( stripslashes( $photo['name'] ) ) . '"
3350
- />
3351
- <!-- Size -->';
3352
- if ( wppa_is_video( $id ) ) {
3353
- $result .= '<br>' . wppa_get_videox( $id, 'admin' ) . ' x ' . wppa_get_videoy( $id, 'admin' ) . ' px.';
3354
  }
3355
  else {
3356
- $sp = wppa_get_source_path( $id );
3357
  if ( is_file( $sp ) ) {
3358
  $ima = getimagesize( $sp );
3359
  if ( is_array( $ima ) ) {
3360
- $result .= '<br>' . $ima['0'] . ' x ' . $ima['1'] . ' px.';
3361
  }
3362
  }
3363
  }
3364
- $result .= '
3365
- <!-- Move -->';
3366
- $max = wppa_opt( 'photo_admin_max_albums' );
3367
- if ( ! $max || wppa_get_total_album_count() < $max ) {
3368
-
3369
- // If not done yet, get the album options html with the current album excluded
3370
- if ( ! isset( $album_select[$album] ) ) {
3371
- $album_select[$album] = wppa_album_select_a( array( 'checkaccess' => true,
3372
- 'path' => true,
3373
- 'exclude' => $album,
3374
- 'selected' => '0',
3375
- 'addpleaseselect' => true,
3376
- 'sort' => true,
3377
- )
3378
- );
3379
- }
 
3380
 
3381
- $result .= '
3382
- <br>' . __( 'Target album for move to', 'wp-photo-album-plus' ) . '<br>
3383
- <select
3384
- id="target-' . $id . '"
3385
- onchange="wppaTryMove(' . $id . ', ' . ( wppa_is_video( $id ) ? 'true' : 'false' ) . ')"
3386
- style="max-width:300px"
3387
- >' .
3388
- $album_select[$album] . '
3389
- </select>
3390
- <span id="moving-' . $id . '" style="color:red;font-weight:bold"></span>';
3391
- }
3392
- $result .= '
3393
- </td>';
3394
- wppa_echo( $result );
3395
 
3396
- $result = '
 
3397
  <!-- Description -->
3398
  <td style="width:25%">
3399
- <textarea
3400
- class="wppa-bulk-desc"
3401
- style="height:50px; width:100%"
3402
- onchange="wppaAjaxUpdatePhoto(' . $id . ', \'description\', this.value)"
3403
- >' .
3404
- esc_textarea( stripslashes( $photo['description'] ) ) . '
3405
- </textarea>
3406
  </td>
3407
  <!-- Status -->
3408
- <td>';
3409
- if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
3410
- if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) {
3411
- $dis = ' disabled';
3412
- }
 
 
 
 
 
 
 
 
 
3413
  else {
3414
- $dis = '';
3415
- }
3416
- $ps = $photo['status'];
3417
- $sel = ' selected';
3418
- $result .= '
3419
- <select
3420
- id="status-' . $id . '"
3421
- onchange="wppaAjaxUpdatePhoto(' . $id . ', \'status\', this.value); wppaPhotoStatusChange(' . $id . ')"
3422
- >
3423
- <option value="pending"' . ( $ps == 'pending' ? $sel : '' ) . '>' . esc_html__( 'Pending' , 'wp-photo-album-plus' ) . '</option>
3424
- <option value="publish"' . ( $ps == 'publish' ? $sel : '' ) . '>' . esc_html__( 'Publish' , 'wp-photo-album-plus' ) . '</option>
3425
- <option value="featured"' . ( $ps == 'featured' ? $sel : '' ) . $dis . '>' . esc_html__( 'Featured' , 'wp-photo-album-plus' ) . '</option>
3426
- <option value="gold"' . ( $ps == 'gold' ? $sel : '' ) . $dis . '>' . esc_html__( 'Gold' , 'wp-photo-album-plus' ) . '</option>
3427
- <option value="silver"' . ( $ps == 'silver' ? $sel : '' ) . $dis . '>' . esc_html__( 'Silver' , 'wp-photo-album-plus' ) . '</option>
3428
- <option value="bronze"' . ( $ps == 'bronze' ? $sel : '' ) . $dis . '>' . esc_html__( 'Bronze' , 'wp-photo-album-plus' ) . '</option>
3429
- <option value="scheduled"' . ( $ps == 'scheduled' ? $sel : '' ) . $dis . '>' . esc_html__( 'Scheduled' , 'wp-photo-album-plus' ) . '</option>
3430
- <option value="private"' . ( $ps == 'private' ? $sel : '' ) . $dis . '>' . esc_html__( 'Private' , 'wp-photo-album-plus' ) . '</option>
3431
- </select>';
3432
- }
3433
- else {
3434
- $result .= wppa_status_display_name( $photo['status'] );
3435
- }
3436
- $result .= '
3437
  </td>
3438
  <!-- Owner -->
3439
- <td>' .
3440
- $photo['owner'] . '
3441
  </td>
3442
  <!-- Remark -->
3443
- <td id="remark-' . $id . '" style="width:25%">' .
3444
- esc_html__( 'Not modified' , 'wp-photo-album-plus' ) . '
 
3445
  </td>
3446
- </tr>';
3447
- wppa_echo( $result );
3448
-
3449
- wppa_add_inline_script( 'wppa-admin', 'wppaPhotoStatusChange(' . $id . ');' );
3450
- }
3451
-
3452
- $result = '
3453
  </tbody>
3454
- <tfoot style="font-weight:bold">' .
3455
- $thead_body . '
 
 
 
 
 
 
 
3456
  </tfoot>
3457
  </table>
3458
- </form>';
3459
-
3460
- wppa_echo( $result );
3461
-
3462
- wppa_admin_pagination( $pagesize, $page, $count, $plink, 'bottom' );
3463
  }
3464
  else {
3465
  if ( $page == '1' ) {
3466
  if ( wppa_get( 'searchstring' ) ) {
3467
- wppa_echo( '<h1>' . __( 'No photos matching your search criteria.', 'wp-photo-album-plus' ) . ' 2</h1>' );
3468
  }
3469
  elseif ( $album == 'moderate' ) {
3470
  wppa_echo( '<h1>' . __( 'No photos to moderate', 'wp-photo-album-plus' ) . '</h1>' );
@@ -3478,7 +3483,7 @@ function wppa_album_photos_bulk( $album ) {
3478
  }
3479
  else {
3480
  $page_1 = $page - '1';
3481
- wppa_echo( sprintf( __( 'Page %d is empty, try <a href="%s">page %d</a>.', 'wp-photo-album-plus' ), $page, $link . '&paged=' . $page_1 . '#manage-photos', $page_1 ) );
3482
  }
3483
  }
3484
  }
@@ -3487,17 +3492,11 @@ function wppa_album_photos_bulk( $album ) {
3487
  function wppa_album_photos_sequence( $album ) {
3488
  global $wpdb;
3489
 
3490
- wppa_add_local_js( 'wppa_album_photos_sequence' );
3491
-
3492
  if ( $album ) {
3493
  $photoorder = wppa_get_photo_order( $album, 'norandom' );
3494
  $is_descending = strpos( $photoorder, 'DESC' ) !== false;
3495
  $is_p_order = strpos( $photoorder, 'p_order' ) !== false;
3496
 
3497
- if ( $is_descending && $is_p_order ) {
3498
- wppa_add_inline_script( 'wppa-admin', 'var wppaSeqnoDesc = true;' );
3499
- }
3500
-
3501
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
3502
  WHERE album = %s" . $photoorder, $album ), ARRAY_A );
3503
 
@@ -3505,95 +3504,150 @@ global $wpdb;
3505
  $size = '180';
3506
 
3507
  if ( $photos ) {
3508
- if ( ! $is_p_order ) wppa_warning_message( __( 'Setting photo sequence has only effect if the photo sequence method is set to <b>Sequence #</b>' , 'wp-photo-album-plus' ) );
3509
 
3510
- $result = '
3511
- <div class="widefat wppa-photo-admin-sortable" style="border-color:#cccccc">
3512
- <ul id="sortable">';
3513
- foreach ( $photos as $photo ) {
3514
- $id = $photo['id'];
3515
- if ( wppa_is_video( $id ) ) {
3516
- $imgs['0'] = wppa_get_videox( $id, 'admin' );
3517
- $imgs['1'] = wppa_get_videoy( $id, 'admin' );
3518
- }
3519
- else {
3520
- $imgs['0'] = wppa_get_thumbx( $id );
3521
- $imgs['1'] = wppa_get_thumby( $id );
3522
- }
3523
- if ( ! $imgs['0'] ) { // missing thuimbnail, prevent division by zero
3524
- $imgs['0'] = 200;
3525
- $imgs['1'] = 150;
3526
- }
3527
- $mw = $size - '20';
3528
- $mh = $mw * '3' / '4';
3529
- if ( $imgs[1]/$imgs[0] > $mh/$mw ) { // more portrait than 200x150, y is limit
3530
- $mt = '15';
 
 
 
 
 
 
 
 
 
 
 
 
 
3531
  }
3532
- else { // x is limit
3533
- $mt = ( $mh - ( $imgs[1]/$imgs[0] * $mw ) ) / '2' + '15';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3534
  }
3535
-
3536
- $result .= '
3537
- <li
3538
- id="photoitem-' . $id . '"
3539
- class="ui-state-default-photos wppa-' . $photo['status'] . '"
3540
- style="background-image:none; text-align:center; cursor:move"
3541
- >';
3542
- if ( wppa_is_video( $id ) ) {
3543
- $imgstyle = 'max-width:'.$mw.'px;max-height:'.$mh.'px;margin-top:'.$mt.'px;';
3544
- $result .= wppa_get_video_html( array(
3545
- 'id' => $id,
3546
- 'controls' => false,
3547
- 'tagid' => 'pa-id-'.$id,
3548
- 'preload' => 'metadata',
3549
- 'class' => 'wppa-bulk-thumb',
3550
- 'style' => $imgstyle,
3551
- 'use_thumb' => true
3552
- ) );
3553
  }
3554
  else {
3555
- $result .= '
3556
- <img
3557
- class="wppa-bulk-thumb"' .
3558
- ( wppa_lazy() ? ' data-' : ' ' ) . 'src="' . esc_url( wppa_get_thumb_url( $id ) ) . '"
3559
- style="max-width:' . $mw . 'px;max-height:' . $mh . 'px;margin-top:' . $mt . 'px"
3560
- />';
3561
  }
3562
- $result .= '
3563
- <div
3564
- style="font-size:9px;position:absolute;bottom:24px;text-align:center;width:' . $size . 'px">' .
3565
- wppa_get_photo_name( $id ) . '
3566
- </div>
3567
- <div
3568
- style="text-align:center;width:' . $size . 'px;position:absolute;bottom:8px"
3569
- >
3570
- <span
3571
- style="margin-left:15px;float:left">' .
3572
- esc_html__( 'Id: ' , 'wp-photo-album-plus' ) . $id . '
3573
- </span>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3574
 
3575
- if ( wppa_is_video( $id ) ) $result .= __( 'Video', 'wp-photo-album-plus' );
3576
- if ( wppa_has_audio( $id ) ) $result .= __( 'Audio', 'wp-photo-album-plus' );
3577
 
3578
- $result .= '
3579
- <span style="float:right;margin-right:15px">' .
3580
- esc_html__( 'Seq: ' , 'wp-photo-album-plus' ) . '
3581
- <span id="wppa-seqno-' . $id . '">' .
3582
- $photo['p_order'] . '
3583
- </span>
3584
- </span>
 
 
 
 
 
 
 
3585
  </div>
3586
- <input type="hidden" id="photo-nonce-' . $id . '" value="' . wp_create_nonce( 'wppa-nonce_' . $id ) . '" />
3587
- <input type="hidden" class="wppa-sort-item" value="' . $id . '" />
3588
- <input type="hidden" class="wppa-sort-seqn" id="wppa-sort-seqn-' . $id . '" value="' . $photo['p_order'] . '" />
3589
- </li>';
3590
- }
3591
-
3592
- $result .= '
3593
  </ul>
3594
  <div style="clear:both"></div>
3595
- </div>';
3596
- wppa_echo( $result );
3597
  }
3598
  else {
3599
  wppa_echo( '<h1>'.__( 'The album is empty.' , 'wp-photo-album-plus' ).'</h1>' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 8.2.09.002
7
  *
8
  */
9
 
20
  $photo = wppa_get( 'photo', '0', 'int' );
21
  $thumb = wppa_cache_photo( $photo );
22
  if ( $thumb['owner'] == wppa_get_user() ) {
23
+ wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Edit photo', 'wp-photo-album-plus' ) . '</h2>' );
 
 
 
 
24
  wppa_album_photos( '', $photo );
25
+ wppa_echo( '</div>' );
 
26
  }
27
  else {
28
  wp_die( 'You do not have the rights to do this' );
31
 
32
  // Edit all photos owned by current user
33
  else {
34
+ wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Edit photos', 'wp-photo-album-plus' ) . '</h2>' );
 
 
 
 
35
  wppa_album_photos( '', '', wppa_get_user() );
36
+ wppa_echo( '</div>' );
 
37
  }
38
  }
39
 
45
  $just_edit = wppa_get( 'just-edit' );
46
 
47
  if ( $photo && $just_edit && wppa_user_is_admin() ) {
48
+ wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Edit photo', 'wp-photo-album-plus' ) . '</h2>' . wppa_get( 'just-edit' ) );
 
 
 
 
 
49
  wppa_album_photos( '', $photo, '', false );
50
+ wppa_echo( '</div>' );
 
51
  }
52
  else {
53
+ wppa_echo( '<div class="wrap"><h2>' . esc_html__( 'Moderate photos' , 'wp-photo-album-plus' ) . '</h2>' );
 
 
 
 
54
  if ( wppa_switch( 'moderate_bulk' ) ) {
55
  wppa_album_photos_bulk( 'moderate' );
56
  }
57
  else {
58
  wppa_album_photos( '', $photo, '', true );
59
  }
60
+ wppa_echo( '</div>' );
 
61
  }
62
  }
63
 
65
  function wppa_album_photos( $album = '', $photo = '', $owner = '', $moderate = false ) {
66
  global $wpdb;
67
 
68
+ $pagesize = wppa_opt( 'photo_admin_pagesize' );
69
+ $page = wppa_get( 'wppa-page', '1' );
70
+ if ( ! is_numeric( $page ) ) $page = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  $skip = ( $page - '1' ) * $pagesize;
72
+ $album_is_obvious = false;
 
73
 
74
  // Edit the photos in a specific album
75
  if ( $album ) {
78
  if ( $album == 'search' ) {
79
  $count = wppa_get_edit_search_photos( '', '', 'count_only' );
80
  $photos = wppa_get_edit_search_photos( $skip, $pagesize );
81
+
82
  $link = get_admin_url() . 'admin.php?page=wppa_admin_menu&tab=edit&edit-id=' . $album . '&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' ) . '&wppa-searchstring=' . wppa_get( 'searchstring' );
83
  }
84
 
103
 
104
  // A physical album
105
  else {
106
+ $album_is_obvious = true;
107
  $counts = wppa_get_treecounts_a( $album, true );
108
  $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
109
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
149
  $link = '';
150
  }
151
 
152
+ // Are there photos with pending comments?
153
+ else {
154
+
155
+ // Find pending comments
156
+ $cmt = $wpdb->get_results( "SELECT photo FROM $wpdb->wppa_comments
157
+ WHERE status = 'pending'
158
+ OR status = 'spam'", ARRAY_A );
159
+
160
+ $photos = array();
161
+
162
+ if ( is_array( $cmt ) && count( $cmt ) ) {
163
+
164
+ foreach( $cmt as $id ) {
165
+ $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
166
+ WHERE id = %d", $id ), ARRAY_A );
167
+ }
168
+ $count = count( $photos );
169
+ }
170
+ $link = get_admin_url() . 'admin.php?page=wppa_moderate_photos&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
171
+ }
172
+
173
  // Are there photos to moderate?
174
+ if ( empty( $photos ) ) {
175
 
176
  $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
177
  WHERE status = 'pending'
179
  $count = count( $photos );
180
  }
181
 
182
+ // No photos to moderate?
183
+ if ( empty( $photos ) ) {
184
+
185
+ // Single photo moderate requested
186
+ if ( $photo ) {
187
+ wppa_echo( '<p>' . esc_html__( 'This photo is no longer awaiting moderation.' , 'wp-photo-album-plus' ) . '</p>' );
188
+ }
189
+
190
+ // Multiple photos to moderate requested
191
+ else {
192
+ wppa_echo( '<p>' . esc_html__( 'There are no photos awaiting moderation at this time.', 'wp-photo-album-plus' ) . '</p>' );
193
+ }
194
 
195
+ // If i am admin, i can edit all photos here, sorted by timestamp desc
196
+ if ( wppa_user_is_admin() ) {
197
+ wppa_echo( '<h1>' . esc_html__( 'Manage all photos by timestamp', 'wp-photo-album-plus' ) . '</h1>' );
 
198
 
199
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
200
+ ORDER BY timestamp DESC
201
+ LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
202
 
203
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos" );
204
+ $link = get_admin_url() . 'admin.php?page=wppa_moderate_photos&wppa-nonce=' . wp_create_nonce( 'wppa-nonce' );
 
205
  }
 
206
 
207
+ // Nothing to do
208
+ else {
209
+ return;
210
  }
211
  }
 
212
  }
213
 
214
  // If not one of the cases above apply, log error and quit
217
  return;
218
  }
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  // Quick edit skips a few time consuming settings like copy and move to other album
221
  $quick = wppa_get( 'quick' );
222
  if ( $link && $quick ) $link .= '&quick=1';
223
 
224
  // In case it is a seaerch and edit, show the search statistics
225
+ wppa_show_search_statistics();
 
 
226
 
227
  // If no photos selected produce appropriate message and quit
228
  if ( empty( $photos ) ) {
243
 
244
  // Search
245
  if ( wppa_get( 'searchstring' ) ) {
246
+ wppa_echo( '<h1>' . esc_html__( 'No photos matching your search criteria.', 'wp-photo-album-plus' ) . '</h1>' );
247
  }
248
 
249
  // Album
258
  // There are photos to display for editing
259
  else {
260
 
261
+ // Local js functions
262
+ {
263
+ $the_js = "
264
+ function wppaTryMove( id, video ) {
265
+
266
+ var query;
267
+
268
+ if ( ! jQuery( '#target-' + id ).val() ) {
269
+ alert( '" . esc_js( __( 'Please select an album to move to first.', 'wp-photo-album-plus' ) ) . "' );
270
+ return false;
271
+ }
272
+
273
+ if ( video ) {
274
+ query = '" . esc_js( __( 'Are you sure you want to move this video?', 'wp-photo-album-plus' ) ) . "';
275
+ }
276
+ else {
277
+ query = '" . esc_js( __( 'Are you sure you want to move this photo?', 'wp-photo-album-plus' ) ) . "';
278
+ }
279
+
280
+ if ( confirm( query ) ) {
281
+ wppaAjaxUpdatePhoto( id, 'moveto', document.getElementById( 'target-' + id ).value );
282
+ }
283
+ }
284
+
285
+ function wppaTryCopy( id, video ) {
286
+
287
+ var query;
288
+
289
+ if ( ! jQuery( '#target-' + id ).val() ) {
290
+ alert( '" . esc_js( __( 'Please select an album to copy to first.', 'wp-photo-album-plus' ) ) . "' );
291
+ return false;
292
+ }
293
+
294
+ if ( video ) {
295
+ query = '" . esc_js( __( 'Are you sure you want to copy this video?', 'wp-photo-album-plus' ) ) . "';
296
+ }
297
+ else {
298
+ query = '" . esc_js( __( 'Are you sure you want to copy this photo?', 'wp-photo-album-plus' ) ) . "';
299
+ }
300
+
301
+ if ( confirm( query ) ) {
302
+ wppaAjaxUpdatePhoto( id, 'copyto', document.getElementById( 'target-' + id ).value );
303
+ }
304
+ }
305
+
306
+ function wppaTryDelete( id, video, perm ) {
307
+
308
+ var query;
309
+
310
+ if ( perm ) {
311
+ if ( video ) {
312
+ query = '" . esc_js( __( 'Are you sure you want to remove this video permanently?', 'wp-photo-album-plus' ) ) . "';
313
+ }
314
+ else {
315
+ query = '" . esc_js( __( 'Are you sure you want to remove this photo permanently?', 'wp-photo-album-plus' ) ) . "';
316
+ }
317
+ }
318
+ else {
319
+ if ( video ) {
320
+ query = '" . esc_js( __( 'Are you sure you want to delete this video?', 'wp-photo-album-plus' ) ) . "';
321
+ }
322
+ else {
323
+ query = '" . esc_js( __( 'Are you sure you want to delete this photo?', 'wp-photo-album-plus' ) ) . "';
324
+ }
325
+ }
326
+
327
+ if ( confirm( query ) ) {
328
+ if ( perm ) {
329
+ wppaAjaxDeletePhoto( id, '', '', true );
330
+ }
331
+ else {
332
+ wppaAjaxDeletePhoto( id );
333
+ }
334
+ jQuery( window ).trigger( 'scroll' );
335
+ }
336
+ }
337
+
338
+ function wppaTryUndelete ( id ) {
339
+ wppaAjaxUndeletePhoto( id );
340
+ }
341
+
342
+ function wppaTryRotLeft( id ) {
343
+
344
+ var query = '" . esc_js( __( 'Are you sure you want to rotate this photo left?', 'wp-photo-album-plus' ) ) . "';
345
+
346
+ if ( confirm( query ) ) {
347
+ wppaAjaxUpdatePhoto( id, 'rotleft', 0 );
348
+ }
349
+ }
350
+
351
+ function wppaTryRot180( id ) {
352
+
353
+ var query = '" . esc_js( __( 'Are you sure you want to rotate this photo 180&deg;?', 'wp-photo-album-plus' ) ) . "';
354
+
355
+ if ( confirm( query ) ) {
356
+ wppaAjaxUpdatePhoto( id, 'rot180', 0 );
357
+ }
358
+ }
359
+
360
+ function wppaTryRotRight( id ) {
361
+
362
+ var query = '" . esc_js( __( 'Are you sure you want to rotate this photo right?', 'wp-photo-album-plus' ) ) . "';
363
+
364
+ if ( confirm( query ) ) {
365
+ wppaAjaxUpdatePhoto( id, 'rotright', 0 );
366
+ }
367
+ }
368
+
369
+ function wppaTryFlip( id ) {
370
+
371
+ var query = '" . esc_js( __( 'Are you sure you want to flip this photo?', 'wp-photo-album-plus' ) ) . "';
372
+
373
+ if ( confirm( query ) ) {
374
+ wppaAjaxUpdatePhoto( id, 'flip', 0 );
375
+ }
376
+ }
377
+
378
+ function wppaTryFlop( id ) {
379
+
380
+ var query = '" . esc_js( __( 'Are you sure you want to flip this photo?', 'wp-photo-album-plus' ) ) . "';
381
+
382
+ if ( confirm( query ) ) {
383
+ wppaAjaxUpdatePhoto( id, 'flop', 0 );
384
+ }
385
+ }
386
+
387
+ function wppaTryWatermark( id, hasSource, canRemove ) {
388
+
389
+ var query;
390
+ var wmFile = jQuery( '#wmfsel_' + id ).val();
391
+ if ( wmFile == '--- none ---' ) {
392
+ alert( '" . esc_js( __( 'No watermark selected', 'wp-photo-album-plus' ) ) . "' );
393
+ return;
394
+ }
395
+ if ( hasSource ) {
396
+ query = '" . esc_js( __( 'Are you sure?', 'wp-photo-album-plus' ) ) . "';
397
+ query += '. ';
398
+ query += '" . esc_js( __( 'To revert to the default watermark setting afterwards: select Watermark: --- default --- and press the Remake files button', 'wp-photo-album-plus' ) ) . "';
399
+ if ( canRemove ) {
400
+ query += '. ';
401
+ query += '" . esc_js( __( 'To remove: select Watermark: --- none --- and press the Remake files button', 'wp-photo-album-plus' ) ) . "';
402
+ }
403
+ }
404
+ else {
405
+ query = '" . esc_js( __( 'Are you sure? Once applied it can not be removed!', 'wp-photo-album-plus' ) ) . "';
406
+ query += '. ';
407
+ query += '" . esc_js( __( 'And I do not know if there is already a watermark on this photo', 'wp-photo-album-plus' ) ) . "';
408
+ }
409
+
410
+ if ( confirm( query ) ) {
411
+ wppaAjaxApplyWatermark( id, document.getElementById( 'wmfsel_' + id ).value, document.getElementById( 'wmpsel_' + id ).value );
412
+ }
413
+ }
414
+
415
+ function wppaTryMagick( id, slug, value ) {
416
+
417
+ if ( ! value ) {
418
+ value = 0;
419
+ }
420
+
421
+ var query = '" . esc_js( __( 'Are you sure you want to magically process this photo?', 'wp-photo-album-plus' ) ) . "';
422
+
423
+ if ( true || confirm( query ) ) {
424
+ jQuery( '#wppa-admin-spinner' ).css( 'display', 'inline' );
425
+ wppaAjaxUpdatePhoto( id, slug, value );
426
+ }
427
+ }
428
+
429
+ wppaHor = false;
430
+ function wppaToggleHorizon() {
431
+ if ( wppaHor ) {
432
+ jQuery( '#wppa-horizon' ).css( 'display', 'none' );
433
+ wppaHor = false;
434
+ }
435
+ else {
436
+ jQuery( '#wppa-horizon' ).css( 'display', 'inline' );
437
+ wppaHor = true;
438
+ }
439
+ }
440
+
441
+ function wppaTryScheduledel( id ) {
442
+ wppaPhotoStatusChange( id );
443
+ if ( ! jQuery( '#scheduledel-' + id ).prop( 'checked' ) ) {
444
+ wppaAjaxUpdatePhoto( id, 'removescheduledel', 0 );
445
+ }
446
+ }
447
+ ";
448
+
449
+ wppa_add_inline_script( 'wppa-admin', $the_js );
450
+ }
451
+
452
  $mvt = esc_attr( __( 'Move video', 'wp-photo-album-plus' ) );
453
  $mpt = esc_attr( __( 'Move photo', 'wp-photo-album-plus' ) );
454
  $cvt = esc_attr( __( 'Copy video', 'wp-photo-album-plus' ) );
455
  $cpt = esc_attr( __( 'Copy photo', 'wp-photo-album-plus' ) );
456
 
457
  // Display the pagelinks
458
+ wppa_admin_page_links( $page, $pagesize, $count, $link );
459
 
460
  // Horizon
461
  wppa_echo( '<div id="wppa-horizon"><hr></div>' );
591
  wppa_echo( '
592
  <div
593
  id="photoitem-' . $id . '"
594
+ class="wppa-table-wrap"
595
+ style="display:block;padding:20px"
596
  >' .
597
 
598
  // Photo specific nonce field
621
  'width' => '160',
622
  'height' => '160' * $videoy / $videox,
623
  'controls' => false,
624
+ 'use_thumb' => true
 
625
  ) ) . '
626
  </a>' );
627
 
665
  id="thumburl-' . $id . '"' .
666
  ( wppa_lazy() && $count > '1' ? ' data-' : ' ' ) . 'src="' . esc_url( $src ) . '"
667
  alt="' . esc_attr( $name ) . '"
668
+ style="max-width:160px;vertical-align:middle"
669
  />
670
  </a>' );
671
 
702
 
703
  wppa_echo( '</div>' );
704
  }
705
+ wppa_echo( '<h1 style="display:inline;vertical-align:bottom;">' . wppa_get_photo_name( $id ) . '</h1>' );
706
 
707
+ // Get the clicks, views and downloads stats
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  {
709
+ $th_1 = array();
710
+ $td_1 = array();
711
 
712
  // Clicks
713
  if ( wppa_switch( 'track_clickcounts' ) ) {
714
+ $th_1[] = __( 'Clicks', 'wp-photo-album-plus' );
715
+ $td_1[] = strval( intval( $clicks ) );
716
  }
717
 
718
  // Views
719
  if ( wppa_switch( 'track_viewcounts' ) ) {
720
+ $th_1[] = __( 'Views', 'wp-photo-album-plus' );
721
+ $td_1[] = strval( intval( $views ) );
722
  }
723
 
724
  // Downloads. Only photos are downloadable
725
  if ( ! wppa_is_multi( $id ) ) {
726
+ $th_1[] = __( 'Downloads', 'wp-photo-album-plus' );
727
+ $td_1[] = strval( intval( $dlcount ) );
728
  }
729
+ }
730
+
731
+ // Get the rating stats
732
+ {
733
+ $th_2 = array();
734
+ $td_2 = array();
735
 
736
  // Rating
737
  $entries = wppa_get_rating_count_by_id( $id );
742
  }
743
  else {
744
  $label = __( 'Rating (#, avg)', 'wp-photo-album-plus' );
745
+ $value = wppa_get_rating_by_id( $id, 'nolabel' );
 
 
746
  }
747
  }
748
  else {
750
  $value = __( 'None', 'wp-photo-album-plus' );
751
  }
752
 
753
+ $th_2[] = $label;
754
+ $td_2[] = $value;
755
 
756
  // Dislikes
757
  $dislikes = wppa_dislike_get( $id );
758
  if ( $dislikes ) {
759
+ $th_2[] = __( 'Dislikes', 'wp-photo-album-plus' );
760
+ $td_2[] = strval( intval( $dislikes ) );
761
  }
762
 
763
  // Pending votes
764
  $pending = wppa_pendrat_get( $id );
765
  if ( $pending ) {
766
+ $th_2[] = __( 'Pending votes', 'wp-photo-album-plus' );
767
+ $td_2[] = strval( intval( $pending ) );
768
  }
769
  }
770
 
771
  // Display the stats
772
+ {
773
+ $table = '<table>';
774
+ $header = array(1 => array(), 2 => array());
775
+ $rows = array(1 => array(), 2 => array());
 
 
 
 
 
 
 
 
776
 
777
+ for($i=0, $limit = max(count($th_1), count($th_2)); $i < $limit; $i++) {
778
 
779
+ $header[1][] .= isset($th_1[$i]) ? $th_1[$i] : '';
780
+ $header[2][] .= isset($th_2[$i]) ? $th_2[$i] : '';
781
+ $rows[1][] .= isset($td_1[$i]) ? $td_1[$i] : '';
782
+ $rows[2][] .= isset($td_2[$i]) ? $td_2[$i] : '';
783
+
784
+ }
785
+
786
+ $table .= '<thead><tr><th style="min-width: 100px; text-align: left;">' . implode('</th><th style="min-width: 100px; text-align: left;">', $header[1]) . '</th></tr></thead>';
787
+ $table .= '<tbody><tr><td>' . implode('</td><td>', $rows[1]) . '</td></tr></tbody>';
788
+ $table .= '<thead><tr><th style="text-align: left;">' . implode('</th><th style="text-align: left;">', $header[2]) . '</th></tr></thead>';
789
+ $table .= '<tbody><tr><td>' . implode('</td><td>', $rows[2]) . '</td></tr></tbody>';
790
+
791
+ $table .= '</table>';
792
+
793
+ wppa_echo( $table );
794
+ }
 
 
 
 
795
 
796
  wppa_echo( '
797
  </div>' );
804
 
805
  // Open the details area
806
  wppa_echo( '
807
+ <details class="wppa-toplevel-details" ' . ( $timestamp > time() - 3600 ? 'open' : '' ) . '>
808
  <summary class="toplevel wppa-summary-sublevel"> ' .
809
  $details . '
810
  </summary>' );
811
+
812
  // Update status field
813
  {
814
  wppa_echo( '
822
  </span>
823
  </h3>' );
824
  }
825
+
826
  // The tabs
827
  $ptitle = __( 'Photo', 'wp-photo-album-plus' );
828
  if ( wppa_is_video( $id ) ) $ptitle = __( 'Video', 'wp-photo-album-plus' );
842
  }
843
  if ( ! $quick && ! empty( $exifs ) ) {
844
  $result .= '
845
+ <li class="wppa-photoadmin-tab-'.$id.'" onclick="wppaChangePhotoAdminTab(this,\'#photoexif-'.$id.'\','.$id.');">' . __( 'EXIF', 'wp-photo-album-plus' ) . '</li>';
 
 
 
 
846
  }
847
  if ( ! $quick && ! empty( $iptcs ) ) {
848
  $result .= '
849
+ <li class="wppa-photoadmin-tab-'.$id.'" onclick="wppaChangePhotoAdminTab(this,\'#photoiptc-'.$id.'\','.$id.');">' . __( 'IPTC', 'wp-photo-album-plus' ) . '</li>';
 
 
 
 
850
  }
851
  if ( ! $quick && ! empty( $comments ) ) {
852
  $result .= '
853
+ <li class="wppa-photoadmin-tab-'.$id.'" onclick="wppaChangePhotoAdminTab(this,\'#photocomment-'.$id.'\','.$id.');">' . __( 'Comments', 'wp-photo-album-plus' ) . '</li>';
 
 
 
 
 
854
  }
855
  $result .= '
856
  </ul>
858
  </div>';
859
  wppa_echo( $result );
860
 
861
+ // The script for the tabs to operate, we need this only once
862
+ global $did_add_cpat;
863
+ if ( ! $did_add_cpat ) {
864
+ $the_js = '
865
+ function wppaChangePhotoAdminTab(elm,tabId,itemId) {
866
+ jQuery(".wppa-photoadmin-tab-"+itemId).removeClass(\'active\');
867
+ jQuery(elm).addClass(\'active\');
868
+ jQuery(".wppa-tabcontent-"+itemId).hide();
869
+ jQuery(tabId).show();
870
+ }';
871
+ wppa_add_inline_script( 'wppa-admin', $the_js );
872
+ $did_add_cpat = true;
873
+ }
874
+
875
  // Tab 1 Photo general
876
  wppa_echo( '
877
  <div
953
  }
954
 
955
  // Album. Show album only when it is not evident
956
+ if ( ! $album_is_obvious ) {
957
  wppa_echo( '
958
  <div class="left" style="margin-right: 4px;">
959
  <label>' .
1023
  }
1024
 
1025
  // Status
 
1026
  if ( ! $may_edit_status ) {
1027
  if ( $status == 'pending' ) $s = __( 'Pending', 'wp-photo-album-plus' );
1028
  elseif ( $status == 'publish' ) $s = __( 'Publish', 'wp-photo-album-plus' );
1042
  </div>
1043
  </div>' );
1044
  }
 
1045
 
1046
  // Schedule for delete
1047
  if ( ! wppa_user_is_admin() && $owner != wppa_get_user() ) {
1098
 
1099
  // Owner
1100
  if ( $owner_editable ) {
1101
+ /*
1102
+ wppa_echo( '
1103
+ <div class="left">
1104
+ <label
1105
+ for="owner-' . $id . '">' .
1106
+ __( 'Owned by', 'wp-photo-album-plus' ) . '
1107
+ </label><br>
1108
+ <input
1109
+ style="max-width:150px"
1110
+ id="owner-' . $id . '"
1111
+ type="text"
1112
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'owner\', this.value )"
1113
+ value="' . esc_attr( $owner ) . '"
1114
+ />
1115
+ </div>' );
1116
+ */
1117
  if ( wppa_get_user_count() > wppa_opt( 'max_users' ) ) {
1118
  wppa_echo( '
1119
  <div class="left">
1218
  }
1219
 
1220
  // Status
1221
+ if ( $may_edit_status ) {
1222
  $sel = ' selected';
1223
  if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) {
1224
  $dis = ' disabled';
1645
  wppa_echo( '
1646
  <div class="wppa-flex-column">' );
1647
 
1648
+ // Name
1649
+ wppa_echo( '
1650
+ <fieldset class="wppa-fieldset">
1651
+ <legend class="wppa-legend">' .
1652
+ __( 'Name', 'wp-photo-album-plus' ) . '
1653
+ </legend>
1654
+ <input
1655
+ type="text"
1656
+ style="width:100%"
1657
+ id="pname-' . $id . '"
1658
+ onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this.value)"
1659
+ value="' . esc_attr( stripslashes( $name ) ) . '"
1660
+ />
1661
+ <br>
1662
+ <span style="float:right">' .
1663
+ __( 'Name slug', 'wp-photo-album-plus' ) . ': ' . $sname . '
1664
+ </span>
1665
+ </fieldset>' );
1666
+
1667
+ // Description editable
1668
+ if ( ! wppa_switch( 'desc_is_restricted' ) || wppa_user_is_admin() ) {
1669
+ wppa_echo( '
1670
+ <fieldset class="wppa-fieldset">
1671
+ <legend class="wppa-legend">' .
1672
+ __( 'Description', 'wp-photo-album-plus' ) . '
1673
  </legend>' );
1674
 
1675
  // WP editor
1964
  <div
1965
  id="photofiles-' . $id . '"
1966
  class="wppa-table-wrap wppa-tabcontent-'.$id.'"
1967
+ style="position:relative;padding-bottom:12px;padding-left:12px;display:none"
1968
  >' );
1969
 
1970
+ {
1971
  wppa_echo( '
1972
+ <table class="wppa-table">
1973
+ <thead>
1974
+ <td>' . __( 'Type', 'wp-photo-album-plus' ) . '</td>
1975
+ <td>' . __( 'Size', 'wp-photo-album-plus' ) . '</td>
1976
+ <td>' . __( 'Path', 'wp-photo-album-plus' ) . '</td>
1977
+ <td>' . __( 'Url', 'wp-photo-album-plus' ) . '</td>
1978
+ </thead>
1979
+ <tbody>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980
 
1981
+ // Video
1982
+ if ( $b_is_video ) {
1983
+
1984
+ $formats = '';
1985
+ $paths = '';
1986
+ $urls = '';
1987
+ foreach ( $is_video as $fmt ) {
1988
+ $formats .= $fmt . ' (' . wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . ')<br>';
1989
+ $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
1990
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) );
1991
+ $urls .= '<a href="'. $url .'" target="_blank">' . $url . '<br>';
 
 
 
 
1992
  }
1993
 
1994
+ wppa_echo( '
1995
+ <tr>
1996
+ <td>' .
1997
+ $formats . '
1998
+ </td>
1999
+ <td>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2000
 
2001
+ // If video sizes are correct and retieved from the file,
2002
+ // and possible rotation has been into account, field needs not to be editable
2003
+ if ( $photo['videox'] == $videox && $photo['videoy'] == $videoy ) {
2004
+ wppa_echo( sprintf( __( 'Width: %d pixels, height: %d pixels', 'wp-photo-album-plus' ), $videox, $videoy ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2005
  }
2006
+ else {
 
2007
  wppa_echo( '
2008
+ <input
2009
+ type="text"
2010
+ style="width:50px;margin:0 4px;padding-left:8px!important"
2011
+ onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videox\', this.value)"
2012
+ value="' . esc_attr( $videox ) . '"
2013
+ />px W' .
2014
+ sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_width' ) ) . '
2015
+ <input
2016
+ type="text"
2017
+ style="width:50px;margin:0 4px;padding-left:8px!important"
2018
+ onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'videoy\', this.value)"
2019
+ value="' . esc_attr( $videoy ) . '"
2020
+ />px H' .
2021
+ sprintf( __( '(0=default:%s)', 'wp-photo-album-plus' ), wppa_opt( 'video_height' ) ) );
 
 
2022
  }
2023
+ wppa_echo( '
2024
+ </td>
2025
+ <td>' .
2026
+ $paths . '
2027
+ </td>
2028
+ <td>' .
2029
+ $urls . '
2030
+ </td>
2031
+ </tr>' );
2032
+ }
2033
+
2034
+ // Audio
2035
+ if ( $b_has_audio ) {
2036
+
2037
+ $formats = '';
2038
+ $sizes = '';
2039
+ $paths = '';
2040
+ $urls = '';
2041
+ foreach ( $has_audio as $fmt ) {
2042
+ $formats .= $fmt . '<br>';
2043
+ $sizes .= wppa_get_filesize( str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
2044
+ $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) ) . '<br>';
2045
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, str_replace( 'xxx', $fmt, wppa_get_photo_path( $id, false ) ) );
2046
+ $urls .= '<a href="'. $url .'" target="_blank">' . $url . '<br>';
2047
  }
2048
 
2049
+ wppa_echo( '
2050
+ <tr>
2051
+ <td>' .
2052
+ $formats . '
2053
+ </td>
2054
+ <td>' .
2055
+ $sizes . '
2056
+ </td>
2057
+ <td>' .
2058
+ $paths . '
2059
+ </td>
2060
+ <td>' .
2061
+ $urls . '
2062
+ </td>
2063
+ </tr>' );
2064
+ }
 
 
 
 
 
 
 
 
 
2065
 
2066
+ // Pdf
2067
+ if ( $is_pdf ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2068
 
2069
+ // Source
2070
+ $sp = wppa_get_source_path( $id );
2071
+ $fs = wppa_get_filesize( $sp );
2072
+ $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp );
2073
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp );
2074
+ wppa_echo( '
2075
+ <tr>
2076
+ <td>' .
2077
+ __( 'Document file', 'wp-photo-album-plus' ) . '
2078
+ </td>
2079
+ <td>' .
2080
+ $fs . '
2081
+ </td>
2082
+ <td>' .
2083
+ $path . '
2084
+ </td>
2085
+ <td>
2086
+ <a href="'.$url.'" target="_blank">' .
2087
+ $url . '
2088
+ </a>
2089
+ </td>
2090
+ </tr>' );
2091
+ }
2092
 
2093
+ // Non pdf source_file
2094
+ else {
2095
 
2096
+ // Source
2097
+ $sp = wppa_get_source_path( $id );
2098
+ $o1sp = wppa_get_o1_source_path( $id );
2099
+ $files = [];
2100
+ if ( wppa_is_file( $sp ) || wppa_is_file( $o1sp ) ) {
2101
 
2102
+ if ( is_file( $sp ) ) {
2103
+ $ima = getimagesize( $sp );
2104
+ $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $sp ) . '.';
2105
+ $files[] = ['name' => __( 'Source', 'wp-photo-album-plus' ),
2106
+ 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp ),
2107
+ 'size' => $txt,
2108
+ 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp )];
2109
+ }
2110
+ if ( is_file( $o1sp ) ) {
2111
+ $ima = getimagesize( $o1sp );
2112
+ $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $o1sp ) . '.';
2113
+ $files[] = ['name' => __( 'Oriented source', 'wp-photo-album-plus' ),
2114
+ 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $o1sp ),
2115
+ 'size' => $txt,
2116
+ 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $o1sp )];
2117
+ }
2118
+
2119
+ foreach( $files as $file ) {
2120
  wppa_echo( '
2121
  <tr>
2122
  <td>' .
2123
+ $file['name'] . '
2124
  </td>
2125
  <td>' .
2126
+ $file['size'] . '
2127
  </td>
2128
  <td>' .
2129
+ $file['path'] . '
2130
  </td>
2131
  <td>
2132
+ <a href="'.$file['url'].'" target="_blank">' .
2133
+ $file['url'] . '
2134
  </a>
2135
  </td>
2136
  </tr>' );
2137
  }
2138
  }
2139
+ }
2140
 
2141
+ // Poster
2142
+ if ( $is_pdf || $b_is_video ) {
 
 
 
 
 
 
 
 
 
 
 
 
2143
 
2144
+ // Poster
2145
+ $sp = wppa_fix_poster_ext( wppa_get_source_path( $id ), $id );
2146
+ $dsp = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id );
2147
+ $files = [];
2148
+ if ( wppa_is_file( $sp ) || wppa_is_file( $dsp ) ) {
2149
+
2150
+ if ( wppa_is_file( $sp ) ) {
2151
+ $ima = getimagesize( $sp );
2152
+ $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $sp ) . '.';
2153
+ $files[] = ['name' => __( 'Poster source', 'wp-photo-album-plus' ),
2154
+ 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $sp ),
2155
+ 'size' => $txt,
2156
+ 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $sp )];
2157
+ }
2158
+ if ( wppa_is_file( $dsp ) ) {
2159
+ $ima = getimagesize( $dsp );
2160
+ $txt = $ima['0'] . ' x ' . $ima['1'] . ' (' . sprintf('%4.2fMp', ( $ima['0'] * $ima['1'] ) / ( 1024 * 1024 ) ) . ') ' . wppa_get_filesize( $dsp ) . '.';
2161
+ $files[] = ['name' => __( 'Poster display', 'wp-photo-album-plus' ),
2162
+ 'path' => str_replace( WPPA_UPLOAD_PATH, '.../wppa', $dsp ),
2163
+ 'size' => $txt,
2164
+ 'url' => str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $dsp )];
2165
+ }
2166
 
2167
+ foreach( $files as $file ) {
2168
  wppa_echo( '
2169
  <tr>
2170
  <td>' .
2171
+ $file['name'] . '
2172
  </td>
2173
  <td>' .
2174
+ $file['size'] . '
2175
  </td>
2176
  <td>' .
2177
+ $file['path'] . '
2178
  </td>
2179
  <td>
2180
+ <a href="'.$file['url'].'" target="_blank">' .
2181
+ $file['url'] . '
2182
  </a>
2183
  </td>
2184
  </tr>' );
2185
  }
2186
  }
2187
+ }
2188
 
2189
+ // Non video, non pdf Display
2190
+ if ( ! $b_is_video && ! $is_pdf ) {
2191
+ $dp = wppa_get_photo_path( $id );
2192
+ $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $dp );
2193
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $dp );
2194
 
2195
+ if ( is_file( $dp ) ) {
 
2196
 
2197
+ $txt = '
2198
+ <span id="photox-' . $id . '">' . wppa_get_photox( $id ) . '</span> x
2199
+ <span id="photoy-' . $id . '">' . wppa_get_photoy( $id ) . '</span>:
2200
+ (<span id="photofilesize-' . $id . '">' . wppa_get_filesize( $dp ) . '</span>)';
2201
 
2202
+ wppa_echo( '
2203
+ <tr>
2204
+ <td>' .
2205
+ __( 'Display file', 'wp-photo-album-plus' ) . '
2206
+ </td>
2207
+ <td>' .
2208
+ $txt . '
2209
+ </td>
2210
+ <td>' .
2211
+ $path . '
2212
+ </td>
2213
+ <td>
2214
+ <a href="'.$url.'" target="_blank">' .
2215
+ $url . '
2216
+ </a>
2217
+ </td>
2218
+ </tr>' );
2219
+ }
2220
+ }
2221
 
2222
+ // Thumbnail
2223
+ if ( true ) {
2224
+ $tp = wppa_get_thumb_path( $id );
2225
+ if ( is_file( $tp ) ) {
2226
+ $txt = '
2227
+ <span id="thumbx-' . $id . '">' . wppa_get_thumbx( $id ) . '</span> x
2228
+ <span id="thumby-' . $id . '">' . wppa_get_thumby( $id ) . '</span>:
2229
+ (<span id="thumbfilesize-' . $id . '">' . wppa_get_filesize( $tp ) . '</span>)
2230
+ &nbsp;
2231
+ <input
2232
+ type="checkbox"' .
2233
+ ( $thumblock ? ' checked' : '' ) . '
2234
+ onchange="wppaAjaxUpdatePhoto( ' . strval( intval( $id ) ) . ', \'thumblock\', jQuery(this).prop(\'checked\') ? 1 : 0 )" /> ' .
2235
+ __( 'Locked', 'wp-photo-album-plus' );
2236
 
2237
+ $path = str_replace( WPPA_UPLOAD_PATH, '.../wppa', $tp );
2238
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $tp );
2239
 
2240
+ wppa_echo( '
2241
+ <tr>
2242
+ <td>' .
2243
+ __( 'Thumbnail', 'wp-photo-album-plus' ) . '
2244
+ </td>
2245
+ <td>' .
2246
+ $txt . '
2247
+ </td>
2248
+ <td>' .
2249
+ $path . '
2250
+ </td>
2251
+ <td>
2252
+ <a href="'.$url.'" target="_blank">' .
2253
+ $url . '
2254
+ </a>
2255
+ </td>
2256
+ </tr>' );
2257
+ }
2258
+ }
2259
 
2260
+ // Local CDN
2261
+ if ( wppa_cdn( 'admin' ) == 'local' ) {
2262
 
2263
+ $files = wppa_cdn_files( $id );
2264
+ if ( !empty( $files ) ) {
 
 
 
2265
 
2266
+ $txt = '<span id="cdnfiles-' . $id . '">';
2267
+ $paths = '';
2268
+ $urls = '';
2269
+
2270
+ foreach( $files as $file ) {
2271
+ if ( basename( $file ) != 'index.php' ) {
2272
+ $t = explode( '.', basename( $file ) );
2273
+ $t = explode( '-', $t[0] );
2274
+ $x = $t[0];
2275
+ $y = $t[1];
2276
+ $size = filesize( $file );
2277
+
2278
+ $txt .=
2279
+
2280
+ str_replace( '-', ' x ', wppa_strip_ext( basename( $file ) ) ) . ': ' .
2281
+
2282
+ sprintf( '(%4.2fkB)', $size / 1024 ) . '<br>';
2283
+
2284
+ $paths .= str_replace( WPPA_UPLOAD_PATH, '.../wppa', $file ) . '<br>';
2285
+
2286
+ $url = str_replace( WPPA_UPLOAD_PATH, WPPA_UPLOAD_URL, $file );
2287
+ $urls .= '<a href="'.$url.'" target="_blank">' . $url . '</a><br>';
2288
+ }
2289
  }
2290
+ $txt .= '</span>';
2291
 
2292
+ wppa_echo( '
2293
+ <tr>
2294
+ <td style="line-height:20px">' .
2295
+ __( 'Local CDN', 'wp-photo-album-plus' ) . '
2296
+ </td>
2297
+ <td style="line-height:20px">' .
2298
+ $txt . '
2299
+ </td>
2300
+ <td style="line-height:20px">' .
2301
+ $paths . '
2302
+ </td>
2303
+ <td style="line-height:20px">' .
2304
+ $urls . '
2305
+ </td>
2306
+ </tr>' );
2307
+ }
2308
  }
2309
 
2310
+ wppa_echo( '
2311
+ </tbody>
2312
+ </table>' );
2313
+ }
2314
 
2315
+ // Remake displayfiles
2316
  if ( ! $is_video ) {
2317
  wppa_echo( '
 
 
 
 
 
2318
 
2319
  <input
2320
  type="button"
2323
  onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remake\', 0 )"
2324
  value="' . esc_attr( __( 'Remake files', 'wp-photo-album-plus' ) ) . '"
2325
  />
2326
+ ' );
2327
+ }
2328
+
2329
+ // Remake thumbnail
2330
+ if ( ! $is_video ) {
2331
+ wppa_echo( '
2332
+
2333
  <input
2334
  type="button"
2335
  class="wppa-admin-button button"
2337
  onclick="wppaAjaxUpdatePhoto( ' . $id . ', \'remakethumb\', 0 )"
2338
  value="' . esc_attr( __( 'Remake thumbnail file', 'wp-photo-album-plus' ) ) . '"
2339
  />
2340
+ ' );
 
2341
  }
2342
 
2343
 
2352
  <div
2353
  id="photomagic-' . $id . '"
2354
  class="wppa-table-wrap wppa-tabcontent-'.$id.'"
2355
+ style="position:relative;padding-bottom:12px;padding-left:12px;display:none"
2356
  >' );
2357
 
2358
+ {
2359
+
2360
+ // Explanation
2361
  wppa_echo( '
2362
+ <h2 class="description" style="margin:1em">' .
2363
+ __( 'The operations are executed upon the display file.', 'wp-photo-album-plus' ) . ' ' .
2364
+ __( 'A new thumbnail image will be created from the display file.', 'wp-photo-album-plus' ) . '
2365
+ </h2>' );
2366
 
2367
+ // --- Actions ---
2368
+ wppa_echo( '
2369
+ <div class="wppa-flex">' );
2370
 
2371
  {
2372
+ // Rotate left
 
2373
  wppa_echo( '
2374
+ <input
2375
+ type="button"
2376
+ class="wppa-admin-button button"
2377
+ onclick="wppaTryMagick( ' . $id . ', \'magickrotleft\' )"
2378
+ value="' . esc_attr( __( 'Rotate left', 'wp-photo-album-plus' ) ) . '"
2379
+ />' );
2380
 
2381
+ // Rotat 180
2382
  wppa_echo( '
2383
+ <input
2384
+ type="button"
2385
+ class="wppa-admin-button button"
2386
+ onclick="wppaTryMagick( ' . $id . ', \'magickrot180\' )"
2387
+ value="' . esc_attr( __( 'Rotate 180&deg;', 'wp-photo-album-plus' ) ) . '"
2388
+ />' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2389
 
2390
+ // Rotate right
2391
+ wppa_echo( '
2392
+ <input
2393
+ type="button"
2394
+ class="wppa-admin-button button"
2395
+ onclick="wppaTryMagick( ' . $id . ', \'magickrotright\' )"
2396
+ value="' . esc_attr( __( 'Rotate right', 'wp-photo-album-plus' ) ) . '"
2397
+ />' );
 
2398
 
2399
+ // Flip
2400
+ wppa_echo( '
2401
+ <input
2402
+ type="button"
2403
+ class="wppa-admin-button button"
2404
+ onclick="wppaTryMagick( ' . $id . ', \'magickflip\' )"
2405
+ value="' . esc_attr( __( 'Flip', 'wp-photo-album-plus' ) ) . '&thinsp;&#8212;"
2406
+ title="-flip"
2407
+ />' );
2408
 
2409
+ // Flop
2410
+ wppa_echo( '
2411
+ <input
2412
+ type="button"
2413
+ class="wppa-admin-button button"
2414
+ onclick="wppaTryMagick( ' . $id . ', \'magickflop\' )"
2415
+ value="' . esc_attr( __( 'Flop', 'wp-photo-album-plus' ) ) . ' |"
2416
+ title="-flop"
2417
+ />' );
2418
 
2419
+ // Enhance
2420
+ wppa_echo( '
2421
+ <input
2422
+ type="button"
2423
+ class="wppa-admin-button button"
2424
+ onclick="wppaTryMagick( ' . $id . ', \'enhance\' )"
2425
+ value="' . esc_attr( __( 'Enhance', 'wp-photo-album-plus' ) ) . '"
2426
+ title="-enhance"
2427
+ />' );
2428
 
2429
+ // Sharpen
2430
+ wppa_echo( '
2431
+ <input
2432
+ type="button"
2433
+ class="wppa-admin-button button"
2434
+ onclick="wppaTryMagick( ' . $id . ', \'sharpen\' )"
2435
+ value="' . esc_attr( __( 'Sharpen', 'wp-photo-album-plus' ) ) . '"
2436
+ title="-sharpen 0x1"
2437
+ />' );
2438
 
2439
+ // Blur
2440
+ wppa_echo( '
2441
+ <input
2442
+ type="button"
2443
+ class="wppa-admin-button button"
2444
+ onclick="wppaTryMagick( ' . $id . ', \'blur\' )"
2445
+ value="' . esc_attr( __( 'Blur', 'wp-photo-album-plus' ) ) . '"
2446
+ title="-blur 0x1"
2447
+ />' );
2448
 
2449
+ // Auto gamma
2450
+ wppa_echo( '
2451
+ <input
2452
+ type="button"
2453
+ class="wppa-admin-button button"
2454
+ onclick="wppaTryMagick( ' . $id . ', \'auto-gamma\' )"
2455
+ value="' . esc_attr( __( 'Auto Gamma', 'wp-photo-album-plus' ) ) . '"
2456
+ title="-auto-gamma"
2457
+ />' );
2458
 
2459
+ // Auto level
2460
+ wppa_echo( '
2461
+ <input
2462
+ type="button"
2463
+ class="wppa-admin-button button"
2464
+ onclick="wppaTryMagick( ' . $id . ', \'auto-level\' )"
2465
+ value="' . esc_attr( __( 'Auto Level', 'wp-photo-album-plus' ) ) . '"
2466
+ title="-auto-level"
2467
+ />' );
2468
 
2469
+ // Contrast+
2470
+ wppa_echo( '
2471
+ <input
2472
+ type="button"
2473
+ class="wppa-admin-button button"
2474
+ onclick="wppaTryMagick( ' . $id . ', \'contrast-p\' )"
2475
+ value="' . esc_attr( __( 'Contrast+', 'wp-photo-album-plus' ) ) . '"
2476
+ title="-brightness-contrast 0x5"
2477
+ />' );
2478
 
2479
+ // Contrast-
2480
+ wppa_echo( '
2481
+ <input
2482
+ type="button"
2483
+ class="wppa-admin-button button"
2484
+ onclick="wppaTryMagick( ' . $id . ', \'contrast-m\' )"
2485
+ value="' . esc_attr( __( 'Contrast-', 'wp-photo-album-plus' ) ) . '"
2486
+ title="-brightness-contrast 0x-5"
2487
+ />' );
2488
 
2489
+ // Brightness+
2490
+ wppa_echo( '
2491
+ <input
2492
+ type="button"
2493
+ class="wppa-admin-button button"
2494
+ onclick="wppaTryMagick( ' . $id . ', \'brightness-p\' )"
2495
+ value="' . esc_attr( __( 'Brightness+', 'wp-photo-album-plus' ) ) . '"
2496
+ title="-brightness-contrast 5"
2497
+ />' );
2498
 
2499
+ // Brightness-
2500
+ wppa_echo( '
2501
+ <input
2502
+ type="button"
2503
+ class="wppa-admin-button button"
2504
+ onclick="wppaTryMagick( ' . $id . ', \'brightness-m\' )"
2505
+ value="' . esc_attr( __( 'Brightness-', 'wp-photo-album-plus' ) ) . '"
2506
+ title="-brightness-contrast -5"
2507
+ />' );
2508
 
2509
+ // Despeckle
2510
+ wppa_echo( '
2511
+ <input
2512
+ type="button"
2513
+ class="wppa-admin-button button"
2514
+ onclick="wppaTryMagick( ' . $id . ', \'despeckle\' )"
2515
+ value="' . esc_attr( __( 'Despeckle', 'wp-photo-album-plus' ) ) . '"
2516
+ title="-despeckle"
2517
+ />' );
2518
 
2519
+ // Lenear gray
2520
+ wppa_echo( '
2521
+ <input
2522
+ type="button"
2523
+ class="wppa-admin-button button"
2524
+ onclick="wppaTryMagick( ' . $id . ', \'lineargray\' )"
2525
+ value="' . esc_attr( __( 'Linear gray', 'wp-photo-album-plus' ) ) . '"
2526
+ title="-colorspace gray"
2527
+ />' );
2528
 
2529
+ // Non-linear gray
2530
+ wppa_echo( '
2531
+ <input
2532
+ type="button"
2533
+ class="wppa-admin-button button"
2534
+ onclick="wppaTryMagick( ' . $id . ', \'nonlineargray\' )"
2535
+ value="' . esc_attr( __( 'Non-linear gray', 'wp-photo-album-plus' ) ) . '"
2536
+ title="-grayscale Rec709Luma"
2537
+ />' );
2538
 
2539
+ // Charcoal
2540
+ wppa_echo( '
2541
+ <input
2542
+ type="button"
2543
+ class="wppa-admin-button button"
2544
+ onclick="wppaTryMagick( ' . $id . ', \'charcoal\' )"
2545
+ value="' . esc_attr( __( 'Charcoal', 'wp-photo-album-plus' ) ) . '"
2546
+ title="-charcoal"
2547
+ />' );
2548
+
2549
+ // Paint
2550
+ wppa_echo( '
2551
+ <input
2552
+ type="button"
2553
+ class="wppa-admin-button button"
2554
+ onclick="wppaTryMagick( ' . $id . ', \'paint\' )"
2555
+ value="' . esc_attr( __( 'Paint', 'wp-photo-album-plus' ) ) . '"
2556
+ title="-paint"
2557
+ />' );
2558
 
2559
+ // Sepia
2560
+ wppa_echo( '
2561
+ <input
2562
+ type="button"
2563
+ class="wppa-admin-button button"
2564
+ onclick="wppaTryMagick( ' . $id . ', \'sepia\' )"
2565
+ value="' . esc_attr( __( 'Sepia', 'wp-photo-album-plus' ) ) . '"
2566
+ title="-sepia-tone 80%"
2567
+ />' );
2568
 
2569
+ // Show/hide wppa-horizon
2570
+ wppa_echo( '
2571
+ <input
2572
+ type="button"
2573
+ class="wppa-admin-button button"
2574
+ onclick="wppaToggleHorizon()"
2575
+ value="' . esc_attr( 'Show/hide horizon', 'wp-photo-album-plus' ) . '"
2576
+ title="' . esc_attr( 'Toggle horizon reference line on/off', 'wp-photo-album-plus' ) . '"
2577
+ />' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2578
 
2579
+ // Anticlock 0.5 deg
2580
+ wppa_echo( '
2581
+ <input
2582
+ type="button"
2583
+ class="wppa-admin-button button"
2584
+ onclick="wppaTryMagick( ' . $id . ', \'skyleft\' )"
2585
+ value="' . esc_attr( '0.5&deg;', 'wp-photo-album-plus' ) . '"
2586
+ title="' . esc_attr( 'Rotate image by 0.5&deg; anticlockwise', 'wp-photo-album-plus' ) . '"
2587
+ />' );
2588
 
2589
+ // Clockwise 0.5 deg
2590
+ wppa_echo( '
2591
+ <input
2592
+ type="button"
2593
+ class="wppa-admin-button button"
2594
+ onclick="wppaTryMagick( ' . $id . ', \'skyright\' )"
2595
+ value="' . esc_attr( '-0.5&deg;', 'wp-photo-album-plus' ) . '"
2596
+ title="' . esc_attr( 'Rotate image by 0.5&deg; clockwise', 'wp-photo-album-plus' ) . '"
2597
+ />' );
2598
 
2599
+ // Crop
2600
  wppa_echo( '
2601
+ <input
2602
+ type="button"
2603
+ class="wppa-admin-button button"
2604
+ id="button-' . $id . '"
2605
+ value="Crop"
2606
+ title=""
2607
+ />' );
2608
+
2609
+ // Set cropbox aspect ratio
2610
+ $ratio = ( $photoy ? ( $photox / $photoy ) : 'NaN' );
2611
+ $dflt = wppa_opt( 'image_magick_ratio' );
 
 
 
 
 
 
 
2612
 
 
 
 
2613
  wppa_echo( '
2614
+ <select
2615
+ onchange="wppaCropper[' . $id . '].setAspectRatio(this.value)"
2616
+ title="' . __( 'Aspect ratio of cropped image', 'wp-photo-album-plus' ) . '"
2617
+ >
2618
+ <option value="NaN"' . ( $dflt == 'NaN' ? ' selected' : '' ) . '>' . __( 'free', 'wp-photo-album-plus' ) . '</option>
2619
+ <option value="' . $ratio . '"' . ( $dflt == 'ratio' ? ' selected' : '' ) . '>' . __( 'original', 'wp-photo-album-plus' ) . '</option>
2620
+ <option value="1"' . ( $dflt == '1' ? ' selected' : '' ) . '>' . __( 'square', 'wp-photo-album-plus' ) . '</option>
2621
+ <option value="1.25"' . ( $dflt == '1.25' ? ' selected' : '' ) . '>4:5 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2622
+ <option value="1.33333"' . ( $dflt == '1.33333' ? ' selected' : '' ) . '>3:4 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2623
+ <option value="1.5"' . ( $dflt == '1.5' ? ' selected' : '' ) . '>2:3 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2624
+ <option value="1.6"' . ( $dflt == '1.6' ? ' selected' : '' ) . '>5:8 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2625
+ <option value="1.77777"' . ( $dflt == '1.77777' ? ' selected' : '' ) . '>9:16 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2626
+ <option value="2"' . ( $dflt == '2' ? ' selected' : '' ) . '>1:2 ' . __( 'landscape', 'wp-photo-album-plus' ) . '</option>
2627
+ <option value="0.8"' . ( $dflt == '0.8' ? ' selected' : '' ) . '>4:5 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2628
+ <option value="0.75"' . ( $dflt == '0.75' ? ' selected' : '' ) . '>3:4 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2629
+ <option value="0.66667"' . ( $dflt == '0.66667' ? ' selected' : '' ) . '>2:3 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2630
+ <option value="0.625"' . ( $dflt == '0.625' ? ' selected' : '' ) . '>5:8 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2631
+ <option value="0.5625"' . ( $dflt == '0.5625' ? ' selected' : '' ) . '>9:16 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2632
+ <option value="0.5"' . ( $dflt == '0.5' ? ' selected' : '' ) . '>1:2 ' . __( 'portrait', 'wp-photo-album-plus' ) . '</option>
2633
+ </select>' . $br );
2634
+
2635
+ if ( $dflt == 'ratio' ) {
2636
+ $value = $ratio;
2637
+ }
2638
+ elseif ( $dflt == 'free' ) {
2639
+ $value = '';
2640
+ }
2641
+ else {
2642
+ $value = $dflt;
2643
+ }
2644
 
2645
+ // $the_js = 'jQuery(document).ready(function(){wppaCropper[' . $id . '].setAspectRatio(' . $value . ');});';
2646
+ // wppa_add_inline_script( 'wppa-admin', $the_js );
2647
  }
2648
 
2649
+ // End flex div
2650
+ wppa_echo( '</div>' );
2651
+
2652
+ // Command stack
2653
+ wppa_echo( '
2654
+ <h2 class="description" style="margin:1em">' .
2655
+ __( '<b>ImageMagick</b> command stack', 'wp-photo-album-plus' ) . ':
2656
+ <span
2657
+ id="magickstack-' . strval( intval( $id ) ). '"
2658
+ style="color:blue"
2659
+ >' .
2660
+ sanitize_text_field( $magickstack ) . '
2661
+ </span>
2662
+ <input
2663
+ type="button"
2664
+ class="wppa-admin-button button"
2665
+ id="imstackbutton-' . strval( intval( $id ) ) . '"
2666
+ onclick="wppaTryMagick( ' . strval( intval( $id ) ) . ', \'magickundo\' )"
2667
+ value="' . esc_attr( __( 'Undo', 'wp-photo-album-plus' ) ) . '"
2668
+ title="' . esc_attr( __( 'Undo last Magick command', 'wp-photo-album-plus' ) ) . '"
2669
+ style="margin-left:4px;' . ( $magickstack ? 'display:inline;' : 'display:none;' ) . '"
2670
+ />
2671
+ </h2>' );
2672
+
2673
+ // Cropper container
2674
+ // Fake 'for social media' to use the local file here, not cloudinary. Files from cloudinary do not reload, even with ?ver=...
2675
+ wppa( 'for_sm', true );
2676
+ wppa_echo( '
2677
+ <div
2678
+ class="wppa-cropper-container-wrapper">
2679
+ <img
2680
+ id="fs-img-' . $id . '"
2681
+ src="' . esc_url( wppa_get_photo_url( $id ) ) . '"
2682
+ style="float:left;max-width:100%"
2683
+ />
2684
+ </div>' );
2685
+
2686
+ // Reset switch
2687
+ wppa( 'for_sm', false );
2688
+ }
2689
 
2690
  // End Tab 3
2691
  wppa_echo( '</div>' );
2809
 
2810
 
2811
  // Comments
 
2812
  if ( ! $quick && ! empty( $comments ) ) {
2813
 
2814
  wppa_echo( '
2869
  }
2870
  wppa_echo( '<td style="padding:0 4px">' . $comment['comment'] . '</td>
2871
  </tr>' );
 
 
 
2872
  }
2873
 
2874
  wppa_echo( '
2878
  </div>' );
2879
  }
2880
 
2881
+ wppa_add_inline_script( 'wppa-admin', 'wppaPhotoStatusChange('.$id.');' );
 
 
 
 
 
 
 
 
 
 
 
2882
 
2883
  wppa_echo( '
2884
  <div class="clear"></div>
2891
 
2892
  } /* foreach photo */
2893
 
2894
+ wppa_admin_page_links( $page, $pagesize, $count, $link );
2895
 
2896
  } /* photos not empty */
2897
  } /* function */
2907
  }
2908
 
2909
  // Init
 
2910
  $count = '0';
2911
  $abort = false;
2912
 
3020
  }
3021
  else wppa_error_message( 'Unexpected error #2 in wppa_album_photos_bulk().' );
3022
  }
3023
+ else wppa_error_message( 'Unexpected error #1 in wppa_album_photos_bulk().' );
 
 
 
3024
 
3025
  if ( $count && ! $abort ) {
3026
  switch ( wppa_get( 'bulk-action' ) ) {
3050
  }
3051
  }
3052
 
3053
+ $pagesize = wppa_opt( 'photo_admin_pagesize' ) ? wppa_opt( 'photo_admin_pagesize' ) : '20';
3054
+ $next_after = wppa_get( 'next-after', '0' ) ? '1' : '0';
3055
+ $p = wppa_get( 'wppa-page', '1' );
3056
+ $page = $p + $next_after;
3057
+ $skip = ( $page - '1' ) * $pagesize;
 
 
 
 
 
 
 
3058
 
3059
  if ( $album ) {
3060
  if ( $album == 'moderate' ) {
3099
 
3100
  if ( $photos ) {
3101
  $plink = $link . '&next-after=' . $next_after;
3102
+ wppa_admin_page_links( $page, $pagesize, $count, $plink, '#manage-photos' );
3103
 
3104
+ $the_js = "
3105
+ function wppaTryMove( id, video ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3106
 
3107
+ var query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3108
 
3109
+ if ( ! jQuery( '#target-' + id ).val() ) {
3110
+ alert( '" . esc_js( __( 'Please select an album to move to first.', 'wp-photo-album-plus' ) ) . "' );
3111
+ return false;
3112
+ }
3113
 
3114
+ if ( video ) {
3115
+ query = '" . esc_js( __( 'Are you sure you want to move this video?', 'wp-photo-album-plus' ) ) . "';
3116
+ }
3117
+ else {
3118
+ query = '" . esc_js( __( 'Are you sure you want to move this photo?', 'wp-photo-album-plus' ) ) . "';
3119
+ }
 
 
 
 
 
 
3120
 
3121
+ if ( ! jQuery('#confirm-move').prop('checked') || confirm( query ) ) {
3122
+ jQuery( '#moving-' + id ).html( '". __( 'Moving...', 'wp-photo-album-plus' ) . "' );
3123
+ wppaAjaxUpdatePhoto( id, 'moveto', jQuery( '#target-' + id ).val(), false, '<td colspan=\'8\' >', '</td>' );
3124
+ }
3125
+ }" . '
3126
+ jQuery(document).ready( function() {
3127
+ wppaSetConfirmDelete( "confirm-delete" );
3128
+ wppaSetConfirmMove( "confirm-move" );
3129
+ });
3130
+ function wppaConfirmAndDelete(id, immediate) {
3131
+ if ( ! jQuery("#confirm-delete").prop("checked") ||
3132
+ confirm( "' . esc_js( __( 'Are you sure you want to delete this photo?', 'wp-photo-album-plus' ) ) . '" ) ) {
3133
+ jQuery("#wppa-delete-"+id).html( "' . esc_js( __('Deleting...', 'wp-photo-album-plus' ) ) . '" );
3134
+ wppaAjaxDeletePhoto(id, "<td colspan=8 >", "</td>", immediate);
3135
+ }
3136
+ }';
3137
+
3138
+ wppa_add_inline_script( 'wppa-admin', $the_js );
3139
+
3140
+ $result = '
3141
+ <form action="' . $link . '&wppa-page=' . $page . '#manage-photos" method="post">' .
3142
+ wp_nonce_field( 'wppa-bulk', 'wppa-bulk' ) . '
3143
+ <h1>
3144
+ <span style="font-weight:bold">' . __( 'Bulk action', 'wp-photo-album-plus' ) . '</span>
3145
+ <select id="wppa-bulk-action" name="wppa-bulk-action" onchange="wppaBulkActionChange( this, \'bulk-album\' )">
3146
+ <option value=""></option>';
3147
+ if ( $album == 'trash' ) {
3148
+ $result .= '
3149
+ <option value="wppa-bulk-delete-immediate">' . __( 'Remove permanently', 'wp-photo-album-plus' ) . '</option>
3150
+ <option value="wppa-bulk-undelete">' . __( 'Undelete', 'wp-photo-album-plus' ) . '</option>';
3151
+ }
3152
+ else {
3153
+ $result .= '
3154
+ <option value="wppa-bulk-delete">' . __( 'Delete', 'wp-photo-album-plus' ) . '</option>';
3155
+ }
3156
+ $result .= '
3157
+ <option value="wppa-bulk-move-to">' . __( 'Move to', 'wp-photo-album-plus' ) . '</option>
3158
+ <option value="wppa-bulk-copy-to">' . __( 'Copy to', 'wp-photo-album-plus' ) . '</option>';
3159
 
3160
+ if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
3161
+ $result .= '
3162
+ <option value="wppa-bulk-status">' . __( 'Set status to', 'wp-photo-album-plus' ) . '</option>';
3163
+ }
3164
+ if ( wppa_user_is_admin() && wppa_switch( 'photo_owner_change' ) ) {
3165
  $result .= '
3166
+ <option value="wppa-bulk-owner">' . __( 'Set owner to', 'wp-photo-album-plus' ) . '</option>';
3167
+ }
3168
+ $result .= '
3169
+ </select>' .
3170
+
3171
+ wppa_album_select_a( array( 'checkaccess' => true,
3172
+ 'path' => true,
3173
+ 'exclude' => $album,
3174
+ 'selected' => '0',
3175
+ 'addpleaseselect' => true,
3176
+ 'sort' => true,
3177
+ 'tagopen' => '<select' .
3178
+ ' name="wppa-bulk-album"' .
3179
+ ' id="wppa-bulk-album"' .
3180
+ ' style="display:none"' .
3181
+ ' onchange="wppa_setCookie( \'wppa_bulk_album\',this.value,365 )"' .
3182
+ ' >',
3183
+ 'tagname' => 'wppa-bulk-album',
3184
+ 'tagid' => 'wppa-bulk-album',
3185
+ 'tagonchange' => 'wppa_setCookie( \'wppa_bulk_album\',this.value,365 );',
3186
+ 'tagstyle' => 'display:none;cursor:pointer;',
3187
+ ) );
3188
+
3189
+ wppa_echo( $result );
3190
+ ?>
3191
+ <select name="wppa-bulk-status" id="wppa-bulk-status" style="display:none" onchange="wppa_setCookie( 'wppa_bulk_status',this.value,365 )">
3192
+ <option value=""><?php _e( '- select a status -' , 'wp-photo-album-plus' ) ?></option>
3193
+ <option value="pending"><?php _e( 'Pending' , 'wp-photo-album-plus' ) ?></option>
3194
+ <option value="publish"><?php _e( 'Publish' , 'wp-photo-album-plus' ) ?></option>
3195
+ <?php if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) $dis = ' disabled'; else $dis = ''; ?>
3196
+ <option value="featured"<?php wppa_echo( $dis )?> ><?php _e( 'Featured' , 'wp-photo-album-plus' ) ?></option>
3197
+ <option value="gold" <?php wppa_echo( $dis )?> ><?php _e( 'Gold' , 'wp-photo-album-plus' ) ?></option>
3198
+ <option value="silver" <?php wppa_echo( $dis )?> ><?php _e( 'Silver' , 'wp-photo-album-plus' ) ?></option>
3199
+ <option value="bronze" <?php wppa_echo( $dis )?> ><?php _e( 'Bronze' , 'wp-photo-album-plus' ) ?></option>
3200
+ <option value="scheduled" <?php wppa_echo( $dis )?> ><?php _e( 'Scheduled' , 'wp-photo-album-plus' ) ?></option>
3201
+ <option value="private" <?php wppa_echo( $dis ) ?> ><?php _e( 'Private' , 'wp-photo-album-plus' ) ?></option>
3202
+ </select>
3203
+ <!-- Owner -->
3204
+ <?php $users = wppa_get_users();
3205
+ if ( count( $users ) ) { ?>
3206
+ <select name="wppa-bulk-owner" id="wppa-bulk-owner" style="display:none" onchange="wppa_setCookie( 'wppa_bulk_owner',this.value,365 )">
3207
+ <option value=""><?php _e( '- select an owner -' , 'wp-photo-album-plus' ) ?></option>
3208
+ <?php
3209
+
3210
+ foreach ( $users as $user ) {
3211
+ wppa_echo( '<option value="' . esc_attr( $user['user_login'] ) . '">' . htmlspecialchars( $user['display_name'] ) . ' (' . htmlspecialchars( $user['user_login'] ) . ')</option>' );
3212
+ }
3213
+ ?>
3214
+ </select>
3215
+ <?php } else { ?>
3216
+ <input name="wppa-bulk-owner" id="wppa-bulk-owner" style="display:none" onchange="wppa_setCookie( 'wppa_bulk_owner',this.value,365 )" />
3217
+ <?php } ?>
3218
+ <!-- Submit -->
3219
+ <input type="submit" onclick="return wppaBulkDoitOnClick()" class="button-primary" value="<?php _e( 'Doit!' , 'wp-photo-album-plus' ) ?>" />
3220
+ <?php
3221
  if ( wppa_is_mobile() ) {
3222
+ wppa_echo( '<br>' );
3223
  }
3224
+ ?>
3225
+ <?php $nextafterselhtml =
3226
+ '<select name="next-after">' .
3227
+ '<option value="-1"' . ( $next_after == '-1' ? ' selected' : '' ) . '>' . __( 'the previous page', 'wp-photo-album-plus' ) . '</option>' .
3228
+ '<option value="0"' . ( $next_after == '0' ? ' selected' : '' ) . '>' . __( 'the same page', 'wp-photo-album-plus' ) . '</option>' .
3229
+ '<option value="1"' . ( $next_after == '1' ? ' selected' : '' ) . '>' . __( 'the next page', 'wp-photo-album-plus' ) . '</option>' .
3230
+ '</select>';
3231
+ wppa_echo( sprintf( __( 'Go to %s after Doit!.', 'wp-photo-album-plus' ), $nextafterselhtml ) );
 
3232
  if ( wppa_is_mobile() ) {
3233
+ wppa_echo( '<br>' );
3234
  }
3235
+ ?>
3236
+
3237
+ <input
3238
+ type="checkbox"
3239
+ id="confirm-delete"
3240
+ name="confirm-delete"
3241
+ checked="checked"
3242
+ onchange="wppaToggleConfirmDelete( this )"
3243
+ />
3244
+ <?php _e('Confirm delete', 'wp-photo-album-plus' ) ?>
3245
+
3246
+ <input
3247
+ type="checkbox"
3248
+ id="confirm-move"
3249
+ name="confirm-move"
3250
+ checked="checked"
3251
+ onchange="wppaToggleConfirmMove(this)"
3252
+ />
3253
+ <?php _e('Confirm move', 'wp-photo-album-plus' ) ?>
3254
 
3255
+ <?php wppa_echo( '<small style="float:right"> (' . count( $photos ) . ')</small>' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3256
 
3257
+ ?>
3258
+ </h1>
3259
+ <?php $edit_link = wppa_ea_url( 'single', 'edit' ) ?>
 
 
 
 
 
 
 
 
 
 
3260
  <table class="widefat">
3261
+ <thead style="font-weight:bold">
3262
+ <td><input type="checkbox" class="wppa-bulk-photo" onchange="jQuery( '.wppa-bulk-photo' ).prop( 'checked', this.checked )" /></td>
3263
+ <td><?php _e( 'ID' , 'wp-photo-album-plus' ) ?></td>
3264
+ <td><?php _e( 'Preview' , 'wp-photo-album-plus' ) ?></td>
3265
+ <td><?php _e( 'Name' , 'wp-photo-album-plus' ) ?></td>
3266
+ <td><?php _e( 'Description' , 'wp-photo-album-plus' ) ?></td>
3267
+ <td><?php _e( 'Status' , 'wp-photo-album-plus' ) ?></td>
3268
+ <td><?php _e( 'Owner' , 'wp-photo-album-plus' ) ?></td>
3269
+ <td><?php _e( 'Remark' , 'wp-photo-album-plus' ) ?></td>
3270
  </thead>
3271
+ <tbody>
3272
+ <?php
 
3273
  foreach ( $photos as $photo ) {
3274
  $id = $photo['id'];
3275
 
3291
  }
3292
  }
3293
 
3294
+ $maxsize = wppa_get_minisize(); ?>
3295
+ <tr id="photoitem-<?php wppa_echo( $photo['id'] ) ?>">
 
 
3296
  <!-- Checkbox -->
3297
  <td>
3298
+ <input type="hidden" id="photo-nonce-<?php wppa_echo( $photo['id'] ) ?>" value="<?php wppa_echo( wp_create_nonce( 'wppa-nonce_'.$photo['id'] ) ) ?>" />
3299
+ <input type="checkbox" name="wppa-bulk-photo[<?php wppa_echo( $photo['id'] ) ?>]" class="wppa-bulk-photo" />
3300
  </td>
3301
  <!-- ID and delete link -->
3302
+ <td><?php
3303
+ wppa_echo(
3304
+ '<a
3305
+ href="' . $edit_link . '&photo=' . $photo['id'] . '"
3306
  target="_blank"
3307
  >' .
3308
+ $photo['id'] . '
3309
  </a>
3310
  <br>
3311
  <a
3312
+ id="wppa-delete-' . $photo['id'] . '"
3313
+ onclick="wppaConfirmAndDelete(' . $photo['id'] . ', '.( $album == 'trash' ? 'true' : 'false' ).' )"
3314
  style="color:red;font-weight:bold;cursor:pointer"
3315
  >' .
3316
  ( $album == 'trash' ? __( 'Remove permanently', 'wp-photo-album-plus' ) : __( 'Delete', 'wp-photo-album-plus' ) ) . '
3317
+ </a>' );
3318
+ ?>
3319
  </td>
3320
  <!-- Preview -->
3321
+ <td style="min-width:240px; text-align:center">
3322
+ <?php if ( wppa_is_video( $photo['id'] ) ) {
 
3323
  $a = false;
3324
  if ( wppa_is_file( wppa_strip_ext( wppa_get_photo_path( $id ) ) . '.mp4' ) ) {
3325
  $a = true;
3326
+ wppa_echo( '
3327
  <a
3328
  href="' . esc_url( str_replace( '.jpg', '.mp4', wppa_get_photo_url( $id ) ) ) . '"
3329
  target="_blank"
3330
  title="' . esc_attr( __( 'Click to see fullsize video', 'wp-photo-album-plus' ) ) . '"
3331
+ >' );
3332
  }
3333
 
3334
+ wppa_echo( wppa_get_video_html( array(
3335
+ 'id' => $id,
3336
+ 'height' => '160',
3337
+ 'controls' => false,
3338
+ 'tagid' => 'pa-id-' . $id,
3339
+ 'preload' => 'metadata',
3340
+ 'use_thumb' => true,
3341
+ ) ) );
3342
+ if ( $a ) {
3343
+ wppa_echo( '</a>' );
3344
+ }
3345
  }
3346
  else {
3347
+ wppa_echo(
3348
+ '<a' .
3349
+ ' href="' . esc_url( wppa_get_photo_url( $photo['id'] ) ) . '"' .
3350
+ ' target="_blank"' .
3351
+ ' title="' . esc_attr( __( 'Click to see fullsize', 'wp-photo-album-plus' ) ) . '"' .
3352
+ ' >' .
3353
+ '<img' .
3354
+ ' class="wppa-bulk-thumb"' .
3355
+ ' ' . ( wppa_lazy() ? 'data-' : '' ) . 'src="' . esc_url( wppa_get_thumb_url( $photo['id'] ) ) . '"' .
3356
+ ' style="max-width:' . $maxsize . 'px;max-height:' . $maxsize . 'px"' .
3357
+ ' />' .
3358
+ '</a>' );
3359
  }
3360
+ ?>
3361
  </td>
3362
  <!-- Name, size, move -->
3363
+ <!-- Name -->
3364
  <td style="width:25%">
3365
+ <input type="text" style="width:300px" id="pname-<?php wppa_echo( $photo['id'] ) ?>" onchange="wppaAjaxUpdatePhoto( <?php wppa_echo( $photo['id'] ) ?>, 'name', this.value)" value="<?php wppa_echo( esc_attr( stripslashes( $photo['name'] ) ) ) ?>" />
3366
+ <!-- Size -->
3367
+ <?php
3368
+ if ( wppa_is_video( $photo['id'] ) ) {
3369
+ wppa_echo( '<br>'.wppa_get_videox( $photo['id'], 'admin' ).' x '.wppa_get_videoy( $photo['id'], 'admin' ).' px.' );
 
 
 
 
 
 
3370
  }
3371
  else {
3372
+ $sp = wppa_get_source_path( $photo['id'] );
3373
  if ( is_file( $sp ) ) {
3374
  $ima = getimagesize( $sp );
3375
  if ( is_array( $ima ) ) {
3376
+ wppa_echo( '<br>'.$ima['0'].' x '.$ima['1'].' px.' );
3377
  }
3378
  }
3379
  }
3380
+ ?>
3381
+ <!-- Move -->
3382
+ <?php
3383
+ $max = wppa_opt( 'photo_admin_max_albums' );
3384
+ if ( ! $max || wppa_get_total_album_count() < $max ) {
3385
+
3386
+ // If not done yet, get the album options html with the current album excluded
3387
+ if ( ! isset( $album_select[$album] ) ) {
3388
+ $album_select[$album] = wppa_album_select_a( array( 'checkaccess' => true,
3389
+ 'path' => true,
3390
+ 'exclude' => $album,
3391
+ 'selected' => '0',
3392
+ 'addpleaseselect' => true,
3393
+ 'sort' => true,
3394
+ )
3395
+ );
3396
+ }
3397
 
3398
+ wppa_echo(
3399
+ '<br>' . __( 'Target album for move to', 'wp-photo-album-plus' ) . '<br>' .
3400
+ '<select' .
3401
+ ' id="target-' . $id . '"' .
3402
+ ' onchange="wppaTryMove(' . $id . ', ' . ( wppa_is_video( $id ) ? 'true' : 'false' ) . ')"' .
3403
+ ' style="max-width:300px"' .
3404
+ ' >' .
3405
+ $album_select[$album] .
3406
+ '</select>' .
3407
+ '<span id="moving-' . $id . '" style="color:red;font-weight:bold"></span>' );
3408
+ }
 
 
 
3409
 
3410
+ ?>
3411
+ </td>
3412
  <!-- Description -->
3413
  <td style="width:25%">
3414
+ <textarea class="wppa-bulk-dec" style="height:50px; width:100%" onchange="wppaAjaxUpdatePhoto( <?php wppa_echo( $photo['id'] ) ?>, 'description', this.value)"><?php wppa_echo( ( esc_textarea( stripslashes( $photo['description'] ) ) ) ) ?></textarea>
 
 
 
 
 
 
3415
  </td>
3416
  <!-- Status -->
3417
+ <td>
3418
+ <?php if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) { ?>
3419
+ <select id="status-<?php wppa_echo( $photo['id'] ) ?>" onchange="wppaAjaxUpdatePhoto( <?php wppa_echo( $photo['id'] ) ?>, 'status', this.value); wppaPhotoStatusChange( <?php wppa_echo( $photo['id'] ) ?> ); ">
3420
+ <option value="pending" <?php if ( $photo['status']=='pending' ) wppa_echo( 'selected' )?> ><?php _e( 'Pending' , 'wp-photo-album-plus' ) ?></option>
3421
+ <option value="publish" <?php if ( $photo['status']=='publish' ) wppa_echo( 'selected' )?> ><?php _e( 'Publish' , 'wp-photo-album-plus' ) ?></option>
3422
+ <?php if ( wppa_switch( 'ext_status_restricted' ) && ! wppa_user_is_admin() ) $dis = ' disabled'; else $dis = ''; ?>
3423
+ <option value="featured" <?php if ( $photo['status']=='featured' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Featured' , 'wp-photo-album-plus' ) ?></option>
3424
+ <option value="gold" <?php if ( $photo['status'] == 'gold' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Gold' , 'wp-photo-album-plus' ) ?></option>
3425
+ <option value="silver" <?php if ( $photo['status'] == 'silver' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Silver' , 'wp-photo-album-plus' ) ?></option>
3426
+ <option value="bronze" <?php if ( $photo['status'] == 'bronze' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Bronze' , 'wp-photo-album-plus' ) ?></option>
3427
+ <option value="scheduled" <?php if ( $photo['status'] == 'scheduled' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Scheduled' , 'wp-photo-album-plus' ) ?></option>
3428
+ <option value="private" <?php if ( $photo['status'] == 'private' ) wppa_echo( 'selected' ); wppa_echo( $dis )?> ><?php _e( 'Private' , 'wp-photo-album-plus' ) ?></option>
3429
+ </select>
3430
+ <?php }
3431
  else {
3432
+ if ( $photo['status'] == 'pending' ) _e( 'Pending' , 'wp-photo-album-plus' );
3433
+ elseif ( $photo['status'] == 'publish' ) _e( 'Publish' , 'wp-photo-album-plus' );
3434
+ elseif ( $photo['status'] == 'featured' ) e( 'Featured' );
3435
+ elseif ( $photo['status'] == 'gold' ) _e( 'Gold' , 'wp-photo-album-plus' );
3436
+ elseif ( $photo['status'] == 'silver' ) _e( 'Silver' , 'wp-photo-album-plus' );
3437
+ elseif ( $photo['status'] == 'bronze' ) _e( 'Bronze' , 'wp-photo-album-plus' );
3438
+ elseif ( $photo['status'] == 'scheduled' ) _e( 'Scheduled' , 'wp-photo-album-plus' );
3439
+ elseif ( $photo['status'] == 'private' ) _e( 'Private' , 'wp-photo-album-plus' );
3440
+ } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3441
  </td>
3442
  <!-- Owner -->
3443
+ <td>
3444
+ <?php wppa_echo( $photo['owner'] ) ?>
3445
  </td>
3446
  <!-- Remark -->
3447
+ <td id="remark-<?php wppa_echo( $photo['id'] ) ?>" style="width:25%">
3448
+ <?php _e( 'Not modified' , 'wp-photo-album-plus' ) ?>
3449
+ <?php wppa_add_inline_script( 'wppa-admin', 'wppaPhotoStatusChange('.$photo['id'].');' ); ?>
3450
  </td>
3451
+ </tr>
3452
+ <?php } ?>
 
 
 
 
 
3453
  </tbody>
3454
+ <tfoot style="font-weight:bold">
3455
+ <td><input type="checkbox" class="wppa-bulk-photo" onchange="jQuery( '.wppa-bulk-photo' ).prop( 'checked', this.checked )" /></td>
3456
+ <td><?php _e( 'ID' , 'wp-photo-album-plus' ) ?></td>
3457
+ <td><?php _e( 'Preview' , 'wp-photo-album-plus' ) ?></td>
3458
+ <td><?php _e( 'Name' , 'wp-photo-album-plus' ) ?></td>
3459
+ <td><?php _e( 'Description' , 'wp-photo-album-plus' ) ?></td>
3460
+ <td><?php _e( 'Status' , 'wp-photo-album-plus' ) ?></td>
3461
+ <td><?php _e( 'Owner' , 'wp-photo-album-plus' ) ?></td>
3462
+ <td><?php _e( 'Remark' , 'wp-photo-album-plus' ) ?></td>
3463
  </tfoot>
3464
  </table>
3465
+ </form>
3466
+ <?php
3467
+ wppa_admin_page_links( $page, $pagesize, $count, $plink, '#manage-photos' );
 
 
3468
  }
3469
  else {
3470
  if ( $page == '1' ) {
3471
  if ( wppa_get( 'searchstring' ) ) {
3472
+ wppa_echo( '<h1>' . __( 'No photos matching your search criteria.', 'wp-photo-album-plus' ) . '</h1>' );
3473
  }
3474
  elseif ( $album == 'moderate' ) {
3475
  wppa_echo( '<h1>' . __( 'No photos to moderate', 'wp-photo-album-plus' ) . '</h1>' );
3483
  }
3484
  else {
3485
  $page_1 = $page - '1';
3486
+ wppa_echo( sprintf( __( 'Page %d is empty, try <a href="%s">page %d</a>.', 'wp-photo-album-plus' ), $page, $link . '&wppa-page=' . $page_1 . '#manage-photos', $page_1 ) );
3487
  }
3488
  }
3489
  }
3492
  function wppa_album_photos_sequence( $album ) {
3493
  global $wpdb;
3494
 
 
 
3495
  if ( $album ) {
3496
  $photoorder = wppa_get_photo_order( $album, 'norandom' );
3497
  $is_descending = strpos( $photoorder, 'DESC' ) !== false;
3498
  $is_p_order = strpos( $photoorder, 'p_order' ) !== false;
3499
 
 
 
 
 
3500
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
3501
  WHERE album = %s" . $photoorder, $album ), ARRAY_A );
3502
 
3504
  $size = '180';
3505
 
3506
  if ( $photos ) {
 
3507
 
3508
+ $the_js = '
3509
+ jQuery( function() {
3510
+ jQuery( "#sortable" ).sortable( {
3511
+ cursor: "move",
3512
+ placeholder: "sortable-placeholder-photos",
3513
+ stop: function( event, ui ) {
3514
+ var ids = jQuery( ".wppa-sort-item" );
3515
+ var seq = jQuery( ".wppa-sort-seqn" );
3516
+ var idx = 0;
3517
+ var descend = ' . ( $is_descending ? 'true' : 'false' ) . ';
3518
+ while ( idx < ids.length ) {
3519
+ var newvalue;
3520
+ if ( descend ) newvalue = ids.length - idx;
3521
+ else newvalue = idx + 1;
3522
+ var oldvalue = seq[idx].value;
3523
+ var photo = ids[idx].value;
3524
+ if ( newvalue != oldvalue ) {
3525
+ wppaDoSeqUpdate( photo, newvalue );
3526
+ }
3527
+ idx++;
3528
+ }
3529
+ },
3530
+ delay: 100,
3531
+ opacity: 0.5,
3532
+ scroll: false,
3533
+ cursorAt: { left: 90, top: 90 }
3534
+ });
3535
+ jQuery( "#sortable" ).disableSelection();
3536
+ });
3537
+ var wppaAjaxRequests = 0;
3538
+ function wppaDoSeqUpdate( photo, seqno ) {
3539
+ if ( wppaAjaxRequests >=10 ) {
3540
+ setTimeout(function(){wppaDoSeqUpdate( photo, seqno );},500);
3541
+ return;
3542
  }
3543
+ var data = "action=wppa&wppa-action=update-photo&photo-id="+photo+"&item=p_order&wppa-nonce="+document.getElementById(\'photo-nonce-\'+photo).value+"&value="+seqno;
3544
+ var xmlhttp = new XMLHttpRequest();
3545
+
3546
+ xmlhttp.onreadystatechange = function() {
3547
+ if ( xmlhttp.readyState == 4 && xmlhttp.status != 404 ) {
3548
+ var ArrValues = xmlhttp.responseText.split( "||" );
3549
+ if ( ArrValues[0] != "" ) {
3550
+ alert("The server returned unexpected output:\n"+ArrValues[0]);
3551
+ }
3552
+ switch ( ArrValues[1] ) {
3553
+ case "0": // No error
3554
+ jQuery("#wppa-seqno-"+photo).html(seqno);
3555
+ break;
3556
+ case "99": // Photo is gone
3557
+ jQuery("#wppa-seqno-"+photo).html(\'<span style="color:red">deleted</span>\');
3558
+ break;
3559
+ default: // Any error
3560
+ jQuery("#wppa-seqno-"+photo).html(\'<span style="color:red">Err:"+ArrValues[1]+"</span>\');
3561
+ break;
3562
+ }
3563
+ wppaAjaxRequests--;
3564
+ wppaConsoleLog("Pending ajax requests = "+wppaAjaxRequests);
3565
+ }
3566
  }
3567
+ xmlhttp.open("POST",wppaAjaxUrl,true);
3568
+ xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
3569
+ xmlhttp.send( data );
3570
+ wppaAjaxRequests++;
3571
+ wppaConsoleLog("Pending ajax requests = "+wppaAjaxRequests);
3572
+ jQuery("#wppa-sort-seqn-"+photo).val(seqno); // set hidden value to new value to prevent duplicate action
3573
+ var spinnerhtml = \'<img src="\'+wppaImageDirectory+\'spinner.gif" />\';
3574
+ jQuery("#wppa-seqno-"+photo).html(spinnerhtml);
3575
+ }';
3576
+ wppa_add_inline_script( 'wppa-admin', $the_js );
3577
+
3578
+ if ( ! $is_p_order ) wppa_warning_message( __( 'Setting photo sequence has only effect if the photo sequence method is set to <b>Sequence #</b>' , 'wp-photo-album-plus' ) ) ?>
3579
+ <div class="widefat wppa-photo-admin-sortable" style="border-color:#cccccc">
3580
+ <ul id="sortable">
3581
+ <?php foreach ( $photos as $photo ) {
3582
+ if ( wppa_is_video( $photo['id'] ) ) {
3583
+ $imgs['0'] = wppa_get_videox( $photo['id'], 'admin' );
3584
+ $imgs['1'] = wppa_get_videoy( $photo['id'], 'admin' );
3585
  }
3586
  else {
3587
+ $imgs['0'] = wppa_get_thumbx( $photo['id'] );
3588
+ $imgs['1'] = wppa_get_thumby( $photo['id'] );
 
 
 
 
3589
  }
3590
+ if ( ! $imgs['0'] ) { // missing thuimbnail, prevent division by zero
3591
+ $imgs['0'] = 200;
3592
+ $imgs['1'] = 150;
3593
+ }
3594
+ $mw = $size - '20';
3595
+ $mh = $mw * '3' / '4';
3596
+ if ( $imgs[1]/$imgs[0] > $mh/$mw ) { // more portrait than 200x150, y is limit
3597
+ $mt = '15';
3598
+ }
3599
+ else { // x is limit
3600
+ $mt = ( $mh - ( $imgs[1]/$imgs[0] * $mw ) ) / '2' + '15';
3601
+ }
3602
+ ?>
3603
+ <li id="photoitem-<?php wppa_echo( $photo['id'] ) ?>" class="ui-state-default-photos wppa-<?php wppa_echo( $photo['status'] ) ?>" style="background-image:none; text-align:center; cursor:move">
3604
+ <?php if ( wppa_is_video( $photo['id'] ) ) { ?>
3605
+ <?php $id = $photo['id'] ?>
3606
+ <?php $imgstyle = 'max-width:'.$mw.'px;max-height:'.$mh.'px;margin-top:'.$mt.'px;' ?>
3607
+ <?php wppa_echo( wppa_get_video_html( array(
3608
+ 'id' => $id,
3609
+ // 'width' => $imgwidth,
3610
+ // 'height' => '60',
3611
+ 'controls' => false,
3612
+ // 'margin_top' => '0',
3613
+ // 'margin_bottom' => '0',
3614
+ 'tagid' => 'pa-id-'.$id,
3615
+ // 'cursor' => 'cursor:pointer;',
3616
+ // 'events' => ' onmouseover="jQuery( this ).css( \'height\', \'160\' )" onmouseout="jQuery( this ).css( \'height\', \'60\' )"',
3617
+ // 'title' => $title,
3618
+ 'preload' => 'metadata',
3619
+ // 'onclick' => $onclick,
3620
+ // 'lb' => false,
3621
+ 'class' => 'wppa-bulk-thumb',
3622
+ 'style' => $imgstyle,
3623
+ 'use_thumb' => true
3624
+ )) );
3625
 
 
 
3626
 
3627
+ }
3628
+ else {
3629
+ wppa_echo(
3630
+ '<img' .
3631
+ ' class="wppa-bulk-thumb"' .
3632
+ ' ' . ( wppa_lazy() ? 'data-' : '' ) . 'src="' . esc_url( wppa_get_thumb_url( $photo['id'] ) ) . '"' .
3633
+ ' style="max-width:' . $mw . 'px;max-height:' . $mh . 'px;margin-top:' . $mt . 'px" />' );
3634
+ } ?>
3635
+ <div style="font-size:9px; position:absolute; bottom:24px; text-align:center; width:<?php wppa_echo( $size ) ?>px"><?php wppa_echo( wppa_get_photo_name( $photo['id'] ) ) ?></div>
3636
+ <div style="text-align: center; width: <?php wppa_echo( $size ) ?>px; position:absolute; bottom:8px">
3637
+ <span style="margin-left:15px;float:left"><?php wppa_echo( __( 'Id: ' , 'wp-photo-album-plus' ).$photo['id'] )?></span>
3638
+ <?php if ( wppa_is_video( $photo['id'] ) )_e('Video', 'wp-photo-album-plus' ); ?>
3639
+ <?php if ( wppa_has_audio( $photo['id'] ) ) _e('Audio', 'wp-photo-album-plus' ); ?>
3640
+ <span style="float:right; margin-right:15px"><?php wppa_echo( __( 'Seq: ' , 'wp-photo-album-plus' ).'<span id="wppa-seqno-'.$photo['id'].'">'.$photo['p_order'] ) ?></span>
3641
  </div>
3642
+ <input type="hidden" id="photo-nonce-<?php wppa_echo( $photo['id'] ) ?>" value="<?php wppa_echo( wp_create_nonce( 'wppa-nonce_'.$photo['id'] ) ); ?>" />
3643
+ <input type="hidden" class="wppa-sort-item" value="<?php wppa_echo( $photo['id'] ) ?>" />
3644
+ <input type="hidden" class="wppa-sort-seqn" id="wppa-sort-seqn-<?php wppa_echo( $photo['id'] ) ?>" value="<?php wppa_echo( $photo['p_order'] ) ?>" />
3645
+ </li>
3646
+ <?php } ?>
 
 
3647
  </ul>
3648
  <div style="clear:both"></div>
3649
+ </div>
3650
+ <?php
3651
  }
3652
  else {
3653
  wppa_echo( '<h1>'.__( 'The album is empty.' , 'wp-photo-album-plus' ).'</h1>' );
wppa-picture.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Make the picture html
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -41,7 +41,7 @@ function wppa_get_picture_html( $args ) {
41
 
42
  // Does the photo exist?
43
  if ( ! wppa_photo_exists( $id ) ) {
44
- wppa_log( 'Err', 'Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $args['type'] );
45
  return false;
46
  }
47
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Make the picture html
6
+ * Version 8.2.05.000
7
  *
8
  */
9
 
41
 
42
  // Does the photo exist?
43
  if ( ! wppa_photo_exists( $id ) ) {
44
+ wppa_log( 'Err', 'Photo ' . $id . ' does not exist in call to wppa_get_picture_html(). Type = ' . $type );
45
  return false;
46
  }
47
 
wppa-search-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the search widget
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -113,7 +113,7 @@ class SearchPhotos extends WP_Widget {
113
  $body,
114
  __( 'Album', 'wp-photo-album-plus' ),
115
  false,
116
- __( 'If you want the search to be limited to a specific album and its (sub-)sub albums, select the album here.', 'wp-photo-album-plus' ) .
117
  ' ' .
118
  __( 'If you select an album here, it will overrule the previous checkbox using the album as a \'fixed\' root.', 'wp-photo-album-plus' )
119
  );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the search widget
6
+ * Version 8.2.03.006
7
  *
8
  */
9
 
113
  $body,
114
  __( 'Album', 'wp-photo-album-plus' ),
115
  false,
116
+ __( 'If you want the search to be limited to a specific album and its (sub-)subalbums, select the album here.', 'wp-photo-album-plus' ) .
117
  ' ' .
118
  __( 'If you select an album here, it will overrule the previous checkbox using the album as a \'fixed\' root.', 'wp-photo-album-plus' )
119
  );
wppa-setting-see-also.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -123,7 +123,7 @@ global $wppa_subtab_names;
123
  ),
124
  'admin' => array(
125
  '1' => __( 'WPPA+ related roles and capabilities', 'wp-photo-album-plus' ),
126
- '2' => __( 'Frontend create albums and upload photos enabling and limiting settings' , 'wp-photo-album-plus' ),
127
  '3' => __( 'Import related settings', 'wp-photo-album-plus' ),
128
  '4' => __( 'Admin Functionality restrictions for non administrators' , 'wp-photo-album-plus' ),
129
  '5' => __( 'Miscellaneous limiting settings' , 'wp-photo-album-plus' ),
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.2.02.005
7
  *
8
  */
9
 
123
  ),
124
  'admin' => array(
125
  '1' => __( 'WPPA+ related roles and capabilities', 'wp-photo-album-plus' ),
126
+ '2' => __( 'Frontend create Albums and upload Photos enabling and limiting settings' , 'wp-photo-album-plus' ),
127
  '3' => __( 'Import related settings', 'wp-photo-album-plus' ),
128
  '4' => __( 'Admin Functionality restrictions for non administrators' , 'wp-photo-album-plus' ),
129
  '5' => __( 'Miscellaneous limiting settings' , 'wp-photo-album-plus' ),
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 8.3.01.005
7
  *
8
  */
9
 
@@ -299,15 +299,26 @@ global $wppa_subtab_names;
299
  // Fix invalid source path
300
  wppa_fix_source_path();
301
 
302
- // Spinner image
303
- wppa_admin_spinner();
304
 
305
- // Open page
306
- wppa_echo( '
307
- <div class="wrap">
308
- <h1 class="wp-heading-inline">' .
309
- get_admin_page_title() . '
 
 
 
310
  </h1>' );
 
 
 
 
 
 
 
 
 
311
 
312
  if ( is_multisite() ) {
313
  if ( WPPA_MULTISITE_GLOBAL ) {
@@ -1342,7 +1353,7 @@ global $wppa_subtab_names;
1342
  $vals = array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900');
1343
 
1344
  $name = __('Album titles', 'wp-photo-album-plus' );
1345
- $desc = __('Font used for album titles.', 'wp-photo-album-plus' );
1346
  $help = __('Enter font name, size, color and weight for album cover titles.', 'wp-photo-album-plus' );
1347
  $slug1 = 'wppa_fontfamily_title';
1348
  $slug2 = 'wppa_fontsize_title';
@@ -1662,8 +1673,8 @@ global $wppa_subtab_names;
1662
  wppa_setting_new($slug, '4', $name, $desc, $html, $help);
1663
 
1664
  $name = __('Treecount', 'wp-photo-album-plus' );
1665
- $desc = __('Display the total number of (sub)albums and photos in sub albums', 'wp-photo-album-plus' );
1666
- $help = __('Displays the total number of sub albums and photos in the entire album tree in parenthesis if the numbers differ from the direct content of the album.', 'wp-photo-album-plus' );
1667
  $slug = 'wppa_show_treecount';
1668
  $opts = array( __('none', 'wp-photo-album-plus' ), __('detailed', 'wp-photo-album-plus' ), __('totals only', 'wp-photo-album-plus' ));
1669
  $vals = array( '-none-', 'detail', 'total' );
@@ -1776,8 +1787,8 @@ global $wppa_subtab_names;
1776
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
1777
 
1778
  $name = __('Cats include subs', 'wp-photo-album-plus' );
1779
- $desc = __('Sub albums are included in Category based shortcodes.', 'wp-photo-album-plus' );
1780
- $help = __('When you use album="#cat,...", in a shortcode, the sub albums will be included.', 'wp-photo-album-plus' );
1781
  $slug = 'wppa_cats_inherit';
1782
  $html = wppa_checkbox($slug);
1783
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
@@ -2103,8 +2114,8 @@ global $wppa_subtab_names;
2103
  }
2104
 
2105
  if ( wppa_get_option( 'wppa_potd_album_type' ) == 'physical' ) {
2106
- $name = __( 'Include (sub-)sub albums', 'wp-photo-album-plus' );
2107
- $desc = __( 'Include the photos of all sub albums?', 'wp-photo-album-plus' );
2108
  $slug = 'wppa_potd_include_subs';
2109
  $html = wppa_checkbox( $slug, 'wppaRefreshAfter();' );
2110
  wppa_setting_new( $slug, '9', $name, $desc, $html );
@@ -5193,7 +5204,7 @@ global $wppa_subtab_names;
5193
  $slug4 = 'wppa_album_widget_overrule';
5194
  $slug = array($slug1, $slug2, $slug3, $slug4);
5195
  $opts = array(
5196
- __('sub albums and thumbnails.', 'wp-photo-album-plus' ),
5197
  __('slideshow', 'wp-photo-album-plus' ),
5198
  __('a plain page without a querystring.', 'wp-photo-album-plus' ),
5199
  __('lightbox', 'wp-photo-album-plus' ),
@@ -5226,7 +5237,7 @@ global $wppa_subtab_names;
5226
  $opts = array(
5227
  __('thumbnails', 'wp-photo-album-plus' ),
5228
  __('slideshow', 'wp-photo-album-plus' ),
5229
- __('sub albums and thumbnails', 'wp-photo-album-plus' ),
5230
  __('a plain page without a querystring.', 'wp-photo-album-plus' ),
5231
  __('lightbox', 'wp-photo-album-plus' ),
5232
  );
@@ -5646,8 +5657,8 @@ global $wppa_subtab_names;
5646
  $html = array($html1, $html2, $html3, $html4);
5647
  wppa_setting_new($slug, '11', $name, $desc, $html, $help);
5648
 
5649
- $name = __('Album cover sub albums link', 'wp-photo-album-plus' );
5650
- $desc = __('Select the linktype and display type for sub albums on parent album covers.', 'wp-photo-album-plus' );
5651
  $help = '';
5652
  $slug1 = 'wppa_cover_sublinks';
5653
  $slug2 = 'wppa_cover_sublinks_display';
@@ -5658,7 +5669,7 @@ global $wppa_subtab_names;
5658
  __('No link at all', 'wp-photo-album-plus' ),
5659
  __('Thumbnails and covers', 'wp-photo-album-plus' ),
5660
  __('Slideshow or covers', 'wp-photo-album-plus' ),
5661
- __('Sub album title link', 'wp-photo-album-plus' ),
5662
  );
5663
  $vals = array(
5664
  'none',
@@ -5670,7 +5681,7 @@ global $wppa_subtab_names;
5670
  $opts = array(
5671
  __('No display at all', 'wp-photo-album-plus' ),
5672
  __('A list with sub-(sub) albums', 'wp-photo-album-plus' ),
5673
- __('A list of sub albums', 'wp-photo-album-plus' ),
5674
  __('An enumeration of names', 'wp-photo-album-plus' ),
5675
  __('Micro thumbnails', 'wp-photo-album-plus' ),
5676
  );
@@ -6507,7 +6518,7 @@ global $wppa_subtab_names;
6507
  wppa_setting_new($slug, '23', $name, $desc, $html, $help);
6508
 
6509
  $name = __('Thumbs first', 'wp-photo-album-plus' );
6510
- $desc = __('When displaying album content: thumbnails before sub albums.', 'wp-photo-album-plus' );
6511
  $help = '';
6512
  $slug = 'wppa_thumbs_first';
6513
  $html = wppa_checkbox($slug);
@@ -7044,7 +7055,7 @@ global $wppa_subtab_names;
7044
  case 'selectionbox':
7045
  $name = __('Grant parent', 'wp-photo-album-plus' );
7046
  $desc = __('The parent album(s) of the auto created albums.', 'wp-photo-album-plus' );
7047
- $help = (__('You may select multiple albums. All logged in visitors will get their own sub album in each granted parent.', 'wp-photo-album-plus' ));
7048
  $slug = 'wppa_grant_parent';
7049
  $opts = array( __('--- none ---', 'wp-photo-album-plus' ), __('--- separate ---', 'wp-photo-album-plus' ) );
7050
  $vals = array( 'zero', '-1');
@@ -7179,8 +7190,8 @@ global $wppa_subtab_names;
7179
  $desc = __('The album linktype for new albums', 'wp-photo-album-plus' );
7180
  $help = '';
7181
  $slug = 'wppa_default_album_linktype';
7182
- $opts = array( __('the sub albums and thumbnails', 'wp-photo-album-plus' ),
7183
- __('the sub albums', 'wp-photo-album-plus' ),
7184
  __('the thumbnails', 'wp-photo-album-plus' ),
7185
  __('the album photos as slideshow', 'wp-photo-album-plus' ),
7186
  __('no link at all', 'wp-photo-album-plus' )
@@ -7325,7 +7336,7 @@ global $wppa_subtab_names;
7325
 
7326
  wppa_setting_box_footer_new();
7327
  }
7328
- // Frontend create albums and upload Photos enabling and limiting settings
7329
  {
7330
  $desc = $wppa_subtab_names[$tab]['2'];
7331
  wppa_setting_tab_description($desc);
@@ -7338,7 +7349,7 @@ global $wppa_subtab_names;
7338
  );
7339
  wppa_setting_box_header_new($tab, $coldef);
7340
 
7341
- $name = __('User create albums', 'wp-photo-album-plus' );
7342
  $desc = __('Enable frontend album creation.', 'wp-photo-album-plus' );
7343
  $help = __('If you check this item, frontend album creation will be enabled.', 'wp-photo-album-plus' );
7344
  $slug = 'wppa_user_create_on';
@@ -7402,7 +7413,7 @@ global $wppa_subtab_names;
7402
  $html = array( $html1, $html2 );
7403
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
7404
 
7405
- $name = __('User delete albums', 'wp-photo-album-plus' );
7406
  $desc = __('Enable frontend album deletion', 'wp-photo-album-plus' );
7407
  $help = __('If you check this item, frontend album deletion will be enabled.', 'wp-photo-album-plus' );
7408
  $slug = 'wppa_user_destroy_on';
@@ -7412,7 +7423,7 @@ global $wppa_subtab_names;
7412
  $html = array( $html1, $html2 );
7413
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
7414
 
7415
- $name = __('User create albums captcha', 'wp-photo-album-plus' );
7416
  $desc = __('User must answer security question.', 'wp-photo-album-plus' );
7417
  $help = '';
7418
  $slug = 'wppa_user_create_captcha';
@@ -8026,6 +8037,24 @@ global $wppa_subtab_names;
8026
  $html = wppa_checkbox($slug);
8027
  wppa_setting_new($slug, '3', $name, $desc, $html, $help);
8028
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8029
  $name = __('Photo admin max albums', 'wp-photo-album-plus' );
8030
  $desc = __('Max albums to show in album selectionbox.', 'wp-photo-album-plus' );
8031
  $help = __('If there are more albums in the system, display an input box asking for album id#', 'wp-photo-album-plus' );
@@ -8035,6 +8064,15 @@ global $wppa_subtab_names;
8035
  $html = wppa_select($slug, $opts, $vals, '', '', '', 'wppaRefreshAfter();');
8036
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
8037
 
 
 
 
 
 
 
 
 
 
8038
  $name = __('Geo info edit', 'wp-photo-album-plus' );
8039
  $desc = __('Lattitude and longitude may be edited in photo admin.', 'wp-photo-album-plus' );
8040
  $help = '';
@@ -8592,7 +8630,7 @@ global $wppa_subtab_names;
8592
 
8593
  $name = __('Remove empty albums', 'wp-photo-album-plus' );
8594
  $desc = __('Removes albums that are not used.', 'wp-photo-album-plus' );
8595
- $help = __('Removes all albums that have no photos and no sub albums in it.', 'wp-photo-album-plus' );
8596
  $slug2 = 'wppa_remove_empty_albums';
8597
  $html1 = '';
8598
  $html2 = wppa_maintenance_button( $slug2 );
@@ -9772,8 +9810,8 @@ global $wppa_subtab_names;
9772
  $opts = array( __('--- random ---', 'wp-photo-album-plus' ),
9773
  __('--- random featured ---', 'wp-photo-album-plus' ),
9774
  __('--- most recent added ---', 'wp-photo-album-plus' ),
9775
- __('--- random from (sub-)sub albums ---', 'wp-photo-album-plus' ),
9776
- __('--- most recent from (sub-)sub albums ---', 'wp-photo-album-plus' ),
9777
  __('--- according to albums photo sequence ---', 'wp-photo-album-plus' ),
9778
  );
9779
  $vals = array('-9', '-1', '-2', '-3', '-4', '-5');
@@ -10477,18 +10515,12 @@ global $wppa_subtab_names;
10477
  // close wrapper
10478
  wppa_echo( '</div>' );
10479
 
10480
- // Report resource used and other environmental data
10481
  wppa_echo( '
10482
- <div style="clear:both;margin-top:12px">
10483
- <br>' .
10484
- sprintf( __( 'Memory used on this page: %6.2f Mb', 'wp-photo-album-plus' ), memory_get_peak_usage( true ) / ( 1024 * 1024 ) ) . '<br>' .
10485
- sprintf( __( 'There are %d settings and %d runtime parameters', 'wp-photo-album-plus' ), count( $wppa_opt ), count( $wppa ) ) . '<br>' .
10486
- __( 'Database revision:', 'wp-photo-album-plus' ) . ' ' . wppa_get_option( 'wppa_revision', '100' ) . '<br>' .
10487
- __( 'WP Charset:', 'wp-photo-album-plus' ) . ' ' . get_bloginfo( 'charset' ) . '<br>' .
10488
- __( 'Current PHP version:', 'wp-photo-album-plus' ) . ' ' . phpversion() . '<br>' .
10489
- __( 'WPPA+ API Version:', 'wp-photo-album-plus' ) . ' ' . $wppa_version . '<br>' .
10490
- __( 'Filesystem method:', 'wp-photo-album-plus' ) . ' ' . get_filesystem_method() .
10491
- '<br>' );
10492
 
10493
  wppa_initialize_runtime( true );
10494
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 8.2.09.001
7
  *
8
  */
9
 
299
  // Fix invalid source path
300
  wppa_fix_source_path();
301
 
302
+ wppa_echo( '<div class="wrap">' );
 
303
 
304
+ wppa_admin_spinner();
305
+ $iconurl = WPPA_URL.'/img/settings32.png';
306
+
307
+ // General header
308
+ wppa_echo( '
309
+ <img id="icon-album" src="' . $iconurl . '" />
310
+ <h1 style="display:inline">' . __( 'WP Photo Album Plus Settings', 'wp-photo-album-plus' ) . '
311
+ <span style="color:blue"> ' . __( 'Auto Save', 'wp-photo-album-plus' ) . '</span>
312
  </h1>' );
313
+ if ( current_user_can( 'administrator' ) ) {
314
+ wppa_echo( ' ' .
315
+ __( 'Database revision:', 'wp-photo-album-plus' ) . ' ' . wppa_get_option( 'wppa_revision', '100') . '. ' .
316
+ __( 'WP Charset:', 'wp-photo-album-plus' ) . ' ' . get_bloginfo( 'charset' ) . '. ' .
317
+ __( 'Current PHP version:', 'wp-photo-album-plus' ) . ' ' . phpversion() . '. ' .
318
+ __( 'WPPA+ API Version:', 'wp-photo-album-plus' ) . ' ' . $wppa_version . '. ' .
319
+ __( 'Filesystem method:', 'wp-photo-album-plus' ) . ' ' . get_filesystem_method() );
320
+ }
321
+ wppa_echo( '<br>' );
322
 
323
  if ( is_multisite() ) {
324
  if ( WPPA_MULTISITE_GLOBAL ) {
1353
  $vals = array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900');
1354
 
1355
  $name = __('Album titles', 'wp-photo-album-plus' );
1356
+ $desc = __('Font used for Album titles.', 'wp-photo-album-plus' );
1357
  $help = __('Enter font name, size, color and weight for album cover titles.', 'wp-photo-album-plus' );
1358
  $slug1 = 'wppa_fontfamily_title';
1359
  $slug2 = 'wppa_fontsize_title';
1673
  wppa_setting_new($slug, '4', $name, $desc, $html, $help);
1674
 
1675
  $name = __('Treecount', 'wp-photo-album-plus' );
1676
+ $desc = __('Display the total number of (sub)albums and photos in subalbums', 'wp-photo-album-plus' );
1677
+ $help = __('Displays the total number of subalbums and photos in the entire album tree in parenthesis if the numbers differ from the direct content of the album.', 'wp-photo-album-plus' );
1678
  $slug = 'wppa_show_treecount';
1679
  $opts = array( __('none', 'wp-photo-album-plus' ), __('detailed', 'wp-photo-album-plus' ), __('totals only', 'wp-photo-album-plus' ));
1680
  $vals = array( '-none-', 'detail', 'total' );
1787
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
1788
 
1789
  $name = __('Cats include subs', 'wp-photo-album-plus' );
1790
+ $desc = __('Subalbums are included in Category based shortcodes.', 'wp-photo-album-plus' );
1791
+ $help = __('When you use album="#cat,...", in a shortcode, the subalbums will be included.', 'wp-photo-album-plus' );
1792
  $slug = 'wppa_cats_inherit';
1793
  $html = wppa_checkbox($slug);
1794
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
2114
  }
2115
 
2116
  if ( wppa_get_option( 'wppa_potd_album_type' ) == 'physical' ) {
2117
+ $name = __( 'Include (sub-)subalbums', 'wp-photo-album-plus' );
2118
+ $desc = __( 'Include the photos of all subalbums?', 'wp-photo-album-plus' );
2119
  $slug = 'wppa_potd_include_subs';
2120
  $html = wppa_checkbox( $slug, 'wppaRefreshAfter();' );
2121
  wppa_setting_new( $slug, '9', $name, $desc, $html );
5204
  $slug4 = 'wppa_album_widget_overrule';
5205
  $slug = array($slug1, $slug2, $slug3, $slug4);
5206
  $opts = array(
5207
+ __('subalbums and thumbnails.', 'wp-photo-album-plus' ),
5208
  __('slideshow', 'wp-photo-album-plus' ),
5209
  __('a plain page without a querystring.', 'wp-photo-album-plus' ),
5210
  __('lightbox', 'wp-photo-album-plus' ),
5237
  $opts = array(
5238
  __('thumbnails', 'wp-photo-album-plus' ),
5239
  __('slideshow', 'wp-photo-album-plus' ),
5240
+ __('subalbums and thumbnails', 'wp-photo-album-plus' ),
5241
  __('a plain page without a querystring.', 'wp-photo-album-plus' ),
5242
  __('lightbox', 'wp-photo-album-plus' ),
5243
  );
5657
  $html = array($html1, $html2, $html3, $html4);
5658
  wppa_setting_new($slug, '11', $name, $desc, $html, $help);
5659
 
5660
+ $name = __('Album cover subalbums link', 'wp-photo-album-plus' );
5661
+ $desc = __('Select the linktype and display type for subalbums on parent album covers.', 'wp-photo-album-plus' );
5662
  $help = '';
5663
  $slug1 = 'wppa_cover_sublinks';
5664
  $slug2 = 'wppa_cover_sublinks_display';
5669
  __('No link at all', 'wp-photo-album-plus' ),
5670
  __('Thumbnails and covers', 'wp-photo-album-plus' ),
5671
  __('Slideshow or covers', 'wp-photo-album-plus' ),
5672
+ __('Subalbum title link', 'wp-photo-album-plus' ),
5673
  );
5674
  $vals = array(
5675
  'none',
5681
  $opts = array(
5682
  __('No display at all', 'wp-photo-album-plus' ),
5683
  __('A list with sub-(sub) albums', 'wp-photo-album-plus' ),
5684
+ __('A list of subalbums', 'wp-photo-album-plus' ),
5685
  __('An enumeration of names', 'wp-photo-album-plus' ),
5686
  __('Micro thumbnails', 'wp-photo-album-plus' ),
5687
  );
6518
  wppa_setting_new($slug, '23', $name, $desc, $html, $help);
6519
 
6520
  $name = __('Thumbs first', 'wp-photo-album-plus' );
6521
+ $desc = __('When displaying album content: thumbnails before subalbums.', 'wp-photo-album-plus' );
6522
  $help = '';
6523
  $slug = 'wppa_thumbs_first';
6524
  $html = wppa_checkbox($slug);
7055
  case 'selectionbox':
7056
  $name = __('Grant parent', 'wp-photo-album-plus' );
7057
  $desc = __('The parent album(s) of the auto created albums.', 'wp-photo-album-plus' );
7058
+ $help = (__('You may select multiple albums. All logged in visitors will get their own subalbum in each granted parent.', 'wp-photo-album-plus' ));
7059
  $slug = 'wppa_grant_parent';
7060
  $opts = array( __('--- none ---', 'wp-photo-album-plus' ), __('--- separate ---', 'wp-photo-album-plus' ) );
7061
  $vals = array( 'zero', '-1');
7190
  $desc = __('The album linktype for new albums', 'wp-photo-album-plus' );
7191
  $help = '';
7192
  $slug = 'wppa_default_album_linktype';
7193
+ $opts = array( __('the subalbums and thumbnails', 'wp-photo-album-plus' ),
7194
+ __('the subalbums', 'wp-photo-album-plus' ),
7195
  __('the thumbnails', 'wp-photo-album-plus' ),
7196
  __('the album photos as slideshow', 'wp-photo-album-plus' ),
7197
  __('no link at all', 'wp-photo-album-plus' )
7336
 
7337
  wppa_setting_box_footer_new();
7338
  }
7339
+ // Frontend create Albums and upload Photos enabling and limiting settings
7340
  {
7341
  $desc = $wppa_subtab_names[$tab]['2'];
7342
  wppa_setting_tab_description($desc);
7349
  );
7350
  wppa_setting_box_header_new($tab, $coldef);
7351
 
7352
+ $name = __('User create Albums', 'wp-photo-album-plus' );
7353
  $desc = __('Enable frontend album creation.', 'wp-photo-album-plus' );
7354
  $help = __('If you check this item, frontend album creation will be enabled.', 'wp-photo-album-plus' );
7355
  $slug = 'wppa_user_create_on';
7413
  $html = array( $html1, $html2 );
7414
  wppa_setting_new($slug, '5', $name, $desc, $html, $help);
7415
 
7416
+ $name = __('User delete Albums', 'wp-photo-album-plus' );
7417
  $desc = __('Enable frontend album deletion', 'wp-photo-album-plus' );
7418
  $help = __('If you check this item, frontend album deletion will be enabled.', 'wp-photo-album-plus' );
7419
  $slug = 'wppa_user_destroy_on';
7423
  $html = array( $html1, $html2 );
7424
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
7425
 
7426
+ $name = __('User create Albums Captcha', 'wp-photo-album-plus' );
7427
  $desc = __('User must answer security question.', 'wp-photo-album-plus' );
7428
  $help = '';
7429
  $slug = 'wppa_user_create_captcha';
8037
  $html = wppa_checkbox($slug);
8038
  wppa_setting_new($slug, '3', $name, $desc, $html, $help);
8039
 
8040
+ $name = __('Album admin page size', 'wp-photo-album-plus' );
8041
+ $desc = __('The number of albums per page on the Edit Album admin page.', 'wp-photo-album-plus' );
8042
+ $help = '';
8043
+ $slug = 'wppa_album_admin_pagesize';
8044
+ $opts = array( '10', '20', '50', '100', '200', '500', '700', '1000', '1500', '2000' );
8045
+ $vals = array( '10', '20', '50', '100', '200', '500', '700', '1000', '1500', '2000' );
8046
+ $html = wppa_select($slug, $opts, $vals);
8047
+ wppa_setting_new($slug, '4', $name, $desc, $html, $help);
8048
+
8049
+ $name = __('Photo admin page size', 'wp-photo-album-plus' );
8050
+ $desc = __('The number of photos per page on the Edit Album -> Manage photos and Edit Photos admin pages.', 'wp-photo-album-plus' );
8051
+ $help = '';
8052
+ $slug = 'wppa_photo_admin_pagesize';
8053
+ $opts = array( '10', '20', '50', '100', '200', '500', '700', '1000' );
8054
+ $vals = array( '10', '20', '50', '100', '200', '500', '700', '1000' );
8055
+ $html = wppa_select($slug, $opts, $vals);
8056
+ wppa_setting_new($slug, '5', $name, $desc, $html, $help);
8057
+
8058
  $name = __('Photo admin max albums', 'wp-photo-album-plus' );
8059
  $desc = __('Max albums to show in album selectionbox.', 'wp-photo-album-plus' );
8060
  $help = __('If there are more albums in the system, display an input box asking for album id#', 'wp-photo-album-plus' );
8064
  $html = wppa_select($slug, $opts, $vals, '', '', '', 'wppaRefreshAfter();');
8065
  wppa_setting_new($slug, '6', $name, $desc, $html, $help);
8066
 
8067
+ $name = __('Comment admin page size', 'wp-photo-album-plus' );
8068
+ $desc = __('The number of comments per page on the Comments admin pages.', 'wp-photo-album-plus' );
8069
+ $help = '';
8070
+ $slug = 'wppa_comment_admin_pagesize';
8071
+ $opts = array( __('--- off ---', 'wp-photo-album-plus' ), '10', '20', '50', '100', '200');
8072
+ $vals = array('0', '10', '20', '50', '100', '200');
8073
+ $html = wppa_select($slug, $opts, $vals);
8074
+ wppa_setting_new($slug, '7', $name, $desc, $html, $help);
8075
+
8076
  $name = __('Geo info edit', 'wp-photo-album-plus' );
8077
  $desc = __('Lattitude and longitude may be edited in photo admin.', 'wp-photo-album-plus' );
8078
  $help = '';
8630
 
8631
  $name = __('Remove empty albums', 'wp-photo-album-plus' );
8632
  $desc = __('Removes albums that are not used.', 'wp-photo-album-plus' );
8633
+ $help = __('Removes all albums that have no photos and no subalbums in it.', 'wp-photo-album-plus' );
8634
  $slug2 = 'wppa_remove_empty_albums';
8635
  $html1 = '';
8636
  $html2 = wppa_maintenance_button( $slug2 );
9810
  $opts = array( __('--- random ---', 'wp-photo-album-plus' ),
9811
  __('--- random featured ---', 'wp-photo-album-plus' ),
9812
  __('--- most recent added ---', 'wp-photo-album-plus' ),
9813
+ __('--- random from (sub-)subalbums ---', 'wp-photo-album-plus' ),
9814
+ __('--- most recent from (sub-)subalbums ---', 'wp-photo-album-plus' ),
9815
  __('--- according to albums photo sequence ---', 'wp-photo-album-plus' ),
9816
  );
9817
  $vals = array('-9', '-1', '-2', '-3', '-4', '-5');
10515
  // close wrapper
10516
  wppa_echo( '</div>' );
10517
 
10518
+ // Report resource used
10519
  wppa_echo( '
10520
+ <div style="clear:both;margin-top:12px">' .
10521
+ sprintf(__('<br>Memory used on this page: %6.2f Mb.', 'wp-photo-album-plus' ), memory_get_peak_usage(true)/(1024*1024)) .
10522
+ sprintf(__('<br>There are %d settings and %d runtime parameters.', 'wp-photo-album-plus' ), count($wppa_opt), count($wppa)) . '
10523
+ </div>' );
 
 
 
 
 
 
10524
 
10525
  wppa_initialize_runtime( true );
10526
  }
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -634,7 +634,7 @@ static $user;
634
  $my_albs_parents[] = $parent;
635
  }
636
  else {
637
- wppa_log( 'Err', 'Could not create sub album of ' . $parent . ' for ' . $user );
638
  }
639
  wppa_invalidate_treecounts( $parent );
640
  wppa_index_add( 'album', $id );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 8.2.05.003
7
  *
8
  */
9
 
634
  $my_albs_parents[] = $parent;
635
  }
636
  else {
637
+ wppa_log( 'Err', 'Could not create subalbum of ' . $parent . ' for ' . $user );
638
  }
639
  wppa_invalidate_treecounts( $parent );
640
  wppa_index_add( 'album', $id );
wppa-slideshow-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a slideshow in the sidebar
6
- * Version 8.3.01.001
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -88,7 +88,7 @@ class SlideshowWidget extends WP_Widget {
88
  wppa( 'max_slides_in_ss_widget', $instance['maxslides'] );
89
  wppa( 'is_random', wppa_checked( $instance['random'] ) );
90
 
91
- // Including sub albums?
92
  if ( $album > '0' && wppa_checked( $instance['incsubs'] ) ) {
93
  $album = wppa_alb_to_enum_children( $album );
94
  }
@@ -196,8 +196,8 @@ class SlideshowWidget extends WP_Widget {
196
  wppa_widget_input( $this, 'album', $instance['album'], __( 'Album', 'wp-photo-album-plus' ) );
197
  }
198
 
199
- // Including sub albums?
200
- wppa_widget_checkbox( $this, 'incsubs', $instance['incsubs'], __( 'Include sub albums', 'wp-photo-album-plus' ) );
201
 
202
  // Max
203
  $body =
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a slideshow in the sidebar
6
+ * Version 8.2.05.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
88
  wppa( 'max_slides_in_ss_widget', $instance['maxslides'] );
89
  wppa( 'is_random', wppa_checked( $instance['random'] ) );
90
 
91
+ // Including subalbums?
92
  if ( $album > '0' && wppa_checked( $instance['incsubs'] ) ) {
93
  $album = wppa_alb_to_enum_children( $album );
94
  }
196
  wppa_widget_input( $this, 'album', $instance['album'], __( 'Album', 'wp-photo-album-plus' ) );
197
  }
198
 
199
+ // Including subalbums?
200
+ wppa_widget_checkbox( $this, 'incsubs', $instance['incsubs'], __( 'Include subalbums', 'wp-photo-album-plus' ) );
201
 
202
  // Max
203
  $body =
wppa-slideshow.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains all the slideshow high level functions
6
  *
7
- * Version 8.3.01.001
8
  *
9
  */
10
 
@@ -178,7 +178,7 @@ global $previous_page_last_id;
178
  wppa( 'curpage', '1' );
179
 
180
  // If a page is requested, find it
181
- $pagreq = wppa_get( 'paged', '0' );
182
  if ( $pagreq ) {
183
  wppa( 'curpage', $pagreq );
184
  }
4
  *
5
  * Contains all the slideshow high level functions
6
  *
7
+ * Version 8.2.06.006
8
  *
9
  */
10
 
178
  wppa( 'curpage', '1' );
179
 
180
  // If a page is requested, find it
181
+ $pagreq = wppa_get( 'wppa-page', '0' );
182
  if ( $pagreq ) {
183
  wppa( 'curpage', $pagreq );
184
  }
wppa-statistics.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
- * Version 8.3.01.001
8
  *
9
  */
10
 
@@ -25,7 +25,7 @@ function wppa_show_statistics() {
25
  $result .= '<a href="'.wppa_get_permalink().'wppa-album='.$y_id.'&amp;wppa-cover=0&amp;wppa-occur=1">'.$y_name.'</a>';
26
 
27
  if ($p_id > '0') {
28
- $result .= __(', a sub album of', 'wp-photo-album-plus' ).' ';
29
  $result .= '<a href="'.wppa_get_permalink().'wppa-album='.$p_id.'&amp;wppa-cover=0&amp;wppa-occur=1">'.$p_name.'</a>';
30
  }
31
 
@@ -317,7 +317,7 @@ global $wpdb;
317
  return $treecounts;
318
  }
319
 
320
- // Get the ids of the sub albums
321
  $child_ids = $wpdb->get_col( "SELECT id " .
322
  "FROM $wpdb->wppa_albums " .
323
  "WHERE a_parent = $alb"
@@ -584,11 +584,11 @@ global $wpdb;
584
  return $result;
585
  }
586
 
587
- // An album is physically empty when it has no sub albums, no photos and no recoverable deleted photos
588
  function wppa_is_album_empty( $id ) {
589
  global $wpdb;
590
 
591
- // Sub albums?
592
  $has_albums = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
593
  if ( $has_albums ) {
594
  return false;
@@ -665,7 +665,7 @@ static $login;
665
  }
666
  }
667
 
668
- // Look at sub albums
669
  $albs = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
670
  foreach( $albs as $a ) {
671
 
@@ -823,7 +823,7 @@ static $cache;
823
  return $result;
824
  }
825
 
826
- // Get array of sub album ids, not checked for visibility
827
  function wppa_get_sub_album_ids( $id ) {
828
  global $wpdb;
829
  static $cache;
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
+ * Version 8.2.07.003
8
  *
9
  */
10
 
25
  $result .= '<a href="'.wppa_get_permalink().'wppa-album='.$y_id.'&amp;wppa-cover=0&amp;wppa-occur=1">'.$y_name.'</a>';
26
 
27
  if ($p_id > '0') {
28
+ $result .= __(', a subalbum of', 'wp-photo-album-plus' ).' ';
29
  $result .= '<a href="'.wppa_get_permalink().'wppa-album='.$p_id.'&amp;wppa-cover=0&amp;wppa-occur=1">'.$p_name.'</a>';
30
  }
31
 
317
  return $treecounts;
318
  }
319
 
320
+ // Get the ids of the subalbums
321
  $child_ids = $wpdb->get_col( "SELECT id " .
322
  "FROM $wpdb->wppa_albums " .
323
  "WHERE a_parent = $alb"
584
  return $result;
585
  }
586
 
587
+ // An album is physically empty when it has no subalbums, no photos and no recoverable deleted photos
588
  function wppa_is_album_empty( $id ) {
589
  global $wpdb;
590
 
591
+ // Subalbums?
592
  $has_albums = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
593
  if ( $has_albums ) {
594
  return false;
665
  }
666
  }
667
 
668
+ // Look at subalbums
669
  $albs = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE a_parent = %s", $id ) );
670
  foreach( $albs as $a ) {
671
 
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-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.3.01.001
9
  *
10
  */
11
 
@@ -61,6 +61,17 @@ global $wpdb;
61
  $class = 'thumbnail-frame thumbnail-frame-'.$mocc.' thumbnail-frame-photo-'.$xid;
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
64
  // Find image attributes
65
  $imgsrc = wppa_get_thumb_path( $id );
66
  if ( ! wppa_is_file( $imgsrc ) ) {
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
+ * Version 8.2.05.001
9
  *
10
  */
11
 
61
  $class = 'thumbnail-frame thumbnail-frame-'.$mocc.' thumbnail-frame-photo-'.$xid;
62
  }
63
 
64
+ // If no image to display, die gracefully
65
+ // $imgsrc = wppa_get_thumb_path( $id );
66
+ // if ( ! wppa_is_video( $id ) && ! is_file( $imgsrc ) && ! wppa_has_audio( $id ) ) {
67
+ // $result .= '<div' .
68
+ // ' class="' . $class . '"' .
69
+ // ' style="' . $framestyle . '; color:red">' .
70
+ // 'Missing thumbnail image #' . $id .
71
+ // '</div>';
72
+ // return $result;
73
+ // }
74
+
75
  // Find image attributes
76
  $imgsrc = wppa_get_thumb_path( $id );
77
  if ( ! wppa_is_file( $imgsrc ) ) {
wppa-tinymce-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-tinymce-shortcodes.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
- * Version 8.3.01.001
6
  */
7
 
8
  if ( ! defined( 'ABSPATH' ) )
@@ -111,7 +111,7 @@ global $wpdb;
111
  <option value="" selected disabled style="color:#700 !important;">-- ' . __( 'Please select a gallery type', 'wp-photo-album-plus' ) . ' --</option>
112
  <option value="cover">' . __( 'The cover(s) of specific album(s)', 'wp-photo-album-plus' ) . '</option>
113
  <option value="content">' . __( 'The content of specific album(s)', 'wp-photo-album-plus' ) . '</option>
114
- <option value="covers">' . __( 'The covers of the sub albums of specific album(s)', 'wp-photo-album-plus' ) . '</option>
115
  <option value="thumbs">' . __( 'The thumbnails of specific album(s)', 'wp-photo-album-plus' ) . '</option>
116
  </select>
117
  </td>
2
  /* wppa-tinymce-shortcodes.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
+ * Version 8.2.05.001
6
  */
7
 
8
  if ( ! defined( 'ABSPATH' ) )
111
  <option value="" selected disabled style="color:#700 !important;">-- ' . __( 'Please select a gallery type', 'wp-photo-album-plus' ) . ' --</option>
112
  <option value="cover">' . __( 'The cover(s) of specific album(s)', 'wp-photo-album-plus' ) . '</option>
113
  <option value="content">' . __( 'The content of specific album(s)', 'wp-photo-album-plus' ) . '</option>
114
+ <option value="covers">' . __( 'The covers of the subalbums of specific album(s)', 'wp-photo-album-plus' ) . '</option>
115
  <option value="thumbs">' . __( 'The thumbnails of specific album(s)', 'wp-photo-album-plus' ) . '</option>
116
  </select>
117
  </td>
wppa-topten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
- * Version 8.3.01.001
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
@@ -108,7 +108,7 @@ class TopTenWidget extends WP_Widget {
108
  }
109
  }
110
 
111
- // Including sub albums?
112
  if ( $includesubs ) {
113
  $albenum = wppa_expand_enum( $album );
114
  $albenum = wppa_alb_to_enum_children( $albenum );
@@ -579,8 +579,8 @@ class TopTenWidget extends WP_Widget {
579
 
580
  wppa_widget_selection( $this, 'sortby', $instance['sortby'], __( 'Sort by', 'wp-photo-album-plus' ), $options, $values );
581
 
582
- // Include sub albums
583
- wppa_widget_checkbox( $this, 'includesubs', $instance['includesubs'], __( 'Include sub albums', 'wp-photo-album-plus' ) );
584
 
585
  // Medals only
586
  wppa_widget_checkbox( $this, 'medalsonly', $instance['medalsonly'], __( 'Only with medals', 'wp-photo-album-plus' ) );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
+ * Version 8.2.05.002
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
108
  }
109
  }
110
 
111
+ // Including subalbums?
112
  if ( $includesubs ) {
113
  $albenum = wppa_expand_enum( $album );
114
  $albenum = wppa_alb_to_enum_children( $albenum );
579
 
580
  wppa_widget_selection( $this, 'sortby', $instance['sortby'], __( 'Sort by', 'wp-photo-album-plus' ), $options, $values );
581
 
582
+ // Include subalbums
583
+ wppa_widget_checkbox( $this, 'includesubs', $instance['includesubs'], __( 'Include subalbums', 'wp-photo-album-plus' ) );
584
 
585
  // Medals only
586
  wppa_widget_checkbox( $this, 'medalsonly', $instance['medalsonly'], __( 'Only with medals', 'wp-photo-album-plus' ) );
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.3.01.001
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -228,7 +228,7 @@ class UpldrWidget extends WP_Widget {
228
  ?>
229
 
230
 
231
- <p><label for="<?php echo $this->get_field_id('parent'); ?>"><?php _e('Look only in albums (including sub albums):', 'wp-photo-album-plus' ); ?></label>
232
  <input type="hidden" id="<?php echo $this->get_field_id('parent'); ?>" name="<?php echo $this->get_field_name('parent'); ?>" value="<?php echo $instance['parent'] ?>" />
233
  <?php if ( $instance['parent'] ) echo '<br/><small>( '.$instance['parent'].' )</small>' ?>
234
  <select class="widefat" multiple onchange="wppaGetSelEnumToId( 'parentalbums-<?php echo $this->get_widget_id() ?>', '<?php echo $this->get_field_id('parent') ?>' )" id="<?php echo $this->get_field_id('parent-list'); ?>" name="<?php echo $this->get_field_name('parent-list'); ?>" >
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
+ * Version 8.2.05.002
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
228
  ?>
229
 
230
 
231
+ <p><label for="<?php echo $this->get_field_id('parent'); ?>"><?php _e('Look only in albums (including subalbums):', 'wp-photo-album-plus' ); ?></label>
232
  <input type="hidden" id="<?php echo $this->get_field_id('parent'); ?>" name="<?php echo $this->get_field_name('parent'); ?>" value="<?php echo $instance['parent'] ?>" />
233
  <?php if ( $instance['parent'] ) echo '<br/><small>( '.$instance['parent'].' )</small>' ?>
234
  <select class="widefat" multiple onchange="wppaGetSelEnumToId( 'parentalbums-<?php echo $this->get_widget_id() ?>', '<?php echo $this->get_field_id('parent') ?>' )" id="<?php echo $this->get_field_id('parent-list'); ?>" name="<?php echo $this->get_field_name('parent-list'); ?>" >
wppa-upload-common.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -268,7 +268,7 @@ global $wppa_supported_document_extensions;
268
 
269
  while ( $i < count( $names ) -1 ) {
270
 
271
- // Find album with parent is current and name is sub album name
272
  $a = $wpdb->get_var( $wpdb->prepare( "SELECT id
273
  FROM $wpdb->wppa_albums
274
  WHERE name = %s
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
+ * Version 8.2.09.002
7
  *
8
  */
9
 
268
 
269
  while ( $i < count( $names ) -1 ) {
270
 
271
+ // Find album with parent is current and name is subalbum name
272
  $a = $wpdb->get_var( $wpdb->prepare( "SELECT id
273
  FROM $wpdb->wppa_albums
274
  WHERE name = %s
wppa-upload-widget.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * A wppa widget to upload photos
6
  *
7
- * Version 8.3.01.001
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
11
 
12
  function __construct() {
13
  $widget_ops = array( 'classname' => 'wppa_upload_widget', 'description' => __( 'Display upload photos dialog', 'wp-photo-album-plus' ) );
14
- parent::__construct( 'wppa_upload_widget', __( 'WPPA+ Upload photos', 'wp-photo-album-plus' ), $widget_ops );
15
  }
16
 
17
  function widget( $args, $instance ) {
@@ -115,7 +115,7 @@ class WppaUploadWidget extends WP_Widget {
115
  // Set defaults
116
  function get_defaults() {
117
 
118
- $defaults = array( 'title' => __( 'Upload photos', 'wp-photo-album-plus' ),
119
  'album' => '0',
120
  'logonly' => 'no',
121
  'cache' => '0',
4
  *
5
  * A wppa widget to upload photos
6
  *
7
+ * Version 8.2.05.002
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
11
 
12
  function __construct() {
13
  $widget_ops = array( 'classname' => 'wppa_upload_widget', 'description' => __( 'Display upload photos dialog', 'wp-photo-album-plus' ) );
14
+ parent::__construct( 'wppa_upload_widget', __( 'WPPA+ Upload Photos', 'wp-photo-album-plus' ), $widget_ops );
15
  }
16
 
17
  function widget( $args, $instance ) {
115
  // Set defaults
116
  function get_defaults() {
117
 
118
+ $defaults = array( 'title' => __( 'Upload Photos', 'wp-photo-album-plus' ),
119
  'album' => '0',
120
  'logonly' => 'no',
121
  'cache' => '0',
wppa-upload.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -95,9 +95,7 @@ global $upload_album;
95
  // Open the form
96
  $result = '
97
  <div class="wrap">
98
- <h1>' .
99
- get_admin_page_title() . '
100
- </h1>';
101
 
102
  // Get some req'd data
103
  $max_files = ini_get( 'max_file_uploads' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
+ * Version 8.2.05.002
7
  *
8
  */
9
 
95
  // Open the form
96
  $result = '
97
  <div class="wrap">
98
+ <h2>' . __( 'Upload Photos', 'wp-photo-album-plus' ) . '</h2>';
 
 
99
 
100
  // Get some req'd data
101
  $max_files = ini_get( 'max_file_uploads' );
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.3.01.001
7
  *
8
  */
9
 
@@ -40,31 +40,16 @@ static $users;
40
 
41
  // Get the options html for a selectionbox with users
42
  function wppa_get_user_select( $select = '' ) {
43
-
44
- // Init
45
  $result = '';
46
-
47
- // Unknown user
48
- $result .= '<option value="" disabled selected>' . __( 'Please select' , 'wp-photo-album-plus' ) . '</option>';
49
-
50
- // Who am i?
51
  $iam = $select == '' ? wppa_get_user() : $select;
52
-
53
- // Get all users
54
  $users = wppa_get_users();
55
-
56
- // Add user --- public ---
57
  $sel = $select == '--- public ---' ? 'selected' : '';
58
  $result .= '<option value="--- public ---" '.$sel.'>'.__( '--- public ---' , 'wp-photo-album-plus' ).'</option>';
59
-
60
- // Add all users
61
  foreach ( $users as $usr ) {
62
  if ( $usr['user_login'] == $iam ) $sel = 'selected';
63
  else $sel = '';
64
  $result .= '<option value="' . esc_attr( $usr['user_login'] ) . '" ' . $sel . '>' . sanitize_text_field( $usr['display_name'] ) . '</option>';
65
  }
66
-
67
- // Done
68
  return $result;
69
  }
70
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
+ * Version 8.2.05.002
7
  *
8
  */
9
 
40
 
41
  // Get the options html for a selectionbox with users
42
  function wppa_get_user_select( $select = '' ) {
 
 
43
  $result = '';
 
 
 
 
 
44
  $iam = $select == '' ? wppa_get_user() : $select;
 
 
45
  $users = wppa_get_users();
 
 
46
  $sel = $select == '--- public ---' ? 'selected' : '';
47
  $result .= '<option value="--- public ---" '.$sel.'>'.__( '--- public ---' , 'wp-photo-album-plus' ).'</option>';
 
 
48
  foreach ( $users as $usr ) {
49
  if ( $usr['user_login'] == $iam ) $sel = 'selected';
50
  else $sel = '';
51
  $result .= '<option value="' . esc_attr( $usr['user_login'] ) . '" ' . $sel . '>' . sanitize_text_field( $usr['display_name'] ) . '</option>';
52
  }
 
 
53
  return $result;
54
  }
55
 
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -2612,7 +2612,7 @@ global $wpdb;
2612
  }
2613
  }
2614
 
2615
- // Retrieve the number of sub albums ( if any )
2616
  function wppa_has_children( $alb ) {
2617
  global $wpdb;
2618
  static $childcounts;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.2.09.001
7
  *
8
  */
9
 
2612
  }
2613
  }
2614
 
2615
+ // Retrieve the number of subalbums ( if any )
2616
  function wppa_has_children( $alb ) {
2617
  global $wpdb;
2618
  static $childcounts;
wppa-widget-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
- /* Version 8.3.01.001
6
  /*
7
  */
8
 
@@ -61,7 +61,7 @@ global $wpdb;
61
  }
62
  }
63
 
64
- // If physical album(s) and include sub albums is active, make it an enumeration(with ',' as seperator)
65
  if ( wppa_opt( 'potd_album_type' ) == 'physical' && wppa_switch( 'potd_include_subs' ) ) {
66
  $alb = str_replace( ',', '.', $alb );
67
  $alb = wppa_expand_enum( wppa_alb_to_enum_children( $alb ) );
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
+ /* Version 8.2.08.001
6
  /*
7
  */
8
 
61
  }
62
  }
63
 
64
+ // If physical album(s) and include subalbums is active, make it an enumeration(with ',' as seperator)
65
  if ( wppa_opt( 'potd_album_type' ) == 'physical' && wppa_switch( 'potd_include_subs' ) ) {
66
  $alb = str_replace( ',', '.', $alb );
67
  $alb = wppa_expand_enum( wppa_alb_to_enum_children( $alb ) );
wppa-wpdb-update.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
- * Version 8.3.01.001
7
  *
8
  */
9
 
@@ -131,11 +131,6 @@ global $wpdb;
131
  if ( is_numeric( $itemvalue ) ) {
132
  $doit = true;
133
  }
134
- case 'owner':
135
- if ( $itemvalue == '--- public ---' || get_user_by( 'login', $itemvalue ) ) {
136
- $doit = true;
137
- }
138
-
139
  default:
140
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
141
  return false;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
+ * Version 8.2.05.003
7
  *
8
  */
9
 
131
  if ( is_numeric( $itemvalue ) ) {
132
  $doit = true;
133
  }
 
 
 
 
 
134
  default:
135
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
136
  return false;
wppa-wrappers.php CHANGED
@@ -5,7 +5,7 @@
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
- * Version 8.3.01.003
9
  *
10
  */
11
 
@@ -765,7 +765,7 @@ static $allowed_tags;
765
  'h4' => $sa,
766
  'h5' => $sa,
767
  'h6' => $sa,
768
- 'hr' => $sa,
769
  'i' => $sa,
770
  'img' => array_merge( $sa, array(
771
  'alt' => true,
@@ -789,8 +789,6 @@ static $allowed_tags;
789
  'accept' => true,
790
  'placeholder' => true,
791
  'download' => true,
792
- 'size' => true,
793
- 'aria-describedby' => true,
794
  ) ),
795
  'label' => array(
796
  'for' => true,
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 8.2.08.001
9
  *
10
  */
11
 
765
  'h4' => $sa,
766
  'h5' => $sa,
767
  'h6' => $sa,
768
+ 'hr' => array(),
769
  'i' => $sa,
770
  'img' => array_merge( $sa, array(
771
  'alt' => true,
789
  'accept' => true,
790
  'placeholder' => true,
791
  'download' => true,
 
 
792
  ) ),
793
  'label' => array(
794
  'for' => true,
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.3.01.005
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.3.01.005'; // 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.09.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/
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
+ global $wppa_version; $wppa_version = '8.2.09.002'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */