Version Description
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 6.6.13 |
Comparing to | |
See all releases |
Code changes from version 6.6.12 to 6.6.13
- js/wppa-admin-scripts.js +4 -3
- js/wppa-ajax-front.js +14 -3
- js/wppa-ajax-front.min.js +5 -4
- js/wppa-lightbox.js +11 -1
- js/wppa-lightbox.min.js +3 -3
- js/wppa-slideshow.js +19 -6
- js/wppa-slideshow.min.js +5 -5
- readme.txt +25 -2
- theme/wppa-style.css +2 -1
- wppa-adminbar.php +13 -1
- wppa-ajax.php +9 -2
- wppa-album-admin-autosave.php +5 -5
- wppa-boxes-html.php +7 -1
- wppa-export.php +3 -3
- wppa-filter.php +81 -0
- wppa-functions.php +103 -110
- wppa-import.php +185 -13
- wppa-index.php +162 -145
- wppa-items.php +173 -47
- wppa-non-admin.php +8 -7
- wppa-settings-autosave.php +68 -3
- wppa-setup.php +10 -4
- wppa-slideshow.php +4 -4
- wppa-thumbnails.php +5 -6
- wppa-topten-widget.php +3 -1
- wppa-utils.php +17 -3
- wppa.php +3 -3
js/wppa-admin-scripts.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/* admin-scripts.js */
|
2 |
/* Package: wp-photo-album-plus
|
3 |
/*
|
4 |
-
/* Version 6.6.
|
5 |
/* Various js routines used in admin pages
|
6 |
*/
|
7 |
|
@@ -169,12 +169,13 @@ function wppaInitSettings() {
|
|
169 |
wppaCheckFontPreview();
|
170 |
wppaCheckCheck( 'enable_video', 'wppa-video' );
|
171 |
wppaCheckCheck( 'custom_fields', 'custfields' );
|
|
|
172 |
wppaCheckCheck( 'new_mod_label_is_text', 'nmtxt' );
|
173 |
wppaCheckCheck( 'coverphoto_responsive', 'cvpr' );
|
174 |
wppaCheckSmWidgetLink();
|
175 |
|
176 |
var tab = new Array('O','I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII');
|
177 |
-
var sub = new Array('A','B','C','D','E','F','G','H','I','J','K');
|
178 |
|
179 |
for (table=1; table<13; table++) {
|
180 |
var cookie = wppa_getCookie('table_'+table);
|
@@ -184,7 +185,7 @@ function wppaInitSettings() {
|
|
184 |
else {
|
185 |
wppaHideTable(table); // Refreshes cookie, so it 'never' forgets
|
186 |
}
|
187 |
-
for (subtab=0; subtab<
|
188 |
cookie = wppa_getCookie('table_'+tab[table-1]+'-'+sub[subtab]);
|
189 |
if (cookie == 'on') {
|
190 |
wppaToggleSubTable(tab[table-1],sub[subtab]);
|
1 |
/* admin-scripts.js */
|
2 |
/* Package: wp-photo-album-plus
|
3 |
/*
|
4 |
+
/* Version 6.6.13
|
5 |
/* Various js routines used in admin pages
|
6 |
*/
|
7 |
|
169 |
wppaCheckFontPreview();
|
170 |
wppaCheckCheck( 'enable_video', 'wppa-video' );
|
171 |
wppaCheckCheck( 'custom_fields', 'custfields' );
|
172 |
+
wppaCheckCheck( 'album_custom_fields', 'albumcustfields' );
|
173 |
wppaCheckCheck( 'new_mod_label_is_text', 'nmtxt' );
|
174 |
wppaCheckCheck( 'coverphoto_responsive', 'cvpr' );
|
175 |
wppaCheckSmWidgetLink();
|
176 |
|
177 |
var tab = new Array('O','I','II','III','IV','V','VI','VII','VIII','IX','X','XI','XII');
|
178 |
+
var sub = new Array('A','B','C','D','E','F','G','H','I','J','K','L');
|
179 |
|
180 |
for (table=1; table<13; table++) {
|
181 |
var cookie = wppa_getCookie('table_'+table);
|
185 |
else {
|
186 |
wppaHideTable(table); // Refreshes cookie, so it 'never' forgets
|
187 |
}
|
188 |
+
for (subtab=0; subtab<12; subtab++) {
|
189 |
cookie = wppa_getCookie('table_'+tab[table-1]+'-'+sub[subtab]);
|
190 |
if (cookie == 'on') {
|
191 |
wppaToggleSubTable(tab[table-1],sub[subtab]);
|
js/wppa-ajax-front.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
// Contains frontend ajax modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
-
var wppaJsAjaxVersion = '6.6.
|
7 |
|
8 |
var wppaRenderAdd = false;
|
9 |
var wppaWaitForCounter = 0;
|
@@ -601,6 +601,7 @@ function wppaVoteThumb( mocc, photo ) {
|
|
601 |
'&wppa-rating=1' +
|
602 |
'&wppa-rating-id=' + photo +
|
603 |
'&wppa-occur=' + mocc +
|
|
|
604 |
'&wppa-nonce=' + jQuery( '#wppa-nonce' ).val(),
|
605 |
async: true,
|
606 |
type: 'GET',
|
@@ -857,11 +858,21 @@ function wppaAjaxMakeOrigName( mocc, photo ) {
|
|
857 |
if ( ArrValues[1] == '0' ) { // Ok, no error
|
858 |
|
859 |
// Publish result
|
860 |
-
if (
|
861 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
862 |
}
|
863 |
else {
|
864 |
|
|
|
|
|
|
|
865 |
// Show error
|
866 |
alert( 'Error: '+ArrValues[1]+'\n\n'+ArrValues[2] );
|
867 |
}
|
3 |
// Contains frontend ajax modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
+
var wppaJsAjaxVersion = '6.6.13';
|
7 |
|
8 |
var wppaRenderAdd = false;
|
9 |
var wppaWaitForCounter = 0;
|
601 |
'&wppa-rating=1' +
|
602 |
'&wppa-rating-id=' + photo +
|
603 |
'&wppa-occur=' + mocc +
|
604 |
+
'&wppa-index=0' +
|
605 |
'&wppa-nonce=' + jQuery( '#wppa-nonce' ).val(),
|
606 |
async: true,
|
607 |
type: 'GET',
|
858 |
if ( ArrValues[1] == '0' ) { // Ok, no error
|
859 |
|
860 |
// Publish result
|
861 |
+
if ( wppaIsSafari ) {
|
862 |
+
if ( wppaArtMonkyLink == 'file' ) wppaWindowReference.location = ArrValues[2];
|
863 |
+
if ( wppaArtMonkyLink == 'zip' ) document.location = ArrValues[2];
|
864 |
+
}
|
865 |
+
else {
|
866 |
+
if ( wppaArtMonkyLink == 'file' ) window.open( ArrValues[2] );
|
867 |
+
if ( wppaArtMonkyLink == 'zip' ) document.location = ArrValues[2];
|
868 |
+
}
|
869 |
+
|
870 |
}
|
871 |
else {
|
872 |
|
873 |
+
// Close pre-opened window
|
874 |
+
if ( wppaIsSafari && wppaArtMonkyLink == 'file' ) wppaWindowReference.close();
|
875 |
+
|
876 |
// Show error
|
877 |
alert( 'Error: '+ArrValues[1]+'\n\n'+ArrValues[2] );
|
878 |
}
|
js/wppa-ajax-front.min.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
-
var wppaJsAjaxVersion='6.6.
|
8 |
wppaRenderAdd=add;if(wppaLang!='')ajaxurl+='&lang='+wppaLang;if(wppaAutoColumnWidth[mocc])ajaxurl+='&resp=1';if(addHilite&&_wppaCurIdx[mocc]&&_wppaId[mocc][_wppaCurIdx[mocc]])ajaxurl+='&wppa-hilite='+_wppaId[mocc][_wppaCurIdx[mocc]];if(wppaCanAjaxRender){jQuery.ajax({url:ajaxurl,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){if(_wppaSSRuns[mocc])_wppaStop(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','');},success:function(result,status,xhr){if(wppaRenderAdd){jQuery(wppaRenderAdd+result).insertBefore('#wppa-container-'+mocc+'-end');}
|
9 |
else{if(wppaRenderModal){var opt={modal:true,resizable:true,width:wppaGetContainerWidth(mocc),show:{effect:"fadeIn",duration:400},closeText:"",};jQuery('#wppa-modal-container-'+mocc).html(result).dialog(opt).dialog("open");jQuery('.ui-dialog').css({boxShadow:'0px 0px 5px 5px #aaaaaa',borderRadius:wppaBoxRadius+'px',padding:'8px',backgroundColor:wppaModalBgColor,boxSizing:'content-box',zIndex:100000,});jQuery('.ui-dialog-titlebar').css({lineHeight:'0px',height:'32px',});jQuery('.ui-button').css({backgroundImage:wppaModalQuitImg,padding:0,position:'absolute',right:'8px',top:'8px',width:'16px',height:'16px',});jQuery('.ui-button').attr('title','Close');jQuery('.ui-button').on('click',function(){_wppaStop(mocc);});}
|
10 |
else{jQuery('#wppa-container-'+mocc).html(result);}}
|
@@ -41,7 +41,7 @@ function wppaAjaxDestroyAlbum(album,nonce){if(confirm('Are you sure you want to
|
|
41 |
return false;}
|
42 |
function _bumpClickCount(photo){if(!wppaBumpClickCount)return;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=bumpclickcount'+'&wppa-photo='+photo+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:false,type:'GET',timeout:60000,success:function(result,status,xhr){wppaConsoleLog('_bumpClickCount success.');},error:function(xhr,status,error){wppaConsoleLog('_bumpClickCount failed. Error = '+error+', status = '+status,'force');},});}
|
43 |
function _bumpViewCount(photo){if(!wppaBumpViewCount)return;if(wppaPhotoView[photo])return;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=bumpviewcount'+'&wppa-photo='+photo+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,success:function(result,status,xhr){wppaPhotoView[photo]=true;},error:function(xhr,status,error){wppaConsoleLog('_bumpViewCount failed. Error = '+error+', status = '+status,'force');},});}
|
44 |
-
function wppaVoteThumb(mocc,photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=rate'+'&wppa-rating=1'+'&wppa-rating-id='+photo+'&wppa-occur='+mocc+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,success:function(result,status,xhr){jQuery('#wppa-vote-button-'+mocc+'-'+photo).val(wppaVotedForMe);},error:function(xhr,status,error){wppaConsoleLog('wppaVoteThumb failed. Error = '+error+', status = '+status,'force');},});}
|
45 |
function _wppaRateIt(mocc,value){if(value==0)return;if(_wppaSSRuns[mocc])return;var photo=_wppaId[mocc][_wppaCurIdx[mocc]];var oldval=_wppaMyr[mocc][_wppaCurIdx[mocc]];var waittext=_wppaWaitTexts[mocc][_wppaCurIdx[mocc]];if(waittext.length>0){alert(waittext);return;}
|
46 |
if(oldval!=0&&wppaRatingOnce){return;}
|
47 |
if(oldval<0)return;_wppaVoteInProgress=true;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=rate'+'&wppa-rating='+value+'&wppa-rating-id='+photo+'&wppa-occur='+mocc+'&wppa-index='+_wppaCurIdx[mocc]+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,beforeSend:function(xhr){jQuery('#wppa-rate-'+mocc+'-'+value).attr('src',wppaImageDirectory+'tick.png');jQuery('#wppa-rate-'+mocc+'-'+value).stop().fadeTo(100,1.0);jQuery('#wppa-like-'+mocc).attr('src',wppaImageDirectory+'spinner.gif');},success:function(result,status,xhr){var ArrValues=result.split("||");if(ArrValues[0]==0){if(ArrValues[1]==900){alert(ArrValues[2]);_wppaSetRatingDisplay(mocc);}
|
@@ -61,8 +61,9 @@ else{jQuery('#wppa-like-'+id+'-'+mocc).attr('src',wppaImageDirectory+'thumbup.pn
|
|
61 |
return;}
|
62 |
_wppaSetRd(mocc,ArrValues[4],'.wppa-avg-');_wppaSetRd(mocc,ArrValues[3],'.wppa-rate-');if(reloadAfter){return;}
|
63 |
if(wppaNextOnCallback)wppaOvlShowNext();}},error:function(xhr,status,error){wppaConsoleLog('_wppaOvlRateIt failed. Error = '+error+', status = '+status,'force');},});}
|
64 |
-
function wppaAjaxMakeOrigName(mocc,photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=makeorigname'+'&photo-id='+photo+'&from=fsname',async:true,type:'GET',timeout:60000,beforeSend:function(xhr){},success:function(result,status,xhr){var ArrValues=result.split("||");if(ArrValues[1]=='0'){if(wppaArtMonkyLink=='file')
|
65 |
-
else{
|
|
|
66 |
function wppaAjaxDownloadAlbum(mocc,id){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=downloadalbum'+'&album-id='+id,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){jQuery('#dwnspin-'+mocc+'-'+id).css('display','');},success:function(result,status,xhr){var ArrValues=result.split("||");var url=ArrValues[0];var erok=ArrValues[1];var text=ArrValues[2];if(ArrValues.length==3&&text!='')alert('Attention:\n\n'+text);if(erok=='OK'){document.location=url;}
|
67 |
else{alert('The server could not complete the request.\nPlease try again.');}},error:function(xhr,status,error){alert('An error occurred:\n'+error+'\nPlease try again');},complete:function(xhr,status,newurl){jQuery('#dwnspin-'+mocc+'-'+id).css('display','none');}});}
|
68 |
function wppaAjaxComment(mocc,id){if(!_wppaValidateComment(mocc,id))return;var data='action=wppa'+'&wppa-action=do-comment'+'&photo-id='+id+'&comname='+jQuery("#wppa-comname-"+mocc).val()+'&comment='+wppaEncode(jQuery("#wppa-comment-"+mocc).val())+'&wppa-captcha='+jQuery("#wppa-captcha-"+mocc).val()+'&wppa-nonce='+jQuery("#wppa-nonce-"+mocc).val()+'&moccur='+mocc;if(typeof(jQuery("#wppa-comemail-"+mocc).val())!='undefined'){data+='&comemail='+jQuery("#wppa-comemail-"+mocc).val();}
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
+
var wppaJsAjaxVersion='6.6.13';var wppaRenderAdd=false;var wppaWaitForCounter=0;function wppaDoAjaxRender(mocc,ajaxurl,newurl,add,waitfor,addHilite){if(parseInt(waitfor)>0&&waitfor!=wppaWaitForCounter){setTimeout('wppaDoAjaxRender( '+mocc+', \''+ajaxurl+'\', \''+newurl+'\', \''+add+'\', '+waitfor+' )',100);return;}
|
8 |
wppaRenderAdd=add;if(wppaLang!='')ajaxurl+='&lang='+wppaLang;if(wppaAutoColumnWidth[mocc])ajaxurl+='&resp=1';if(addHilite&&_wppaCurIdx[mocc]&&_wppaId[mocc][_wppaCurIdx[mocc]])ajaxurl+='&wppa-hilite='+_wppaId[mocc][_wppaCurIdx[mocc]];if(wppaCanAjaxRender){jQuery.ajax({url:ajaxurl,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){if(_wppaSSRuns[mocc])_wppaStop(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','');},success:function(result,status,xhr){if(wppaRenderAdd){jQuery(wppaRenderAdd+result).insertBefore('#wppa-container-'+mocc+'-end');}
|
9 |
else{if(wppaRenderModal){var opt={modal:true,resizable:true,width:wppaGetContainerWidth(mocc),show:{effect:"fadeIn",duration:400},closeText:"",};jQuery('#wppa-modal-container-'+mocc).html(result).dialog(opt).dialog("open");jQuery('.ui-dialog').css({boxShadow:'0px 0px 5px 5px #aaaaaa',borderRadius:wppaBoxRadius+'px',padding:'8px',backgroundColor:wppaModalBgColor,boxSizing:'content-box',zIndex:100000,});jQuery('.ui-dialog-titlebar').css({lineHeight:'0px',height:'32px',});jQuery('.ui-button').css({backgroundImage:wppaModalQuitImg,padding:0,position:'absolute',right:'8px',top:'8px',width:'16px',height:'16px',});jQuery('.ui-button').attr('title','Close');jQuery('.ui-button').on('click',function(){_wppaStop(mocc);});}
|
10 |
else{jQuery('#wppa-container-'+mocc).html(result);}}
|
41 |
return false;}
|
42 |
function _bumpClickCount(photo){if(!wppaBumpClickCount)return;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=bumpclickcount'+'&wppa-photo='+photo+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:false,type:'GET',timeout:60000,success:function(result,status,xhr){wppaConsoleLog('_bumpClickCount success.');},error:function(xhr,status,error){wppaConsoleLog('_bumpClickCount failed. Error = '+error+', status = '+status,'force');},});}
|
43 |
function _bumpViewCount(photo){if(!wppaBumpViewCount)return;if(wppaPhotoView[photo])return;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=bumpviewcount'+'&wppa-photo='+photo+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,success:function(result,status,xhr){wppaPhotoView[photo]=true;},error:function(xhr,status,error){wppaConsoleLog('_bumpViewCount failed. Error = '+error+', status = '+status,'force');},});}
|
44 |
+
function wppaVoteThumb(mocc,photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=rate'+'&wppa-rating=1'+'&wppa-rating-id='+photo+'&wppa-occur='+mocc+'&wppa-index=0'+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,success:function(result,status,xhr){jQuery('#wppa-vote-button-'+mocc+'-'+photo).val(wppaVotedForMe);},error:function(xhr,status,error){wppaConsoleLog('wppaVoteThumb failed. Error = '+error+', status = '+status,'force');},});}
|
45 |
function _wppaRateIt(mocc,value){if(value==0)return;if(_wppaSSRuns[mocc])return;var photo=_wppaId[mocc][_wppaCurIdx[mocc]];var oldval=_wppaMyr[mocc][_wppaCurIdx[mocc]];var waittext=_wppaWaitTexts[mocc][_wppaCurIdx[mocc]];if(waittext.length>0){alert(waittext);return;}
|
46 |
if(oldval!=0&&wppaRatingOnce){return;}
|
47 |
if(oldval<0)return;_wppaVoteInProgress=true;jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=rate'+'&wppa-rating='+value+'&wppa-rating-id='+photo+'&wppa-occur='+mocc+'&wppa-index='+_wppaCurIdx[mocc]+'&wppa-nonce='+jQuery('#wppa-nonce').val(),async:true,type:'GET',timeout:60000,beforeSend:function(xhr){jQuery('#wppa-rate-'+mocc+'-'+value).attr('src',wppaImageDirectory+'tick.png');jQuery('#wppa-rate-'+mocc+'-'+value).stop().fadeTo(100,1.0);jQuery('#wppa-like-'+mocc).attr('src',wppaImageDirectory+'spinner.gif');},success:function(result,status,xhr){var ArrValues=result.split("||");if(ArrValues[0]==0){if(ArrValues[1]==900){alert(ArrValues[2]);_wppaSetRatingDisplay(mocc);}
|
61 |
return;}
|
62 |
_wppaSetRd(mocc,ArrValues[4],'.wppa-avg-');_wppaSetRd(mocc,ArrValues[3],'.wppa-rate-');if(reloadAfter){return;}
|
63 |
if(wppaNextOnCallback)wppaOvlShowNext();}},error:function(xhr,status,error){wppaConsoleLog('_wppaOvlRateIt failed. Error = '+error+', status = '+status,'force');},});}
|
64 |
+
function wppaAjaxMakeOrigName(mocc,photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=makeorigname'+'&photo-id='+photo+'&from=fsname',async:true,type:'GET',timeout:60000,beforeSend:function(xhr){},success:function(result,status,xhr){var ArrValues=result.split("||");if(ArrValues[1]=='0'){if(wppaIsSafari){if(wppaArtMonkyLink=='file')wppaWindowReference.location=ArrValues[2];if(wppaArtMonkyLink=='zip')document.location=ArrValues[2];}
|
65 |
+
else{if(wppaArtMonkyLink=='file')window.open(ArrValues[2]);if(wppaArtMonkyLink=='zip')document.location=ArrValues[2];}}
|
66 |
+
else{if(wppaIsSafari&&wppaArtMonkyLink=='file')wppaWindowReference.close();alert('Error: '+ArrValues[1]+'\n\n'+ArrValues[2]);}},error:function(xhr,status,error){wppaConsoleLog('wppaAjaxMakeOrigName failed. Error = '+error+', status = '+status,'force');},complete:function(xhr,status,newurl){}});}
|
67 |
function wppaAjaxDownloadAlbum(mocc,id){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=downloadalbum'+'&album-id='+id,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){jQuery('#dwnspin-'+mocc+'-'+id).css('display','');},success:function(result,status,xhr){var ArrValues=result.split("||");var url=ArrValues[0];var erok=ArrValues[1];var text=ArrValues[2];if(ArrValues.length==3&&text!='')alert('Attention:\n\n'+text);if(erok=='OK'){document.location=url;}
|
68 |
else{alert('The server could not complete the request.\nPlease try again.');}},error:function(xhr,status,error){alert('An error occurred:\n'+error+'\nPlease try again');},complete:function(xhr,status,newurl){jQuery('#dwnspin-'+mocc+'-'+id).css('display','none');}});}
|
69 |
function wppaAjaxComment(mocc,id){if(!_wppaValidateComment(mocc,id))return;var data='action=wppa'+'&wppa-action=do-comment'+'&photo-id='+id+'&comname='+jQuery("#wppa-comname-"+mocc).val()+'&comment='+wppaEncode(jQuery("#wppa-comment-"+mocc).val())+'&wppa-captcha='+jQuery("#wppa-captcha-"+mocc).val()+'&wppa-nonce='+jQuery("#wppa-nonce-"+mocc).val()+'&moccur='+mocc;if(typeof(jQuery("#wppa-comemail-"+mocc).val())!='undefined'){data+='&comemail='+jQuery("#wppa-comemail-"+mocc).val();}
|
js/wppa-lightbox.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
// Conatins lightbox modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
-
var wppaLightboxVersion = '6.6.
|
7 |
|
8 |
// Global inits
|
9 |
var wppaNormsBtnOpac = 0.75;
|
@@ -500,6 +500,11 @@ wppaConsoleLog( '_wppaOvlShow, idx='+idx );
|
|
500 |
jQuery( '#wppa-overlay-ic' ).html( html );
|
501 |
}
|
502 |
|
|
|
|
|
|
|
|
|
|
|
503 |
// Replace svg img src to html
|
504 |
// wppaReplaceSvg();
|
505 |
|
@@ -758,6 +763,11 @@ wppaConsoleLog( '_wppaOvlShow, idx='+idx );
|
|
758 |
// Restore opacity of fs and exit buttons
|
759 |
// wppaShowFsButtons();
|
760 |
|
|
|
|
|
|
|
|
|
|
|
761 |
// Size
|
762 |
wppaOvlResize();
|
763 |
|
3 |
// Conatins lightbox modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
+
var wppaLightboxVersion = '6.6.13';
|
7 |
|
8 |
// Global inits
|
9 |
var wppaNormsBtnOpac = 0.75;
|
500 |
jQuery( '#wppa-overlay-ic' ).html( html );
|
501 |
}
|
502 |
|
503 |
+
// Disable right mouse button
|
504 |
+
jQuery( '#wppa-overlay-img' ).bind( 'contextmenu', function(e) {
|
505 |
+
return false;
|
506 |
+
});
|
507 |
+
|
508 |
// Replace svg img src to html
|
509 |
// wppaReplaceSvg();
|
510 |
|
763 |
// Restore opacity of fs and exit buttons
|
764 |
// wppaShowFsButtons();
|
765 |
|
766 |
+
// Disable right mouse button
|
767 |
+
jQuery( '#wppa-overlay-img' ).bind( 'contextmenu', function(e) {
|
768 |
+
return false;
|
769 |
+
});
|
770 |
+
|
771 |
// Size
|
772 |
wppaOvlResize();
|
773 |
|
js/wppa-lightbox.min.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
-
var wppaLightboxVersion='6.6.
|
8 |
function wppaOvlKeyboardHandler(e){var keycode;var escapeKey;if(e==null){keycode=event.keyCode;escapeKey=27;}else{keycode=e.keyCode;escapeKey=27;}
|
9 |
var key=String.fromCharCode(keycode).toLowerCase();switch(keycode){case escapeKey:wppaStopVideo(mocc);if(wppaOvlMode!='normal'){wppaOvlNorm(true);}
|
10 |
wppaOvlHide();break;case 37:wppaOvlShowPrev();break;case 39:wppaOvlShowNext();break;}
|
@@ -54,7 +54,7 @@ html+='</div>';'</div>';}
|
|
54 |
var dark=wppaIsMobile?'0.1':'0.1';html+='<div'+' id="wppa-exit-btn"'+' style="height:48px;z-index:100098;position:fixed;top:0;right:0;opacity:'+wppaNormsBtnOpac+';"'+' onclick="wppaOvlHide()"'+' onmouseover="jQuery(this).stop().fadeTo(300,1);"'+' ontouchstart="jQuery(this).stop().fadeTo(300,1);"'+' onmouseout="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' ontouchend="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' >'+
|
55 |
wppaSvgHtml('Exit','48px',true,true,'0','0','0','0')+'</div>';html+='<div'+' id="wppa-norms-btn"'+' style="height:48px;z-index:100098;position:fixed;top:0;right:48px;opacity:'+wppaNormsBtnOpac+';"'+' onclick="wppaOvlNorm()"'+' onmouseover="jQuery(this).stop().fadeTo(300,1);"'+' ontouchstart="jQuery(this).stop().fadeTo(300,1);"'+' onmouseout="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' ontouchend="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' >'+
|
56 |
wppaSvgHtml('Exit-Full-Screen','48px',true,true,'0','0','0','0')+'</div>';if((!wppaIsVideo&&!wppaHasAudio)||wppaOvlFsPhotoId!=wppaPhotoId||wppaPhotoId==0){wppaStopVideo(0);wppaStopAudio();jQuery('#wppa-overlay-ic').html(html);}
|
57 |
-
wppaOvlIsVideo=wppaIsVideo;setTimeout('wppaOvlFormatFull()',10);if(wppaIsVideo||wppaHasAudio){setTimeout('wppaOvlUpdateFsId()',2000);}
|
58 |
else{wppaOvlFsPhotoId=0;}
|
59 |
wppaOvlFirst=false;return false;}
|
60 |
else{wppaOvlFsPhotoId=0;wppaPhotoId=0;wppaStopVideo(0);var txtcol=wppaOvlTheme=='black'?'#a7a7a7':'#272727';if(wppaOvlFontColor){txtcol=wppaOvlFontColor;}
|
@@ -76,7 +76,7 @@ wppaSvgHtml('Next-Button','48px',true,true)+'</div>';}
|
|
76 |
html+='</div>';var showCounter=!wppaOvlIsSingle&&wppaOvlShowCounter;html+='<div id="wppa-overlay-txt-container"'+' style="'+'position:relative;'+'padding:10px;'+'background-color:'+wppaOvlTheme+';'+'color:'+txtcol+';'+'text-align:center;'+'font-family:'+wppaOvlFontFamily+';'+'font-size:'+wppaOvlFontSize+'px;'+'font-weight:'+wppaOvlFontWeight+';'+'line-height:'+wppaOvlLineHeight+'px;'+'box-shadow:none;'+'border-bottom-left-radius:'+wppaOvlRadius+'px;'+'border-bottom-right-radius:'+wppaOvlRadius+'px;'+'"'+' >'+'<div'+' id="wppa-overlay-txt"'+' style="'+'text-align:center;'+'min-height:36px;'+'width:100%;'+
|
77 |
(wppaOvlTxtHeight=='auto'?'max-height:200px;':'max-height:'+wppaOvlTxtHeight+'px;')+'overflow:auto;'+'box-shadow:none;'+'"'+' >'+
|
78 |
(showCounter?(wppaOvlIdx+1)+'/'+wppaOvlUrls.length+'<br />':'')+
|
79 |
-
wppaOvlTitles[idx]+'</div>';'</div>';jQuery('#wppa-overlay-ic').html(html);wppaOvlResize();return false;}}
|
80 |
function wppaOvlSize(speed){wppaConsoleLog('wppaOvlSize');var img=document.getElementById('wppa-overlay-img');var txt=document.getElementById('wppa-overlay-txt');if(!img||!txt||jQuery('#wppa-overlay-bg').css('display')=='none'){wppaConsoleLog('Lb quitted');return;}
|
81 |
if(wppaOvlMode!='normal'){wppaOvlFormatFull();return;}
|
82 |
var iw=jQuery(window).width();var ih=jQuery(window).height();var cw,nw,nh;if(wppaOvlIsVideo){cw=img.clientWidth;nw=wppaOvlVideoNaturalWidths[wppaOvlCurIdx];nh=wppaOvlVideoNaturalHeights[wppaOvlCurIdx];}
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
+
var wppaLightboxVersion='6.6.13';var wppaNormsBtnOpac=0.75;var wppaIsVideo=false;var wppaHasAudio=false;var wppaOvlImgs=[];var wppaKbHandlerInstalled=false;var wppaOvlMode='';var wppaOvlCurIdx=0;var wppaOvlSvgInverse=false;var wppaSavedContainerWidth=0;var wppaSavedContainerHeight;var wppaSavedMarginLeft;var wppaSavedMarginTop;var wppaSavedImageWidth;var wppaSavedImageHeight;jQuery(document).ready(function(e){wppaInitOverlay();});jQuery(window).resize(function(){jQuery("#wppa-overlay-bg").css({height:window.innerHeight,width:window.innerWidth,});wppaOvlResize();});function wppaDoOnOrientationChange(e){if(wppaOvlMode!='normal'&&document.getElementById('wppa-overlay-img')){setTimeout('wppaOvlShow( '+wppaOvlIdx+' )',100);return;}}
|
8 |
function wppaOvlKeyboardHandler(e){var keycode;var escapeKey;if(e==null){keycode=event.keyCode;escapeKey=27;}else{keycode=e.keyCode;escapeKey=27;}
|
9 |
var key=String.fromCharCode(keycode).toLowerCase();switch(keycode){case escapeKey:wppaStopVideo(mocc);if(wppaOvlMode!='normal'){wppaOvlNorm(true);}
|
10 |
wppaOvlHide();break;case 37:wppaOvlShowPrev();break;case 39:wppaOvlShowNext();break;}
|
54 |
var dark=wppaIsMobile?'0.1':'0.1';html+='<div'+' id="wppa-exit-btn"'+' style="height:48px;z-index:100098;position:fixed;top:0;right:0;opacity:'+wppaNormsBtnOpac+';"'+' onclick="wppaOvlHide()"'+' onmouseover="jQuery(this).stop().fadeTo(300,1);"'+' ontouchstart="jQuery(this).stop().fadeTo(300,1);"'+' onmouseout="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' ontouchend="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' >'+
|
55 |
wppaSvgHtml('Exit','48px',true,true,'0','0','0','0')+'</div>';html+='<div'+' id="wppa-norms-btn"'+' style="height:48px;z-index:100098;position:fixed;top:0;right:48px;opacity:'+wppaNormsBtnOpac+';"'+' onclick="wppaOvlNorm()"'+' onmouseover="jQuery(this).stop().fadeTo(300,1);"'+' ontouchstart="jQuery(this).stop().fadeTo(300,1);"'+' onmouseout="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' ontouchend="jQuery(this).stop().fadeTo(300,'+dark+');wppaNormsBtnOpac='+dark+';"'+' >'+
|
56 |
wppaSvgHtml('Exit-Full-Screen','48px',true,true,'0','0','0','0')+'</div>';if((!wppaIsVideo&&!wppaHasAudio)||wppaOvlFsPhotoId!=wppaPhotoId||wppaPhotoId==0){wppaStopVideo(0);wppaStopAudio();jQuery('#wppa-overlay-ic').html(html);}
|
57 |
+
jQuery('#wppa-overlay-img').bind('contextmenu',function(e){return false;});wppaOvlIsVideo=wppaIsVideo;setTimeout('wppaOvlFormatFull()',10);if(wppaIsVideo||wppaHasAudio){setTimeout('wppaOvlUpdateFsId()',2000);}
|
58 |
else{wppaOvlFsPhotoId=0;}
|
59 |
wppaOvlFirst=false;return false;}
|
60 |
else{wppaOvlFsPhotoId=0;wppaPhotoId=0;wppaStopVideo(0);var txtcol=wppaOvlTheme=='black'?'#a7a7a7':'#272727';if(wppaOvlFontColor){txtcol=wppaOvlFontColor;}
|
76 |
html+='</div>';var showCounter=!wppaOvlIsSingle&&wppaOvlShowCounter;html+='<div id="wppa-overlay-txt-container"'+' style="'+'position:relative;'+'padding:10px;'+'background-color:'+wppaOvlTheme+';'+'color:'+txtcol+';'+'text-align:center;'+'font-family:'+wppaOvlFontFamily+';'+'font-size:'+wppaOvlFontSize+'px;'+'font-weight:'+wppaOvlFontWeight+';'+'line-height:'+wppaOvlLineHeight+'px;'+'box-shadow:none;'+'border-bottom-left-radius:'+wppaOvlRadius+'px;'+'border-bottom-right-radius:'+wppaOvlRadius+'px;'+'"'+' >'+'<div'+' id="wppa-overlay-txt"'+' style="'+'text-align:center;'+'min-height:36px;'+'width:100%;'+
|
77 |
(wppaOvlTxtHeight=='auto'?'max-height:200px;':'max-height:'+wppaOvlTxtHeight+'px;')+'overflow:auto;'+'box-shadow:none;'+'"'+' >'+
|
78 |
(showCounter?(wppaOvlIdx+1)+'/'+wppaOvlUrls.length+'<br />':'')+
|
79 |
+
wppaOvlTitles[idx]+'</div>';'</div>';jQuery('#wppa-overlay-ic').html(html);jQuery('#wppa-overlay-img').bind('contextmenu',function(e){return false;});wppaOvlResize();return false;}}
|
80 |
function wppaOvlSize(speed){wppaConsoleLog('wppaOvlSize');var img=document.getElementById('wppa-overlay-img');var txt=document.getElementById('wppa-overlay-txt');if(!img||!txt||jQuery('#wppa-overlay-bg').css('display')=='none'){wppaConsoleLog('Lb quitted');return;}
|
81 |
if(wppaOvlMode!='normal'){wppaOvlFormatFull();return;}
|
82 |
var iw=jQuery(window).width();var ih=jQuery(window).height();var cw,nw,nh;if(wppaOvlIsVideo){cw=img.clientWidth;nw=wppaOvlVideoNaturalWidths[wppaOvlCurIdx];nh=wppaOvlVideoNaturalHeights[wppaOvlCurIdx];}
|
js/wppa-slideshow.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
// Contains slideshow modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
-
var wppaJsSlideshowVersion = '6.6.
|
7 |
|
8 |
// This is an entrypoint to load the slide data
|
9 |
function wppaStoreSlideInfo(
|
@@ -994,7 +994,14 @@ var result = '';
|
|
994 |
if ( wppaArtMonkeyButton ) {
|
995 |
if ( _wppaFullNames[mocc][_wppaCurIdx[mocc]] ) {
|
996 |
var label = _wppaFullNames[mocc][_wppaCurIdx[mocc]].split( '<img' );
|
997 |
-
result = '<input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
998 |
if ( label[1] ) result += '<img'+label[1];
|
999 |
}
|
1000 |
else {
|
@@ -1002,7 +1009,13 @@ var result = '';
|
|
1002 |
}
|
1003 |
}
|
1004 |
else {
|
1005 |
-
result =
|
|
|
|
|
|
|
|
|
|
|
|
|
1006 |
}
|
1007 |
break;
|
1008 |
case 'none':
|
@@ -1674,9 +1687,9 @@ function _wppaSetRd( mocc, avg, where ) {
|
|
1674 |
var ihigh = wppaRatingMax;
|
1675 |
|
1676 |
for ( idx=ilow;idx<=ihigh;idx++ ) {
|
1677 |
-
if ( where == '#wppa-rate-' || where == '.wppa-rate-' ) {
|
1678 |
-
jQuery( where+mocc+'-'+idx ).attr( 'src', wppaImageDirectory+'star.ico' );
|
1679 |
-
}
|
1680 |
if ( idx <= idx1 ) {
|
1681 |
jQuery( where+mocc+'-'+idx ).stop().fadeTo( 100, 1.0 );
|
1682 |
}
|
3 |
// Contains slideshow modules
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
+
var wppaJsSlideshowVersion = '6.6.13';
|
7 |
|
8 |
// This is an entrypoint to load the slide data
|
9 |
function wppaStoreSlideInfo(
|
994 |
if ( wppaArtMonkeyButton ) {
|
995 |
if ( _wppaFullNames[mocc][_wppaCurIdx[mocc]] ) {
|
996 |
var label = _wppaFullNames[mocc][_wppaCurIdx[mocc]].split( '<img' );
|
997 |
+
result = '<input' +
|
998 |
+
' type="button"' +
|
999 |
+
' title="Download"' +
|
1000 |
+
' style="cursor:pointer;margin-bottom:0px;max-width:' + ( wppaGetContainerWidth( mocc ) - 24 ) + 'px;"' +
|
1001 |
+
' class="wppa-download-button"' +
|
1002 |
+
' onclick="' + ( wppaIsSafari && wppaArtMonkyLink == 'file' ? 'wppaWindowReference = window.open();' : '' ) + 'wppaAjaxMakeOrigName( '+mocc+', \''+_wppaId[mocc][_wppaCurIdx[mocc]]+'\' );"' +
|
1003 |
+
' value="' + wppaDownLoad + ': ' + label[0] + '"' +
|
1004 |
+
' />';
|
1005 |
if ( label[1] ) result += '<img'+label[1];
|
1006 |
}
|
1007 |
else {
|
1009 |
}
|
1010 |
}
|
1011 |
else {
|
1012 |
+
result = '<a' +
|
1013 |
+
' title="Download"' +
|
1014 |
+
' style="cursor:pointer;"' +
|
1015 |
+
' onclick="' + ( wppaIsSafari && wppaArtMonkyLink == 'file' ? 'wppaWindowReference = window.open();' : '' ) + 'wppaAjaxMakeOrigName( '+mocc+', \''+_wppaId[mocc][_wppaCurIdx[mocc]]+'\' );"' +
|
1016 |
+
' >' +
|
1017 |
+
wppaDownLoad + ': ' + _wppaFullNames[mocc][_wppaCurIdx[mocc]] +
|
1018 |
+
'</a>';
|
1019 |
}
|
1020 |
break;
|
1021 |
case 'none':
|
1687 |
var ihigh = wppaRatingMax;
|
1688 |
|
1689 |
for ( idx=ilow;idx<=ihigh;idx++ ) {
|
1690 |
+
// if ( where == '#wppa-rate-' || where == '.wppa-rate-' ) {
|
1691 |
+
// jQuery( where+mocc+'-'+idx ).attr( 'src', wppaImageDirectory+'star.ico' );
|
1692 |
+
// }
|
1693 |
if ( idx <= idx1 ) {
|
1694 |
jQuery( where+mocc+'-'+idx ).stop().fadeTo( 100, 1.0 );
|
1695 |
}
|
js/wppa-slideshow.min.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
-
var wppaJsSlideshowVersion='6.6.
|
8 |
cursor='default';if(linkurl!=''){cursor='pointer';}
|
9 |
else if(wppaLightBox[mocc]!=''){cursor='url( '+wppaImageDirectory+wppaMagnifierCursor+' ),pointer';}
|
10 |
_wppaIsVideo[mocc][id]=(''!=videohtml);if(_wppaIsVideo[mocc][id]){_wppaSlides[mocc][id]=' alt="'+imagealt+'" class="theimg theimg-'+mocc+' big" ';if(wppaSlideVideoStart&&wppaLightBox[mocc]==''){_wppaSlides[mocc][id]+=' autoplay ';}
|
@@ -96,9 +96,10 @@ if(margl<0)margl=0;jQuery('#'+imgid).css({marginLeft:'auto',marginRight:'auto'})
|
|
96 |
if(audios.length>0){var i=0;jQuery(audios[i]).css({width:imgw,left:(contw-imgw)/2});i++;}}
|
97 |
var bbbwidth=parseInt(framew/3);var leftmarg=bbbwidth*2;jQuery('#bbb-'+mocc+'-l').css({height:frameh,width:bbbwidth,left:0});jQuery('#bbb-'+mocc+'-r').css({height:frameh,width:bbbwidth,left:leftmarg});}
|
98 |
function wppaMakeNameHtml(mocc){var result='';if(_wppaCurIdx[mocc]<0)return'';if(wppaIsMini[mocc]||_wppaIsVideo[mocc][_wppaCurIdx[mocc]]){result=_wppaFullNames[mocc][_wppaCurIdx[mocc]];}
|
99 |
-
else switch(wppaArtMonkyLink){case'file':case'zip':if(wppaArtMonkeyButton){if(_wppaFullNames[mocc][_wppaCurIdx[mocc]]){var label=_wppaFullNames[mocc][_wppaCurIdx[mocc]].split('<img');result='<input type="button" title="Download" style="cursor:pointer;
|
100 |
else{result='';}}
|
101 |
-
else{result='<a title="Download" style="cursor:pointer;" onclick="
|
|
|
102 |
break;case'none':result=_wppaFullNames[mocc][_wppaCurIdx[mocc]];break;default:result='';}
|
103 |
return wppaRepairBrTags(result);}
|
104 |
function wppaMakeTheSlideHtml(mocc,bgfg,idx){var imgVideo=(_wppaIsVideo[mocc][idx])?'video':'img';var theHtml;var url;var theTitle='title';if(wppaLightBox[mocc]=='wppa')theTitle='data-lbtitle';var mmEvents=wppaLightBox[mocc]==''?' onpause="wppaVideoPlaying['+mocc+'] = false;" onplay="wppaVideoPlaying['+mocc+'] = true;"':'';if(_wppaLinkUrl[mocc][idx]!=''){if(wppaSlideToFullpopup){theHtml='<a onclick="wppaStopAudio();wppaStopShow('+mocc+');'+_wppaLinkUrl[mocc][idx]+'" target="'+_wppaLinkTarget[mocc][idx]+'" title="'+_wppaLinkTitle[mocc][idx]+'">'+'<'+imgVideo+mmEvents+' title="'+_wppaLinkTitle[mocc][idx]+'" id="theimg'+bgfg+'-'+mocc+'" '+_wppaSlides[mocc][idx]+'</a>';}
|
@@ -189,8 +190,7 @@ if(myr==0){jQuery('#wppa-vote-button-'+mocc).val(wppaVoteForMe);}
|
|
189 |
else{jQuery('#wppa-vote-button-'+mocc).val(wppaVotedForMe);}
|
190 |
jQuery('#wppa-vote-count-'+mocc).html(cnt);}
|
191 |
function wppaGetDislikeText(dsc,myr,incmine){return dsc;}
|
192 |
-
function _wppaSetRd(mocc,avg,where){var idx1=parseInt(avg);var idx2=idx1+1;var frac=avg-idx1;var opac=wppaStarOpacity+frac*(1.0-wppaStarOpacity);var ilow=1;var ihigh=wppaRatingMax;for(idx=ilow;idx<=ihigh;idx++){if(
|
193 |
-
if(idx<=idx1){jQuery(where+mocc+'-'+idx).stop().fadeTo(100,1.0);}
|
194 |
else if(idx==idx2){jQuery(where+mocc+'-'+idx).stop().fadeTo(100,opac);}
|
195 |
else{jQuery(where+mocc+'-'+idx).stop().fadeTo(100,wppaStarOpacity);}}}
|
196 |
function _wppaFollowMe(mocc,idx){if(_wppaSSRuns[mocc])return;if(_wppaMyr[mocc][_wppaCurIdx[mocc]]!=0&&wppaRatingOnce)return;if(_wppaMyr[mocc][_wppaCurIdx[mocc]]<0)return;if(_wppaVoteInProgress)return;_wppaSetRd(mocc,idx,'#wppa-rate-');}
|
4 |
// Dependancies: wppa.js and default wp jQuery library
|
5 |
//
|
6 |
|
7 |
+
var wppaJsSlideshowVersion='6.6.13';function wppaStoreSlideInfo(mocc,id,url,size,width,height,fullname,name,desc,photoid,avgrat,discount,myrat,rateurl,linkurl,linktitle,linktarget,iwtimeout,commenthtml,iptchtml,exifhtml,lbtitle,shareurl,smhtml,ogdsc,hiresurl,videohtml,audiohtml,waittext,imagealt,posterurl){var cursor;desc=wppaRepairScriptTags(desc);if(!_wppaSlides[mocc]||'0'==id){_wppaSlides[mocc]=[];_wppaNames[mocc]=[];_wppaFullNames[mocc]=[];_wppaDsc[mocc]=[];_wppaOgDsc[mocc]=[];_wppaCurIdx[mocc]=-1;_wppaNxtIdx[mocc]=0;if(parseInt(iwtimeout)>0)_wppaTimeOut[mocc]=parseInt(iwtimeout);else _wppaTimeOut[mocc]=wppaSlideShowTimeOut;_wppaSSRuns[mocc]=false;_wppaTP[mocc]=-2;_wppaFg[mocc]=0;_wppaIsBusy[mocc]=false;_wppaFirst[mocc]=true;_wppaId[mocc]=[];_wppaAvg[mocc]=[];_wppaDisc[mocc]=[];_wppaMyr[mocc]=[];_wppaVRU[mocc]=[];_wppaLinkUrl[mocc]=[];_wppaLinkTitle[mocc]=[];_wppaLinkTarget[mocc]=[];_wppaCommentHtml[mocc]=[];_wppaIptcHtml[mocc]=[];_wppaExifHtml[mocc]=[];_wppaUrl[mocc]=[];_wppaSkipRated[mocc]=false;_wppaLbTitle[mocc]=[];_wppaDidGoto[mocc]=false;wppaSlidePause[mocc]=false;_wppaShareUrl[mocc]=[];_wppaShareHtml[mocc]=[];_wppaFilmNoMove[mocc]=false;_wppaHiresUrl[mocc]=[];_wppaIsVideo[mocc]=[];_wppaVideoHtml[mocc]=[];_wppaAudioHtml[mocc]=[];_wppaVideoNatWidth[mocc]=[];_wppaVideoNatHeight[mocc]=[];wppaVideoPlaying[mocc]=false;wppaAudioPlaying[mocc]=false;_wppaWaitTexts[mocc]=[];_wppaImageAlt[mocc]=[];}
|
8 |
cursor='default';if(linkurl!=''){cursor='pointer';}
|
9 |
else if(wppaLightBox[mocc]!=''){cursor='url( '+wppaImageDirectory+wppaMagnifierCursor+' ),pointer';}
|
10 |
_wppaIsVideo[mocc][id]=(''!=videohtml);if(_wppaIsVideo[mocc][id]){_wppaSlides[mocc][id]=' alt="'+imagealt+'" class="theimg theimg-'+mocc+' big" ';if(wppaSlideVideoStart&&wppaLightBox[mocc]==''){_wppaSlides[mocc][id]+=' autoplay ';}
|
96 |
if(audios.length>0){var i=0;jQuery(audios[i]).css({width:imgw,left:(contw-imgw)/2});i++;}}
|
97 |
var bbbwidth=parseInt(framew/3);var leftmarg=bbbwidth*2;jQuery('#bbb-'+mocc+'-l').css({height:frameh,width:bbbwidth,left:0});jQuery('#bbb-'+mocc+'-r').css({height:frameh,width:bbbwidth,left:leftmarg});}
|
98 |
function wppaMakeNameHtml(mocc){var result='';if(_wppaCurIdx[mocc]<0)return'';if(wppaIsMini[mocc]||_wppaIsVideo[mocc][_wppaCurIdx[mocc]]){result=_wppaFullNames[mocc][_wppaCurIdx[mocc]];}
|
99 |
+
else switch(wppaArtMonkyLink){case'file':case'zip':if(wppaArtMonkeyButton){if(_wppaFullNames[mocc][_wppaCurIdx[mocc]]){var label=_wppaFullNames[mocc][_wppaCurIdx[mocc]].split('<img');result='<input'+' type="button"'+' title="Download"'+' style="cursor:pointer;margin-bottom:0px;max-width:'+(wppaGetContainerWidth(mocc)-24)+'px;"'+' class="wppa-download-button"'+' onclick="'+(wppaIsSafari&&wppaArtMonkyLink=='file'?'wppaWindowReference = window.open();':'')+'wppaAjaxMakeOrigName( '+mocc+', \''+_wppaId[mocc][_wppaCurIdx[mocc]]+'\' );"'+' value="'+wppaDownLoad+': '+label[0]+'"'+' />';if(label[1])result+='<img'+label[1];}
|
100 |
else{result='';}}
|
101 |
+
else{result='<a'+' title="Download"'+' style="cursor:pointer;"'+' onclick="'+(wppaIsSafari&&wppaArtMonkyLink=='file'?'wppaWindowReference = window.open();':'')+'wppaAjaxMakeOrigName( '+mocc+', \''+_wppaId[mocc][_wppaCurIdx[mocc]]+'\' );"'+' >'+
|
102 |
+
wppaDownLoad+': '+_wppaFullNames[mocc][_wppaCurIdx[mocc]]+'</a>';}
|
103 |
break;case'none':result=_wppaFullNames[mocc][_wppaCurIdx[mocc]];break;default:result='';}
|
104 |
return wppaRepairBrTags(result);}
|
105 |
function wppaMakeTheSlideHtml(mocc,bgfg,idx){var imgVideo=(_wppaIsVideo[mocc][idx])?'video':'img';var theHtml;var url;var theTitle='title';if(wppaLightBox[mocc]=='wppa')theTitle='data-lbtitle';var mmEvents=wppaLightBox[mocc]==''?' onpause="wppaVideoPlaying['+mocc+'] = false;" onplay="wppaVideoPlaying['+mocc+'] = true;"':'';if(_wppaLinkUrl[mocc][idx]!=''){if(wppaSlideToFullpopup){theHtml='<a onclick="wppaStopAudio();wppaStopShow('+mocc+');'+_wppaLinkUrl[mocc][idx]+'" target="'+_wppaLinkTarget[mocc][idx]+'" title="'+_wppaLinkTitle[mocc][idx]+'">'+'<'+imgVideo+mmEvents+' title="'+_wppaLinkTitle[mocc][idx]+'" id="theimg'+bgfg+'-'+mocc+'" '+_wppaSlides[mocc][idx]+'</a>';}
|
190 |
else{jQuery('#wppa-vote-button-'+mocc).val(wppaVotedForMe);}
|
191 |
jQuery('#wppa-vote-count-'+mocc).html(cnt);}
|
192 |
function wppaGetDislikeText(dsc,myr,incmine){return dsc;}
|
193 |
+
function _wppaSetRd(mocc,avg,where){var idx1=parseInt(avg);var idx2=idx1+1;var frac=avg-idx1;var opac=wppaStarOpacity+frac*(1.0-wppaStarOpacity);var ilow=1;var ihigh=wppaRatingMax;for(idx=ilow;idx<=ihigh;idx++){if(idx<=idx1){jQuery(where+mocc+'-'+idx).stop().fadeTo(100,1.0);}
|
|
|
194 |
else if(idx==idx2){jQuery(where+mocc+'-'+idx).stop().fadeTo(100,opac);}
|
195 |
else{jQuery(where+mocc+'-'+idx).stop().fadeTo(100,wppaStarOpacity);}}}
|
196 |
function _wppaFollowMe(mocc,idx){if(_wppaSSRuns[mocc])return;if(_wppaMyr[mocc][_wppaCurIdx[mocc]]!=0&&wppaRatingOnce)return;if(_wppaMyr[mocc][_wppaCurIdx[mocc]]<0)return;if(_wppaVoteInProgress)return;_wppaSetRd(mocc,idx,'#wppa-rate-');}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: opajaap
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source¤cy_code=USD&lc=US
|
4 |
Tags: photo, album, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
|
5 |
-
Version: 6.6.
|
6 |
-
Stable tag: 6.6.
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
@@ -180,6 +180,29 @@ Oh, just Google on 'picture resizer' and you will find a bunch of free programs
|
|
180 |
|
181 |
See for additional information: <a href="http://www.wppa.nl/changelog/" >The documentation website</a>
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
= 6.6.12 =
|
184 |
|
185 |
= Bug Fixes =
|
2 |
Contributors: opajaap
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source¤cy_code=USD&lc=US
|
4 |
Tags: photo, album, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
|
5 |
+
Version: 6.6.13
|
6 |
+
Stable tag: 6.6.13
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
180 |
|
181 |
See for additional information: <a href="http://www.wppa.nl/changelog/" >The documentation website</a>
|
182 |
|
183 |
+
= 6.6.13 =
|
184 |
+
|
185 |
+
= Bug Fixes =
|
186 |
+
|
187 |
+
* Indexing of qTranslate-able phrases in all available langages in photo and album names and descriptions now works as designed.
|
188 |
+
* Rating stars in Chrome had an opacity problem. Fixed.
|
189 |
+
|
190 |
+
= New Features =
|
191 |
+
|
192 |
+
* New album description keyword w#fsviews used to display the total number of fullsize views of photos in the album.
|
193 |
+
* New shortcode [photo xx] where xx is an existing photo number, to display a single photo. Related settings in Table IX-L.
|
194 |
+
* During import .csv file (for custom data) also the following fields can be modified:
|
195 |
+
album, name, description, p_order, linkurl, linktitle, linktarget, owner, timestamp, status, tags, alt, modified, location, views, clicks, exifdtm.
|
196 |
+
The first header item must be <b>filename</b> in this case.
|
197 |
+
* Photo name can now contain keyword w#id. 'Photo w#id' has beed added to the selections in <b>Table IX-D10</b>: <i>Default photo name</i>
|
198 |
+
* Added 'Album' in the admin bar 'New' menu for users with the rights to add top-level albums.
|
199 |
+
|
200 |
+
= Other Changes =
|
201 |
+
|
202 |
+
* Provided a workaround for a bug in Safari browser resulting in not working of the download links of image files.
|
203 |
+
* Added class wppa-rating-star to rating stars and wppa-rating-thumb to the dislike thumb down.
|
204 |
+
* Right mouse button on lightbox image is now disabled.
|
205 |
+
|
206 |
= 6.6.12 =
|
207 |
|
208 |
= Bug Fixes =
|
theme/wppa-style.css
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
/*
|
9 |
/* You may always look into a newer version of this file to see what new classes and id's come with an upgrade
|
10 |
/*
|
11 |
-
/* This is version 6.6.
|
12 |
*/
|
13 |
|
14 |
.wppa-container, .wppa-cover-box, .wppa-thumb-area {
|
@@ -476,3 +476,4 @@ display:none;
|
|
476 |
.wppa-minicover {
|
477 |
box-sizing:content-box !important;
|
478 |
}
|
|
8 |
/*
|
9 |
/* You may always look into a newer version of this file to see what new classes and id's come with an upgrade
|
10 |
/*
|
11 |
+
/* This is version 6.6.13
|
12 |
*/
|
13 |
|
14 |
.wppa-container, .wppa-cover-box, .wppa-thumb-area {
|
476 |
.wppa-minicover {
|
477 |
box-sizing:content-box !important;
|
478 |
}
|
479 |
+
|
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 6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -131,4 +131,16 @@ function wppa_admin_bar_menu() {
|
|
131 |
// Add item
|
132 |
$wp_admin_bar->add_menu( $menu_item );
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* enhances the admin bar with wppa+ menu
|
6 |
+
* version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
131 |
// Add item
|
132 |
$wp_admin_bar->add_menu( $menu_item );
|
133 |
}
|
134 |
+
|
135 |
+
// Add New -> Photo Album
|
136 |
+
if ( current_user_can( 'wppa_admin' ) ) {
|
137 |
+
|
138 |
+
$menu_item = array( 'id' => 'wppa-album-new',
|
139 |
+
'parent' => 'new-content-default',
|
140 |
+
'title' => __( 'Album', 'wp-photo-album-plus' ),
|
141 |
+
'href' => admin_url( 'admin.php?page=wppa_admin_menu&tab=edit&edit_id=new' ),
|
142 |
+
);
|
143 |
+
// Add item
|
144 |
+
$wp_admin_bar->add_menu( $menu_item );
|
145 |
+
}
|
146 |
}
|
wppa-ajax.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
-
* Version 6.6.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -1638,7 +1638,7 @@ global $wppa_log_file;
|
|
1638 |
default:
|
1639 |
$itemname = $item;
|
1640 |
}
|
1641 |
-
|
1642 |
$iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $photo ) );
|
1643 |
if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
|
1644 |
if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
|
@@ -2666,6 +2666,13 @@ global $wppa_log_file;
|
|
2666 |
}
|
2667 |
ob_end_clean();
|
2668 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2669 |
|
2670 |
default:
|
2671 |
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
+
* Version 6.6.13
|
6 |
*
|
7 |
*/
|
8 |
|
1638 |
default:
|
1639 |
$itemname = $item;
|
1640 |
}
|
1641 |
+
|
1642 |
$iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $photo ) );
|
1643 |
if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
|
1644 |
if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
|
2666 |
}
|
2667 |
ob_end_clean();
|
2668 |
break;
|
2669 |
+
case 'wppa_search_user_void':
|
2670 |
+
ob_start();
|
2671 |
+
wppa_schedule_maintenance_proc( 'wppa_remake_index_albums' );
|
2672 |
+
wppa_schedule_maintenance_proc( 'wppa_remake_index_photos' );
|
2673 |
+
wppa_schedule_maintenance_proc( 'wppa_cleanup_index' );
|
2674 |
+
ob_end_clean();
|
2675 |
+
break;
|
2676 |
|
2677 |
default:
|
2678 |
|
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 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1330,7 +1330,7 @@ global $wpdb;
|
|
1330 |
$num = true;
|
1331 |
break;
|
1332 |
case 'a_parent':
|
1333 |
-
$seq[] = strtolower(wppa_get_album_name($album['a_parent'], 'extended'));
|
1334 |
break;
|
1335 |
default:
|
1336 |
$seq[] = $album['id'];
|
@@ -1459,7 +1459,7 @@ global $wpdb;
|
|
1459 |
<td><?php echo($album['owner']); ?></td>
|
1460 |
<?php } ?>
|
1461 |
<td><?php echo($album['a_order']) ?></td>
|
1462 |
-
<td><?php echo wppa_get_album_name($album['a_parent'], 'extended') ?></td>
|
1463 |
<?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album['id']); ?>
|
1464 |
<?php $na = $counts['selfalbums']; ?>
|
1465 |
<?php $np = $counts['selfphotos']; ?>
|
@@ -1698,7 +1698,7 @@ global $wpdb;
|
|
1698 |
$num = true;
|
1699 |
break;
|
1700 |
case 'a_parent':
|
1701 |
-
$seq[] = strtolower(wppa_get_album_name($album['a_parent']), 'extended');
|
1702 |
break;
|
1703 |
default:
|
1704 |
$seq[] = $album['id'];
|
@@ -2104,7 +2104,7 @@ global $wpdb;
|
|
2104 |
<td><?php echo($album['owner']); ?></td>
|
2105 |
<?php } ?>
|
2106 |
<td><?php echo($album['a_order']) ?></td>
|
2107 |
-
<td><?php echo wppa_get_album_name($album['a_parent'], 'extended') ?></td>
|
2108 |
<?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album['id']); ?>
|
2109 |
<?php $na = $counts['selfalbums']; ?>
|
2110 |
<?php $np = $counts['selfphotos']; ?>
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* create, edit and delete albums
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
1330 |
$num = true;
|
1331 |
break;
|
1332 |
case 'a_parent':
|
1333 |
+
$seq[] = strtolower(wppa_get_album_name($album['a_parent'], array( 'extended' => true )));
|
1334 |
break;
|
1335 |
default:
|
1336 |
$seq[] = $album['id'];
|
1459 |
<td><?php echo($album['owner']); ?></td>
|
1460 |
<?php } ?>
|
1461 |
<td><?php echo($album['a_order']) ?></td>
|
1462 |
+
<td><?php echo wppa_get_album_name($album['a_parent'], array( 'extended' => true )) ?></td>
|
1463 |
<?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album['id']); ?>
|
1464 |
<?php $na = $counts['selfalbums']; ?>
|
1465 |
<?php $np = $counts['selfphotos']; ?>
|
1698 |
$num = true;
|
1699 |
break;
|
1700 |
case 'a_parent':
|
1701 |
+
$seq[] = strtolower(wppa_get_album_name($album['a_parent']), array( 'extended' => true ));
|
1702 |
break;
|
1703 |
default:
|
1704 |
$seq[] = $album['id'];
|
2104 |
<td><?php echo($album['owner']); ?></td>
|
2105 |
<?php } ?>
|
2106 |
<td><?php echo($album['a_order']) ?></td>
|
2107 |
+
<td><?php echo wppa_get_album_name($album['a_parent'], array( 'extended' => true )) ?></td>
|
2108 |
<?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album['id']); ?>
|
2109 |
<?php $na = $counts['selfalbums']; ?>
|
2110 |
<?php $np = $counts['selfphotos']; ?>
|
wppa-boxes-html.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -2550,6 +2550,12 @@ static $albums_granted;
|
|
2550 |
__( 'If you leave this blank, iptc tag 120 (Caption) will be used as photoname if available, else the original filename will be used as photo name.',
|
2551 |
'wp-photo-album-plus' );
|
2552 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
2553 |
default:
|
2554 |
$expl =
|
2555 |
__( 'If you leave this blank, the original filename will be used as photo name.',
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
2550 |
__( 'If you leave this blank, iptc tag 120 (Caption) will be used as photoname if available, else the original filename will be used as photo name.',
|
2551 |
'wp-photo-album-plus' );
|
2552 |
break;
|
2553 |
+
case 'Photo w#id':
|
2554 |
+
$expl =
|
2555 |
+
__( 'If you leave this blank, "Photo photoid" will be used as photo name.',
|
2556 |
+
'wp-photo-album-plus' );
|
2557 |
+
break;
|
2558 |
+
|
2559 |
default:
|
2560 |
$expl =
|
2561 |
__( 'If you leave this blank, the original filename will be used as photo name.',
|
wppa-export.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the export functions
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -164,7 +164,7 @@ global $wppa_temp_idx;
|
|
164 |
if (fwrite($file, "name=".$album['name']."\n") !== FALSE) {
|
165 |
if (fwrite($file, "desc=".wppa_nl_to_txt($album['description'])."\n") !== FALSE) {
|
166 |
if (fwrite($file, "aord=".$album['a_order']."\n") !== FALSE) {
|
167 |
-
if (fwrite($file, "prnt=".wppa_get_album_name($album['a_parent'], 'raw')."\n") !== FALSE) {
|
168 |
if (fwrite($file, "pord=".$album['p_order_by']."\n") !== FALSE) {
|
169 |
if (fwrite($file, "ownr=".$album['owner']."\n") !== FALSE) {
|
170 |
|
@@ -230,7 +230,7 @@ global $wppa_temp_idx;
|
|
230 |
if (fwrite($file, "name=".$photo['name']."\n") !== FALSE) {
|
231 |
if (fwrite($file, "desc=".wppa_nl_to_txt($photo['description'])."\n") !== FALSE) {
|
232 |
if (fwrite($file, "pord=".$photo['p_order']."\n") !== FALSE) {
|
233 |
-
if (fwrite($file, "albm=".wppa_get_album_name($photo['album'], 'raw')."\n") !== FALSE) {
|
234 |
if (fwrite($file, "lnku=".$photo['linkurl']."\n") !== FALSE) {
|
235 |
if (fwrite($file, "lnkt=".$photo['linktitle']."\n") !== FALSE) {
|
236 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the export functions
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
164 |
if (fwrite($file, "name=".$album['name']."\n") !== FALSE) {
|
165 |
if (fwrite($file, "desc=".wppa_nl_to_txt($album['description'])."\n") !== FALSE) {
|
166 |
if (fwrite($file, "aord=".$album['a_order']."\n") !== FALSE) {
|
167 |
+
if (fwrite($file, "prnt=".wppa_get_album_name( $album['a_parent'], array( 'raw' => true ) ) . "\n") !== FALSE) {
|
168 |
if (fwrite($file, "pord=".$album['p_order_by']."\n") !== FALSE) {
|
169 |
if (fwrite($file, "ownr=".$album['owner']."\n") !== FALSE) {
|
170 |
|
230 |
if (fwrite($file, "name=".$photo['name']."\n") !== FALSE) {
|
231 |
if (fwrite($file, "desc=".wppa_nl_to_txt($photo['description'])."\n") !== FALSE) {
|
232 |
if (fwrite($file, "pord=".$photo['p_order']."\n") !== FALSE) {
|
233 |
+
if (fwrite($file, "albm=".wppa_get_album_name($photo['album'], array( 'raw' => true ) )."\n") !== FALSE) {
|
234 |
if (fwrite($file, "lnku=".$photo['linkurl']."\n") !== FALSE) {
|
235 |
if (fwrite($file, "lnkt=".$photo['linktitle']."\n") !== FALSE) {
|
236 |
|
wppa-filter.php
CHANGED
@@ -480,3 +480,84 @@ function wppa_lightbox_global( $content ) {
|
|
480 |
}
|
481 |
return $content;
|
482 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
}
|
481 |
return $content;
|
482 |
}
|
483 |
+
|
484 |
+
// Declare the simple photo shortcode handler optionally
|
485 |
+
add_action( 'init', 'wppa_add_photo_shortcode' );
|
486 |
+
|
487 |
+
function wppa_add_photo_shortcode() {
|
488 |
+
if ( wppa_switch( 'photo_shortcode_enabled' ) ) {
|
489 |
+
add_shortcode( 'photo', 'wppa_photo_shortcodes' );
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
function wppa_photo_shortcodes( $xatts ) {
|
494 |
+
global $wppa;
|
495 |
+
global $wppa_postid;
|
496 |
+
|
497 |
+
// Init
|
498 |
+
wppa_reset_occurrance();
|
499 |
+
|
500 |
+
// Get and validate photo id
|
501 |
+
if ( is_numeric( $xatts[0] ) ) {
|
502 |
+
$photo = $xatts[0];
|
503 |
+
if ( ! wppa_photo_exists( $photo ) ) {
|
504 |
+
return sprintf( __( 'Photo %d does not exist', 'wp-photo-album-plus' ), $photo );
|
505 |
+
}
|
506 |
+
}
|
507 |
+
else {
|
508 |
+
return __( 'Missing photo id', 'wp-photo-album-plus' );
|
509 |
+
}
|
510 |
+
|
511 |
+
// Find occur
|
512 |
+
if ( get_the_ID() != $wppa_postid ) { // New post
|
513 |
+
$wppa['occur'] = '0'; // Init this occurance
|
514 |
+
$wppa['fullsize'] = ''; // Reset at each post
|
515 |
+
$wppa_postid = get_the_ID(); // Remember the post id
|
516 |
+
}
|
517 |
+
|
518 |
+
// Get configuration settings
|
519 |
+
$type = wppa_opt( 'wppa_photo_shortcode_type' ); // 'xphoto';
|
520 |
+
$size = wppa_opt( 'wppa_photo_shortcode_size' ); // '350';
|
521 |
+
$align = wppa_opt( 'wppa_photo_shortcode_align' ); //'left';
|
522 |
+
|
523 |
+
switch ( $type ) {
|
524 |
+
case 'photo':
|
525 |
+
case 'sphoto':
|
526 |
+
$wppa['single_photo'] = $photo;
|
527 |
+
break;
|
528 |
+
case 'mphoto':
|
529 |
+
$wppa['single_photo'] = $photo;
|
530 |
+
$wppa['is_mphoto'] = '1';
|
531 |
+
break;
|
532 |
+
case 'xphoto':
|
533 |
+
$wppa['single_photo'] = $photo;
|
534 |
+
$wppa['is_xphoto'] = '1';
|
535 |
+
break;
|
536 |
+
case 'slphoto':
|
537 |
+
$wppa['is_slide'] = '1';
|
538 |
+
$wppa['single_photo'] = $photo;
|
539 |
+
$wppa['start_photo'] = $photo;
|
540 |
+
$wppa['is_single'] = '1';
|
541 |
+
break;
|
542 |
+
}
|
543 |
+
|
544 |
+
// Process size
|
545 |
+
if ( $size && is_numeric( $size ) && $size < 1.0 ) {
|
546 |
+
$wppa['auto_colwidth'] = true;
|
547 |
+
$wppa['fullsize'] = $size;
|
548 |
+
}
|
549 |
+
elseif ( substr( $size, 0, 4 ) == 'auto' ) {
|
550 |
+
$wppa['auto_colwidth'] = true;
|
551 |
+
$wppa['fullsize'] = '';
|
552 |
+
$wppa['max_width'] = substr( $size, 5 );
|
553 |
+
}
|
554 |
+
else {
|
555 |
+
$wppa['auto_colwidth'] = false;
|
556 |
+
$wppa['fullsize'] = $size;
|
557 |
+
}
|
558 |
+
|
559 |
+
// Find align
|
560 |
+
$wppa['align'] = $align;
|
561 |
+
|
562 |
+
return wppa_albums();
|
563 |
+
}
|
wppa-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1146,11 +1146,6 @@ global $wppa_session;
|
|
1146 |
wppa_dbg_msg( 'Get_thumbs entered, mocc = ' . wppa( 'mocc' ) .
|
1147 |
', Start_album=' . wppa( 'start_album' ) . ', Cover=' . wppa( 'is_cover' ) );
|
1148 |
|
1149 |
-
/* debugging, disable for production!
|
1150 |
-
global $wppa;
|
1151 |
-
wppa_dbg_msg( 'wppa='.serialize($wppa) );
|
1152 |
-
/* ens debugging */
|
1153 |
-
|
1154 |
// Done already this occ?
|
1155 |
if ( is_array( $thumbs ) ) {
|
1156 |
wppa_dbg_msg( 'Cached thumbs used' );
|
@@ -1175,16 +1170,30 @@ global $wppa_session;
|
|
1175 |
// Start timer
|
1176 |
$time = -microtime( true );
|
1177 |
|
1178 |
-
// Make Album clause
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1182 |
}
|
|
|
|
|
1183 |
else {
|
1184 |
-
$
|
1185 |
-
$album_clause =
|
1186 |
}
|
1187 |
-
|
1188 |
// For upload link on thumbarea: if startalbum is a single real album, put it in current album
|
1189 |
if ( wppa_is_int( wppa( 'start_album' ) ) ) {
|
1190 |
wppa( 'current_album', wppa( 'start_album' ) );
|
@@ -1197,23 +1206,18 @@ global $wppa_session;
|
|
1197 |
|
1198 |
// Single image slideshow?
|
1199 |
if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
|
1200 |
-
$query = $wpdb->prepare(
|
|
|
1201 |
}
|
1202 |
|
1203 |
// Uploader? // lasten with owner rstriction is handled at the Lasten case
|
1204 |
elseif ( wppa( 'is_upldr' ) && ! wppa( 'is_lasten' ) ) {
|
1205 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1206 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
}
|
1212 |
-
else {
|
1213 |
-
$query = $wpdb->prepare( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1214 |
-
"WHERE `owner` = %s AND ( " . $status . " ) " .
|
1215 |
-
"ORDER BY `timestamp` DESC", wppa( 'is_upldr' ) );
|
1216 |
-
}
|
1217 |
}
|
1218 |
|
1219 |
// Topten?
|
@@ -1221,13 +1225,13 @@ global $wppa_session;
|
|
1221 |
$max = wppa( 'topten_count' );
|
1222 |
switch ( wppa_opt( 'topten_sortby' ) ) {
|
1223 |
case 'mean_rating':
|
1224 |
-
$sortby =
|
1225 |
break;
|
1226 |
case 'rating_count':
|
1227 |
-
$sortby =
|
1228 |
break;
|
1229 |
case 'views':
|
1230 |
-
$sortby =
|
1231 |
break;
|
1232 |
default:
|
1233 |
wppa_error_message( 'Unimplemented sorting method' );
|
@@ -1241,32 +1245,22 @@ global $wppa_session;
|
|
1241 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1242 |
}
|
1243 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
else {
|
1250 |
-
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1251 |
-
"WHERE ( " . $status . " ) " .
|
1252 |
-
"ORDER BY " . $sortby . " LIMIT " . $max;
|
1253 |
-
}
|
1254 |
$count_first = false;
|
1255 |
}
|
1256 |
|
1257 |
// Featen?
|
1258 |
elseif ( wppa( 'is_featen' ) ) {
|
1259 |
$max = wppa( 'featen_count' );
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
else {
|
1266 |
-
$query = "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1267 |
-
"WHERE `status` = 'featured' " .
|
1268 |
-
"ORDER BY RAND( ".wppa_get_randseed()." ) DESC LIMIT ".$max;
|
1269 |
-
}
|
1270 |
$count_first = false;
|
1271 |
}
|
1272 |
|
@@ -1280,64 +1274,41 @@ global $wppa_session;
|
|
1280 |
// If you want only 'New' photos in the selection, the period must be <> 0;
|
1281 |
if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
|
1282 |
$newtime = " `" . $order_by . "` >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
|
1283 |
-
$owner_restriction = ( wppa( 'is_upldr') ) ? "AND `owner` = '" . sanitize_user( wppa( 'is_upldr' ) ) . "' " : "";
|
1284 |
|
1285 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
else {
|
1293 |
-
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1294 |
-
"WHERE " . $newtime . " " .
|
1295 |
-
$owner_restriction .
|
1296 |
-
"ORDER BY `" . $order_by . "` DESC LIMIT " . $max;
|
1297 |
-
}
|
1298 |
}
|
1299 |
else {
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
}
|
1306 |
-
else {
|
1307 |
-
$query = "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1308 |
-
"WHERE ( " . $status . " ) AND (" . $newtime . ") " .
|
1309 |
-
$owner_restriction .
|
1310 |
-
"ORDER BY `" . $order_by . "` DESC LIMIT ".$max;
|
1311 |
-
}
|
1312 |
}
|
1313 |
}
|
1314 |
|
1315 |
// No 'New' limitation
|
1316 |
else {
|
1317 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
}
|
1323 |
-
else {
|
1324 |
-
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1325 |
-
"ORDER BY `" . $order_by . "` DESC LIMIT " . $max;
|
1326 |
-
}
|
1327 |
}
|
1328 |
else {
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
}
|
1334 |
-
else {
|
1335 |
-
$query = "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1336 |
-
"WHERE " . $status . " " .
|
1337 |
-
"ORDER BY `" . $order_by . "` DESC LIMIT " . $max;
|
1338 |
-
}
|
1339 |
}
|
1340 |
}
|
|
|
1341 |
$count_first = false;
|
1342 |
}
|
1343 |
|
@@ -1362,7 +1333,7 @@ global $wppa_session;
|
|
1362 |
// To keep the sequence ok ( in sequence of comments desc ), do the queries one by one
|
1363 |
$thumbs = array();
|
1364 |
if ( is_array( $photo_ids ) ) foreach( $photo_ids as $id ) {
|
1365 |
-
$temp = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `".WPPA_PHOTOS."` WHERE ".$status." AND `id` = %s", $id ), ARRAY_A );
|
1366 |
if ( $temp ) {
|
1367 |
$thumbs[] = $temp;
|
1368 |
}
|
@@ -1406,15 +1377,22 @@ global $wppa_session;
|
|
1406 |
$fac = ' AND ' . $album_clause . ' ';
|
1407 |
}
|
1408 |
else {
|
1409 |
-
$fac = '';
|
1410 |
}
|
1411 |
|
1412 |
// Prepare the query
|
1413 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1414 |
-
$query =
|
|
|
|
|
|
|
1415 |
}
|
1416 |
else {
|
1417 |
-
$query =
|
|
|
|
|
|
|
|
|
1418 |
}
|
1419 |
}
|
1420 |
|
@@ -1431,8 +1409,6 @@ global $wppa_session;
|
|
1431 |
$data = implode( ',', $data );
|
1432 |
$ss_data[3] = $data;
|
1433 |
|
1434 |
-
// $data = $ss_data['3'];
|
1435 |
-
|
1436 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1437 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1438 |
|
@@ -1448,11 +1424,14 @@ global $wppa_session;
|
|
1448 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1449 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1450 |
"WHERE `name` " . $is . " %s " .
|
|
|
1451 |
wppa_get_photo_order( '0' ), $data );
|
1452 |
}
|
1453 |
else {
|
1454 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1455 |
-
"WHERE `name` " . $is . " %s
|
|
|
|
|
1456 |
wppa_get_photo_order( '0' ), $data );
|
1457 |
}
|
1458 |
break;
|
@@ -1462,11 +1441,14 @@ global $wppa_session;
|
|
1462 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1463 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1464 |
"WHERE `owner` = %s " .
|
|
|
1465 |
wppa_get_photo_order( '0' ), $data );
|
1466 |
}
|
1467 |
else {
|
1468 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1469 |
-
"WHERE `owner` = %s
|
|
|
|
|
1470 |
wppa_get_photo_order( '0' ), $data );
|
1471 |
}
|
1472 |
break;
|
@@ -1488,7 +1470,9 @@ global $wppa_session;
|
|
1488 |
}
|
1489 |
if ( count( $tagids ) > '0' ) {
|
1490 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1491 |
-
"WHERE ".$status."
|
|
|
|
|
1492 |
}
|
1493 |
break;
|
1494 |
|
@@ -1552,7 +1536,9 @@ global $wppa_session;
|
|
1552 |
$ids = array( '0' ); // Dummy
|
1553 |
}
|
1554 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1555 |
-
"WHERE ".$status."
|
|
|
|
|
1556 |
break;
|
1557 |
|
1558 |
// Iptc
|
@@ -1567,7 +1553,9 @@ global $wppa_session;
|
|
1567 |
$ids .= ','.$item['photo'];
|
1568 |
}
|
1569 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1570 |
-
"WHERE ".$status."
|
|
|
|
|
1571 |
break;
|
1572 |
|
1573 |
// Exif
|
@@ -1582,7 +1570,9 @@ global $wppa_session;
|
|
1582 |
$ids .= ','.$item['photo'];
|
1583 |
}
|
1584 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1585 |
-
"WHERE ".$status."
|
|
|
|
|
1586 |
break;
|
1587 |
}
|
1588 |
}
|
@@ -1636,9 +1626,9 @@ global $wppa_session;
|
|
1636 |
$final_array = array_unique( $final_array );
|
1637 |
}
|
1638 |
|
1639 |
-
// Remove scheduled and pending when not can moderate
|
1640 |
if ( ! current_user_can( 'wppa_moderate' ) ) {
|
1641 |
-
$needmod = $wpdb->get_results( "SELECT `id` FROM `".WPPA_PHOTOS."` WHERE `status` = 'scheduled' OR `status` = 'pending'", ARRAY_A );
|
1642 |
if ( is_array( $needmod ) ) {
|
1643 |
$delta = array();
|
1644 |
foreach ( $needmod as $item ) {
|
@@ -1648,9 +1638,9 @@ global $wppa_session;
|
|
1648 |
$final_array = array_diff( $final_array, $delta );
|
1649 |
}
|
1650 |
|
1651 |
-
// Remove private when not logged in
|
1652 |
if ( ! is_user_logged_in() ) {
|
1653 |
-
$needlogin = $wpdb->get_results( "SELECT `id` FROM `".WPPA_PHOTOS."` WHERE `status` = 'private'", ARRAY_A );
|
1654 |
if ( is_array( $needlogin ) ) {
|
1655 |
$delta = array();
|
1656 |
foreach ( $needlogin as $item ) {
|
@@ -1774,6 +1764,7 @@ global $wppa_session;
|
|
1774 |
else {
|
1775 |
$query = $wpdb->prepare( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1776 |
"WHERE ( ( " . $status . " ) OR `owner` = %s ) " .
|
|
|
1777 |
wppa_get_photo_order( '0' ), wppa_get_user() );
|
1778 |
}
|
1779 |
}
|
@@ -2101,7 +2092,7 @@ static $user;
|
|
2101 |
$desc = '';
|
2102 |
if ( ( ! wppa( 'is_slideonly' ) || wppa( 'desc_on' ) ) && ! wppa( 'is_filmonly' ) ) {
|
2103 |
|
2104 |
-
$desc .= wppa_get_photo_desc( $id, wppa_switch( 'allow_foreign_shortcodes' ), '
|
2105 |
|
2106 |
// Run wpautop on description?
|
2107 |
if ( wppa_opt( 'wpautop_on_desc' ) == 'wpautop' ) {
|
@@ -3323,6 +3314,8 @@ function wppa_container_wrapper( $key ) {
|
|
3323 |
if ( wppa( 'max_width' ) ) {
|
3324 |
wppa_out( '<div' .
|
3325 |
' id="wppa-container-wrapper-' . wppa( 'mocc' ) . '"' .
|
|
|
|
|
3326 |
' style="' .
|
3327 |
'max-width:' . wppa( 'max_width' ) . 'px;'
|
3328 |
);
|
@@ -4821,7 +4814,7 @@ function wppa_get_lbtitle( $type, $id ) {
|
|
4821 |
' title="' . __( 'Download' , 'wp-photo-album-plus') . '"' .
|
4822 |
' style="cursor:pointer; margin-bottom:0px; max-width:500px;"' .
|
4823 |
' class="wppa-download-button wppa-ovl-button"' .
|
4824 |
-
' onclick="wppaAjaxMakeOrigName( ' . wppa( 'mocc' ) . ', \'' . wppa_encrypt_photo($id) .'\' );"' .
|
4825 |
' value="' . rtrim( __( 'Download' , 'wp-photo-album-plus') . ' ' .
|
4826 |
wppa_get_photo_name( $id, wppa_switch( 'ovl_add_owner' ), false, false, wppa_switch( 'ovl_'.$type.'_name' ) ) ) .
|
4827 |
'"' .
|
@@ -4831,7 +4824,7 @@ function wppa_get_lbtitle( $type, $id ) {
|
|
4831 |
$result .= '<a' .
|
4832 |
' title="' . __( 'Download' , 'wp-photo-album-plus') . '"' .
|
4833 |
' style="cursor:pointer;"' .
|
4834 |
-
' onclick="wppaAjaxMakeOrigName( '.wppa( 'mocc' ).', \''.wppa_encrypt_photo($id).'\' );"' .
|
4835 |
' >' .
|
4836 |
rtrim( __( 'Download' , 'wp-photo-album-plus') . ' ' .
|
4837 |
wppa_get_photo_name( $id, wppa_switch( 'ovl_add_owner' ), false, false, wppa_switch( 'ovl_'.$type.'_name' ) ) ) .
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various functions
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
1146 |
wppa_dbg_msg( 'Get_thumbs entered, mocc = ' . wppa( 'mocc' ) .
|
1147 |
', Start_album=' . wppa( 'start_album' ) . ', Cover=' . wppa( 'is_cover' ) );
|
1148 |
|
|
|
|
|
|
|
|
|
|
|
1149 |
// Done already this occ?
|
1150 |
if ( is_array( $thumbs ) ) {
|
1151 |
wppa_dbg_msg( 'Cached thumbs used' );
|
1170 |
// Start timer
|
1171 |
$time = -microtime( true );
|
1172 |
|
1173 |
+
// Make Album clause if album given
|
1174 |
+
if ( wppa( 'start_album' ) ) {
|
1175 |
+
|
1176 |
+
// See if album is an enumeration or range
|
1177 |
+
$fullalb = wppa( 'start_album' );
|
1178 |
+
|
1179 |
+
// Single album
|
1180 |
+
if ( strpos( $fullalb, '.' ) == false ) {
|
1181 |
+
$album_clause = " `album` = $fullalb ";
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
// Enum albums
|
1185 |
+
else {
|
1186 |
+
$ids = wppa_series_to_array( $fullalb );
|
1187 |
+
$album_clause = " `album` IN ( " . implode( ',', $ids ) . " ) ";
|
1188 |
+
}
|
1189 |
}
|
1190 |
+
|
1191 |
+
// No album given, make sure trashed photos are not found
|
1192 |
else {
|
1193 |
+
$fullalb = '';
|
1194 |
+
$album_clause = " `album` <> '-9' ";
|
1195 |
}
|
1196 |
+
|
1197 |
// For upload link on thumbarea: if startalbum is a single real album, put it in current album
|
1198 |
if ( wppa_is_int( wppa( 'start_album' ) ) ) {
|
1199 |
wppa( 'current_album', wppa( 'start_album' ) );
|
1206 |
|
1207 |
// Single image slideshow?
|
1208 |
if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
|
1209 |
+
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1210 |
+
"WHERE `id` = %s", wppa( 'start_photo' ) );
|
1211 |
}
|
1212 |
|
1213 |
// Uploader? // lasten with owner rstriction is handled at the Lasten case
|
1214 |
elseif ( wppa( 'is_upldr' ) && ! wppa( 'is_lasten' ) ) {
|
1215 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1216 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1217 |
+
|
1218 |
+
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1219 |
+
"WHERE " . $album_clause . " AND `owner` = %s AND ( " . $status . " ) " .
|
1220 |
+
"ORDER BY `timestamp` DESC", wppa( 'is_upldr' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
1221 |
}
|
1222 |
|
1223 |
// Topten?
|
1225 |
$max = wppa( 'topten_count' );
|
1226 |
switch ( wppa_opt( 'topten_sortby' ) ) {
|
1227 |
case 'mean_rating':
|
1228 |
+
$sortby = "`mean_rating` DESC, `rating_count` DESC, `views` DESC";
|
1229 |
break;
|
1230 |
case 'rating_count':
|
1231 |
+
$sortby = "`rating_count` DESC, `mean_rating` DESC, `views` DESC";
|
1232 |
break;
|
1233 |
case 'views':
|
1234 |
+
$sortby = "`views` DESC, `mean_rating` DESC, `rating_count` DESC";
|
1235 |
break;
|
1236 |
default:
|
1237 |
wppa_error_message( 'Unimplemented sorting method' );
|
1245 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1246 |
}
|
1247 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1248 |
+
|
1249 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1250 |
+
"WHERE $album_clause AND ( $status ) " .
|
1251 |
+
"ORDER BY $sortby LIMIT $max";
|
1252 |
+
|
|
|
|
|
|
|
|
|
|
|
1253 |
$count_first = false;
|
1254 |
}
|
1255 |
|
1256 |
// Featen?
|
1257 |
elseif ( wppa( 'is_featen' ) ) {
|
1258 |
$max = wppa( 'featen_count' );
|
1259 |
+
|
1260 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1261 |
+
"WHERE $album_clause AND `status` = 'featured' " .
|
1262 |
+
"ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT $max";
|
1263 |
+
|
|
|
|
|
|
|
|
|
|
|
1264 |
$count_first = false;
|
1265 |
}
|
1266 |
|
1274 |
// If you want only 'New' photos in the selection, the period must be <> 0;
|
1275 |
if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
|
1276 |
$newtime = " `" . $order_by . "` >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
|
1277 |
+
$owner_restriction = ( wppa( 'is_upldr' ) ) ? "AND `owner` = '" . sanitize_user( wppa( 'is_upldr' ) ) . "' " : "";
|
1278 |
|
1279 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1280 |
+
|
1281 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1282 |
+
"WHERE ( $album_clause ) " .
|
1283 |
+
"AND ( $newtime ) " .
|
1284 |
+
$owner_restriction .
|
1285 |
+
"ORDER BY `$order_by` DESC LIMIT $max";
|
|
|
|
|
|
|
|
|
|
|
|
|
1286 |
}
|
1287 |
else {
|
1288 |
+
|
1289 |
+
$query = "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1290 |
+
"WHERE ( $album_clause ) AND ( $status ) AND ( $newtime ) " .
|
1291 |
+
$owner_restriction .
|
1292 |
+
"ORDER BY `$order_by` DESC LIMIT $max";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1293 |
}
|
1294 |
}
|
1295 |
|
1296 |
// No 'New' limitation
|
1297 |
else {
|
1298 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1299 |
+
|
1300 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1301 |
+
"WHERE $album_clause " .
|
1302 |
+
"ORDER BY `$order_by` DESC LIMIT $max";
|
|
|
|
|
|
|
|
|
|
|
1303 |
}
|
1304 |
else {
|
1305 |
+
|
1306 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1307 |
+
"WHERE ( $album_clause ) AND ( $status ) " .
|
1308 |
+
"ORDER BY `$order_by` DESC LIMIT $max";
|
|
|
|
|
|
|
|
|
|
|
|
|
1309 |
}
|
1310 |
}
|
1311 |
+
|
1312 |
$count_first = false;
|
1313 |
}
|
1314 |
|
1333 |
// To keep the sequence ok ( in sequence of comments desc ), do the queries one by one
|
1334 |
$thumbs = array();
|
1335 |
if ( is_array( $photo_ids ) ) foreach( $photo_ids as $id ) {
|
1336 |
+
$temp = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `".WPPA_PHOTOS."` WHERE ".$status." AND `album` <> '-9' AND `id` = %s", $id ), ARRAY_A );
|
1337 |
if ( $temp ) {
|
1338 |
$thumbs[] = $temp;
|
1339 |
}
|
1377 |
$fac = ' AND ' . $album_clause . ' ';
|
1378 |
}
|
1379 |
else {
|
1380 |
+
$fac = " AND `album` <> '-9' ";
|
1381 |
}
|
1382 |
|
1383 |
// Prepare the query
|
1384 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1385 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1386 |
+
"WHERE ( $tags_like ) " .
|
1387 |
+
"AND $album_clause " .
|
1388 |
+
wppa_get_photo_order( '0' );
|
1389 |
}
|
1390 |
else {
|
1391 |
+
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1392 |
+
"WHERE ( $tags_like ) " .
|
1393 |
+
"AND $album_clause " .
|
1394 |
+
"AND $status " .
|
1395 |
+
wppa_get_photo_order( '0' );
|
1396 |
}
|
1397 |
}
|
1398 |
|
1409 |
$data = implode( ',', $data );
|
1410 |
$ss_data[3] = $data;
|
1411 |
|
|
|
|
|
1412 |
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
|
1413 |
if ( ! is_user_logged_in() ) $status .= " AND `status` <> 'private'";
|
1414 |
|
1424 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1425 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1426 |
"WHERE `name` " . $is . " %s " .
|
1427 |
+
"AND `album` <> '-9' " .
|
1428 |
wppa_get_photo_order( '0' ), $data );
|
1429 |
}
|
1430 |
else {
|
1431 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1432 |
+
"WHERE `name` " . $is . " %s " .
|
1433 |
+
"AND `album` <> '-9' " .
|
1434 |
+
"AND " . $status . " " .
|
1435 |
wppa_get_photo_order( '0' ), $data );
|
1436 |
}
|
1437 |
break;
|
1441 |
if ( current_user_can( 'wppa_moderate' ) ) {
|
1442 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1443 |
"WHERE `owner` = %s " .
|
1444 |
+
"AND `album` <> '-9' " .
|
1445 |
wppa_get_photo_order( '0' ), $data );
|
1446 |
}
|
1447 |
else {
|
1448 |
$query = $wpdb->prepare( "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1449 |
+
"WHERE `owner` = %s " .
|
1450 |
+
"AND `album` <> '-9' " .
|
1451 |
+
"AND " . $status . " " .
|
1452 |
wppa_get_photo_order( '0' ), $data );
|
1453 |
}
|
1454 |
break;
|
1470 |
}
|
1471 |
if ( count( $tagids ) > '0' ) {
|
1472 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1473 |
+
"WHERE ".$status." " .
|
1474 |
+
"AND `id` IN (" . implode( ',',$tagids ) . ") " .
|
1475 |
+
"AND `album` <> '-9' ";
|
1476 |
}
|
1477 |
break;
|
1478 |
|
1536 |
$ids = array( '0' ); // Dummy
|
1537 |
}
|
1538 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1539 |
+
"WHERE ".$status." " .
|
1540 |
+
"AND `album` <> '-9' " .
|
1541 |
+
"AND `id` IN (" . trim( implode( ',', $ids ), ',' ) . ")";
|
1542 |
break;
|
1543 |
|
1544 |
// Iptc
|
1553 |
$ids .= ','.$item['photo'];
|
1554 |
}
|
1555 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1556 |
+
"WHERE ".$status." " .
|
1557 |
+
"AND `album` <> '-9' " .
|
1558 |
+
"AND `id` IN (" . $ids . ")";
|
1559 |
break;
|
1560 |
|
1561 |
// Exif
|
1570 |
$ids .= ','.$item['photo'];
|
1571 |
}
|
1572 |
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " .
|
1573 |
+
"WHERE ".$status." " .
|
1574 |
+
"AND `album` <> '-9' " .
|
1575 |
+
"AND `id` IN (" . $ids . ")";
|
1576 |
break;
|
1577 |
}
|
1578 |
}
|
1626 |
$final_array = array_unique( $final_array );
|
1627 |
}
|
1628 |
|
1629 |
+
// Remove scheduled and pending and trashed when not can moderate
|
1630 |
if ( ! current_user_can( 'wppa_moderate' ) ) {
|
1631 |
+
$needmod = $wpdb->get_results( "SELECT `id` FROM `".WPPA_PHOTOS."` WHERE `status` = 'scheduled' OR `status` = 'pending' OR `album` = '-9'", ARRAY_A );
|
1632 |
if ( is_array( $needmod ) ) {
|
1633 |
$delta = array();
|
1634 |
foreach ( $needmod as $item ) {
|
1638 |
$final_array = array_diff( $final_array, $delta );
|
1639 |
}
|
1640 |
|
1641 |
+
// Remove private and trashed when not logged in
|
1642 |
if ( ! is_user_logged_in() ) {
|
1643 |
+
$needlogin = $wpdb->get_results( "SELECT `id` FROM `".WPPA_PHOTOS."` WHERE `status` = 'private' OR `album` = '-9'", ARRAY_A );
|
1644 |
if ( is_array( $needlogin ) ) {
|
1645 |
$delta = array();
|
1646 |
foreach ( $needlogin as $item ) {
|
1764 |
else {
|
1765 |
$query = $wpdb->prepare( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
1766 |
"WHERE ( ( " . $status . " ) OR `owner` = %s ) " .
|
1767 |
+
"AND `album` <> '-9' " .
|
1768 |
wppa_get_photo_order( '0' ), wppa_get_user() );
|
1769 |
}
|
1770 |
}
|
2092 |
$desc = '';
|
2093 |
if ( ( ! wppa( 'is_slideonly' ) || wppa( 'desc_on' ) ) && ! wppa( 'is_filmonly' ) ) {
|
2094 |
|
2095 |
+
$desc .= wppa_get_photo_desc( $id, array( 'doshortcodes' => wppa_switch( 'allow_foreign_shortcodes' ), 'dogeo' => true ) ); // Foreign shortcodes is handled here
|
2096 |
|
2097 |
// Run wpautop on description?
|
2098 |
if ( wppa_opt( 'wpautop_on_desc' ) == 'wpautop' ) {
|
3314 |
if ( wppa( 'max_width' ) ) {
|
3315 |
wppa_out( '<div' .
|
3316 |
' id="wppa-container-wrapper-' . wppa( 'mocc' ) . '"' .
|
3317 |
+
( wppa( 'align' ) == 'left' ? ' class="alignleft"' : '' ) .
|
3318 |
+
( wppa( 'align' ) == 'right' ? ' class="alignright"' : '' ) .
|
3319 |
' style="' .
|
3320 |
'max-width:' . wppa( 'max_width' ) . 'px;'
|
3321 |
);
|
4814 |
' title="' . __( 'Download' , 'wp-photo-album-plus') . '"' .
|
4815 |
' style="cursor:pointer; margin-bottom:0px; max-width:500px;"' .
|
4816 |
' class="wppa-download-button wppa-ovl-button"' .
|
4817 |
+
' onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( ' . wppa( 'mocc' ) . ', \'' . wppa_encrypt_photo($id) .'\' );"' .
|
4818 |
' value="' . rtrim( __( 'Download' , 'wp-photo-album-plus') . ' ' .
|
4819 |
wppa_get_photo_name( $id, wppa_switch( 'ovl_add_owner' ), false, false, wppa_switch( 'ovl_'.$type.'_name' ) ) ) .
|
4820 |
'"' .
|
4824 |
$result .= '<a' .
|
4825 |
' title="' . __( 'Download' , 'wp-photo-album-plus') . '"' .
|
4826 |
' style="cursor:pointer;"' .
|
4827 |
+
' onclick="' . ( wppa_is_safari() && ( wppa_opt( 'art_monkey_link' ) == 'file' ) ? 'wppaWindowReference = window.open();' : '' ) . 'wppaAjaxMakeOrigName( '.wppa( 'mocc' ).', \''.wppa_encrypt_photo($id).'\' );"' .
|
4828 |
' >' .
|
4829 |
rtrim( __( 'Download' , 'wp-photo-album-plus') . ' ' .
|
4830 |
wppa_get_photo_name( $id, wppa_switch( 'ovl_add_owner' ), false, false, wppa_switch( 'ovl_'.$type.'_name' ) ) ) .
|
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 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -2043,6 +2043,43 @@ global $wppa_supported_audio_extensions;
|
|
2043 |
$cust_labels[$i] = wppa_opt( 'custom_caption_' . $i );
|
2044 |
}
|
2045 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2046 |
// Process the files
|
2047 |
$photos_processed_csv = '0';
|
2048 |
$photos_skipped_csv = '0';
|
@@ -2230,17 +2267,26 @@ global $wppa_supported_audio_extensions;
|
|
2230 |
fclose( $handle );
|
2231 |
return;
|
2232 |
}
|
2233 |
-
|
2234 |
-
|
|
|
|
|
2235 |
if ( ! in_array( strtolower( trim( $captions['0'] ) ), array( 'name', 'photoname', 'filename' ) ) ) {
|
2236 |
wppa_error_message( __( 'Invalid header. First item must be \'name\', \'photoname\' or \'filename\'', 'wp-photo-album-plus') );
|
2237 |
fclose( $handle );
|
2238 |
return;
|
2239 |
}
|
2240 |
}
|
2241 |
-
elseif (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2242 |
if ( ! in_array( '', $cust_labels ) ) {
|
2243 |
-
wppa_error_message( __( 'All available custom data fields are in use. There is no space for', 'wp-photo-album-plus') . ' ' . $captions[$
|
2244 |
fclose( $handle );
|
2245 |
return;
|
2246 |
}
|
@@ -2248,7 +2294,7 @@ global $wppa_supported_audio_extensions;
|
|
2248 |
// Add a new caption
|
2249 |
$i = '0';
|
2250 |
while ( $cust_labels[$i] ) $i++;
|
2251 |
-
$cust_labels[$i] = $captions[$
|
2252 |
wppa_update_option( 'wppa_custom_caption_' . $i, $cust_labels[$i] );
|
2253 |
wppa_update_option( 'wppa_custom_visible_' . $i, 'yes' );
|
2254 |
wppa_log( 'dbg', sprintf( __( 'New caption %s added.', 'wp-photo-album-plus'), $cust_labels[$i] ) );
|
@@ -2256,15 +2302,26 @@ global $wppa_supported_audio_extensions;
|
|
2256 |
}
|
2257 |
|
2258 |
// Find the correlation between caption index and custom data index.
|
2259 |
-
$
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
|
|
|
|
|
|
2264 |
}
|
2265 |
}
|
2266 |
}
|
2267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2268 |
|
2269 |
// Now process the lines
|
2270 |
while ( ! feof( $handle ) ) {
|
@@ -2292,10 +2349,116 @@ global $wppa_supported_audio_extensions;
|
|
2292 |
if ( $photos ) {
|
2293 |
foreach( $photos as $photo ) {
|
2294 |
$cust_data = $photo['custom'] ? unserialize( $photo['custom'] ) : array( '', '', '', '', '', '', '', '', '', '' );
|
2295 |
-
|
2296 |
-
|
|
|
|
|
2297 |
}
|
2298 |
wppa_update_photo( array( 'id' => $photo['id'], 'custom' => serialize( $cust_data ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2299 |
$photos_processed_csv ++;
|
2300 |
}
|
2301 |
wppa_log( 'dbg', 'Processed: ' . $data_arr[0] );
|
@@ -2383,6 +2546,15 @@ global $wppa_supported_audio_extensions;
|
|
2383 |
}
|
2384 |
}
|
2385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2386 |
function wppa_get_zipcount( $files ) {
|
2387 |
$result = 0;
|
2388 |
if ( $files ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the import pages and functions
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
2043 |
$cust_labels[$i] = wppa_opt( 'custom_caption_' . $i );
|
2044 |
}
|
2045 |
|
2046 |
+
// Get the system datafields tha may be filled using .csv import
|
2047 |
+
$syst_lables = array(
|
2048 |
+
// id bigint(20) NOT NULL,
|
2049 |
+
'album', // bigint(20) NOT NULL,
|
2050 |
+
// ext tinytext NOT NULL,
|
2051 |
+
'name', // text NOT NULL,
|
2052 |
+
'description', // longtext NOT NULL,
|
2053 |
+
'p_order', // smallint(5) NOT NULL,
|
2054 |
+
// mean_rating tinytext NOT NULL,
|
2055 |
+
'linkurl', // text NOT NULL,
|
2056 |
+
'linktitle', // text NOT NULL,
|
2057 |
+
'linktarget', // tinytext NOT NULL,
|
2058 |
+
'owner', // text NOT NULL,
|
2059 |
+
'timestamp', // tinytext NOT NULL,
|
2060 |
+
'status', // tinytext NOT NULL,
|
2061 |
+
// rating_count bigint(20) NOT NULL default '0',
|
2062 |
+
'tags', // text NOT NULL,
|
2063 |
+
'alt', // tinytext NOT NULL,
|
2064 |
+
// filename tinytext NOT NULL,
|
2065 |
+
'modified', // tinytext NOT NULL,
|
2066 |
+
'location', // tinytext NOT NULL,
|
2067 |
+
'views', // bigint(20) NOT NULL default '0',
|
2068 |
+
'clicks', // bigint(20) NOT NULL default '0',
|
2069 |
+
// page_id bigint(20) NOT NULL default '0',
|
2070 |
+
'exifdtm', // tinytext NOT NULL,
|
2071 |
+
// videox smallint(5) NOT NULL default '0',
|
2072 |
+
// videoy smallint(5) NOT NULL default '0',
|
2073 |
+
// thumbx smallint(5) NOT NULL default '0',
|
2074 |
+
// thumby smallint(5) NOT NULL default '0',
|
2075 |
+
// photox smallint(5) NOT NULL default '0',
|
2076 |
+
// photoy smallint(5) NOT NULL default '0',
|
2077 |
+
// scheduledtm tinytext NOT NULL,
|
2078 |
+
// custom longtext NOT NULL,
|
2079 |
+
// stereo smallint NOT NULL default '0',
|
2080 |
+
// crypt tinytext NOT NULL,
|
2081 |
+
);
|
2082 |
+
|
2083 |
// Process the files
|
2084 |
$photos_processed_csv = '0';
|
2085 |
$photos_skipped_csv = '0';
|
2267 |
fclose( $handle );
|
2268 |
return;
|
2269 |
}
|
2270 |
+
|
2271 |
+
// Verify or add cutom fields
|
2272 |
+
foreach ( array_keys( $captions ) as $captidx ) {
|
2273 |
+
if ( $captidx == '0' ) {
|
2274 |
if ( ! in_array( strtolower( trim( $captions['0'] ) ), array( 'name', 'photoname', 'filename' ) ) ) {
|
2275 |
wppa_error_message( __( 'Invalid header. First item must be \'name\', \'photoname\' or \'filename\'', 'wp-photo-album-plus') );
|
2276 |
fclose( $handle );
|
2277 |
return;
|
2278 |
}
|
2279 |
}
|
2280 |
+
elseif ( in_array( $captions[$captidx], $syst_lables ) ) {
|
2281 |
+
if ( $captions['0'] != 'filename' ) {
|
2282 |
+
wppa_error_message( __( 'Invalid header. First item must be \'filename\' when importing system data fields', 'wp-photo-album-plus' ) );
|
2283 |
+
fclose( $handle );
|
2284 |
+
return;
|
2285 |
+
}
|
2286 |
+
}
|
2287 |
+
elseif ( ! in_array( $captions[$captidx], $cust_labels ) ) {
|
2288 |
if ( ! in_array( '', $cust_labels ) ) {
|
2289 |
+
wppa_error_message( __( 'All available custom data fields are in use. There is no space for', 'wp-photo-album-plus') . ' ' . $captions[$captidx] );
|
2290 |
fclose( $handle );
|
2291 |
return;
|
2292 |
}
|
2294 |
// Add a new caption
|
2295 |
$i = '0';
|
2296 |
while ( $cust_labels[$i] ) $i++;
|
2297 |
+
$cust_labels[$i] = $captions[$captidx];
|
2298 |
wppa_update_option( 'wppa_custom_caption_' . $i, $cust_labels[$i] );
|
2299 |
wppa_update_option( 'wppa_custom_visible_' . $i, 'yes' );
|
2300 |
wppa_log( 'dbg', sprintf( __( 'New caption %s added.', 'wp-photo-album-plus'), $cust_labels[$i] ) );
|
2302 |
}
|
2303 |
|
2304 |
// Find the correlation between caption index and custom data index.
|
2305 |
+
// $custptrs is an array of custom data field numbers
|
2306 |
+
$custptrs = array();
|
2307 |
+
for ( $captidx = '1'; $captidx < count( $captions ); $captidx++ ) {
|
2308 |
+
if ( ! in_array( $captions[$captidx], $syst_lables ) ) {
|
2309 |
+
for ( $custidx = '0'; $custidx < '10'; $custidx++ ) {
|
2310 |
+
if ( $captions[$captidx] == $cust_labels[$custidx] ) {
|
2311 |
+
$custptrs[$custidx] = $captidx;
|
2312 |
+
}
|
2313 |
}
|
2314 |
}
|
2315 |
}
|
2316 |
|
2317 |
+
// Find the correlation betwwn caption index and system data field names.
|
2318 |
+
// $systptrs is an array of system data field names. Key is data filed number, value is system field name
|
2319 |
+
$systptrs = array();
|
2320 |
+
for ( $captidx = '1'; $captidx < count( $captions ); $captidx++ ) {
|
2321 |
+
if ( in_array( $captions[$captidx], $syst_lables ) ) {
|
2322 |
+
$systptrs[$captidx] = $captions[$captidx];
|
2323 |
+
}
|
2324 |
+
}
|
2325 |
|
2326 |
// Now process the lines
|
2327 |
while ( ! feof( $handle ) ) {
|
2349 |
if ( $photos ) {
|
2350 |
foreach( $photos as $photo ) {
|
2351 |
$cust_data = $photo['custom'] ? unserialize( $photo['custom'] ) : array( '', '', '', '', '', '', '', '', '', '' );
|
2352 |
+
|
2353 |
+
// Update custom fields
|
2354 |
+
foreach( array_keys( $custptrs ) as $idx ) {
|
2355 |
+
$cust_data[$idx] = wppa_sanitize_custom_field( $data_arr[$custptrs[$idx]] );
|
2356 |
}
|
2357 |
wppa_update_photo( array( 'id' => $photo['id'], 'custom' => serialize( $cust_data ) ) );
|
2358 |
+
|
2359 |
+
// Update system fields
|
2360 |
+
foreach( array_keys( $systptrs ) as $idx ) {
|
2361 |
+
$field = $systptrs[$idx];
|
2362 |
+
$value = stripslashes( $data_arr[$idx] );
|
2363 |
+
if ( ! seems_utf8( $value ) ) {
|
2364 |
+
$value = utf8_encode( $value );
|
2365 |
+
}
|
2366 |
+
if ( $value ) {
|
2367 |
+
switch ( $field ) {
|
2368 |
+
case 'album':
|
2369 |
+
if ( wppa_is_int( $value ) && wppa_album_exists( $value ) ) {
|
2370 |
+
wppa_update_photo( array( 'id' => $photo['id'], $p => $value ) );
|
2371 |
+
}
|
2372 |
+
else {
|
2373 |
+
wppa_wrong_value( $value, $field, __('Album does not exist', 'wp-photo-album-plus') );
|
2374 |
+
}
|
2375 |
+
break;
|
2376 |
+
case 'name':
|
2377 |
+
$value = sanitize_text_field( $value );
|
2378 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2379 |
+
break;
|
2380 |
+
case 'description':
|
2381 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2382 |
+
break;
|
2383 |
+
case 'linkurl':
|
2384 |
+
$url = esc_url_raw( $value );
|
2385 |
+
if ( $url ) {
|
2386 |
+
$value = $url;
|
2387 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2388 |
+
}
|
2389 |
+
else {
|
2390 |
+
wppa_wrong_value( $value, $field );
|
2391 |
+
}
|
2392 |
+
break;
|
2393 |
+
case 'linktitle':
|
2394 |
+
$value = sanitize_text_field( $value );
|
2395 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2396 |
+
break;
|
2397 |
+
case 'linktarget':
|
2398 |
+
if ( $value == '_self' || $value == '_blank' ) {
|
2399 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2400 |
+
}
|
2401 |
+
else {
|
2402 |
+
wppa_wrong_value( $value, $field );
|
2403 |
+
}
|
2404 |
+
break;
|
2405 |
+
case 'owner':
|
2406 |
+
$value = sanitize_user( $value );
|
2407 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2408 |
+
break;
|
2409 |
+
case 'timestamp':
|
2410 |
+
case 'modified':
|
2411 |
+
if ( wppa_is_int( $value ) ) {
|
2412 |
+
if ( $value > '0' && $value < time() ) {
|
2413 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2414 |
+
}
|
2415 |
+
else {
|
2416 |
+
wppa_wrong_value( $value, $field, __( 'Timestamp out of range', 'wp-photo-album-plus' ) );
|
2417 |
+
}
|
2418 |
+
}
|
2419 |
+
else {
|
2420 |
+
wppa_wrong_value( $value, $field );
|
2421 |
+
}
|
2422 |
+
break;
|
2423 |
+
case 'status':
|
2424 |
+
if ( in_array( $value, array( 'pending', 'publish', 'featured', 'gold', 'silver', 'bronze', 'scheduled', 'private' ) ) ) {
|
2425 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2426 |
+
}
|
2427 |
+
else {
|
2428 |
+
wppa_wrong_value( $value, $field );
|
2429 |
+
}
|
2430 |
+
break;
|
2431 |
+
case 'tags':
|
2432 |
+
$value = wppa_sanitize_tags( $value );
|
2433 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2434 |
+
break;
|
2435 |
+
case 'alt':
|
2436 |
+
$value = sanitize_text_field( $value );
|
2437 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2438 |
+
break;
|
2439 |
+
case 'location':
|
2440 |
+
break;
|
2441 |
+
case 'p_order':
|
2442 |
+
case 'views':
|
2443 |
+
case 'clicks':
|
2444 |
+
If ( wppa_is_int( $value ) && $value > 0 ) {
|
2445 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2446 |
+
}
|
2447 |
+
else {
|
2448 |
+
wppa_wrong_value( $value, $field );
|
2449 |
+
}
|
2450 |
+
break;
|
2451 |
+
case 'exifdtm':
|
2452 |
+
if ( wppa_is_exif_date( $value ) ) {
|
2453 |
+
wppa_update_photo( array( 'id' => $photo['id'], $field => $value ) );
|
2454 |
+
}
|
2455 |
+
else {
|
2456 |
+
wppa_wrong_value( $value, $field );
|
2457 |
+
}
|
2458 |
+
break;
|
2459 |
+
}
|
2460 |
+
}
|
2461 |
+
}
|
2462 |
$photos_processed_csv ++;
|
2463 |
}
|
2464 |
wppa_log( 'dbg', 'Processed: ' . $data_arr[0] );
|
2546 |
}
|
2547 |
}
|
2548 |
|
2549 |
+
function wppa_wrong_value( $value, $field, $extra = '' ) {
|
2550 |
+
$message = sprintf( __( 'Value %s is not valid for %s.', 'wp-photo-album-plus' ), $value, $field );
|
2551 |
+
if ( $extra ) {
|
2552 |
+
$message .= '<br />' . $extra;
|
2553 |
+
}
|
2554 |
+
$message .= '<br />' . __( 'This value is ignored.', 'wp-photo-album-plus' );
|
2555 |
+
wppa_error_message( $message );
|
2556 |
+
}
|
2557 |
+
|
2558 |
function wppa_get_zipcount( $files ) {
|
2559 |
$result = 0;
|
2560 |
if ( $files ) {
|
wppa-index.php
CHANGED
@@ -3,12 +3,18 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all indexing functions
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*
|
9 |
*/
|
10 |
|
11 |
// Add an item to the index
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
function wppa_index_add( $type, $id ) {
|
13 |
global $wpdb;
|
14 |
global $acount;
|
@@ -27,26 +33,31 @@ global $pcount;
|
|
27 |
return;
|
28 |
}
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
// Find the raw text, all qTranslate languages
|
33 |
$words = wppa_index_get_raw_album( $id );
|
34 |
|
35 |
-
// Convert to santized array of
|
36 |
$words = wppa_index_raw_to_words( $words );
|
37 |
|
38 |
// Process all the words to see if they must be added to the index
|
39 |
foreach ( $words as $word ) {
|
40 |
|
41 |
// Get the row of the index table where the word is registered.
|
42 |
-
$indexline = $wpdb->get_row($wpdb->prepare("SELECT * FROM `".WPPA_INDEX."` WHERE `slug` = %s", $word), ARRAY_A);
|
43 |
|
44 |
// If this line does not exist yet, create it with only one album number as data
|
45 |
if ( ! $indexline ) {
|
46 |
wppa_create_index_entry( array( 'slug' => $word, 'albums' => $id ) );
|
|
|
47 |
}
|
48 |
|
49 |
-
// Index line already
|
50 |
else {
|
51 |
|
52 |
// Convert existing album ids to an array
|
@@ -65,12 +76,12 @@ global $pcount;
|
|
65 |
$newalbums = wppa_index_array_to_string( $oldalbums );
|
66 |
|
67 |
// Update db
|
68 |
-
$wpdb->query($wpdb->prepare( "UPDATE `".WPPA_INDEX."` SET `albums` = %s WHERE `id` = %s", $newalbums, $indexline['id']));
|
69 |
|
70 |
}
|
71 |
}
|
72 |
}
|
73 |
-
$acount
|
74 |
}
|
75 |
|
76 |
elseif ( $type == 'photo' ) {
|
@@ -86,78 +97,158 @@ global $pcount;
|
|
86 |
return;
|
87 |
}
|
88 |
|
89 |
-
|
|
|
90 |
|
91 |
-
//
|
92 |
-
$words =
|
93 |
|
94 |
-
|
95 |
foreach ( $words as $word ) {
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
wppa_create_index_entry( array( 'slug' => $word, 'photos' => $id ) );
|
|
|
99 |
}
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
if ( ! in_array( $id, $oldphotos ) ) {
|
|
|
|
|
103 |
$oldphotos[] = $id;
|
|
|
|
|
104 |
wppa_log( 'Cron', 'Adding photo # {b}'.$id.'{/b} to index slug {b}'.$word.'{/b}');
|
105 |
-
|
106 |
-
|
107 |
-
$
|
|
|
|
|
|
|
108 |
}
|
109 |
}
|
110 |
|
111 |
}
|
112 |
-
$pcount
|
113 |
}
|
114 |
|
115 |
-
else
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
// Convert raw data string to indexable word array
|
119 |
-
|
|
|
|
|
|
|
|
|
120 |
|
|
|
121 |
$ignore = array( '"', "'", '`', '\\', '>', '<', ',', ':', ';', '!', '?', '=', '_',
|
122 |
'[', ']', '(', ')', '{', '}', '..', '...', '....', "\n", "\r",
|
123 |
"\t", '.jpg', '.png', '.gif', ''', '&',
|
124 |
-
'w#cc0', 'w#cc1', 'w#cc2', 'w#cc3', 'w#cc4', 'w#cc5', 'w#cc6', 'w#cc7', 'w#cc8', 'w#cc9'
|
|
|
|
|
125 |
);
|
126 |
if ( wppa_switch( 'index_ignore_slash' ) ) {
|
127 |
$ignore[] = '/';
|
128 |
}
|
129 |
-
if ( $noskips ) $skips = array();
|
130 |
-
else $skips = get_option( 'wppa_index_skips', array() );
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
$result = array();
|
|
|
|
|
133 |
if ( $xtext ) {
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$text =
|
138 |
-
|
139 |
-
|
140 |
-
$text =
|
141 |
-
|
142 |
-
|
143 |
-
$text =
|
144 |
-
|
145 |
-
|
146 |
-
$text = str_replace('
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
foreach ( $words as $word ) {
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
foreach ( $fracts as $fract ) {
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
}
|
163 |
}
|
@@ -166,7 +257,11 @@ function wppa_index_raw_to_words($xtext, $noskips = false, $minlen = '2' ) {
|
|
166 |
// Remove numbers optionaly
|
167 |
if ( wppa_switch( 'search_numbers_void' ) ) {
|
168 |
foreach ( array_keys( $result ) as $key ) {
|
169 |
-
|
|
|
|
|
|
|
|
|
170 |
if ( ! $t || is_numeric( $t ) ) {
|
171 |
unset( $result[$key] );
|
172 |
}
|
@@ -176,7 +271,9 @@ function wppa_index_raw_to_words($xtext, $noskips = false, $minlen = '2' ) {
|
|
176 |
// Remove dups and sort
|
177 |
$result = array_unique( $result );
|
178 |
|
|
|
179 |
return $result;
|
|
|
180 |
}
|
181 |
|
182 |
// Expand compressed string
|
@@ -328,77 +425,6 @@ global $wpdb;
|
|
328 |
$wpdb->query( "DELETE FROM `".WPPA_INDEX."` WHERE `albums` = '' AND `photos` = ''" ); // Cleanup empty entries
|
329 |
}
|
330 |
|
331 |
-
// Use this function if you know the current photo data matches the index info. Mostly fails...
|
332 |
-
function wppa_index_quick_remove($type, $id) {
|
333 |
-
global $wpdb;
|
334 |
-
|
335 |
-
// If there is a cron job running cleaning the index and this is not that cron job, do nothing
|
336 |
-
if ( get_option( 'wppa_cleanup_index_user' ) == 'cron-job' && ! wppa_is_cron() ) {
|
337 |
-
return;
|
338 |
-
}
|
339 |
-
|
340 |
-
// If no user runs the cleanup proc, start it as cron job
|
341 |
-
if ( ! get_option( 'wppa_cleanup_index_user' ) ) {
|
342 |
-
wppa_schedule_maintenance_proc( 'wppa_cleanup_index' );
|
343 |
-
return;
|
344 |
-
}
|
345 |
-
|
346 |
-
if ( $type == 'album' ) {
|
347 |
-
|
348 |
-
$album = wppa_cache_album($id);
|
349 |
-
|
350 |
-
$words = stripslashes( $album['name'] ).' '.stripslashes( $album['description'] ).' '.$album['cats'];
|
351 |
-
$words = wppa_index_raw_to_words($words);
|
352 |
-
|
353 |
-
foreach ( $words as $word ) {
|
354 |
-
$indexline = $wpdb->get_row("SELECT * FROM `".WPPA_INDEX."` WHERE `slug` = '".$word."'", ARRAY_A);
|
355 |
-
$array = wppa_index_string_to_array($indexline['albums']);
|
356 |
-
foreach ( array_keys($array) as $k ) {
|
357 |
-
if ( $array[$k] == $id ) {
|
358 |
-
unset ( $array[$k] );
|
359 |
-
$string = wppa_index_array_to_string($array);
|
360 |
-
if ( $string || $indexline['photos'] ) {
|
361 |
-
$wpdb->query("UPDATE `".WPPA_INDEX."` SET `albums` = '".$string."' WHERE `id` = ".$indexline['id']);
|
362 |
-
}
|
363 |
-
else {
|
364 |
-
$wpdb->query("DELETE FROM `".WPPA_INDEX."` WHERE `id` = ".$indexline['id']);
|
365 |
-
}
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
}
|
371 |
-
elseif ( $type == 'photo') {
|
372 |
-
|
373 |
-
$thumb = wppa_cache_thumb($id);
|
374 |
-
|
375 |
-
// Find the raw text
|
376 |
-
$words = stripslashes( $thumb['name'] ).' '.$thumb['filename'].' '.stripslashes( $thumb['description'] ).' '.$thumb['tags'];
|
377 |
-
$coms = $wpdb->get_results($wpdb->prepare( "SELECT `comment` FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved'", $thumb['id'] ), ARRAY_A );
|
378 |
-
if ( $coms ) foreach ( $coms as $com ) {
|
379 |
-
$words .= ' '.stripslashes( $com['comment'] );
|
380 |
-
}
|
381 |
-
$words = wppa_index_raw_to_words($words, 'noskips');
|
382 |
-
|
383 |
-
foreach ( $words as $word ) {
|
384 |
-
$indexline = $wpdb->get_row("SELECT * FROM `".WPPA_INDEX."` WHERE `slug` = '".$word."'", ARRAY_A);
|
385 |
-
$array = wppa_index_string_to_array($indexline['photos']);
|
386 |
-
foreach ( array_keys($array) as $k ) {
|
387 |
-
if ( $array[$k] == $id ) {
|
388 |
-
unset ( $array[$k] );
|
389 |
-
$string = wppa_index_array_to_string($array);
|
390 |
-
if ( $string || $indexline['albums'] ) {
|
391 |
-
$wpdb->query("UPDATE `".WPPA_INDEX."` SET `photos` = '".$string."' WHERE `id` = ".$indexline['id']);
|
392 |
-
}
|
393 |
-
else {
|
394 |
-
$wpdb->query("DELETE FROM `".WPPA_INDEX."` WHERE `id` = ".$indexline['id']);
|
395 |
-
}
|
396 |
-
}
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
}
|
401 |
-
|
402 |
// Re-index an edited item
|
403 |
function wppa_index_update($type, $id) {
|
404 |
wppa_index_remove($type, $id);
|
@@ -424,14 +450,23 @@ function wppa_index_compute_skips() {
|
|
424 |
update_option( 'wppa_index_skips', $result );
|
425 |
}
|
426 |
|
427 |
-
// Find the raw text for album, all qTranslate languages
|
|
|
|
|
428 |
function wppa_index_get_raw_album( $id ) {
|
|
|
|
|
429 |
$album = wppa_cache_album( $id );
|
430 |
-
|
431 |
-
//
|
|
|
|
|
|
|
432 |
if ( wppa_switch( 'search_cats' ) ) {
|
433 |
$words .= ' '.$album['cats'];
|
434 |
}
|
|
|
|
|
435 |
return $words;
|
436 |
}
|
437 |
|
@@ -439,33 +474,15 @@ function wppa_index_get_raw_photo( $id ) {
|
|
439 |
global $wpdb;
|
440 |
|
441 |
$thumb = wppa_cache_thumb( $id );
|
442 |
-
|
443 |
-
$
|
444 |
-
$desc = wppa_filter_iptc( $desc, $thumb['id'] ); // Render IPTC tags
|
445 |
-
$desc = wppa_filter_exif( $desc, $thumb['id'] ); // Render EXIF tags
|
446 |
-
|
447 |
-
$custom = wppa_get_photo_item( $id, 'custom' );
|
448 |
-
if ( $custom ) {
|
449 |
-
$custom_data = unserialize( $custom );
|
450 |
-
for ( $i = 0; $i < 10; $i++ ) {
|
451 |
-
if ( wppa_switch( 'custom_visible_'.$i ) ) { // May be displayed
|
452 |
-
$desc = str_replace( 'w#cd'.$i, __( stripslashes( $custom_data[$i] ) ), $desc ); // Data
|
453 |
-
}
|
454 |
-
else {
|
455 |
-
$desc = str_replace( 'w#cd'.$i, '', $desc ); // Data
|
456 |
-
}
|
457 |
-
}
|
458 |
-
}
|
459 |
-
$words = stripslashes($thumb['name']).' '.$thumb['filename'].' '.$desc;
|
460 |
-
*/
|
461 |
-
$words = wppa_get_photo_desc( $id ) . ' ' . wppa_get_photo_name( $id );
|
462 |
|
463 |
if ( wppa_switch( 'search_tags' ) ) $words .= ' '.$thumb['tags']; // Tags
|
464 |
if ( wppa_switch( 'search_comments' ) ) {
|
465 |
$coms = $wpdb->get_results($wpdb->prepare( "SELECT `comment` FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved'", $thumb['id'] ), ARRAY_A );
|
466 |
if ( $coms ) {
|
467 |
foreach ( $coms as $com ) {
|
468 |
-
$words .= ' '.stripslashes( $com['comment'] );
|
469 |
}
|
470 |
}
|
471 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all indexing functions
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*
|
9 |
*/
|
10 |
|
11 |
// Add an item to the index
|
12 |
+
//
|
13 |
+
// @1: string. Type. Can be 'album' os 'photo'
|
14 |
+
// @2: int. Id. The id of the album or the photo.
|
15 |
+
//
|
16 |
+
// The actual addition of searchable words and ids into the index db table is handled in a cron job.
|
17 |
+
// If this function is called real-time, it simply notifys cron to scan all albums or photos on missing items.
|
18 |
function wppa_index_add( $type, $id ) {
|
19 |
global $wpdb;
|
20 |
global $acount;
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
+
// If album is gone, trigger cron to cleanup the index
|
37 |
+
if ( ! wppa_album_exists( $id ) ) {
|
38 |
+
wppa_schedule_maintenance_proc( 'wppa_cleanup_index' );
|
39 |
+
return;
|
40 |
+
}
|
41 |
|
42 |
// Find the raw text, all qTranslate languages
|
43 |
$words = wppa_index_get_raw_album( $id );
|
44 |
|
45 |
+
// Convert to santized array of indexable words
|
46 |
$words = wppa_index_raw_to_words( $words );
|
47 |
|
48 |
// Process all the words to see if they must be added to the index
|
49 |
foreach ( $words as $word ) {
|
50 |
|
51 |
// Get the row of the index table where the word is registered.
|
52 |
+
$indexline = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = %s", $word ), ARRAY_A );
|
53 |
|
54 |
// If this line does not exist yet, create it with only one album number as data
|
55 |
if ( ! $indexline ) {
|
56 |
wppa_create_index_entry( array( 'slug' => $word, 'albums' => $id ) );
|
57 |
+
wppa_log( 'Cron', 'Adding index slug {b}' . $word . '{/b} for album # {b}' . $id . '{/b}' );
|
58 |
}
|
59 |
|
60 |
+
// Index line already exitst, process this album id for this word
|
61 |
else {
|
62 |
|
63 |
// Convert existing album ids to an array
|
76 |
$newalbums = wppa_index_array_to_string( $oldalbums );
|
77 |
|
78 |
// Update db
|
79 |
+
$wpdb->query( $wpdb->prepare( "UPDATE `" . WPPA_INDEX . "` SET `albums` = %s WHERE `id` = %s", $newalbums, $indexline['id'] ) );
|
80 |
|
81 |
}
|
82 |
}
|
83 |
}
|
84 |
+
$acount++;
|
85 |
}
|
86 |
|
87 |
elseif ( $type == 'photo' ) {
|
97 |
return;
|
98 |
}
|
99 |
|
100 |
+
// Find the raw text, all qTranslate languages
|
101 |
+
$words = wppa_index_get_raw_photo( $id );
|
102 |
|
103 |
+
// Convert to santized array of indexable words
|
104 |
+
$words = wppa_index_raw_to_words( $words );
|
105 |
|
106 |
+
// Process all the words to see if they must be added to the index
|
107 |
foreach ( $words as $word ) {
|
108 |
+
|
109 |
+
// Get the row of the index table where the word is registered.
|
110 |
+
$indexline = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = %s", $word ), ARRAY_A );
|
111 |
+
|
112 |
+
// If this line does not exist yet, create it with only one album number as data
|
113 |
+
if ( ! $indexline ) {
|
114 |
wppa_create_index_entry( array( 'slug' => $word, 'photos' => $id ) );
|
115 |
+
wppa_log( 'Cron', 'Adding index slug {b}' . $word . '{/b} for photo # {b}' . $id . '{/b}' );
|
116 |
}
|
117 |
+
|
118 |
+
// Index line already exitst, process this photo id for this word
|
119 |
+
else {
|
120 |
+
|
121 |
+
// Convert existing album ids to an array
|
122 |
+
$oldphotos = wppa_index_string_to_array( $indexline['photos'] );
|
123 |
+
|
124 |
+
// If not in yet...
|
125 |
if ( ! in_array( $id, $oldphotos ) ) {
|
126 |
+
|
127 |
+
// Add it
|
128 |
$oldphotos[] = $id;
|
129 |
+
|
130 |
+
// Report addition
|
131 |
wppa_log( 'Cron', 'Adding photo # {b}'.$id.'{/b} to index slug {b}'.$word.'{/b}');
|
132 |
+
|
133 |
+
// Covert to string again
|
134 |
+
$newphotos = wppa_index_array_to_string( $oldphotos );
|
135 |
+
|
136 |
+
// Update db
|
137 |
+
$wpdb->query( $wpdb->prepare( "UPDATE `" . WPPA_INDEX . "` SET `photos` = %s WHERE `id` = %s", $newphotos, $indexline['id'] ) );
|
138 |
}
|
139 |
}
|
140 |
|
141 |
}
|
142 |
+
$pcount++;
|
143 |
}
|
144 |
|
145 |
+
else {
|
146 |
+
|
147 |
+
// Log error
|
148 |
+
wppa_log( 'Error, unimplemented type {b}' . $type . '{/b} in wppa_index_add().' );
|
149 |
+
}
|
150 |
}
|
151 |
|
152 |
// Convert raw data string to indexable word array
|
153 |
+
// Sanitizes any string and clips it into an array of potential slugs in the index db table.
|
154 |
+
//
|
155 |
+
// @1: string. Any test string may contain all kind of garbage.
|
156 |
+
//
|
157 |
+
function wppa_index_raw_to_words( $xtext ) {
|
158 |
|
159 |
+
// Find chars to be replaced by delimiters (spaces)
|
160 |
$ignore = array( '"', "'", '`', '\\', '>', '<', ',', ':', ';', '!', '?', '=', '_',
|
161 |
'[', ']', '(', ')', '{', '}', '..', '...', '....', "\n", "\r",
|
162 |
"\t", '.jpg', '.png', '.gif', ''', '&',
|
163 |
+
'w#cc0', 'w#cc1', 'w#cc2', 'w#cc3', 'w#cc4', 'w#cc5', 'w#cc6', 'w#cc7', 'w#cc8', 'w#cc9',
|
164 |
+
'w#cd0', 'w#cd1', 'w#cd2', 'w#cd3', 'w#cd4', 'w#cd5', 'w#cd6', 'w#cd7', 'w#cd8', 'w#cd9',
|
165 |
+
'#',
|
166 |
);
|
167 |
if ( wppa_switch( 'index_ignore_slash' ) ) {
|
168 |
$ignore[] = '/';
|
169 |
}
|
|
|
|
|
170 |
|
171 |
+
// Find words to skip
|
172 |
+
$skips = get_option( 'wppa_index_skips', array() );
|
173 |
+
|
174 |
+
// Find minimum token length
|
175 |
+
$minlen = wppa_opt( 'search_min_length' );
|
176 |
+
|
177 |
+
// Init results array
|
178 |
$result = array();
|
179 |
+
|
180 |
+
// Process text
|
181 |
if ( $xtext ) {
|
182 |
+
|
183 |
+
// Sanitize
|
184 |
+
// Uses downcase only
|
185 |
+
$text = strtolower( $xtext );
|
186 |
+
|
187 |
+
// Convert to real chars/symbols
|
188 |
+
$text = html_entity_decode( $text );
|
189 |
+
|
190 |
+
// strip style and script tags inclusive content
|
191 |
+
$text = wppa_strip_tags( $text, 'script&style' );
|
192 |
+
|
193 |
+
// Make sure <td>word1</td><td>word2</td> will not endup in 'word1word2', but in 'word1' 'word2'
|
194 |
+
$text = str_replace( '>', '> ', $text );
|
195 |
+
|
196 |
+
// Now strip remaining tags without stripping the content
|
197 |
+
$text = strip_tags( $text );
|
198 |
+
|
199 |
+
// Strip qTranslate language shortcodes: [:*]
|
200 |
+
$text = preg_replace( '/\[:..\]|\[:\]/', ' ', $text );
|
201 |
+
|
202 |
+
// Replace ignorable chars and words by delimiters ( $ignore is an array )
|
203 |
+
$text = str_replace( $ignore, ' ', $text );
|
204 |
+
|
205 |
+
// Remove accents
|
206 |
+
$text = str_replace( array( 'è', 'é', 'ë'), 'e', $text );
|
207 |
+
$text = str_replace( array( 'ò', 'ó', 'ö'), 'o', $text );
|
208 |
+
$text = str_replace( array( 'à', 'á', 'ä'), 'a', $text );
|
209 |
+
$text = str_replace( array( 'ù', 'ú', 'ü'), 'u', $text );
|
210 |
+
$text = str_replace( array( 'ì', 'í', 'ï'), 'i', $text );
|
211 |
+
$text = str_replace( 'ç', 'c', $text );
|
212 |
+
|
213 |
+
// Trim
|
214 |
+
$text = trim( $text );
|
215 |
+
$text = trim( $text, " ./-" );
|
216 |
+
|
217 |
+
// Replace multiple space chars by one space char
|
218 |
+
while ( strpos( $text, ' ' ) ) {
|
219 |
+
$text = str_replace( ' ', ' ', $text );
|
220 |
+
}
|
221 |
+
|
222 |
+
// Convert to array
|
223 |
+
$words = explode( ' ', $text );
|
224 |
+
|
225 |
+
// Decide for each word if it is in
|
226 |
foreach ( $words as $word ) {
|
227 |
+
|
228 |
+
// Trim word
|
229 |
+
$word = trim( $word );
|
230 |
+
$word = trim( $word, " ./-" );
|
231 |
+
|
232 |
+
// If lare enough and not a word to skip, use it: copy to array $result
|
233 |
+
if ( strlen( $word ) >= $minlen && ! in_array( $word, $skips ) ) {
|
234 |
+
$result[] = $word;
|
235 |
+
}
|
236 |
+
|
237 |
+
// If the word contains (a) dashe(s), also process the fractions before/between/after the dash(es)
|
238 |
+
if ( strpos( $word, '-' ) !== false ) {
|
239 |
+
|
240 |
+
// Break word into fragments
|
241 |
+
$fracts = explode( '-', $word );
|
242 |
foreach ( $fracts as $fract ) {
|
243 |
+
|
244 |
+
// Trim
|
245 |
+
$fract = trim( $fract );
|
246 |
+
$fract = trim( $fract, " ./-" );
|
247 |
+
|
248 |
+
// If lare enough and not a word to skip, use it: copy to array $result
|
249 |
+
if ( strlen( $fract ) >= $minlen && ! in_array( $fract, $skips ) ) {
|
250 |
+
$result[] = $fract;
|
251 |
+
}
|
252 |
}
|
253 |
}
|
254 |
}
|
257 |
// Remove numbers optionaly
|
258 |
if ( wppa_switch( 'search_numbers_void' ) ) {
|
259 |
foreach ( array_keys( $result ) as $key ) {
|
260 |
+
|
261 |
+
// Strip leading zeroes
|
262 |
+
$t = ltrim( $result[$key], '0' );
|
263 |
+
|
264 |
+
// If nothing left (zoroes only) or numeric, discard it
|
265 |
if ( ! $t || is_numeric( $t ) ) {
|
266 |
unset( $result[$key] );
|
267 |
}
|
271 |
// Remove dups and sort
|
272 |
$result = array_unique( $result );
|
273 |
|
274 |
+
// Done !
|
275 |
return $result;
|
276 |
+
|
277 |
}
|
278 |
|
279 |
// Expand compressed string
|
425 |
$wpdb->query( "DELETE FROM `".WPPA_INDEX."` WHERE `albums` = '' AND `photos` = ''" ); // Cleanup empty entries
|
426 |
}
|
427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
// Re-index an edited item
|
429 |
function wppa_index_update($type, $id) {
|
430 |
wppa_index_remove($type, $id);
|
450 |
update_option( 'wppa_index_skips', $result );
|
451 |
}
|
452 |
|
453 |
+
// Find the raw text for indexing album, all qTranslate languages
|
454 |
+
//
|
455 |
+
// @1: int: album id
|
456 |
function wppa_index_get_raw_album( $id ) {
|
457 |
+
|
458 |
+
// Get the album data
|
459 |
$album = wppa_cache_album( $id );
|
460 |
+
|
461 |
+
// Get words from name and description
|
462 |
+
$words = wppa_get_album_desc( $id, array( 'translate' => false ) ) . ' ' . wppa_get_album_name( $id, array( 'translate' => false ) );
|
463 |
+
|
464 |
+
// Optionally album categories
|
465 |
if ( wppa_switch( 'search_cats' ) ) {
|
466 |
$words .= ' '.$album['cats'];
|
467 |
}
|
468 |
+
|
469 |
+
// Done!
|
470 |
return $words;
|
471 |
}
|
472 |
|
474 |
global $wpdb;
|
475 |
|
476 |
$thumb = wppa_cache_thumb( $id );
|
477 |
+
|
478 |
+
$words = wppa_get_photo_desc( $id, array( 'translate' => false ) ) . ' ' . wppa_get_photo_name( $id, array( 'translate' => false ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
|
480 |
if ( wppa_switch( 'search_tags' ) ) $words .= ' '.$thumb['tags']; // Tags
|
481 |
if ( wppa_switch( 'search_comments' ) ) {
|
482 |
$coms = $wpdb->get_results($wpdb->prepare( "SELECT `comment` FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved'", $thumb['id'] ), ARRAY_A );
|
483 |
if ( $coms ) {
|
484 |
foreach ( $coms as $com ) {
|
485 |
+
$words .= ' ' . stripslashes( $com['comment'] );
|
486 |
}
|
487 |
}
|
488 |
}
|
wppa-items.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains functions to retrieve album and photo items
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -217,7 +217,8 @@ static $thumb_cache_2;
|
|
217 |
}
|
218 |
|
219 |
// get the name of a full sized image
|
220 |
-
function wppa_get_photo_name( $id, $add_owner = false, $add_medal = false, $esc_js = false, $show_name = true ) {
|
|
|
221 |
|
222 |
// Init
|
223 |
$result = '';
|
@@ -228,19 +229,28 @@ function wppa_get_photo_name( $id, $add_owner = false, $add_medal = false, $esc_
|
|
228 |
return '';
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
// Get data
|
232 |
$thumb = wppa_cache_thumb( $id );
|
233 |
-
if ( $
|
234 |
$result .= __( stripslashes( $thumb['name'] ) , 'wp-photo-album-plus');
|
235 |
}
|
236 |
|
237 |
// Add owner?
|
238 |
-
if ( $
|
239 |
$user = wppa_get_user_by( 'login', $thumb['owner'] );
|
240 |
if ( $user ) {
|
241 |
-
if ( $
|
242 |
if ( wppa_switch( 'owner_on_new_line' ) ) {
|
243 |
-
if ( ! $
|
244 |
$result .= '<br />';
|
245 |
}
|
246 |
else {
|
@@ -259,10 +269,10 @@ function wppa_get_photo_name( $id, $add_owner = false, $add_medal = false, $esc_
|
|
259 |
}
|
260 |
|
261 |
// For js use?
|
262 |
-
if ( $
|
263 |
|
264 |
// Medal?
|
265 |
-
if ( $
|
266 |
$color = wppa_opt( 'medal_color' );
|
267 |
$wppa_url = is_ssl() ? str_replace( 'http://', 'https://', WPPA_URL ) : WPPA_URL; // Probably redundant... but it is not clear in to the codex if plugins_url() returns https
|
268 |
if ( $thumb['status'] == 'gold' ) $result .= '<img src="'.$wppa_url.'/img/medal_gold_'.$color.'.png" title="'.esc_attr(__('Gold medal', 'wp-photo-album-plus')).'" alt="'.__('Gold', 'wp-photo-album-plus').'" style="border:none; margin:0; padding:0; box-shadow:none; height:32px;" />';
|
@@ -279,11 +289,14 @@ function wppa_get_photo_name( $id, $add_owner = false, $add_medal = false, $esc_
|
|
279 |
$result = strip_shortcodes( $result );
|
280 |
}
|
281 |
|
|
|
|
|
|
|
282 |
return $result;
|
283 |
}
|
284 |
|
285 |
// get the description of an image
|
286 |
-
function wppa_get_photo_desc( $id, $
|
287 |
|
288 |
// Verify args
|
289 |
if ( ! is_numeric( $id ) || $id < '1' ) {
|
@@ -291,6 +304,13 @@ function wppa_get_photo_desc( $id, $do_shortcodes = false, $do_geo = false ) {
|
|
291 |
return '';
|
292 |
}
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
// Get data
|
295 |
$thumb = wppa_cache_thumb( $id );
|
296 |
$desc = $thumb['description']; // Raw data
|
@@ -301,7 +321,7 @@ function wppa_get_photo_desc( $id, $do_shortcodes = false, $do_geo = false ) {
|
|
301 |
$desc = str_replace( array( '%%wppa%%', '[wppa', '[/wppa]' ), array( '%-wppa-%', '{wppa', '{/wppa}' ), $desc );
|
302 |
|
303 |
// Geo
|
304 |
-
if ( $thumb['location'] && ! wppa_in_widget() && strpos( wppa_opt( 'custom_content' ), 'w#location' ) !== false && $
|
305 |
wppa_do_geo( $id, $thumb['location'] );
|
306 |
}
|
307 |
|
@@ -309,7 +329,7 @@ function wppa_get_photo_desc( $id, $do_shortcodes = false, $do_geo = false ) {
|
|
309 |
$desc = wppa_translate_photo_keywords( $id, $desc );
|
310 |
|
311 |
// Shortcodes
|
312 |
-
if ( $
|
313 |
else $desc = strip_shortcodes( $desc ); // Remove shortcodes if not wanted
|
314 |
|
315 |
$desc = wppa_html( $desc ); // Enable html
|
@@ -417,50 +437,93 @@ function wppa_translate_photo_keywords( $id, $text ) {
|
|
417 |
}
|
418 |
|
419 |
// get album name
|
420 |
-
function wppa_get_album_name( $id, $extended = false ) {
|
421 |
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
$album = false;
|
427 |
}
|
428 |
|
429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
|
431 |
-
if ( $extended ) {
|
432 |
if ( $id == '0' ) {
|
433 |
-
|
|
|
|
|
|
|
|
|
|
|
434 |
return $name;
|
435 |
}
|
436 |
if ( $id == '-1' ) {
|
437 |
-
|
|
|
|
|
|
|
|
|
|
|
438 |
return $name;
|
439 |
}
|
440 |
if ( $id == '-2' ) {
|
441 |
-
|
|
|
|
|
|
|
|
|
|
|
442 |
return $name;
|
443 |
}
|
444 |
if ( $id == '-3' ) {
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
446 |
return $name;
|
447 |
}
|
448 |
if ( $id == '-9' ) {
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
450 |
return $name;
|
451 |
}
|
452 |
-
if ( $
|
453 |
$name = $album['name'];
|
454 |
return $name;
|
455 |
}
|
456 |
}
|
457 |
else {
|
458 |
if ( $id == '-2' ) {
|
459 |
-
|
|
|
|
|
|
|
|
|
|
|
460 |
return $name;
|
461 |
}
|
462 |
if ( $id == '-3' ) {
|
463 |
-
|
|
|
|
|
|
|
|
|
|
|
464 |
}
|
465 |
}
|
466 |
|
@@ -469,15 +532,25 @@ function wppa_get_album_name( $id, $extended = false ) {
|
|
469 |
return '';
|
470 |
}
|
471 |
elseif ( ! is_numeric( $id ) || $id < '1' ) {
|
472 |
-
wppa_dbg_msg( 'Invalid arg wppa_get_album_name( '.$id.', '
|
473 |
return '';
|
474 |
}
|
475 |
else {
|
476 |
if ( ! $album ) {
|
477 |
-
|
|
|
|
|
|
|
|
|
|
|
478 |
}
|
479 |
else {
|
480 |
-
|
|
|
|
|
|
|
|
|
|
|
481 |
}
|
482 |
}
|
483 |
|
@@ -494,19 +567,47 @@ function wppa_get_album_name( $id, $extended = false ) {
|
|
494 |
}
|
495 |
|
496 |
// get album description
|
497 |
-
function wppa_get_album_desc( $id ) {
|
498 |
|
499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
$album = wppa_cache_album( $id );
|
501 |
-
|
502 |
-
|
503 |
-
$desc =
|
504 |
-
|
505 |
-
|
506 |
-
|
|
|
|
|
|
|
|
|
|
|
507 |
|
508 |
// Album keywords
|
509 |
-
$desc = wppa_translate_album_keywords( $id, $desc );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
|
511 |
// To prevent recursive rendering of scripts or shortcodes:
|
512 |
$desc = str_replace( array( '%%wppa%%', '[wppa', '[/wppa]' ), array( '%-wppa-%', '{wppa', '{/wppa}' ), $desc );
|
@@ -534,15 +635,18 @@ function wppa_get_album_desc( $id ) {
|
|
534 |
$desc = wpautop( $desc );
|
535 |
break;
|
536 |
default:
|
537 |
-
wppa_log('Err', 'Unimplemented option value: '.wppa_opt( 'wpautop_on_album_desc' ).' for wppa_opt( \'wpautop_on_album_desc\' )' );
|
538 |
|
539 |
}
|
|
|
|
|
540 |
return $desc;
|
541 |
}
|
542 |
|
543 |
// Translate album keywords
|
544 |
-
function wppa_translate_album_keywords( $id, $text ) {
|
545 |
|
|
|
546 |
$result = $text;
|
547 |
|
548 |
// Does album exist and is there any 'w#' ?
|
@@ -554,11 +658,23 @@ function wppa_translate_album_keywords( $id, $text ) {
|
|
554 |
// Keywords
|
555 |
$keywords = array( 'name', 'owner', 'id', 'views' );
|
556 |
foreach ( $keywords as $keyword ) {
|
557 |
-
$replacement =
|
558 |
-
if ( $
|
|
|
|
|
|
|
|
|
559 |
$result = str_replace( 'w#'.$keyword, $replacement, $result );
|
560 |
}
|
561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
// Timestamps
|
563 |
$timestamps = array( 'timestamp', 'modified' );
|
564 |
foreach ( $timestamps as $timestamp ) {
|
@@ -566,19 +682,29 @@ function wppa_translate_album_keywords( $id, $text ) {
|
|
566 |
$result = str_replace( 'w#'.$timestamp, wppa_local_date( get_option( 'date_format', "F j, Y," ).' '.get_option( 'time_format', "g:i a" ), $album['timestamp'] ), $result );
|
567 |
}
|
568 |
else {
|
569 |
-
$result = str_replace( 'w#'.$timestamp, '‹'.__('unknown', 'wp-photo-album-plus').'›', $result );
|
570 |
}
|
571 |
}
|
572 |
|
573 |
// Custom data fields
|
574 |
-
if ( wppa_switch( '
|
|
|
|
|
575 |
$custom = $album['custom'];
|
576 |
$custom_data = $custom ? unserialize( $custom ) : array( '', '', '', '', '', '', '', '', '', '' );
|
|
|
|
|
577 |
for ( $i = '0'; $i < '10'; $i++ ) {
|
578 |
if ( wppa_opt( 'album_custom_caption_'.$i ) ) { // Field defined
|
579 |
if ( wppa_switch( 'album_custom_visible_'.$i ) ) { // May be displayed
|
580 |
-
|
581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
}
|
583 |
else { // May not be displayed
|
584 |
$result = str_replace( 'w#cc'.$i, '', $result ); // Remove
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains functions to retrieve album and photo items
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
217 |
}
|
218 |
|
219 |
// get the name of a full sized image
|
220 |
+
//function wppa_get_photo_name( $id, $add_owner = false, $add_medal = false, $esc_js = false, $show_name = true ) {
|
221 |
+
function wppa_get_photo_name( $id, $xargs = array() ) {
|
222 |
|
223 |
// Init
|
224 |
$result = '';
|
229 |
return '';
|
230 |
}
|
231 |
|
232 |
+
// Fill in the optional args
|
233 |
+
$defaults = array( 'translate' => true,
|
234 |
+
'addowner' => false,
|
235 |
+
'addmedal' => false,
|
236 |
+
'escjs' => false,
|
237 |
+
'showname' => true,
|
238 |
+
);
|
239 |
+
$args = wp_parse_args( $xargs, $defaults );
|
240 |
+
|
241 |
// Get data
|
242 |
$thumb = wppa_cache_thumb( $id );
|
243 |
+
if ( $args['showname'] ) {
|
244 |
$result .= __( stripslashes( $thumb['name'] ) , 'wp-photo-album-plus');
|
245 |
}
|
246 |
|
247 |
// Add owner?
|
248 |
+
if ( $args['addowner'] ) {
|
249 |
$user = wppa_get_user_by( 'login', $thumb['owner'] );
|
250 |
if ( $user ) {
|
251 |
+
if ( $args['showname'] ) {
|
252 |
if ( wppa_switch( 'owner_on_new_line' ) ) {
|
253 |
+
if ( ! $args['escjs'] ) {
|
254 |
$result .= '<br />';
|
255 |
}
|
256 |
else {
|
269 |
}
|
270 |
|
271 |
// For js use?
|
272 |
+
if ( $args['escjs'] ) $result = esc_js( $result );
|
273 |
|
274 |
// Medal?
|
275 |
+
if ( $args['addmedal'] ) {
|
276 |
$color = wppa_opt( 'medal_color' );
|
277 |
$wppa_url = is_ssl() ? str_replace( 'http://', 'https://', WPPA_URL ) : WPPA_URL; // Probably redundant... but it is not clear in to the codex if plugins_url() returns https
|
278 |
if ( $thumb['status'] == 'gold' ) $result .= '<img src="'.$wppa_url.'/img/medal_gold_'.$color.'.png" title="'.esc_attr(__('Gold medal', 'wp-photo-album-plus')).'" alt="'.__('Gold', 'wp-photo-album-plus').'" style="border:none; margin:0; padding:0; box-shadow:none; height:32px;" />';
|
289 |
$result = strip_shortcodes( $result );
|
290 |
}
|
291 |
|
292 |
+
// Translate keywords
|
293 |
+
$result = str_replace( 'w#id', $id, $result );
|
294 |
+
|
295 |
return $result;
|
296 |
}
|
297 |
|
298 |
// get the description of an image
|
299 |
+
function wppa_get_photo_desc( $id, $xargs = array() ) {
|
300 |
|
301 |
// Verify args
|
302 |
if ( ! is_numeric( $id ) || $id < '1' ) {
|
304 |
return '';
|
305 |
}
|
306 |
|
307 |
+
// Fill in the optional args
|
308 |
+
$defaults = array( 'translate' => true,
|
309 |
+
'doshortcodes' => false,
|
310 |
+
'dogeo' => false,
|
311 |
+
);
|
312 |
+
$args = wp_parse_args( $xargs, $defaults );
|
313 |
+
|
314 |
// Get data
|
315 |
$thumb = wppa_cache_thumb( $id );
|
316 |
$desc = $thumb['description']; // Raw data
|
321 |
$desc = str_replace( array( '%%wppa%%', '[wppa', '[/wppa]' ), array( '%-wppa-%', '{wppa', '{/wppa}' ), $desc );
|
322 |
|
323 |
// Geo
|
324 |
+
if ( $thumb['location'] && ! wppa_in_widget() && strpos( wppa_opt( 'custom_content' ), 'w#location' ) !== false && $args['dogeo'] ) {
|
325 |
wppa_do_geo( $id, $thumb['location'] );
|
326 |
}
|
327 |
|
329 |
$desc = wppa_translate_photo_keywords( $id, $desc );
|
330 |
|
331 |
// Shortcodes
|
332 |
+
if ( $args['doshortcodes'] ) $desc = do_shortcode( $desc ); // Do shortcodes if wanted
|
333 |
else $desc = strip_shortcodes( $desc ); // Remove shortcodes if not wanted
|
334 |
|
335 |
$desc = wppa_html( $desc ); // Enable html
|
437 |
}
|
438 |
|
439 |
// get album name
|
440 |
+
function wppa_get_album_name( $id, $xargs = array() ) { // $extended = false ) {
|
441 |
|
442 |
+
// Sanitize args
|
443 |
+
if ( ! is_numeric( $id ) ) {
|
444 |
+
wppa_dbg_msg( 'Invalid arg wppa_get_album_name(' . $id . ')', 'red' );
|
445 |
+
return '';
|
|
|
446 |
}
|
447 |
|
448 |
+
// Fill in the optional args
|
449 |
+
$defaults = array( 'translate' => true,
|
450 |
+
'extended' => false,
|
451 |
+
'raw' => false,
|
452 |
+
);
|
453 |
+
$args = wp_parse_args( $xargs, $defaults );
|
454 |
+
|
455 |
+
// Init
|
456 |
+
$album = $id > '0' ? wppa_cache_album( $id ) : false;
|
457 |
+
$name = '';
|
458 |
|
459 |
+
if ( $args['extended'] ) {
|
460 |
if ( $id == '0' ) {
|
461 |
+
if ( $args['translate'] ) {
|
462 |
+
$name = __( '--- none ---', 'wp-photo-album-plus' );
|
463 |
+
}
|
464 |
+
else {
|
465 |
+
$name = '--- none ---';
|
466 |
+
}
|
467 |
return $name;
|
468 |
}
|
469 |
if ( $id == '-1' ) {
|
470 |
+
if ( $args['translate'] ) {
|
471 |
+
$name = __( '--- separate ---', 'wp-photo-album-plus' );
|
472 |
+
}
|
473 |
+
else {
|
474 |
+
$name = '--- separate ---';
|
475 |
+
}
|
476 |
return $name;
|
477 |
}
|
478 |
if ( $id == '-2' ) {
|
479 |
+
if ( $args['translate'] ) {
|
480 |
+
$name = __( '--- all ---', 'wp-photo-album-plus' );
|
481 |
+
}
|
482 |
+
else {
|
483 |
+
$name = '--- all ---';
|
484 |
+
}
|
485 |
return $name;
|
486 |
}
|
487 |
if ( $id == '-3' ) {
|
488 |
+
if ( $args['translate'] ) {
|
489 |
+
$name = __( '--- owner/public ---', 'wp-photo-album-plus' );
|
490 |
+
}
|
491 |
+
else {
|
492 |
+
$name = '--- owner/public ---';
|
493 |
+
}
|
494 |
return $name;
|
495 |
}
|
496 |
if ( $id == '-9' ) {
|
497 |
+
if ( $args['translate'] ) {
|
498 |
+
$name = __( '--- deleted ---', 'wp-photo-album-plus' );
|
499 |
+
}
|
500 |
+
else {
|
501 |
+
$name = '--- deleted ---';
|
502 |
+
}
|
503 |
return $name;
|
504 |
}
|
505 |
+
if ( $args['raw'] ) {
|
506 |
$name = $album['name'];
|
507 |
return $name;
|
508 |
}
|
509 |
}
|
510 |
else {
|
511 |
if ( $id == '-2' ) {
|
512 |
+
if ( $args['translate'] ) {
|
513 |
+
$name = __( 'All Albums', 'wp-photo-album-plus' );
|
514 |
+
}
|
515 |
+
else {
|
516 |
+
$name = 'All Albums';
|
517 |
+
}
|
518 |
return $name;
|
519 |
}
|
520 |
if ( $id == '-3' ) {
|
521 |
+
if ( $args['translate'] ) {
|
522 |
+
$name = __( 'My and public albums', 'wp-photo-album-plus' );
|
523 |
+
}
|
524 |
+
else {
|
525 |
+
$name = 'My and public albums';
|
526 |
+
}
|
527 |
}
|
528 |
}
|
529 |
|
532 |
return '';
|
533 |
}
|
534 |
elseif ( ! is_numeric( $id ) || $id < '1' ) {
|
535 |
+
wppa_dbg_msg( 'Invalid arg wppa_get_album_name( '.$id.', ' . $args['extended'] . ' )', 'red' );
|
536 |
return '';
|
537 |
}
|
538 |
else {
|
539 |
if ( ! $album ) {
|
540 |
+
if ( $args['translate'] ) {
|
541 |
+
$name = __( '--- deleted ---', 'wp-photo-album-plus');
|
542 |
+
}
|
543 |
+
else {
|
544 |
+
$name = '--- deleted ---';
|
545 |
+
}
|
546 |
}
|
547 |
else {
|
548 |
+
if ( $args['translate'] ) {
|
549 |
+
$name = __( stripslashes( $album['name'] ) );
|
550 |
+
}
|
551 |
+
else {
|
552 |
+
$name = stripslashes( $album['name'] );
|
553 |
+
}
|
554 |
}
|
555 |
}
|
556 |
|
567 |
}
|
568 |
|
569 |
// get album description
|
570 |
+
function wppa_get_album_desc( $id, $xargs = array() ) {
|
571 |
|
572 |
+
// Sanitize args
|
573 |
+
if ( ! is_numeric( $id ) || $id < '1' ) {
|
574 |
+
wppa_dbg_msg( 'Invalid arg wppa_get_album_desc(' . $id . ')', 'red' );
|
575 |
+
return '';
|
576 |
+
}
|
577 |
+
|
578 |
+
// Fill in the optional args
|
579 |
+
$defaults = array( 'translate' => true );
|
580 |
+
$args = wp_parse_args( $xargs, $defaults );
|
581 |
+
|
582 |
+
// Get the album data
|
583 |
$album = wppa_cache_album( $id );
|
584 |
+
|
585 |
+
// Raw data
|
586 |
+
$desc = $album['description'];
|
587 |
+
|
588 |
+
// No content, need no filtering
|
589 |
+
if ( ! $desc ) {
|
590 |
+
return '';
|
591 |
+
}
|
592 |
+
|
593 |
+
// Unescape
|
594 |
+
$desc = stripslashes( $desc );
|
595 |
|
596 |
// Album keywords
|
597 |
+
$desc = wppa_translate_album_keywords( $id, $desc, $args['translate'] );
|
598 |
+
|
599 |
+
// Optionally translate
|
600 |
+
if ( $args['translate'] ) {
|
601 |
+
|
602 |
+
// qTranslate
|
603 |
+
$desc = __( $desc );
|
604 |
+
}
|
605 |
+
|
606 |
+
// Enable or strip html
|
607 |
+
$desc = wppa_html( $desc );
|
608 |
+
|
609 |
+
// Balance tags
|
610 |
+
$desc = balanceTags( $desc, true );
|
611 |
|
612 |
// To prevent recursive rendering of scripts or shortcodes:
|
613 |
$desc = str_replace( array( '%%wppa%%', '[wppa', '[/wppa]' ), array( '%-wppa-%', '{wppa', '{/wppa}' ), $desc );
|
635 |
$desc = wpautop( $desc );
|
636 |
break;
|
637 |
default:
|
638 |
+
wppa_log('Err', 'Unimplemented option value: ' . wppa_opt( 'wpautop_on_album_desc' ) . ' for wppa_opt( \'wpautop_on_album_desc\' )' );
|
639 |
|
640 |
}
|
641 |
+
|
642 |
+
// Done!
|
643 |
return $desc;
|
644 |
}
|
645 |
|
646 |
// Translate album keywords
|
647 |
+
function wppa_translate_album_keywords( $id, $text, $translate = true ) {
|
648 |
|
649 |
+
// Init
|
650 |
$result = $text;
|
651 |
|
652 |
// Does album exist and is there any 'w#' ?
|
658 |
// Keywords
|
659 |
$keywords = array( 'name', 'owner', 'id', 'views' );
|
660 |
foreach ( $keywords as $keyword ) {
|
661 |
+
$replacement = trim( stripslashes( $album[$keyword] ) );
|
662 |
+
if ( $translate ) {
|
663 |
+
$replacement = __( $replacement );
|
664 |
+
}
|
665 |
+
|
666 |
+
if ( $replacement == '' ) $replacement = '‹' . __( 'none' , 'wp-photo-album-plus' ) . '›';
|
667 |
$result = str_replace( 'w#'.$keyword, $replacement, $result );
|
668 |
}
|
669 |
|
670 |
+
// FS views
|
671 |
+
if ( strpos( $result, 'w#fsviews' ) !== false ) {
|
672 |
+
|
673 |
+
$treecounts = wppa_get_treecounts_a( $id );
|
674 |
+
$count = $treecounts['selfphotoviews'];
|
675 |
+
$result = str_replace( 'w#fsviews', $count, $result );
|
676 |
+
}
|
677 |
+
|
678 |
// Timestamps
|
679 |
$timestamps = array( 'timestamp', 'modified' );
|
680 |
foreach ( $timestamps as $timestamp ) {
|
682 |
$result = str_replace( 'w#'.$timestamp, wppa_local_date( get_option( 'date_format', "F j, Y," ).' '.get_option( 'time_format', "g:i a" ), $album['timestamp'] ), $result );
|
683 |
}
|
684 |
else {
|
685 |
+
$result = str_replace( 'w#'.$timestamp, '‹' . __( 'unknown', 'wp-photo-album-plus' ) . '›', $result );
|
686 |
}
|
687 |
}
|
688 |
|
689 |
// Custom data fields
|
690 |
+
if ( wppa_switch( 'album_custom_fields' ) ) {
|
691 |
+
|
692 |
+
// Get raw data
|
693 |
$custom = $album['custom'];
|
694 |
$custom_data = $custom ? unserialize( $custom ) : array( '', '', '', '', '', '', '', '', '', '' );
|
695 |
+
|
696 |
+
// Process max all 10 sub-items
|
697 |
for ( $i = '0'; $i < '10'; $i++ ) {
|
698 |
if ( wppa_opt( 'album_custom_caption_'.$i ) ) { // Field defined
|
699 |
if ( wppa_switch( 'album_custom_visible_'.$i ) ) { // May be displayed
|
700 |
+
if ( $translate ) {
|
701 |
+
$result = str_replace( 'w#cc'.$i, __( wppa_opt( 'album_custom_caption_'.$i ) ) . ':', $result ); // Caption
|
702 |
+
$result = str_replace( 'w#cd'.$i, __( stripslashes( $custom_data[$i] ) ), $result ); // Data
|
703 |
+
}
|
704 |
+
else {
|
705 |
+
$result = str_replace( 'w#cc'.$i, wppa_opt( 'album_custom_caption_' . $i ) . ':', $result ); // Caption
|
706 |
+
$result = str_replace( 'w#cd'.$i, stripslashes( $custom_data[$i] ), $result ); // Data
|
707 |
+
}
|
708 |
}
|
709 |
else { // May not be displayed
|
710 |
$result = str_replace( 'w#cc'.$i, '', $result ); // Remove
|
wppa-non-admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the non admin stuff
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -660,12 +660,13 @@ function wppa_add_page_specific_urls() {
|
|
660 |
$result = '
|
661 |
<!-- WPPA+ BEGIN Page specific urls and device specific data -->
|
662 |
<script type="text/javascript">
|
663 |
-
wppaImageDirectory = "'.wppa_get_imgdir().'";
|
664 |
-
wppaWppaUrl = "'.wppa_get_wppa_url().'";
|
665 |
-
wppaIncludeUrl = "'.trim( includes_url(), '/' ).'";
|
666 |
-
wppaAjaxUrl = "'.( wppa_switch( 'ajax_non_admin' ) ? wppa_url( 'wppa-ajax-front.php' ) : admin_url( 'admin-ajax.php' ) ).'";
|
667 |
-
wppaUploadUrl = "'.WPPA_UPLOAD_URL.'";
|
668 |
-
wppaIsIe = '.( wppa_is_ie() ? 'true' : 'false' ).';
|
|
|
669 |
wppaSlideshowNavigationType = "' . wppa_get_navigation_type() . '";
|
670 |
</script>
|
671 |
<!-- WPPA+ END Page specific urls -->';
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the non admin stuff
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
660 |
$result = '
|
661 |
<!-- WPPA+ BEGIN Page specific urls and device specific data -->
|
662 |
<script type="text/javascript">
|
663 |
+
wppaImageDirectory = "' . wppa_get_imgdir() . '";
|
664 |
+
wppaWppaUrl = "' . wppa_get_wppa_url() . '";
|
665 |
+
wppaIncludeUrl = "' . trim( includes_url(), '/' ) . '";
|
666 |
+
wppaAjaxUrl = "' . ( wppa_switch( 'ajax_non_admin' ) ? wppa_url( 'wppa-ajax-front.php' ) : admin_url( 'admin-ajax.php' ) ) . '";
|
667 |
+
wppaUploadUrl = "' . WPPA_UPLOAD_URL . '";
|
668 |
+
wppaIsIe = ' . ( wppa_is_ie() ? 'true' : 'false' ) . ';
|
669 |
+
wppaIsSafari = ' . ( wppa_is_safari() ? 'true' : 'false' ) . ';
|
670 |
wppaSlideshowNavigationType = "' . wppa_get_navigation_type() . '";
|
671 |
</script>
|
672 |
<!-- WPPA+ END Page specific urls -->';
|
wppa-settings-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -8419,9 +8419,10 @@ if ( strpos( $_SERVER['SERVER_NAME'], 'opajaap' ) !== false ) {
|
|
8419 |
__('Filename without extension', 'wp-photo-album-plus'),
|
8420 |
__('IPTC Tag 2#005 (Graphic name)', 'wp-photo-album-plus'),
|
8421 |
__('IPTC Tag 2#120 (Caption)', 'wp-photo-album-plus'),
|
8422 |
-
__('No name at all', 'wp-photo-album-plus')
|
|
|
8423 |
);
|
8424 |
-
$vals = array( 'filename', 'noext', '2#005', '2#120', 'none' );
|
8425 |
$html = wppa_select($slug, $opts, $vals);
|
8426 |
$clas = '';
|
8427 |
$tags = 'system,meta,album';
|
@@ -9530,9 +9531,73 @@ if ( strpos( $_SERVER['SERVER_NAME'], 'opajaap' ) !== false ) {
|
|
9530 |
$clas = 'wppa_fotomoto';
|
9531 |
$tags = 'system';
|
9532 |
wppa_setting($slug, '6.3', $name, $desc, $html, $help, $clas, $tags);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9533 |
}
|
9534 |
?>
|
9535 |
|
|
|
|
|
9536 |
</tbody>
|
9537 |
<tfoot style="font-weight: bold;" class="wppa_table_9">
|
9538 |
<tr>
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
8419 |
__('Filename without extension', 'wp-photo-album-plus'),
|
8420 |
__('IPTC Tag 2#005 (Graphic name)', 'wp-photo-album-plus'),
|
8421 |
__('IPTC Tag 2#120 (Caption)', 'wp-photo-album-plus'),
|
8422 |
+
__('No name at all', 'wp-photo-album-plus'),
|
8423 |
+
__('Photo w#id (literally)', 'wp-photo-album-plus'),
|
8424 |
);
|
8425 |
+
$vals = array( 'filename', 'noext', '2#005', '2#120', 'none', 'Photo w#id' );
|
8426 |
$html = wppa_select($slug, $opts, $vals);
|
8427 |
$clas = '';
|
8428 |
$tags = 'system,meta,album';
|
9531 |
$clas = 'wppa_fotomoto';
|
9532 |
$tags = 'system';
|
9533 |
wppa_setting($slug, '6.3', $name, $desc, $html, $help, $clas, $tags);
|
9534 |
+
}
|
9535 |
+
|
9536 |
+
wppa_setting_subheader( 'L', '1', __( 'Photo shortcode related settings' , 'wp-photo-album-plus') );
|
9537 |
+
{
|
9538 |
+
$name = __('Enable shortcode [photo ..]', 'wp-photo-album-plus');
|
9539 |
+
$desc = __('Make the use of shortcode [photo ..] possible', 'wp-photo-album-plus');
|
9540 |
+
$help = esc_js(__('Only disbale this when there is a conflict with another plugin', 'wp-photo-album-plus'));
|
9541 |
+
$slug = 'wppa_photo_shortcode_enabled';
|
9542 |
+
$html = wppa_checkbox($slug);
|
9543 |
+
$clas = '';
|
9544 |
+
$tags = 'system';
|
9545 |
+
wppa_setting($slug, '1', $name, $desc, $html, $help, $clas, $tags);
|
9546 |
+
|
9547 |
+
$name = __('Single image type', 'wp-photo-album-plus');
|
9548 |
+
$desc = __('Specify the single image type the shortcode [photo ..] should show.', 'wp-photo-album-plus');
|
9549 |
+
$help = '';
|
9550 |
+
$slug = 'wppa_photo_shortcode_type';
|
9551 |
+
$opts = array( __('A plain single photo', 'wp-photo-album-plus'),
|
9552 |
+
__('A single photo with caption', 'wp-photo-album-plus'),
|
9553 |
+
__('A single photo with extended caption', 'wp-photo-album-plus'),
|
9554 |
+
__('A single photo in the style of a slideshow', 'wp-photo-album-plus'),
|
9555 |
+
);
|
9556 |
+
$vals = array( 'photo',
|
9557 |
+
'mphoto',
|
9558 |
+
'xphoto',
|
9559 |
+
'slphoto',
|
9560 |
+
);
|
9561 |
+
$html = wppa_select($slug, $opts, $vals);
|
9562 |
+
$clas = '';
|
9563 |
+
$tags = 'system';
|
9564 |
+
wppa_setting($slug, '2', $name, $desc, $html, $help, $clas, $tags);
|
9565 |
+
|
9566 |
+
$name = __('Size', 'wp-photo-album-plus');
|
9567 |
+
$desc = __('Specify the size (width) of the image.', 'wp-photo-album-plus');
|
9568 |
+
$help = esc_js(__('Use the same syntax as in the [wppa size=".."] shortcode', 'wp-photo-album-plus'));
|
9569 |
+
$help .= '\n\n'.esc_js(__('Examples: 350 for a fixed width of 350 pixels, or: 0.75 for a responsive display of 75% width, or: auto,350 for responsive with a maximum of 350 pixels.', 'wp-photo-album-plus'));
|
9570 |
+
$slug = 'wppa_photo_shortcode_size';
|
9571 |
+
$html = wppa_input($slug, '300px');
|
9572 |
+
$clas = '';
|
9573 |
+
$tags = 'system';
|
9574 |
+
wppa_setting($slug, '3', $name, $desc, $html, $help, $clas, $tags);
|
9575 |
+
|
9576 |
+
$name = __('Align', 'wp-photo-album-plus');
|
9577 |
+
$desc = __('Specify the alignment of the image.', 'wp-photo-album-plus');
|
9578 |
+
$help = '';
|
9579 |
+
$slug = 'wppa_photo_shortcode_align';
|
9580 |
+
$opts = array( __('--- none ---', 'wp-photo-album-plus'),
|
9581 |
+
__('left', 'wp-photo-album-plus'),
|
9582 |
+
__('center', 'wp-photo-album-plus'),
|
9583 |
+
__('right', 'wp-photo-album-plus'),
|
9584 |
+
);
|
9585 |
+
$vals = array( '',
|
9586 |
+
'left',
|
9587 |
+
'center',
|
9588 |
+
'right',
|
9589 |
+
);
|
9590 |
+
$html = wppa_select($slug, $opts, $vals);
|
9591 |
+
$clas = '';
|
9592 |
+
$tags = 'system';
|
9593 |
+
wppa_setting($slug, '4', $name, $desc, $html, $help, $clas, $tags);
|
9594 |
+
|
9595 |
+
|
9596 |
}
|
9597 |
?>
|
9598 |
|
9599 |
+
|
9600 |
+
|
9601 |
</tbody>
|
9602 |
<tfoot style="font-weight: bold;" class="wppa_table_9">
|
9603 |
<tr>
|
wppa-setup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1606,7 +1606,7 @@ Hide Camera info
|
|
1606 |
'wppa_search_in_section' => __( 'Search in current section' , 'wp-photo-album-plus'),
|
1607 |
'wppa_search_in_results' => __( 'Search in current results' , 'wp-photo-album-plus'),
|
1608 |
'wppa_search_min_length' => '2', // 18
|
1609 |
-
'wppa_search_user_void' => '',
|
1610 |
'wppa_search_numbers_void' => 'no',
|
1611 |
'wppa_index_ignore_slash' => 'no',
|
1612 |
// 'wppa_index_skips' => '', // Do not add, this is an array
|
@@ -1679,12 +1679,18 @@ Hide Camera info
|
|
1679 |
'wppa_fotomoto_hide_when_running' => 'no',
|
1680 |
'wppa_fotomoto_min_width' => '400',
|
1681 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1682 |
// Photo of the day widget
|
1683 |
'wppa_potd_title' => __('Photo of the day', 'wp-photo-album-plus'),
|
1684 |
'wppa_potd_widget_width' => '200',
|
1685 |
'wppa_potd_align' => 'center',
|
1686 |
-
'wppa_potd_linkurl'
|
1687 |
-
'wppa_potd_linktitle'
|
1688 |
'wppa_potd_subtitle' => 'none',
|
1689 |
'wppa_potd_counter' => 'no',
|
1690 |
'wppa_potd_counter_link' => 'thumbs',
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
1606 |
'wppa_search_in_section' => __( 'Search in current section' , 'wp-photo-album-plus'),
|
1607 |
'wppa_search_in_results' => __( 'Search in current results' , 'wp-photo-album-plus'),
|
1608 |
'wppa_search_min_length' => '2', // 18
|
1609 |
+
'wppa_search_user_void' => 'times,views,wp-content,wp,content,wppa-pl,wppa,pl',
|
1610 |
'wppa_search_numbers_void' => 'no',
|
1611 |
'wppa_index_ignore_slash' => 'no',
|
1612 |
// 'wppa_index_skips' => '', // Do not add, this is an array
|
1679 |
'wppa_fotomoto_hide_when_running' => 'no',
|
1680 |
'wppa_fotomoto_min_width' => '400',
|
1681 |
|
1682 |
+
// L photo shortcode
|
1683 |
+
'wppa_photo_shortcode_enabled' => 'yes',
|
1684 |
+
'wppa_photo_shortcode_type' => 'mphoto',
|
1685 |
+
'wppa_photo_shortcode_size' => '350',
|
1686 |
+
'wppa_photo_shortcode_align' => 'center',
|
1687 |
+
|
1688 |
// Photo of the day widget
|
1689 |
'wppa_potd_title' => __('Photo of the day', 'wp-photo-album-plus'),
|
1690 |
'wppa_potd_widget_width' => '200',
|
1691 |
'wppa_potd_align' => 'center',
|
1692 |
+
'wppa_potd_linkurl' => __('Type your custom url here', 'wp-photo-album-plus'),
|
1693 |
+
'wppa_potd_linktitle' => __('Type the title here', 'wp-photo-album-plus'),
|
1694 |
'wppa_potd_subtitle' => 'none',
|
1695 |
'wppa_potd_counter' => 'no',
|
1696 |
'wppa_potd_counter_link' => 'thumbs',
|
wppa-slideshow.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -960,7 +960,7 @@ global $wpdb;
|
|
960 |
while ( $i <= wppa_opt( 'rating_max' ) ) {
|
961 |
$result .= '<img' .
|
962 |
' id="wppa-avg-' . wppa( 'mocc' ) . '-' . $i . '"' .
|
963 |
-
' class="wppa-avg-' . wppa( 'mocc' ) . '-' . $i . ' wppa-avg-'.wppa( 'mocc' ).' no-shadow"' .
|
964 |
' style="' .
|
965 |
$style .
|
966 |
( $id ? $opac[$i] : '' ) .
|
@@ -996,7 +996,7 @@ global $wpdb;
|
|
996 |
' src="'.wppa_get_imgdir().'thumbdown.png"' .
|
997 |
' alt="d"' .
|
998 |
' style="height:'.$fs.'px; margin:0 0 -3px 0; padding:0 '.$pad.'px; box-shadow:none; display:inline;"' .
|
999 |
-
' class="no-shadow"' .
|
1000 |
' onmouseover="jQuery(this).stop().fadeTo(100, 1.0)"' .
|
1001 |
' onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)"' .
|
1002 |
' onclick="';
|
@@ -1058,7 +1058,7 @@ global $wpdb;
|
|
1058 |
while ( $i <= wppa_opt( 'rating_max' ) ) {
|
1059 |
$result .= '<img' .
|
1060 |
' id="wppa-rate-' . wppa( 'mocc' ) . '-' . $i . '"' .
|
1061 |
-
' class="wppa-rate-' . wppa( 'mocc' ) . '-' . $i . ' wppa-rate-'.wppa( 'mocc' ).' no-shadow"' .
|
1062 |
' style="' .
|
1063 |
$style .
|
1064 |
( $id ? $opac[$i] : '' ) .
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the slideshow high level functions
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
960 |
while ( $i <= wppa_opt( 'rating_max' ) ) {
|
961 |
$result .= '<img' .
|
962 |
' id="wppa-avg-' . wppa( 'mocc' ) . '-' . $i . '"' .
|
963 |
+
' class="wppa-rating-star wppa-avg-' . wppa( 'mocc' ) . '-' . $i . ' wppa-avg-'.wppa( 'mocc' ).' no-shadow"' .
|
964 |
' style="' .
|
965 |
$style .
|
966 |
( $id ? $opac[$i] : '' ) .
|
996 |
' src="'.wppa_get_imgdir().'thumbdown.png"' .
|
997 |
' alt="d"' .
|
998 |
' style="height:'.$fs.'px; margin:0 0 -3px 0; padding:0 '.$pad.'px; box-shadow:none; display:inline;"' .
|
999 |
+
' class="wppa-rating-thumb no-shadow"' .
|
1000 |
' onmouseover="jQuery(this).stop().fadeTo(100, 1.0)"' .
|
1001 |
' onmouseout="jQuery(this).stop().fadeTo(100, wppaStarOpacity)"' .
|
1002 |
' onclick="';
|
1058 |
while ( $i <= wppa_opt( 'rating_max' ) ) {
|
1059 |
$result .= '<img' .
|
1060 |
' id="wppa-rate-' . wppa( 'mocc' ) . '-' . $i . '"' .
|
1061 |
+
' class="wppa-rating-star wppa-rate-' . wppa( 'mocc' ) . '-' . $i . ' wppa-rate-'.wppa( 'mocc' ).' no-shadow"' .
|
1062 |
' style="' .
|
1063 |
$style .
|
1064 |
( $id ? $opac[$i] : '' ) .
|
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 6.6.
|
9 |
*
|
10 |
*/
|
11 |
|
@@ -597,12 +597,11 @@ global $wpdb;
|
|
597 |
' class="wppa-thumb-text"' .
|
598 |
' style="'.__wcs( 'wppa-thumb-text' ).'"' .
|
599 |
' >' .
|
600 |
-
wppa_get_photo_name( $id, wppa_switch( 'thumb_text_owner' ),
|
601 |
'</div>';
|
602 |
}
|
603 |
|
604 |
// searching, link to album
|
605 |
-
// if ( wppa( 'src' ) || wppa( 'supersearch' ) || ( ( wppa( 'is_comten') || wppa( 'is_topten' ) || wppa( 'is_lasten' ) || wppa( 'is_featen') ) && wppa( 'start_album' ) != $thumb['album'] ) ) {
|
606 |
if ( wppa_switch( 'thumb_text_virt_album' ) && wppa_is_virtual() && wppa( 'start_album' ) != $thumb['album'] ) {
|
607 |
$result .= '<div' .
|
608 |
' class="wppa-thumb-text"' .
|
@@ -698,7 +697,7 @@ global $wpdb;
|
|
698 |
if ( $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled' ) {
|
699 |
$desc .= wppa_moderate_links( 'thumb', $id );
|
700 |
}
|
701 |
-
$desc .= wppa_get_photo_desc( $id, wppa_switch( 'allow_foreign_shortcodes_thumbs' ) );
|
702 |
|
703 |
// Run wpautop on description?
|
704 |
if ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'wpautop' ) {
|
@@ -1522,12 +1521,12 @@ function wppa_get_masonry_title( $id ) {
|
|
1522 |
|
1523 |
// Name
|
1524 |
if ( wppa_switch( 'thumb_text_name' ) || wppa_switch( 'thumb_text_owner' ) ) {
|
1525 |
-
$result .= wppa_get_photo_name( $id, wppa_switch( 'thumb_text_owner' ),
|
1526 |
}
|
1527 |
|
1528 |
// Description
|
1529 |
if ( wppa_switch( 'thumb_text_desc' ) || $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled' ) {
|
1530 |
-
$result .= wppa_get_photo_desc( $id, wppa_switch( 'allow_foreign_shortcodes_thumbs' ) ) . "\n";
|
1531 |
}
|
1532 |
|
1533 |
// Rating
|
5 |
* Various funcions to display a thumbnail image
|
6 |
* Contains all possible frontend thumbnail types
|
7 |
*
|
8 |
+
* Version 6.6.13
|
9 |
*
|
10 |
*/
|
11 |
|
597 |
' class="wppa-thumb-text"' .
|
598 |
' style="'.__wcs( 'wppa-thumb-text' ).'"' .
|
599 |
' >' .
|
600 |
+
wppa_get_photo_name( $id, array( 'addowner' => wppa_switch( 'thumb_text_owner' ), 'showname' => wppa_switch( 'thumb_text_name' ) ) ) .
|
601 |
'</div>';
|
602 |
}
|
603 |
|
604 |
// searching, link to album
|
|
|
605 |
if ( wppa_switch( 'thumb_text_virt_album' ) && wppa_is_virtual() && wppa( 'start_album' ) != $thumb['album'] ) {
|
606 |
$result .= '<div' .
|
607 |
' class="wppa-thumb-text"' .
|
697 |
if ( $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled' ) {
|
698 |
$desc .= wppa_moderate_links( 'thumb', $id );
|
699 |
}
|
700 |
+
$desc .= wppa_get_photo_desc( $id, array( 'doshortcodes' => wppa_switch( 'allow_foreign_shortcodes_thumbs' ) ) );
|
701 |
|
702 |
// Run wpautop on description?
|
703 |
if ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'wpautop' ) {
|
1521 |
|
1522 |
// Name
|
1523 |
if ( wppa_switch( 'thumb_text_name' ) || wppa_switch( 'thumb_text_owner' ) ) {
|
1524 |
+
$result .= wppa_get_photo_name( $id, array( 'addowner' => wppa_switch( 'thumb_text_owner' ), 'showname' => wppa_switch( 'thumb_text_name' ) ) ) . "\n";
|
1525 |
}
|
1526 |
|
1527 |
// Description
|
1528 |
if ( wppa_switch( 'thumb_text_desc' ) || $thumb['status'] == 'pending' || $thumb['status'] == 'scheduled' ) {
|
1529 |
+
$result .= wppa_get_photo_desc( $id, array( 'doshortcodes' => wppa_switch( 'allow_foreign_shortcodes_thumbs' ) ) ) . "\n";
|
1530 |
}
|
1531 |
|
1532 |
// Rating
|
wppa-topten-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
-
* Version 6.6.
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
@@ -128,11 +128,13 @@ class TopTenWidget extends WP_Widget {
|
|
128 |
if ( $medalsonly ) {
|
129 |
$thumbs = $wpdb->get_results( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
130 |
"WHERE `status` IN ( 'gold', 'silver', 'bronze' ) " .
|
|
|
131 |
"ORDER BY " . $sortby . " " .
|
132 |
"LIMIT " . $max, ARRAY_A );
|
133 |
}
|
134 |
else {
|
135 |
$thumbs = $wpdb->get_results( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
|
|
136 |
"ORDER BY " . $sortby . " " .
|
137 |
"LIMIT " . $max, ARRAY_A );
|
138 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the top rated photos
|
6 |
+
* Version 6.6.13
|
7 |
*/
|
8 |
|
9 |
class TopTenWidget extends WP_Widget {
|
128 |
if ( $medalsonly ) {
|
129 |
$thumbs = $wpdb->get_results( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
130 |
"WHERE `status` IN ( 'gold', 'silver', 'bronze' ) " .
|
131 |
+
"AND `album` <> '-9' " .
|
132 |
"ORDER BY " . $sortby . " " .
|
133 |
"LIMIT " . $max, ARRAY_A );
|
134 |
}
|
135 |
else {
|
136 |
$thumbs = $wpdb->get_results( "SELECT * FROM `".WPPA_PHOTOS."` " .
|
137 |
+
"WHERE `album` <> '-9' " .
|
138 |
"ORDER BY " . $sortby . " " .
|
139 |
"LIMIT " . $max, ARRAY_A );
|
140 |
}
|
wppa-utils.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
-
* Version 6.6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1990,6 +1990,9 @@ global $wpdb;
|
|
1990 |
$tag = '2#120';
|
1991 |
$name = $wpdb->get_var( $wpdb->prepare( "SELECT `description` FROM `".WPPA_IPTC."` WHERE `photo` = %s AND `tag` = %s", $id, $tag ) );
|
1992 |
break;
|
|
|
|
|
|
|
1993 |
}
|
1994 |
if ( ( $name && $name != $filename ) || $method == 'none' ) { // Update name
|
1995 |
$wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_PHOTOS."` SET `name` = %s WHERE `id` = %s", $name, $id ) );
|
@@ -2561,8 +2564,7 @@ function wppa_browser_can_html5() {
|
|
2561 |
if ( $is_ie ) {
|
2562 |
$tri_pos = strpos( $_SERVER["HTTP_USER_AGENT"], 'Trident/' );
|
2563 |
$tri_ver = substr( $_SERVER["HTTP_USER_AGENT"], $tri_pos+8, 3 );
|
2564 |
-
if ( $
|
2565 |
-
// echo $tri_ver;
|
2566 |
}
|
2567 |
|
2568 |
return false;
|
@@ -3261,6 +3263,18 @@ function wppa_is_ie() {
|
|
3261 |
return $result;
|
3262 |
}
|
3263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3264 |
function wppa_chmod( $fso ) {
|
3265 |
|
3266 |
if ( is_dir( $fso ) ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
+
* Version 6.6.13
|
7 |
*
|
8 |
*/
|
9 |
|
1990 |
$tag = '2#120';
|
1991 |
$name = $wpdb->get_var( $wpdb->prepare( "SELECT `description` FROM `".WPPA_IPTC."` WHERE `photo` = %s AND `tag` = %s", $id, $tag ) );
|
1992 |
break;
|
1993 |
+
case 'Photo w#id':
|
1994 |
+
$name = __( 'Photo w#id', 'wp-photo-album-plus' );
|
1995 |
+
break;
|
1996 |
}
|
1997 |
if ( ( $name && $name != $filename ) || $method == 'none' ) { // Update name
|
1998 |
$wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_PHOTOS."` SET `name` = %s WHERE `id` = %s", $name, $id ) );
|
2564 |
if ( $is_ie ) {
|
2565 |
$tri_pos = strpos( $_SERVER["HTTP_USER_AGENT"], 'Trident/' );
|
2566 |
$tri_ver = substr( $_SERVER["HTTP_USER_AGENT"], $tri_pos+8, 3 );
|
2567 |
+
if ( $tri_ver >= 6.0 ) return true; // IE 10 or later
|
|
|
2568 |
}
|
2569 |
|
2570 |
return false;
|
3263 |
return $result;
|
3264 |
}
|
3265 |
|
3266 |
+
function wppa_is_safari() {
|
3267 |
+
|
3268 |
+
$result = false;
|
3269 |
+
if ( isset ( $_SERVER["HTTP_USER_AGENT"] ) ) {
|
3270 |
+
if ( strpos( $_SERVER["HTTP_USER_AGENT"], 'Safari' ) !== false ) {
|
3271 |
+
$result = true;
|
3272 |
+
}
|
3273 |
+
}
|
3274 |
+
|
3275 |
+
return $result;
|
3276 |
+
}
|
3277 |
+
|
3278 |
function wppa_chmod( $fso ) {
|
3279 |
|
3280 |
if ( is_dir( $fso ) ) {
|
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: 6.6.
|
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/
|
@@ -22,8 +22,8 @@ global $wpdb;
|
|
22 |
global $wp_version;
|
23 |
|
24 |
/* WPPA GLOBALS */
|
25 |
-
global $wppa_revno; $wppa_revno = '
|
26 |
-
global $wppa_api_version; $wppa_api_version = '6-6-
|
27 |
|
28 |
/* start timers */
|
29 |
global $wppa_starttime; $wppa_starttime = microtime(true);
|
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: 6.6.13
|
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/
|
22 |
global $wp_version;
|
23 |
|
24 |
/* WPPA GLOBALS */
|
25 |
+
global $wppa_revno; $wppa_revno = '6613'; // WPPA db version
|
26 |
+
global $wppa_api_version; $wppa_api_version = '6-6-13-008'; // WPPA software version
|
27 |
|
28 |
/* start timers */
|
29 |
global $wppa_starttime; $wppa_starttime = microtime(true);
|