Version Description
= 7.0.00 =
- Shortcode generators for Gutenberg added
= 6.9.21 =
- This version addresses various bug fixes
- This version addresses various security issues.
= 6.9.20 =
- This version addresses various bug fixes
= 6.9.19 =
- This version addresses various minor bug fixes
= 6.9.18 =
- This version addresses various minor bug fixes
= 6.9.17 =
- This version addresses various minor bug fixes and feature requests.
- This version addresses various security issues.
= 6.9.16 =
- This version addresses various minor bug fixes and feature requests.
- This version addresses various security issues.
= 6.9.15 =
- This version addresses various minor bug fixes and feature requests.
- This version addresses various security issues.
= 6.9.14 =
- This version addresses various minor bug fixes and feature requests.
- This version addresses various security issues.
= 6.9.13 =
- Security release.
= 6.9.12 =
- This version addresses various minor bug fixes and performance improvements.
= 6.9.11 =
- This version addresses various minor bug fixes and performance improvements.
= 6.9.10 =
- This version addresses various minor bug fixes and performance improvements.
= 6.9.09 =
- Panorama support phase III.
= 6.9.08 =
- This version addresses various minor bug fixes and feature requests.
- Panorama support phase II.
= 6.9.07 =
- This version addresses various minor bug fixes and feature requests.
- Panorama support phase I.
= 6.9.06 =
- This version addresses various minor bug fixes and feature requests.
= 6.9.05 =
- This version addresses various minor bug fixes and feature requests.
= 6.9.04 =
- This version addresses various minor bug fixes and feature requests.
- Local CDN functionality has been added.
= 6.9.03 =
- This version addresses various minor bug fixes and feature requests.
= 6.9.02 =
- This version addresses various minor bug fixes and feature requests.
= 6.9.01 =
- This version addresses various minor bug fixes and feature requests.
= 6.9.00 =
- This version includes the code for the privacy policy requirements.
= 6.8.09
- This version addresses various bug fixes and code edits.
= 6.8.08 =
- This version addresses various minor bug fixes and feature requests.
- This version offers substantial performance improvements when the box in Table IV-A13: Defer Javascript is ticked. This setting is now recommended and set ticked as the default.
- For more info on performance improvements and compatibility with optimizers: see the changelog.txt
= 6.8.07 =
- This version addresses various minor bug fixes and enhancements, and a new widget: Statistics.
= 6.8.06 =
- This version addresses various minor bug fixes and improved cache handling.
= 6.8.05 =
- This version addresses various minor bug fixes and feture requests.
= 6.8.04 =
- This version addresses various display issues and a few fixes of bugs that seldom affected the plugins behaviour.
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 7.0.00.003 |
Comparing to | |
See all releases |
Code changes from version 6.9.21.006 to 7.0.00.003
- changelog.txt +11 -0
- js/wppa-gutenberg-photo.js +232 -0
- js/wppa-gutenberg-wppa.js +718 -0
- js/wppa-utils.js +1 -98
- js/wppa-utils.min.js +1 -1
- readme.txt +7 -3
- wppa-admin-functions.php +10 -10
- wppa-admin.php +68 -9
- wppa-ajax.php +27 -17
- wppa-common-functions.php +3 -3
- wppa-cron.php +4 -4
- wppa-filter.php +2 -1
- wppa-gutenberg-photo.php +410 -0
- wppa-gutenberg-wppa.php +664 -0
- wppa-import.php +17 -17
- wppa-init.php +4 -54
- wppa-local-cdn.php +2 -2
- wppa-maintenance.php +2 -2
- wppa-non-admin.php +4 -4
- wppa-photo-admin-autosave.php +3 -3
- wppa-potd-admin.php +2 -2
- wppa-settings-autosave.php +3 -15
- wppa-setup.php +17 -19
- wppa-source.php +8 -8
- wppa-stereo.php +2 -2
- wppa-utils.php +15 -25
- wppa-watermark.php +9 -3
- wppa-wrappers.php +82 -9
- wppa.php +3 -3
changelog.txt
CHANGED
@@ -1,5 +1,16 @@
|
|
1 |
WP Photo Album Plus Changelog
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 6.9.21 =
|
4 |
|
5 |
= Bug Fixes =
|
1 |
WP Photo Album Plus Changelog
|
2 |
|
3 |
+
= 7.0.00 =
|
4 |
+
|
5 |
+
= New Features =
|
6 |
+
|
7 |
+
* Shortcode generators for Gutenberg added.
|
8 |
+
|
9 |
+
= Other Changes =
|
10 |
+
|
11 |
+
* Removed Table IX-A14. Frontend code is now always loaded.
|
12 |
+
* Removed script to shortcode conversion warning and tool.
|
13 |
+
|
14 |
= 6.9.21 =
|
15 |
|
16 |
= Bug Fixes =
|
js/wppa-gutenberg-photo.js
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* wppa-gutenberg-photo.js
|
2 |
+
* Pachkage: wp-photo-album-plus
|
3 |
+
*
|
4 |
+
* Version 7.0.00
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Global vars
|
8 |
+
var el = wp.element.createElement,
|
9 |
+
wppaPhotoRegisterBlockType = wp.blocks.registerBlockType,
|
10 |
+
wppaPhotoDialogBlockStyle = { backgroundColor: '#ccc', color: '#333', padding: '20px', clear: 'both' },
|
11 |
+
wppaPhotoDialogIconStyle = { width: '24px', height: '24px' },
|
12 |
+
wppaPhotoDialog,
|
13 |
+
wppaPhotoDialogHtml,
|
14 |
+
wppaImageDirectory,
|
15 |
+
wppaPhotoDirectory,
|
16 |
+
wppaPhotoDialogCounter;
|
17 |
+
if ( ! wppaPhotoDialogCounter ) {
|
18 |
+
wppaPhotoDialogCounter = 1;
|
19 |
+
}
|
20 |
+
|
21 |
+
var globalPropsInEdit, globalPropsInSave, globalRes;
|
22 |
+
|
23 |
+
|
24 |
+
// Actions on dom ready
|
25 |
+
jQuery(document).ready(function(){
|
26 |
+
|
27 |
+
// Register our block
|
28 |
+
wppaPhotoRegisterBlockType( 'wppa/gutenberg-photo', {
|
29 |
+
|
30 |
+
title: 'WPPA Photo',
|
31 |
+
icon: el( 'img',
|
32 |
+
{
|
33 |
+
src: wppaImageDirectory+'camera32.png',
|
34 |
+
style: wppaPhotoDialogIconStyle,
|
35 |
+
} ),
|
36 |
+
category: 'wppa-shortcodes',
|
37 |
+
edit: function( props ) {
|
38 |
+
|
39 |
+
var shortcode = props.attributes.shortcode || '';
|
40 |
+
var photo = props.attributes.photo || '';
|
41 |
+
|
42 |
+
if ( photo.length ) {
|
43 |
+
var id = parseInt( 1000 * Math.random() );
|
44 |
+
wppaGutenbergGetPhotoShortcodeRendered( shortcode, id );
|
45 |
+
return el( 'div', {id:id} , 'Loading...' );
|
46 |
+
}
|
47 |
+
else {
|
48 |
+
var Uid = 'wppa-photo-dialog-' + wppaPhotoDialogCounter;
|
49 |
+
wppaPhotoDialogCounter++;
|
50 |
+
wppaPhotoDialog = el( 'div', { id: Uid, style: wppaPhotoDialogBlockStyle }, 'placeholder' );
|
51 |
+
setTimeout( function() {
|
52 |
+
jQuery( '#' + Uid ).html( wppaPhotoDialogHtml );
|
53 |
+
}, 100 );
|
54 |
+
setTimeout( function() {
|
55 |
+
|
56 |
+
// Bind onchange handler to ready button
|
57 |
+
jQuery( '#wppa-shortcode-photo-ready' ).on( 'click',
|
58 |
+
function() {
|
59 |
+
var res = wppaPhotoEvaluate(),
|
60 |
+
sc = res.shortcode,
|
61 |
+
photo = res.photo;
|
62 |
+
|
63 |
+
if ( sc.length ) {
|
64 |
+
props.setAttributes({
|
65 |
+
shortcode: sc,
|
66 |
+
photo: photo
|
67 |
+
});
|
68 |
+
}
|
69 |
+
});
|
70 |
+
}, 150 );
|
71 |
+
return wppaPhotoDialog;
|
72 |
+
}
|
73 |
+
},
|
74 |
+
save: function( props ) {
|
75 |
+
|
76 |
+
var shortcode = props.attributes.shortcode || '';
|
77 |
+
|
78 |
+
if ( shortcode.length ) {
|
79 |
+
return shortcode;
|
80 |
+
}
|
81 |
+
},
|
82 |
+
} );
|
83 |
+
|
84 |
+
// Get the dialog html
|
85 |
+
jQuery.ajax( {
|
86 |
+
|
87 |
+
url: wppaAjaxUrl,
|
88 |
+
data: 'action=wppa' +
|
89 |
+
'&wppa-action=gutenbergphotodialog',
|
90 |
+
async: true,
|
91 |
+
type: 'GET',
|
92 |
+
timeout: 10000,
|
93 |
+
beforeSend: function( xhr ) {
|
94 |
+
|
95 |
+
},
|
96 |
+
success: function( result, status, xhr ) {
|
97 |
+
wppaPhotoDialogHtml = result;
|
98 |
+
},
|
99 |
+
error: function( xhr, status, error ) {
|
100 |
+
wppaConsoleLog( 'Get gutenberg photo dialog failed. Error = ' + error + ', status = ' + status, 'force' );
|
101 |
+
},
|
102 |
+
complete: function( xhr, status, newurl ) {
|
103 |
+
|
104 |
+
}
|
105 |
+
} );
|
106 |
+
|
107 |
+
} );
|
108 |
+
|
109 |
+
|
110 |
+
var wppaMyPhotoSelection = true;
|
111 |
+
|
112 |
+
// Return '[photo xxx]' when a photo is selected. xxx stands for the integer photo id.
|
113 |
+
function wppaPhotoEvaluate() {
|
114 |
+
|
115 |
+
// Assume shortcode complete
|
116 |
+
var shortcodeOk = true;
|
117 |
+
var myAll;
|
118 |
+
var shortcode;
|
119 |
+
var result;
|
120 |
+
|
121 |
+
// Photo
|
122 |
+
if ( wppaMyPhotoSelection ) {
|
123 |
+
myAll = 'my';
|
124 |
+
}
|
125 |
+
else {
|
126 |
+
myAll = 'all';
|
127 |
+
}
|
128 |
+
photo = jQuery('#wppaphoto-'+myAll+'photo').val();
|
129 |
+
|
130 |
+
if ( ! wppaIsEmpty( photo ) ) {
|
131 |
+
id = photo.replace(/\//g,'');
|
132 |
+
id = id.split('.');
|
133 |
+
id = id[0];
|
134 |
+
jQuery('#wppaphoto-photo-preview-tr').show();
|
135 |
+
var html = wppaGutenbergBasicPhotoPreview( photo );
|
136 |
+
jQuery('#wppaphoto-photo-preview').html(html);
|
137 |
+
jQuery('#wppaphoto-'+myAll+'photo').css('color', '#070');
|
138 |
+
shortcode = '[photo ' + id + ']';
|
139 |
+
}
|
140 |
+
else {
|
141 |
+
jQuery('#wppaphoto-'+myAll+'photo').css('color', '#700');
|
142 |
+
shortcode = '';
|
143 |
+
}
|
144 |
+
|
145 |
+
// Display shortcode preview
|
146 |
+
shortcode = shortcode.replace(/"/g, '"');
|
147 |
+
var html = '<input type="text" id="wppaphoto-shortcode-preview" style="background-color:#ddd; width:100%; height:26px;" value="'+shortcode+'" />';
|
148 |
+
jQuery( '#wppaphoto-shortcode-preview-container' ).html( html );
|
149 |
+
|
150 |
+
if ( shortcode.length > 0 ) {
|
151 |
+
jQuery( '#wppa-shortcode-photo-ready' ).css( 'display', 'block' );
|
152 |
+
}
|
153 |
+
|
154 |
+
// Is shortcode complete?
|
155 |
+
shortcodeOk = ! wppaIsEmpty( photo );
|
156 |
+
|
157 |
+
if ( shortcodeOk ) {
|
158 |
+
|
159 |
+
result = { shortcode: shortcode,
|
160 |
+
photo: photo,
|
161 |
+
}
|
162 |
+
}
|
163 |
+
else {
|
164 |
+
result = { shortcode: '',
|
165 |
+
photo: '',
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
return result;
|
170 |
+
}
|
171 |
+
|
172 |
+
// Display the photo preview
|
173 |
+
function wppaGutenbergBasicPhotoPreview( id ) {
|
174 |
+
|
175 |
+
var html;
|
176 |
+
|
177 |
+
if ( id == '#potd' ) {
|
178 |
+
html = wppaNoPreview;
|
179 |
+
}
|
180 |
+
else if ( id.indexOf('xxx') != -1 ) { // its a video
|
181 |
+
var idv = id.replace('xxx', '');
|
182 |
+
html =
|
183 |
+
'<video preload="metadata" style="max-width:400px; max-height:300px; margin-top:3px;" controls>'+
|
184 |
+
'<source src="'+wppaPhotoDirectory+idv+'mp4" type="video/mp4">'+
|
185 |
+
'<source src="'+wppaPhotoDirectory+idv+'ogg" type="video/ogg">'+
|
186 |
+
'<source src="'+wppaPhotoDirectory+idv+'ogv" type="video/ogg">'+
|
187 |
+
'<source src="'+wppaPhotoDirectory+idv+'webm" type="video/webm">'+
|
188 |
+
'</video>';
|
189 |
+
}
|
190 |
+
else {
|
191 |
+
html =
|
192 |
+
'<img src="'+wppaPhotoDirectory+id+'" style="max-width:400px; max-height:300px;" />';
|
193 |
+
}
|
194 |
+
return html;
|
195 |
+
}
|
196 |
+
|
197 |
+
function wppaDisplaySelectedFile(filetagid, displaytagid) {
|
198 |
+
|
199 |
+
var theFile = jQuery('#'+filetagid);
|
200 |
+
var result = theFile[0].files[0].name;
|
201 |
+
|
202 |
+
jQuery('#'+displaytagid).val('Upload '+result);
|
203 |
+
}
|
204 |
+
|
205 |
+
// Get the rendered shrtcode by ajax
|
206 |
+
function wppaGutenbergGetPhotoShortcodeRendered( shortcode, divId ) {
|
207 |
+
|
208 |
+
console.log('Fetching shortcode rendered '+shortcode);
|
209 |
+
|
210 |
+
jQuery.ajax( {
|
211 |
+
|
212 |
+
url: wppaAjaxUrl,
|
213 |
+
data: 'action=wppa' +
|
214 |
+
'&wppa-action=getshortcodedrendered' +
|
215 |
+
'&shortcode=' + shortcode +
|
216 |
+
'&moccur=' + wppaPhotoDialogCounter,
|
217 |
+
async: true,
|
218 |
+
type: 'GET',
|
219 |
+
timeout: 10000,
|
220 |
+
beforeSend: function( xhr ) {
|
221 |
+
},
|
222 |
+
success: function( result, status, xhr ) {
|
223 |
+
jQuery( '#' + divId ).html( '<div id="wppa-container-'+wppaPhotoDialogCounter+'" style="clear:both;" ></div>' + result + '<div style="clear:both;" ></div>' );
|
224 |
+
},
|
225 |
+
error: function( xhr, status, error ) {
|
226 |
+
wppaConsoleLog( 'Get gutenberg get shortcode rendered failed. Error = ' + error + ', status = ' + status, 'force' );
|
227 |
+
},
|
228 |
+
complete: function( xhr, status, newurl ) {
|
229 |
+
|
230 |
+
}
|
231 |
+
} );
|
232 |
+
}
|
js/wppa-gutenberg-wppa.js
ADDED
@@ -0,0 +1,718 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* wppa-gutenberg-wppa.js
|
2 |
+
* Pachkage: wp-photo-album-plus
|
3 |
+
*
|
4 |
+
* Version 7.0.00
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Global vars
|
8 |
+
var el = wp.element.createElement,
|
9 |
+
registerBlockType = wp.blocks.registerBlockType,
|
10 |
+
blockStyle = { backgroundColor: '#ccc', color: '#333', padding: '20px', clear: 'both' },
|
11 |
+
iconStyle = { width: '24px', height: '24px' },
|
12 |
+
wppaPhotoDialog,
|
13 |
+
wppaWppaDialogHtml,
|
14 |
+
wppaImageDirectory,
|
15 |
+
wppaPhotoDirectory,
|
16 |
+
wppaPhotoDialogCounter;
|
17 |
+
if ( ! wppaPhotoDialogCounter ) {
|
18 |
+
wppaPhotoDialogCounter = 1;
|
19 |
+
}
|
20 |
+
|
21 |
+
var globalPropsInEdit, globalPropsInSave, globalRes;
|
22 |
+
|
23 |
+
|
24 |
+
// Actions on dom ready
|
25 |
+
jQuery(document).ready(function(){
|
26 |
+
|
27 |
+
// Register our block
|
28 |
+
registerBlockType( 'wppa/gutenberg-wppa', {
|
29 |
+
|
30 |
+
title: 'WPPA Gallery',
|
31 |
+
icon: el( 'img',
|
32 |
+
{
|
33 |
+
src: wppaImageDirectory+'album32.png',
|
34 |
+
style: iconStyle,
|
35 |
+
} ),
|
36 |
+
category: 'wppa-shortcodes',
|
37 |
+
edit: function( props ) {
|
38 |
+
|
39 |
+
var shortcode = props.attributes.shortcode || '';
|
40 |
+
|
41 |
+
if ( shortcode.length ) {
|
42 |
+
var id = parseInt( 1000 * Math.random() );
|
43 |
+
wppaGutenbergGetWppaShorcodeRendered( shortcode, id );
|
44 |
+
return el( 'div', {id:id} , 'Loading...' );
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
var Uid = 'wppa-wppa-dialog-' + wppaPhotoDialogCounter;
|
48 |
+
wppaPhotoDialogCounter++;
|
49 |
+
wppaPhotoDialog = el( 'div', { id: Uid, style: blockStyle }, 'placeholder' );
|
50 |
+
setTimeout( function() {
|
51 |
+
jQuery( '#' + Uid ).html( wppaWppaDialogHtml );
|
52 |
+
}, 100 );
|
53 |
+
setTimeout( function() {
|
54 |
+
|
55 |
+
// Bind onchange handler to ready button
|
56 |
+
jQuery( '#wppa-shortcode-wppa-ready' ).on( 'click',
|
57 |
+
function() {
|
58 |
+
var sc = wppaGalleryEvaluate();
|
59 |
+
|
60 |
+
props.setAttributes({shortcode: sc});
|
61 |
+
});
|
62 |
+
}, 150 );
|
63 |
+
|
64 |
+
return wppaPhotoDialog;
|
65 |
+
}
|
66 |
+
},
|
67 |
+
save: function( props ) {
|
68 |
+
|
69 |
+
var shortcode = props.attributes.shortcode || '';
|
70 |
+
|
71 |
+
if ( shortcode.length ) {
|
72 |
+
return shortcode;
|
73 |
+
}
|
74 |
+
},
|
75 |
+
} );
|
76 |
+
|
77 |
+
// Get the dialog html
|
78 |
+
jQuery.ajax( {
|
79 |
+
|
80 |
+
url: wppaAjaxUrl,
|
81 |
+
data: 'action=wppa' +
|
82 |
+
'&wppa-action=gutenbergwppadialog',
|
83 |
+
async: true,
|
84 |
+
type: 'GET',
|
85 |
+
timeout: 10000,
|
86 |
+
beforeSend: function( xhr ) {
|
87 |
+
|
88 |
+
},
|
89 |
+
success: function( result, status, xhr ) {
|
90 |
+
wppaWppaDialogHtml = result;
|
91 |
+
},
|
92 |
+
error: function( xhr, status, error ) {
|
93 |
+
wppaConsoleLog( 'Get gutenberg photo dialog failed. Error = ' + error + ', status = ' + status, 'force' );
|
94 |
+
},
|
95 |
+
complete: function( xhr, status, newurl ) {
|
96 |
+
|
97 |
+
}
|
98 |
+
} );
|
99 |
+
|
100 |
+
} );
|
101 |
+
|
102 |
+
|
103 |
+
// Returns '[wppa ...]' when done
|
104 |
+
function wppaGalleryEvaluate() {
|
105 |
+
|
106 |
+
// Assume shortcode complete
|
107 |
+
var shortcodeOk = true;
|
108 |
+
|
109 |
+
// Hide option elements
|
110 |
+
jQuery('#wppagallery-galery-type-tr').hide();
|
111 |
+
jQuery('#wppagallery-slides-type-tr').hide();
|
112 |
+
jQuery('#wppagallery-single-type-tr').hide();
|
113 |
+
jQuery('#wppagallery-search-type-tr').hide();
|
114 |
+
jQuery('#wppagallery-miscel-type-tr').hide();
|
115 |
+
jQuery('#wppagallery-album-type-tr').hide();
|
116 |
+
jQuery('#wppagallery-album-real-tr').hide();
|
117 |
+
jQuery('#wppagallery-album-real-search-tr').hide();
|
118 |
+
jQuery('#wppagallery-album-realopt-tr').hide();
|
119 |
+
jQuery('#wppagallery-album-virt-tr').hide();
|
120 |
+
jQuery('#wppagallery-album-virt-cover-tr').hide();
|
121 |
+
jQuery('#wppagallery-owner-tr').hide();
|
122 |
+
jQuery('#wppagallery-owner-parent-tr').hide();
|
123 |
+
jQuery('#wppagallery-album-parent-tr').hide();
|
124 |
+
jQuery('#wppagallery-album-count-tr').hide();
|
125 |
+
jQuery('#wppagallery-photo-count-tr').hide();
|
126 |
+
jQuery('#wppagallery-albumcat-tr').hide();
|
127 |
+
jQuery('#wppagallery-photo-tr').hide();
|
128 |
+
jQuery('#wppagallery-photo-preview-tr').hide();
|
129 |
+
jQuery('#wppagallery-phototags-tr').hide();
|
130 |
+
jQuery('#wppagallery-search-tr').hide();
|
131 |
+
jQuery('#wppagallery-taglist-tr').hide();
|
132 |
+
jQuery('#wppagallery-album-super-tr').hide();
|
133 |
+
jQuery('#wppagallery-calendar-tr').hide();
|
134 |
+
jQuery('#wppagallery-tags-cats-tr').hide();
|
135 |
+
jQuery('#wppagallery-landing-tr').hide();
|
136 |
+
jQuery('#wppagallery-rootalbum-tr').hide();
|
137 |
+
jQuery('#wppagallery-admins-tr').hide();
|
138 |
+
|
139 |
+
// Init shortcode parts
|
140 |
+
var shortcode = '[wppa';
|
141 |
+
var topType = '';
|
142 |
+
var type = '';
|
143 |
+
var galType = '';
|
144 |
+
var slideType = '';
|
145 |
+
var albumType = '';
|
146 |
+
var searchType = '';
|
147 |
+
var miscType = '';
|
148 |
+
var album = '';
|
149 |
+
var parent = '';
|
150 |
+
var count = '';
|
151 |
+
var photo = '';
|
152 |
+
var id = '';
|
153 |
+
var sub = '';
|
154 |
+
var root = '';
|
155 |
+
var needGalType = false;
|
156 |
+
var needSlideType = false;
|
157 |
+
var needAlbum = false;
|
158 |
+
var needPhoto = false;
|
159 |
+
var needOwner = false;
|
160 |
+
var needTag = false;
|
161 |
+
var needTagList = false;
|
162 |
+
var needCat = false;
|
163 |
+
var needSearchType = false;
|
164 |
+
var needMiscType = false;
|
165 |
+
var alltags = '';
|
166 |
+
var taglist = '';
|
167 |
+
var owner = '';
|
168 |
+
var tags = '';
|
169 |
+
var cats = '';
|
170 |
+
var i,j,t;
|
171 |
+
var caltype = '';
|
172 |
+
var reverse = false;
|
173 |
+
var allopen = false;
|
174 |
+
var andor = false;
|
175 |
+
var sep = '';
|
176 |
+
var landing = '0';
|
177 |
+
var rootalbum = '0';
|
178 |
+
var admins = '';
|
179 |
+
var align = 'none';
|
180 |
+
var html = '';
|
181 |
+
|
182 |
+
// Init colors of <select> tags
|
183 |
+
jQuery( 'select' ).css( 'color', '#700' );
|
184 |
+
jQuery( '#wppagallery-album-parent-parent' ).css( 'color', '#070' );
|
185 |
+
jQuery( '#wppagallery-align' ).css( 'color', '#070' );
|
186 |
+
|
187 |
+
// Type
|
188 |
+
topType = jQuery('#wppagallery-top-type').val();
|
189 |
+
if ( ! wppaIsEmpty( topType ) ) {
|
190 |
+
jQuery('#wppagallery-top-type').css('color', '#070');
|
191 |
+
}
|
192 |
+
switch ( topType ) {
|
193 |
+
case 'galerytype':
|
194 |
+
jQuery('#wppagallery-galery-type-tr').show();
|
195 |
+
type = jQuery('#wppagallery-galery-type').val();
|
196 |
+
needGalType = true;
|
197 |
+
needAlbum = true;
|
198 |
+
jQuery('#wppagallery-album-type-tr').show();
|
199 |
+
if ( ! wppaIsEmpty( type ) ) {
|
200 |
+
jQuery('#wppagallery-galery-type').css('color', '#070');
|
201 |
+
galType = type;
|
202 |
+
}
|
203 |
+
break;
|
204 |
+
case 'slidestype':
|
205 |
+
jQuery('#wppagallery-slides-type-tr').show();
|
206 |
+
type = jQuery('#wppagallery-slides-type').val();
|
207 |
+
needSlideType = true;
|
208 |
+
needAlbum = true;
|
209 |
+
jQuery('#wppagallery-album-type-tr').show();
|
210 |
+
if ( ! wppaIsEmpty( type ) ) {
|
211 |
+
jQuery('#wppagallery-slides-type').css('color', '#070');
|
212 |
+
slideType = type;
|
213 |
+
}
|
214 |
+
break;
|
215 |
+
case 'singletype':
|
216 |
+
jQuery('#wppagallery-single-type-tr').show();
|
217 |
+
type = jQuery('#wppagallery-single-type').val();
|
218 |
+
needPhoto = true;
|
219 |
+
jQuery('#wppagallery-photo-tr').show();
|
220 |
+
if ( ! wppaIsEmpty( type ) ) {
|
221 |
+
jQuery('#wppagallery-single-type').css('color', '#070');
|
222 |
+
}
|
223 |
+
break;
|
224 |
+
case 'searchtype':
|
225 |
+
jQuery('#wppagallery-search-type-tr').show();
|
226 |
+
type = jQuery('#wppagallery-search-type').val();
|
227 |
+
needSearchType = true;
|
228 |
+
searchType = type;
|
229 |
+
if ( ! wppaIsEmpty( type ) ) {
|
230 |
+
jQuery('#wppagallery-search-type').css('color', '#070');
|
231 |
+
}
|
232 |
+
switch ( type ) {
|
233 |
+
case 'search':
|
234 |
+
jQuery('#wppagallery-search-tr').show();
|
235 |
+
if ( jQuery('#wppagallery-root').prop('checked') ) {
|
236 |
+
jQuery('#wppagallery-rootalbum-tr').show();
|
237 |
+
}
|
238 |
+
rootalbum = jQuery('#wppagallery-rootalbum').val();
|
239 |
+
jQuery('#wppagallery-landing-tr').show();
|
240 |
+
landing = jQuery('#wppagallery-landing').val();
|
241 |
+
break;
|
242 |
+
case 'supersearch':
|
243 |
+
break;
|
244 |
+
case 'tagcloud':
|
245 |
+
case 'multitag':
|
246 |
+
jQuery('#wppagallery-taglist-tr').show();
|
247 |
+
alltags = jQuery('#wppagallery-alltags').prop('checked');
|
248 |
+
if ( ! alltags ) {
|
249 |
+
needTagList = true;
|
250 |
+
jQuery('#wppagallery-seltags').show();
|
251 |
+
t = jQuery('.wppagallery-taglist-tags');
|
252 |
+
var tagarr = [];
|
253 |
+
i = 0;
|
254 |
+
j = 0;
|
255 |
+
while ( i < t.length ) {
|
256 |
+
if ( t[i].selected ) {
|
257 |
+
tagarr[j] = t[i].value;
|
258 |
+
j++;
|
259 |
+
}
|
260 |
+
i++;
|
261 |
+
}
|
262 |
+
taglist = wppaArrayToEnum( tagarr, ',' );
|
263 |
+
}
|
264 |
+
break;
|
265 |
+
case 'superview':
|
266 |
+
jQuery('#wppagallery-album-super-tr').show();
|
267 |
+
album = jQuery('#wppagallery-album-super-parent').val();
|
268 |
+
break;
|
269 |
+
case 'calendar':
|
270 |
+
jQuery('#wppagallery-calendar-tr').show();
|
271 |
+
jQuery('#wppagallery-album-super-tr').show(); // Optional parent album
|
272 |
+
caltype = jQuery('#wppagallery-calendar-type').val();
|
273 |
+
reverse = jQuery('#wppagallery-calendar-reverse').prop('checked');
|
274 |
+
allopen = jQuery('#wppagallery-calendar-allopen').prop('checked');
|
275 |
+
parent = jQuery('#wppagallery-album-super-parent').val();
|
276 |
+
break;
|
277 |
+
default:
|
278 |
+
}
|
279 |
+
break;
|
280 |
+
case 'misceltype':
|
281 |
+
jQuery('#wppagallery-miscel-type-tr').show();
|
282 |
+
type = jQuery('#wppagallery-miscel-type').val();
|
283 |
+
needMiscType = true;
|
284 |
+
if ( ! wppaIsEmpty( type ) ) {
|
285 |
+
jQuery('#wppagallery-miscel-type').css('color', '#070');
|
286 |
+
}
|
287 |
+
switch ( type ) {
|
288 |
+
case 'generic':
|
289 |
+
miscType = type;
|
290 |
+
break;
|
291 |
+
case 'upload':
|
292 |
+
miscType = type;
|
293 |
+
jQuery('#wppagallery-album-realopt-tr').show();
|
294 |
+
album = jQuery('#wppagallery-album-realopt').val();
|
295 |
+
album = album.toString().replace( /,/g, '.' );
|
296 |
+
break;
|
297 |
+
case 'landing':
|
298 |
+
case 'stereo':
|
299 |
+
miscType = type;
|
300 |
+
break;
|
301 |
+
case 'choice':
|
302 |
+
miscType = type;
|
303 |
+
jQuery('#wppagallery-admins-tr').show();
|
304 |
+
admins = wppaGetSelectionEnumByClass('.wppagallery-admin', ',');
|
305 |
+
break;
|
306 |
+
default:
|
307 |
+
}
|
308 |
+
break;
|
309 |
+
default:
|
310 |
+
}
|
311 |
+
if ( ! wppaIsEmpty( type ) ) {
|
312 |
+
shortcode += ' type="'+type+'"';
|
313 |
+
}
|
314 |
+
|
315 |
+
// Album
|
316 |
+
if ( needAlbum ) {
|
317 |
+
albumType = jQuery('#wppagallery-album-type').val();
|
318 |
+
if ( ! wppaIsEmpty( albumType ) ) {
|
319 |
+
jQuery( '#wppagallery-album-type' ).css('color', '#070');
|
320 |
+
}
|
321 |
+
switch ( albumType ) {
|
322 |
+
case 'real':
|
323 |
+
jQuery('#wppagallery-album-real-tr').show();
|
324 |
+
jQuery('#wppagallery-album-real-search-tr').show();
|
325 |
+
|
326 |
+
// WPPA has Not many albums, there is a quick select box. If used, ...val() is not empty,
|
327 |
+
if ( jQuery('#wppagallery-album-real-search') ) {
|
328 |
+
if ( jQuery('#wppagallery-album-real-search').val() ) {
|
329 |
+
var s = jQuery('#wppagallery-album-real-search').val().toLowerCase();
|
330 |
+
if ( ! wppaIsEmpty( s ) ) {
|
331 |
+
albums = jQuery('.wppagallery-album-r');
|
332 |
+
if ( albums.length > 0 ) {
|
333 |
+
var i = 0;
|
334 |
+
while ( i < albums.length ) {
|
335 |
+
var a = albums[i].innerHTML.toLowerCase();
|
336 |
+
if ( a.search( s ) == -1 ) {
|
337 |
+
jQuery( albums[i] ).removeAttr( 'selected' );
|
338 |
+
jQuery( albums[i] ).hide();
|
339 |
+
}
|
340 |
+
else {
|
341 |
+
jQuery( albums[i] ).show();
|
342 |
+
}
|
343 |
+
i++;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
}
|
348 |
+
else {
|
349 |
+
jQuery('.wppagallery-album-r').show();
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
// Get the selected album(s)
|
354 |
+
album = jQuery('#wppagallery-album-real').val();
|
355 |
+
|
356 |
+
// Make sure right delimiter
|
357 |
+
album = album.toString().replace( /,/g, '.' );
|
358 |
+
break;
|
359 |
+
|
360 |
+
case 'virtual':
|
361 |
+
|
362 |
+
// Open the right selection box dependant of type is cover or not
|
363 |
+
// and get the album identifier
|
364 |
+
if ( type == 'cover') {
|
365 |
+
jQuery('#wppagallery-album-virt-cover-tr').show();
|
366 |
+
album = jQuery('#wppagallery-album-virt-cover').val();
|
367 |
+
}
|
368 |
+
else { // type != cover
|
369 |
+
jQuery('#wppagallery-album-virt-tr').show();
|
370 |
+
album = jQuery('#wppagallery-album-virt').val();
|
371 |
+
}
|
372 |
+
|
373 |
+
// Now displatch on album identifier found
|
374 |
+
// and get the (optional) additional data
|
375 |
+
if ( ! wppaIsEmpty( album ) ) {
|
376 |
+
jQuery('#wppagallery-album-virt').css('color', '#070');
|
377 |
+
switch ( album ) {
|
378 |
+
case '#topten':
|
379 |
+
case '#lasten':
|
380 |
+
case '#featen':
|
381 |
+
case '#comten':
|
382 |
+
jQuery('#wppagallery-album-realopt-tr').show();
|
383 |
+
|
384 |
+
// We use parent here for optional album(s), because album is already used for virtual album type
|
385 |
+
// Not many albums
|
386 |
+
if ( jQuery('.wppagallery-album-ropt').length > 0 ) {
|
387 |
+
parent = wppaGetSelectionEnumByClass('.wppagallery-album-ropt', '.');
|
388 |
+
}
|
389 |
+
else {
|
390 |
+
parent = jQuery('#wppagallery-album-realopt').val();
|
391 |
+
if ( parent.indexOf(',') != -1 ) {
|
392 |
+
parr = parent.split(',');
|
393 |
+
parent = wppaArrayToEnum( parr, '.' );
|
394 |
+
}
|
395 |
+
}
|
396 |
+
if ( parent == '' ) parent = '0';
|
397 |
+
jQuery('#wppagallery-photo-count-tr').show();
|
398 |
+
count = jQuery('#wppagallery-photo-count').val();
|
399 |
+
break;
|
400 |
+
case '#tags':
|
401 |
+
jQuery('#wppagallery-phototags-tr').show();
|
402 |
+
jQuery('#wppagallery-tags-cats-tr').show();
|
403 |
+
andor = jQuery('[name=andor]:checked').val();
|
404 |
+
if ( ! andor ) jQuery('#wppagallery-or').prop( 'checked', true );
|
405 |
+
andor = jQuery('[name=andor]:checked').val();
|
406 |
+
if ( andor == 'or' ) sep = ';';
|
407 |
+
else sep = ',';
|
408 |
+
needTag = true;
|
409 |
+
t = jQuery('.wppagallery-phototags');
|
410 |
+
var tagarr = [];
|
411 |
+
i = 0;
|
412 |
+
j = 0;
|
413 |
+
while ( i < t.length ) {
|
414 |
+
if ( t[i].selected ) {
|
415 |
+
tagarr[j] = t[i].value;
|
416 |
+
j++;
|
417 |
+
}
|
418 |
+
i++;
|
419 |
+
}
|
420 |
+
tags = wppaArrayToEnum( tagarr, sep );
|
421 |
+
break;
|
422 |
+
case '#last':
|
423 |
+
jQuery('#wppagallery-album-parent-tr').show();
|
424 |
+
parent = jQuery('#wppagallery-album-parent-parent').val();
|
425 |
+
jQuery('#wppagallery-album-count-tr').show();
|
426 |
+
count = jQuery('#wppagallery-album-count').val();
|
427 |
+
break;
|
428 |
+
case '#cat':
|
429 |
+
jQuery('#wppagallery-albumcat-tr').show();
|
430 |
+
jQuery('#wppagallery-tags-cats-tr').show();
|
431 |
+
andor = jQuery('[name=andor]:checked').val();
|
432 |
+
if ( ! andor ) jQuery('#wppagallery-or').prop( 'checked', true );
|
433 |
+
andor = jQuery('[name=andor]:checked').val();
|
434 |
+
if ( andor == 'or' ) sep = ';';
|
435 |
+
else sep = ',';
|
436 |
+
needCat = true;
|
437 |
+
t = jQuery('.wppagallery-albumcat');
|
438 |
+
var catarr = [];
|
439 |
+
i = 0;
|
440 |
+
j = 0;
|
441 |
+
while ( i < t.length ) {
|
442 |
+
if ( t[i].selected ) {
|
443 |
+
catarr[j] = t[i].value;
|
444 |
+
j++;
|
445 |
+
}
|
446 |
+
i++;
|
447 |
+
}
|
448 |
+
cats = wppaArrayToEnum( catarr, sep );
|
449 |
+
break;
|
450 |
+
case '#owner':
|
451 |
+
case '#upldr':
|
452 |
+
jQuery('#wppagallery-owner-tr').show();
|
453 |
+
needOwner = true;
|
454 |
+
owner = jQuery('#wppagallery-owner').val();
|
455 |
+
if ( ! wppaIsEmpty( owner ) ) {
|
456 |
+
jQuery( '#wppagallery-owner' ).css( 'color', '#070' );
|
457 |
+
jQuery('#wppagallery-owner-parent-tr').show();
|
458 |
+
parent = wppaGetSelectionEnumByClass('.wppagallery-album-p', '.');
|
459 |
+
parent = parent.toString().replace( 'zero', '0' );
|
460 |
+
}
|
461 |
+
break;
|
462 |
+
case '#all':
|
463 |
+
break;
|
464 |
+
default:
|
465 |
+
if ( album != null ) {
|
466 |
+
alert( wppaUIERR + ': ' + album );
|
467 |
+
}
|
468 |
+
}
|
469 |
+
if ( ( album != '#cat' || cats != '' ) &&
|
470 |
+
( album != '#owner' || owner != '' ) &&
|
471 |
+
( album != '#upldr' || owner != '' ) &&
|
472 |
+
( album != '#topten' || parent != '' ) &&
|
473 |
+
( album != '#lasten' || parent != '' ) &&
|
474 |
+
( album != '#comten' || parent != '' ) &&
|
475 |
+
( album != '#featen' || parent != '' ) ) {
|
476 |
+
}
|
477 |
+
}
|
478 |
+
break;
|
479 |
+
default:
|
480 |
+
album = '';
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
// Add album specs to shortcode
|
485 |
+
if ( ! wppaIsEmpty( album ) ) {
|
486 |
+
shortcode += ' album="'+album;
|
487 |
+
if ( owner != '' ) shortcode += ','+owner;
|
488 |
+
if ( parent == '' && count != '' ) parent = '0';
|
489 |
+
if ( parent != '' ) shortcode += ','+parent;
|
490 |
+
if ( count != '' ) shortcode += ','+count;
|
491 |
+
if ( tags != '' ) shortcode += ','+tags;
|
492 |
+
if ( cats != '' ) shortcode += ','+cats;
|
493 |
+
shortcode += '"';
|
494 |
+
}
|
495 |
+
|
496 |
+
// Photo
|
497 |
+
if ( needPhoto ) {
|
498 |
+
photo = jQuery('#wppagallery-photo').val();
|
499 |
+
if ( photo ) {
|
500 |
+
id = photo.replace(/\//g,'');
|
501 |
+
id = id.split('.');
|
502 |
+
id = id[0];
|
503 |
+
jQuery('#wppagallery-photo-preview-tr').show();
|
504 |
+
var html = wppaGutenbergPhotoPreview( photo );
|
505 |
+
jQuery('#wppagallery-photo-preview').html(html);
|
506 |
+
shortcode += ' photo="'+id+'"';
|
507 |
+
jQuery('#wppagallery-photo').css('color', '#070');
|
508 |
+
}
|
509 |
+
}
|
510 |
+
|
511 |
+
// Search options
|
512 |
+
if ( type == 'search' ) {
|
513 |
+
sub = jQuery('#wppagallery-sub').prop('checked');
|
514 |
+
root = jQuery('#wppagallery-root').prop('checked');
|
515 |
+
if ( sub ) shortcode += ' sub="1"';
|
516 |
+
if ( root ) {
|
517 |
+
if ( rootalbum != '0' ) shortcode += ' root="#'+rootalbum+'"';
|
518 |
+
else shortcode += ' root="1"';
|
519 |
+
}
|
520 |
+
if ( landing != '0' ) shortcode += ' landing="'+landing+'"';
|
521 |
+
}
|
522 |
+
if ( type == 'tagcloud' || type == 'multitag' ) {
|
523 |
+
if ( taglist != '' ) {
|
524 |
+
shortcode += ' taglist="'+taglist+'"';
|
525 |
+
}
|
526 |
+
}
|
527 |
+
if ( type == 'calendar' ) {
|
528 |
+
shortcode += ' calendar="'+caltype+'"';
|
529 |
+
if ( parent ) {
|
530 |
+
shortcode += ' album="'+parent+'"';
|
531 |
+
}
|
532 |
+
if ( reverse ) {
|
533 |
+
shortcode += ' reverse="1"';
|
534 |
+
}
|
535 |
+
if ( allopen ) {
|
536 |
+
shortcode += ' all="1"';
|
537 |
+
}
|
538 |
+
}
|
539 |
+
|
540 |
+
// Admins choice
|
541 |
+
if ( type == 'choice' ) {
|
542 |
+
if ( admins.length > 0 ) {
|
543 |
+
shortcode += ' admin="'+admins+'"';
|
544 |
+
}
|
545 |
+
}
|
546 |
+
|
547 |
+
// Size
|
548 |
+
var size = document.getElementById('wppagallery-size').value;
|
549 |
+
|
550 |
+
// See if auto with fixed max
|
551 |
+
var temp = size.split(',');
|
552 |
+
if ( temp[1] ) {
|
553 |
+
if ( temp[0] == 'auto' && parseInt( temp[1] ) == temp[1] && temp[1] > 100 ) {
|
554 |
+
|
555 |
+
// its ok, auto with a static max of size temp[1]
|
556 |
+
jQuery('#wppagallery-size').css('color', '#070');
|
557 |
+
}
|
558 |
+
else {
|
559 |
+
|
560 |
+
// Not ok
|
561 |
+
size = 0;
|
562 |
+
jQuery('#wppagallery-size').css('color', '#700');
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
// Numeric?
|
567 |
+
else {
|
568 |
+
if ( size != '' && size != 'auto' ) {
|
569 |
+
if ( parseInt(size) != size ) {
|
570 |
+
size = 0;
|
571 |
+
jQuery('#wppagallery-size').css('color', '#700');
|
572 |
+
}
|
573 |
+
}
|
574 |
+
if ( size < 0 ) {
|
575 |
+
size = -size;
|
576 |
+
}
|
577 |
+
if ( size < 100 ) {
|
578 |
+
size = size / 100;
|
579 |
+
}
|
580 |
+
jQuery('#wppagallery-size').css('color', '#070');
|
581 |
+
}
|
582 |
+
|
583 |
+
// Add size to shortcode
|
584 |
+
if ( size != 0 ) {
|
585 |
+
shortcode += ' size="'+size+'"';
|
586 |
+
}
|
587 |
+
|
588 |
+
// Align
|
589 |
+
align = jQuery('#wppagallery-align').val();
|
590 |
+
if ( align != 'none' ) {
|
591 |
+
shortcode += ' align="'+align+'"';
|
592 |
+
}
|
593 |
+
|
594 |
+
// Extract comment
|
595 |
+
/*
|
596 |
+
var t = document.getElementById('wppagallery-shortcode-preview').value;
|
597 |
+
t = t.replace(/"/g, '"');
|
598 |
+
t = t.split(']');
|
599 |
+
t = t[1];
|
600 |
+
t = t.split('[');
|
601 |
+
var shortcodeComment = t[0];
|
602 |
+
*/
|
603 |
+
|
604 |
+
// Close
|
605 |
+
shortcode += ']';//+shortcodeComment+'[/wppa]';
|
606 |
+
|
607 |
+
// Display shortcode
|
608 |
+
dispShortcode = shortcode.replace(/"/g, '"');
|
609 |
+
html = '<input type="text" id="wppagallery-shortcode-preview" style="background-color:#ddd; width:100%; height:26px;" value="'+dispShortcode+'" />';
|
610 |
+
jQuery('#wppagallery-shortcode-preview-container').html( html );
|
611 |
+
|
612 |
+
// Is shortcode complete?
|
613 |
+
shortcodeOk = ( album != '' || ! needAlbum ) &&
|
614 |
+
( photo != '' || ! needPhoto ) &&
|
615 |
+
( owner != '' || ! needOwner ) &&
|
616 |
+
( taglist != '' || ! needTagList ) &&
|
617 |
+
( galType != '' || ! needGalType ) &&
|
618 |
+
( slideType != '' || ! needSlideType ) &&
|
619 |
+
( searchType != '' || ! needSearchType ) &&
|
620 |
+
( miscType != '' || ! needMiscType ) &&
|
621 |
+
( tags != '' || ! needTag ) &&
|
622 |
+
( cats != '' || ! needCat );
|
623 |
+
|
624 |
+
// Debug
|
625 |
+
if ( ! shortcodeOk ) {
|
626 |
+
var text = '';
|
627 |
+
if ( album == '' && needAlbum ) text += 'Need album\n';
|
628 |
+
if ( photo == '' && needPhoto ) text += 'Need photo\n';
|
629 |
+
if ( owner == '' && needOwner ) text += 'Need owner';
|
630 |
+
if ( taglist == '' && needTagList ) text += 'Need taglist';
|
631 |
+
if ( galType == '' && needGalType ) text += 'Need galType';
|
632 |
+
if ( slideType == '' && needSlideType ) text += 'Need slideType';
|
633 |
+
if ( searchType == '' && needSearchType ) text += 'Need searchType';
|
634 |
+
if ( miscType == '' && needMiscType ) text += 'Need miscType';
|
635 |
+
if ( tags == '' && needTag ) text += 'Need tags';
|
636 |
+
if ( cats == '' && needCat ) text += 'Need cats';
|
637 |
+
// alert( text );
|
638 |
+
}
|
639 |
+
|
640 |
+
// Display the right button
|
641 |
+
if ( shortcodeOk ) {
|
642 |
+
|
643 |
+
jQuery( '#wppa-shortcode-wppa-ready' ).show();
|
644 |
+
// jQuery('#wppagallery-submit').show();
|
645 |
+
// jQuery('#wppagallery-submit-notok').hide();
|
646 |
+
}
|
647 |
+
else {
|
648 |
+
jQuery( '#wppa-shortcode-wppa-ready' ).hide();
|
649 |
+
// jQuery('#wppagallery-submit').hide();
|
650 |
+
// jQuery('#wppagallery-submit-notok').show();
|
651 |
+
}
|
652 |
+
|
653 |
+
if ( shortcodeOk ) {
|
654 |
+
result = shortcode;
|
655 |
+
}
|
656 |
+
else {
|
657 |
+
result = '';
|
658 |
+
}
|
659 |
+
|
660 |
+
return result;
|
661 |
+
}
|
662 |
+
|
663 |
+
|
664 |
+
|
665 |
+
// Get the rendered shrtcode by ajax
|
666 |
+
function wppaGutenbergGetWppaShorcodeRendered( shortcode, divId ) {
|
667 |
+
|
668 |
+
console.log('Fetching shortcode rendered '+shortcode);
|
669 |
+
|
670 |
+
jQuery.ajax( {
|
671 |
+
|
672 |
+
url: wppaAjaxUrl,
|
673 |
+
data: 'action=wppa' +
|
674 |
+
'&wppa-action=getshortcodedrendered' +
|
675 |
+
'&shortcode=' + shortcode +
|
676 |
+
'&moccur=' + wppaPhotoDialogCounter,
|
677 |
+
async: true,
|
678 |
+
type: 'GET',
|
679 |
+
timeout: 10000,
|
680 |
+
beforeSend: function( xhr ) {
|
681 |
+
|
682 |
+
},
|
683 |
+
success: function( result, status, xhr ) {
|
684 |
+
jQuery( '#' + divId ).html( '<div id="wppa-container-'+wppaPhotoDialogCounter+'" style="clear:both;" ></div>' + result + '<div style="clear:both;" ></div>' );
|
685 |
+
// jQuery( '#' + divId ).html( '<div id="wppa-container-1" style="clear:both;" ></div>' + result + '<div style="clear:both;" ></div>' );
|
686 |
+
},
|
687 |
+
error: function( xhr, status, error ) {
|
688 |
+
wppaConsoleLog( 'Get gutenberg get shortcode rendered failed. Error = ' + error + ', status = ' + status, 'force' );
|
689 |
+
},
|
690 |
+
complete: function( xhr, status, newurl ) {
|
691 |
+
|
692 |
+
}
|
693 |
+
} );
|
694 |
+
}
|
695 |
+
|
696 |
+
function wppaGutenbergPhotoPreview( id ) {
|
697 |
+
|
698 |
+
var html;
|
699 |
+
|
700 |
+
if ( id == '#potd' ) {
|
701 |
+
html = wppaNoPreview;
|
702 |
+
}
|
703 |
+
else if ( id.indexOf('xxx') != -1 ) { // its a video
|
704 |
+
var idv = id.replace('xxx', '');
|
705 |
+
html =
|
706 |
+
'<video preload="metadata" style="max-width:400px; max-height:300px; margin-top:3px;" controls>'+
|
707 |
+
'<source src="'+wppaPhotoDirectory+idv+'mp4" type="video/mp4">'+
|
708 |
+
'<source src="'+wppaPhotoDirectory+idv+'ogg" type="video/ogg">'+
|
709 |
+
'<source src="'+wppaPhotoDirectory+idv+'ogv" type="video/ogg">'+
|
710 |
+
'<source src="'+wppaPhotoDirectory+idv+'webm" type="video/webm">'+
|
711 |
+
'</video>';
|
712 |
+
}
|
713 |
+
else {
|
714 |
+
html =
|
715 |
+
'<img src="'+wppaPhotoDirectory+id+'" style="max-width:400px; max-height:300px;" />';
|
716 |
+
}
|
717 |
+
return html;
|
718 |
+
}
|
js/wppa-utils.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
//
|
3 |
// conatins common vars and functions
|
4 |
//
|
5 |
-
var wppaJsUtilsVersion = '
|
6 |
var wppaDebug;
|
7 |
|
8 |
// Trim
|
@@ -159,103 +159,6 @@ function wppaConsoleLog( arg, force ) {
|
|
159 |
}
|
160 |
}
|
161 |
|
162 |
-
// Conversion utility
|
163 |
-
function wppaConvertScriptToShortcode( scriptId, shortcodeId ) {
|
164 |
-
|
165 |
-
var script;
|
166 |
-
var workArr;
|
167 |
-
var temp;
|
168 |
-
var item;
|
169 |
-
var value;
|
170 |
-
var type;
|
171 |
-
var album;
|
172 |
-
var photo;
|
173 |
-
var size;
|
174 |
-
var align;
|
175 |
-
var result;
|
176 |
-
|
177 |
-
script = jQuery( '#'+scriptId ).val();
|
178 |
-
if ( typeof( script ) != 'string' || script.length == 0 ) {
|
179 |
-
jQuery( '#'+shortcodeId ).val( 'No script found' );
|
180 |
-
jQuery( '#'+shortcodeId ).css( 'color', 'red' );
|
181 |
-
return;
|
182 |
-
}
|
183 |
-
|
184 |
-
workarr = script.split( '%%' );
|
185 |
-
if ( workarr[1] != 'wppa' || workarr.length < 3 ) {
|
186 |
-
jQuery( '#'+shortcodeId ).val( 'No %%wppa%% found' );
|
187 |
-
jQuery( '#'+shortcodeId ).css( 'color', 'red' );
|
188 |
-
return;
|
189 |
-
}
|
190 |
-
|
191 |
-
for ( i=3;i<workarr.length;i+=2 ) {
|
192 |
-
temp = workarr[i].split( '=' );
|
193 |
-
item = temp[0];
|
194 |
-
value = temp[1];
|
195 |
-
if ( item && value ) {
|
196 |
-
switch( item ) {
|
197 |
-
case 'size':
|
198 |
-
size = value;
|
199 |
-
break;
|
200 |
-
case 'align':
|
201 |
-
align = value;
|
202 |
-
break;
|
203 |
-
case 'photo':
|
204 |
-
case 'mphoto':
|
205 |
-
case 'slphoto':
|
206 |
-
type = item;
|
207 |
-
photo = value;
|
208 |
-
break;
|
209 |
-
case 'album':
|
210 |
-
case 'cover':
|
211 |
-
case 'slide':
|
212 |
-
case 'slideonly':
|
213 |
-
case 'slideonlyf':
|
214 |
-
case 'slidef':
|
215 |
-
type = item;
|
216 |
-
album = value;
|
217 |
-
break;
|
218 |
-
default:
|
219 |
-
jQuery( '#'+shortcodeId ).val( 'Token "' + workarr[i] + '" not recognized' );
|
220 |
-
jQuery( '#'+shortcodeId ).css( 'color', 'red' );
|
221 |
-
return;
|
222 |
-
|
223 |
-
}
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
result = '[wppa';
|
228 |
-
|
229 |
-
if ( type && type.length > 0 ) {
|
230 |
-
result += ' type="' + type + '"';
|
231 |
-
}
|
232 |
-
|
233 |
-
if ( album && album.length > 0 ) {
|
234 |
-
result += ' album="' + album + '"';
|
235 |
-
}
|
236 |
-
|
237 |
-
if ( photo && photo.length > 0 ) {
|
238 |
-
result += ' photo="' + photo + '"';
|
239 |
-
}
|
240 |
-
|
241 |
-
if ( size && size.length > 0 ) {
|
242 |
-
result += ' size="' + size + '"';
|
243 |
-
}
|
244 |
-
|
245 |
-
if ( align && align.length > 0 ) {
|
246 |
-
result += ' align="' + align + '"';
|
247 |
-
}
|
248 |
-
|
249 |
-
result += '][/wppa]';
|
250 |
-
|
251 |
-
jQuery( '#'+shortcodeId ).val( result );
|
252 |
-
jQuery( '#'+shortcodeId ).css( 'color', 'green' );
|
253 |
-
|
254 |
-
document.getElementById( shortcodeId ).focus();
|
255 |
-
document.getElementById( shortcodeId ).select();
|
256 |
-
|
257 |
-
}
|
258 |
-
|
259 |
// Get an svg image html
|
260 |
// @1: string: Name of the .svg file without extension
|
261 |
// @2: string: CSS height or empty, no ; required
|
2 |
//
|
3 |
// conatins common vars and functions
|
4 |
//
|
5 |
+
var wppaJsUtilsVersion = '7.0.00';
|
6 |
var wppaDebug;
|
7 |
|
8 |
// Trim
|
159 |
}
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
// Get an svg image html
|
163 |
// @1: string: Name of the .svg file without extension
|
164 |
// @2: string: CSS height or empty, no ; required
|
js/wppa-utils.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var wppaDebug,wppaJsUtilsVersion="
|
1 |
+
var wppaDebug,wppaJsUtilsVersion="7.0.00";function wppaTrim(e,a){return wppaTrimRight(wppaTrimLeft(e,a),a)}function wppaTrimLeft(e,a){var t,r,p,o,n,i,s;switch(typeof a){case"string":for(r=(t=e).length,p=a.length;p<=r&&t.substr(0,p)==a;)r=(t=t.substr(p)).length;break;case"object":for(n=!1,s=e;!n;){for(o=0,i=s;o<a.length;)s=wppaTrimLeft(s,a[o]),o++;n=i==s}t=s;break;default:return e.replace(/^\s\s*/,"")}return t}function wppaTrimRight(e,a){var t,r,p,o,n,i,s;switch(typeof a){case"string":for(r=(t=e).length,p=a.length;p<=r&&t.substr(r-p)==a;)r=(t=t.substr(0,r-p)).length;break;case"object":for(n=!1,s=e;!n;){for(o=0,i=s;o<a.length;)s=wppaTrimRight(s,a[o]),o++;n=i==s}t=s;break;default:return e.replace(/\s\s*$/,"")}return t}function wppa_setCookie(e,a,t){var r=new Date;r.setDate(r.getDate()+t);var p=escape(a)+(null==t?"":"; expires="+r.toUTCString());document.cookie=e+"="+p}function wppa_getCookie(e){var a,t,r,p=document.cookie.split(";");for(a=0;a<p.length;a++)if(t=p[a].substr(0,p[a].indexOf("=")),r=p[a].substr(p[a].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))==e)return unescape(r);return""}function wppaStereoTypeChange(e){wppa_setCookie("stereotype",e,365)}function wppaStereoGlassChange(e){wppa_setCookie("stereoglass",e,365)}function wppaConsoleLog(e,a){if("undefined"!=typeof console&&(wppaDebug||"force"==a)){var t=(new Date).getTime()%864e5,r=Math.floor(t/36e5);t-=60*r*60*1e3;var p=Math.floor(t/6e4);t-=60*p*1e3;var o=Math.floor(t/1e3);t-=1e3*o,console.log("At: "+r+":"+p+":"+o+"."+t+" message: "+e)}}function wppaSvgHtml(e,a,t,r,p,o,n,i){var s,l,c;switch(p||(p="0"),o||(o="10"),n||(n="20"),i||(i="50"),!1,wppaSvgCornerStyle){case"gif":case"none":radius=p;break;case"light":radius=o;break;case"medium":radius=n;break;case"heavy":radius=i}a||(a="32px"),t?(s=wppaOvlSvgFillcolor,l=wppaOvlSvgBgcolor):(s=wppaSvgFillcolor,l=wppaSvgBgcolor),c=wppaUseSvg?wppaImageDirectory+e+".svg":wppaImageDirectory+e+".png";if(wppaUseSvg&&"-1"!=jQuery.inArray(e,["Next-Button","Prev-Button","Backward-Button","Forward-Button","Pause-Button","Play-Button","Stop-Button","Eagle-1","Snail","Exit","Full-Screen","Exit-Full-Screen","Content-View"])){var u='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;'+(a?"height:"+a+";":"")+"fill:"+s+";background-color:"+l+";text-decoration:none !important;vertical-align:middle;"+(radius?"border-radius:"+radius+"%;":"")+'" xml:space="preserve" ><g>';switch(e){case"Next-Button":u+='<path d="M30,0H0V30H30V0z M20,20.5c0,0.3-0.2,0.5-0.5,0.5S19,20.8,19,20.5v-4.2l-8.3,4.6c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.2,0-0.3-0.1c-0.2-0.1-0.2-0.3-0.2-0.4v-11c0-0.2,0.1-0.4,0.3-0.4c0.2-0.1,0.4-0.1,0.5,0l8.2,5.5V9.5C19,9.2,19.2,9,19.5,9S20,9.2,20,9.5V20.5z" />';break;case"Prev-Button":u+='<path d="M30,0H0V30H30V0z M20,20.5c0,0.2-0.1,0.4-0.3,0.4c-0.1,0-0.2,0.1-0.2,0.1c-0.1,0-0.2,0-0.3-0.1L11,15.4v5.1c0,0.3-0.2,0.5-0.5,0.5S10,20.8,10,20.5v-11C10,9.2,10.2,9,10.5,9S11,9.2,11,9.5v4.2l8.3-4.6c0.2-0.1,0.3-0.1,0.5,0S20,9.3,20,9.5V20.5z" />';break;case"Pause-Button":u+='<path d="M30,0H0V30H30V0z M14,20.5c0,0.3-0.2,0.5-0.5,0.5h-4C9.2,21,9,20.8,9,20.5v-11C9,9.2,9.2,9,9.5,9h4C13.8,9,14,9.2,14,9.5V20.5z M21,20.5c0,0.3-0.2,0.5-0.5,0.5h-4c-0.3,0-0.5-0.2-0.5-0.5v-11C16,9.2,16.2,9,16.5,9h4C20.8,9,21,9.2,21,9.5V20.5z" />';break;case"Play-Button":u+='<path d="M30,0H0V30H30V0zM19.8,14.9l-8,5C11.7,20,11.6,20,11.5,20c-0.1,0-0.2,0-0.2-0.1c-0.2-0.1-0.3-0.3-0.3-0.4v-9c0-0.2,0.1-0.3,0.2-0.4c0.1-0.1,0.3-0.1,0.5,0l8,4c0.2,0.1,0.3,0.2,0.3,0.4C20,14.7,19.9,14.8,19.8,14.9z" />';break;case"Stop-Button":u+='<path d="M30,0H0V30H30V0z M21,20.5c0,0.3-0.2,0.5-0.5,0.5h-11C9.2,21,9,20.8,9,20.5v-11C9,9.2,9.2,9,9.5,9h11C20.8,9,21,9.2,21,9.5V20.5z"/>';break;case"Exit":u+='<path d="M30 24.398l-8.406-8.398 8.406-8.398-5.602-5.602-8.398 8.402-8.402-8.402-5.598 5.602 8.398 8.398-8.398 8.398 5.598 5.602 8.402-8.402 8.398 8.402z"></path>';break;case"Full-Screen":u+='<path d="M27.414 24.586l-4.586-4.586-2.828 2.828 4.586 4.586-4.586 4.586h12v-12zM12 0h-12v12l4.586-4.586 4.543 4.539 2.828-2.828-4.543-4.539zM12 22.828l-2.828-2.828-4.586 4.586-4.586-4.586v12h12l-4.586-4.586zM32 0h-12l4.586 4.586-4.543 4.539 2.828 2.828 4.543-4.539 4.586 4.586z"></path>';break;case"Exit-Full-Screen":u+='<path d="M24.586 27.414l4.586 4.586 2.828-2.828-4.586-4.586 4.586-4.586h-12v12zM0 12h12v-12l-4.586 4.586-4.539-4.543-2.828 2.828 4.539 4.543zM0 29.172l2.828 2.828 4.586-4.586 4.586 4.586v-12h-12l4.586 4.586zM20 12h12l-4.586-4.586 4.547-4.543-2.828-2.828-4.547 4.543-4.586-4.586z"></path>';break;default:alert("Native svg "+e+" not implemented")}u+="</g></svg>"}else u='<img src="'+c+'"'+(wppaUseSvg?' class="wppa-svg"':"")+' style="height:'+a+";fill:"+s+";background-color:"+l+";"+(radius?"border-radius:"+radius+"%;":"")+(wppaUseSvg?"display:none;":"")+'text-decoration:none !important;vertical-align:middle;" />';return u}var wppaLastLazy=0;function wppaMakeLazyVisible(){var e,a=(new Date).getTime();a<wppaLastLazy+200||(jQuery(".wppa-lazy").each(function(){e=jQuery(this).attr("data-src"),wppaLazyLoad&&!wppaIsElementInViewport(this)||(jQuery(this).attr("src",e),jQuery(this).removeAttr("data-src"),jQuery(this).removeClass("wppa-lazy"))}),wppaLastLazy=a)}function wppaIsElementInViewport(e){var a=e.getBoundingClientRect();return!a||0<a.bottom&&0<a.right&&a.left<jQuery(window).width()&&a.top<jQuery(window).height()}function wppaSizeThumbArea(){0<wppaThumbAreaMaxFrac&&wppaThumbAreaMaxFrac<1&&jQuery(".wppa-thumb-area").css("max-height",jQuery(window).height()*wppaThumbAreaMaxFrac)}function wppaIconSize(e,a,t){var r=t?wppaIconSizeSlide:wppaIconSizeNormal;return"default"==r?a:(wppaIsMini[e]?r/2:r)+"px;"}wppaConsoleLog("wppa-utils.js version "+wppaJsUtilsVersion+" loaded.","force");
|
readme.txt
CHANGED
@@ -2,12 +2,12 @@
|
|
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, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
|
5 |
-
Version:
|
6 |
-
Stable tag: 6.9.
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
10 |
-
Tested up to:
|
11 |
Requires PHP: 5.5
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
|
|
137 |
|
138 |
== Upgrade Notice ==
|
139 |
|
|
|
|
|
|
|
|
|
140 |
= 6.9.21 =
|
141 |
|
142 |
* This version addresses various 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, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
|
5 |
+
Version: 7.0.00
|
6 |
+
Stable tag: 6.9.21.006
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
10 |
+
Tested up to: 5.0
|
11 |
Requires PHP: 5.5
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
137 |
|
138 |
== Upgrade Notice ==
|
139 |
|
140 |
+
= 7.0.00 =
|
141 |
+
|
142 |
+
* Shortcode generators for Gutenberg added
|
143 |
+
|
144 |
= 6.9.21 =
|
145 |
|
146 |
* This version addresses various bug fixes
|
wppa-admin-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* gp admin functions
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -142,10 +142,10 @@ global $wpdb;
|
|
142 |
// Do it with albums
|
143 |
if ( $albums ) foreach ( $albums as $album ) {
|
144 |
$source_dir = wppa_get_source_album_dir( $album['id'] );
|
145 |
-
if (
|
146 |
$files = glob( $source_dir.'/*' );
|
147 |
if ( $files ) foreach ( $files as $file ) {
|
148 |
-
if ( !
|
149 |
$filename = basename( $file );
|
150 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
|
151 |
WHERE filename = %s
|
@@ -194,25 +194,25 @@ global $wpdb;
|
|
194 |
// display usefull message
|
195 |
function wppa_update_message( $msg, $fixed = false, $id = '' ) {
|
196 |
|
197 |
-
echo '<div class="notice notice-info is-dismissible"><p>' .
|
198 |
}
|
199 |
|
200 |
// display error message
|
201 |
function wppa_error_message( $msg ) {
|
202 |
|
203 |
-
echo '<div class="notice notice-error is-dismissible"><p>' .
|
204 |
}
|
205 |
|
206 |
// display warning message
|
207 |
function wppa_warning_message( $msg, $fixed = false, $id = '' ) {
|
208 |
|
209 |
-
echo '<div class="notice notice-warning is-dismissible"><p>' .
|
210 |
}
|
211 |
|
212 |
// display ok message
|
213 |
function wppa_ok_message( $msg ) {
|
214 |
|
215 |
-
echo '<div class="notice notice-success is-dismissible"><p>' .
|
216 |
}
|
217 |
|
218 |
function wppa_check_numeric( $value, $minval, $target, $maxval = '' ) {
|
@@ -241,7 +241,7 @@ function wppa_user_select( $select = '' ) {
|
|
241 |
foreach ( $users as $usr ) {
|
242 |
if ( $usr['user_login'] == $iam ) $sel = 'selected="selected"';
|
243 |
else $sel = '';
|
244 |
-
$result .= '<option value="'
|
245 |
}
|
246 |
echo ( $result );
|
247 |
}
|
@@ -540,7 +540,7 @@ global $wppa_supported_audio_extensions;
|
|
540 |
rename( $file, $newname );
|
541 |
}
|
542 |
}
|
543 |
-
elseif (
|
544 |
$entry = basename( $file );
|
545 |
if ( $entry != '.' && $entry != '..' ) {
|
546 |
_wppa_sanitze_files( $file );
|
@@ -757,7 +757,7 @@ global $warning_given_small;
|
|
757 |
|
758 |
// Verify file exists
|
759 |
if ( ! wppa( 'is_remote' ) && ! file_exists( $file ) ) {
|
760 |
-
if ( !
|
761 |
wppa_error_message( 'Error: Directory '.dirname( $file ).' does not exist.' );
|
762 |
return false;
|
763 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* gp admin functions
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
142 |
// Do it with albums
|
143 |
if ( $albums ) foreach ( $albums as $album ) {
|
144 |
$source_dir = wppa_get_source_album_dir( $album['id'] );
|
145 |
+
if ( wppa_is_dir( $source_dir ) ) {
|
146 |
$files = glob( $source_dir.'/*' );
|
147 |
if ( $files ) foreach ( $files as $file ) {
|
148 |
+
if ( ! wppa_is_dir( $file ) ) {
|
149 |
$filename = basename( $file );
|
150 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
|
151 |
WHERE filename = %s
|
194 |
// display usefull message
|
195 |
function wppa_update_message( $msg, $fixed = false, $id = '' ) {
|
196 |
|
197 |
+
echo '<div class="notice notice-info is-dismissible"><p>' . $msg . '</p></div>';
|
198 |
}
|
199 |
|
200 |
// display error message
|
201 |
function wppa_error_message( $msg ) {
|
202 |
|
203 |
+
echo '<div class="notice notice-error is-dismissible"><p>' . $msg . '</p></div>';
|
204 |
}
|
205 |
|
206 |
// display warning message
|
207 |
function wppa_warning_message( $msg, $fixed = false, $id = '' ) {
|
208 |
|
209 |
+
echo '<div class="notice notice-warning is-dismissible"><p>' . $msg . '</p></div>';
|
210 |
}
|
211 |
|
212 |
// display ok message
|
213 |
function wppa_ok_message( $msg ) {
|
214 |
|
215 |
+
echo '<div class="notice notice-success is-dismissible"><p>' . $msg . '</p></div>';
|
216 |
}
|
217 |
|
218 |
function wppa_check_numeric( $value, $minval, $target, $maxval = '' ) {
|
241 |
foreach ( $users as $usr ) {
|
242 |
if ( $usr['user_login'] == $iam ) $sel = 'selected="selected"';
|
243 |
else $sel = '';
|
244 |
+
$result .= '<option value="' . esc_attr( $usr['user_login'] ) . '" ' . $sel . '>' . $usr['display_name'] . '</option>';
|
245 |
}
|
246 |
echo ( $result );
|
247 |
}
|
540 |
rename( $file, $newname );
|
541 |
}
|
542 |
}
|
543 |
+
elseif ( wppa_is_dir( $file ) ) {
|
544 |
$entry = basename( $file );
|
545 |
if ( $entry != '.' && $entry != '..' ) {
|
546 |
_wppa_sanitze_files( $file );
|
757 |
|
758 |
// Verify file exists
|
759 |
if ( ! wppa( 'is_remote' ) && ! file_exists( $file ) ) {
|
760 |
+
if ( ! wppa_is_dir( dirname( $file ) ) ) {
|
761 |
wppa_error_message( 'Error: Directory '.dirname( $file ).' does not exist.' );
|
762 |
return false;
|
763 |
}
|
wppa-admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains the admin menu and startups the admin pages
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -81,6 +81,11 @@ function wppa_admin_styles() {
|
|
81 |
global $wppa_api_version;
|
82 |
wp_register_style( 'wppa_admin_style', WPPA_URL.'/wppa-admin-styles.css', '', $wppa_api_version );
|
83 |
wp_enqueue_style( 'wppa_admin_style' );
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/* ADMIN SCRIPTS */
|
@@ -102,6 +107,20 @@ global $wppa_api_version;
|
|
102 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
103 |
wp_enqueue_script( 'jquery-form' );
|
104 |
wp_enqueue_script( 'wppa-utils', WPPA_URL . '/js/wppa-utils.js', array(), $wppa_api_version );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
/* ADMIN PAGE PHP's */
|
@@ -179,9 +198,9 @@ require_once 'wppa-tinymce-shortcodes.php';
|
|
179 |
require_once 'wppa-tinymce-photo.php';
|
180 |
require_once 'wppa-privacy-policy.php';
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
|
186 |
/* This is for the changelog text when an update is available */
|
187 |
global $pagenow;
|
@@ -212,9 +231,6 @@ add_action('admin_notices', 'wppa_verify_multisite_config');
|
|
212 |
/* Check for pending maintenance procs */
|
213 |
add_action('admin_notices', 'wppa_maintenance_messages');
|
214 |
|
215 |
-
/* Check for old style scripting */
|
216 |
-
add_action('admin_notices', 'wppa_scripts_are_obssolete');
|
217 |
-
|
218 |
// Check if tags system needs conversion
|
219 |
add_action( 'admin_init', 'wppa_check_tag_system' );
|
220 |
|
@@ -243,6 +259,7 @@ global $wpdb;
|
|
243 |
|
244 |
// Recently uploaded photos
|
245 |
echo '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>';
|
|
|
246 |
$photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
|
247 |
|
248 |
if ( ! empty( $photos ) ) {
|
@@ -362,6 +379,8 @@ function wppa_potdlog() {
|
|
362 |
}
|
363 |
function wppa_show_potd_log() {
|
364 |
|
|
|
|
|
365 |
// Get data
|
366 |
$his = get_option( 'wppa_potd_log_data', array() );
|
367 |
if ( ! empty( $his ) ) {
|
@@ -415,7 +434,7 @@ function wppa_show_potd_log() {
|
|
415 |
}
|
416 |
}
|
417 |
|
418 |
-
// Load
|
419 |
if ( get_option( 'wppa_enable_panorama' ) == 'yes' ) {
|
420 |
add_action( 'admin_footer', 'wppa_load_panorama_js' );
|
421 |
}
|
@@ -436,4 +455,44 @@ function wppa_load_panorama_js() {
|
|
436 |
}
|
437 |
wp_enqueue_script( 'wppa-three-min-js', $three_url, array(), $ver, true );
|
438 |
}
|
439 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains the admin menu and startups the admin pages
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
81 |
global $wppa_api_version;
|
82 |
wp_register_style( 'wppa_admin_style', WPPA_URL.'/wppa-admin-styles.css', '', $wppa_api_version );
|
83 |
wp_enqueue_style( 'wppa_admin_style' );
|
84 |
+
|
85 |
+
// Standard frontend styles
|
86 |
+
wp_register_style('wppa_style', WPPA_URL.'/theme/wppa-style.css', array(), $wppa_api_version);
|
87 |
+
wp_enqueue_style('wppa_style');
|
88 |
+
|
89 |
}
|
90 |
|
91 |
/* ADMIN SCRIPTS */
|
107 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
108 |
wp_enqueue_script( 'jquery-form' );
|
109 |
wp_enqueue_script( 'wppa-utils', WPPA_URL . '/js/wppa-utils.js', array(), $wppa_api_version );
|
110 |
+
wp_enqueue_script( 'wppa', WPPA_URL . '/js/wppa.js', array(), $wppa_api_version );
|
111 |
+
wp_enqueue_script( 'wppa-slideshow', WPPA_URL . '/js/wppa-slideshow.js', array(), $wppa_api_version );
|
112 |
+
// wp_enqueue_script( 'wppa-utils', WPPA_URL . '/js/wppa-utils.js', array(), $wppa_api_version );
|
113 |
+
// wp_enqueue_script( 'wppa-utils', WPPA_URL . '/js/wppa-utils.js', array(), $wppa_api_version );
|
114 |
+
// wp_enqueue_script( 'wppa-utils', WPPA_URL . '/js/wppa-utils.js', array(), $wppa_api_version );
|
115 |
+
/*
|
116 |
+
'wppa',
|
117 |
+
'wppa-slideshow',
|
118 |
+
'wppa-ajax-front',
|
119 |
+
'wppa-lightbox',
|
120 |
+
'wppa-popup',
|
121 |
+
'wppa-touch',
|
122 |
+
'wppa-utils',
|
123 |
+
*/
|
124 |
}
|
125 |
|
126 |
/* ADMIN PAGE PHP's */
|
198 |
require_once 'wppa-tinymce-photo.php';
|
199 |
require_once 'wppa-privacy-policy.php';
|
200 |
|
201 |
+
require_once 'wppa-gutenberg-photo.php';
|
202 |
+
require_once 'wppa-gutenberg-wppa.php';
|
203 |
+
|
204 |
|
205 |
/* This is for the changelog text when an update is available */
|
206 |
global $pagenow;
|
231 |
/* Check for pending maintenance procs */
|
232 |
add_action('admin_notices', 'wppa_maintenance_messages');
|
233 |
|
|
|
|
|
|
|
234 |
// Check if tags system needs conversion
|
235 |
add_action( 'admin_init', 'wppa_check_tag_system' );
|
236 |
|
259 |
|
260 |
// Recently uploaded photos
|
261 |
echo '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>';
|
262 |
+
// echo '<style>#dashboard-widgets .inside .error { display:none; }</style>';
|
263 |
$photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
|
264 |
|
265 |
if ( ! empty( $photos ) ) {
|
379 |
}
|
380 |
function wppa_show_potd_log() {
|
381 |
|
382 |
+
// echo '<style>#dashboard-widgets .inside .error { display:none; }</style>';
|
383 |
+
|
384 |
// Get data
|
385 |
$his = get_option( 'wppa_potd_log_data', array() );
|
386 |
if ( ! empty( $his ) ) {
|
434 |
}
|
435 |
}
|
436 |
|
437 |
+
// Load panoama js if needed at the backend
|
438 |
if ( get_option( 'wppa_enable_panorama' ) == 'yes' ) {
|
439 |
add_action( 'admin_footer', 'wppa_load_panorama_js' );
|
440 |
}
|
455 |
}
|
456 |
wp_enqueue_script( 'wppa-three-min-js', $three_url, array(), $ver, true );
|
457 |
}
|
458 |
+
}
|
459 |
+
|
460 |
+
// Register category for Gutenberg
|
461 |
+
function wppa_block_categories( $categories, $post ) {
|
462 |
+
if ( $post->post_type !== 'post' && $post->post_type !== 'page' ) {
|
463 |
+
return $categories;
|
464 |
+
}
|
465 |
+
return array_merge(
|
466 |
+
$categories,
|
467 |
+
array(
|
468 |
+
array(
|
469 |
+
'slug' => 'wppa-shortcodes',
|
470 |
+
'title' => __( 'WPPA shortcodes', 'wp-photo-album-plus' ),
|
471 |
+
),
|
472 |
+
)
|
473 |
+
);
|
474 |
+
}
|
475 |
+
add_filter( 'block_categories', 'wppa_block_categories', 10, 2 );
|
476 |
+
|
477 |
+
// Fix Gutenberg bug
|
478 |
+
function wppa_fix_gutenberg_shortcodes() {
|
479 |
+
global $wpdb;
|
480 |
+
|
481 |
+
if ( strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post.php' ) !== false &&
|
482 |
+
strpos( $_SERVER['REQUEST_URI'], 'action=edit' ) !== false ) {
|
483 |
+
|
484 |
+
// Get posts with wppa block_categories
|
485 |
+
$posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->posts}
|
486 |
+
WHERE post_content LIKE %s
|
487 |
+
OR post_content LIKE %s",
|
488 |
+
'%' . $wpdb->esc_like( 'wp:wppa/gutenberg-photo' ) . '%',
|
489 |
+
'%' . $wpdb->esc_like( 'wp:wppa/gutenberg-wppa' ) . '%' ), ARRAY_A );
|
490 |
+
foreach( $posts as $post ) {
|
491 |
+
$new_content = str_replace( array( 'wp:wppa/gutenberg-photo', 'wp:wppa/gutenberg-wppa' ), 'wp:shortcode', $post['post_content'] );
|
492 |
+
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts}
|
493 |
+
SET post_content = %s
|
494 |
+
WHERE ID = %d", $new_content, $post['ID'] ) );
|
495 |
+
}
|
496 |
+
}
|
497 |
+
}
|
498 |
+
add_action( 'admin_init', 'wppa_fix_gutenberg_shortcodes' );
|
wppa-ajax.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
-
* Version
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -617,8 +617,8 @@ global $wppa_log_file;
|
|
617 |
|
618 |
// Verify existance of zips dir
|
619 |
$zipsdir = WPPA_UPLOAD_PATH.'/zips/';
|
620 |
-
if ( !
|
621 |
-
if ( !
|
622 |
echo 'ER||'.__( 'Unable to create zipsdir' , 'wp-photo-album-plus');
|
623 |
wppa_exit();
|
624 |
}
|
@@ -652,7 +652,7 @@ global $wppa_log_file;
|
|
652 |
|
653 |
// Verify existance of zips dir
|
654 |
$zipsdir = WPPA_UPLOAD_PATH . '/zips/';
|
655 |
-
if (
|
656 |
|
657 |
// Compose the users zip filename
|
658 |
$zipfile = $zipsdir.wppa_get_user().'.zip';
|
@@ -721,8 +721,8 @@ global $wppa_log_file;
|
|
721 |
$dest = WPPA_UPLOAD_PATH.'/temp/'.$name.'.'.$data['ext'];
|
722 |
$zipfile = WPPA_UPLOAD_PATH.'/temp/'.$name.'.zip';
|
723 |
$tempdir = WPPA_UPLOAD_PATH.'/temp';
|
724 |
-
if ( !
|
725 |
-
if ( !
|
726 |
echo '||2||'.__( 'Unable to create tempdir' , 'wp-photo-album-plus');
|
727 |
wppa_exit();
|
728 |
}
|
@@ -783,11 +783,21 @@ global $wppa_log_file;
|
|
783 |
wppa_exit();
|
784 |
break;
|
785 |
|
|
|
|
|
|
|
|
|
|
|
|
|
786 |
case 'getshortcodedrendered':
|
787 |
-
|
788 |
-
$
|
789 |
-
|
790 |
-
|
|
|
|
|
|
|
|
|
791 |
echo $result;
|
792 |
wppa_exit();
|
793 |
break;
|
@@ -1776,7 +1786,7 @@ global $wppa_log_file;
|
|
1776 |
// Make a backup
|
1777 |
$src_alb_dir = dirname( $src_path );
|
1778 |
//$src_alb_dir = $src_dir . '/album-' . wppa_get_photo_item( $id, 'album' );
|
1779 |
-
if ( !
|
1780 |
|
1781 |
// Make source album folder
|
1782 |
wppa_mktree( $src_alb_dir );
|
@@ -2489,7 +2499,7 @@ global $wppa_log_file;
|
|
2489 |
}
|
2490 |
}
|
2491 |
elseif ( substr( $option, 0, 8 ) == 'wppa_qr_' ) { // Is qr code setting
|
2492 |
-
if (
|
2493 |
$caches = glob( WPPA_UPLOAD_PATH . '/qr/*.svg' );
|
2494 |
if ( $caches ) foreach ( $caches as $cache ) {
|
2495 |
unlink( $cache );
|
@@ -2519,7 +2529,7 @@ global $wppa_log_file;
|
|
2519 |
case 'wppa_custom_photo_proc':
|
2520 |
$err = false;
|
2521 |
$path = WPPA_UPLOAD_PATH . '/procs/' . $option . '.php';
|
2522 |
-
if ( !
|
2523 |
mkdir( dirname( $path ) );
|
2524 |
}
|
2525 |
$file = wppa_fopen( $path, 'wb' );
|
@@ -2865,8 +2875,8 @@ global $wppa_log_file;
|
|
2865 |
|
2866 |
case 'wppa_keep_source':
|
2867 |
$dir = wppa_opt( 'source_dir' );
|
2868 |
-
if ( !
|
2869 |
-
if ( !
|
2870 |
wppa( 'error', '1' );
|
2871 |
$alert = sprintf( __( 'Unable to create or write to %s' , 'wp-photo-album-plus'), $dir );
|
2872 |
}
|
@@ -2881,8 +2891,8 @@ global $wppa_log_file;
|
|
2881 |
}
|
2882 |
else {
|
2883 |
$dir = $value;
|
2884 |
-
if ( !
|
2885 |
-
if ( !
|
2886 |
wppa( 'error', '1' );
|
2887 |
$alert = sprintf( __( 'Unable to create or write to %s' , 'wp-photo-album-plus'), $dir );
|
2888 |
}
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
+
* Version 7.0.00
|
6 |
*
|
7 |
*/
|
8 |
|
617 |
|
618 |
// Verify existance of zips dir
|
619 |
$zipsdir = WPPA_UPLOAD_PATH.'/zips/';
|
620 |
+
if ( ! wppa_is_dir( $zipsdir ) ) wppa_mkdir( $zipsdir );
|
621 |
+
if ( ! wppa_is_dir( $zipsdir ) ) {
|
622 |
echo 'ER||'.__( 'Unable to create zipsdir' , 'wp-photo-album-plus');
|
623 |
wppa_exit();
|
624 |
}
|
652 |
|
653 |
// Verify existance of zips dir
|
654 |
$zipsdir = WPPA_UPLOAD_PATH . '/zips/';
|
655 |
+
if ( wppa_is_dir( $zipsdir ) ) {
|
656 |
|
657 |
// Compose the users zip filename
|
658 |
$zipfile = $zipsdir.wppa_get_user().'.zip';
|
721 |
$dest = WPPA_UPLOAD_PATH.'/temp/'.$name.'.'.$data['ext'];
|
722 |
$zipfile = WPPA_UPLOAD_PATH.'/temp/'.$name.'.zip';
|
723 |
$tempdir = WPPA_UPLOAD_PATH.'/temp';
|
724 |
+
if ( ! wppa_is_dir( $tempdir ) ) wppa_mkdir( $tempdir );
|
725 |
+
if ( ! wppa_is_dir( $tempdir ) ) {
|
726 |
echo '||2||'.__( 'Unable to create tempdir' , 'wp-photo-album-plus');
|
727 |
wppa_exit();
|
728 |
}
|
783 |
wppa_exit();
|
784 |
break;
|
785 |
|
786 |
+
case 'gutenbergwppadialog':
|
787 |
+
$result = wppa_make_gutenberg_wppa_dialog();
|
788 |
+
echo $result;
|
789 |
+
wppa_exit();
|
790 |
+
break;
|
791 |
+
|
792 |
case 'getshortcodedrendered':
|
793 |
+
$shortcode = stripslashes( $_REQUEST['shortcode'] );
|
794 |
+
$occ = strval( intval ( $_REQUEST['moccur'] ) );
|
795 |
+
wppa_log( 'Obs', 'Shortcode request from Gutenberg: ' . $shortcode . ', occ=' . $occ );
|
796 |
+
global $wppa_opt;
|
797 |
+
$wppa_opt['wppa_lazy'] = 'no';
|
798 |
+
$wppa_opt['wppa_inline_css'] = 'yes';
|
799 |
+
// wppa( 'mocc', $occ );
|
800 |
+
$result = do_shortcode( $shortcode );
|
801 |
echo $result;
|
802 |
wppa_exit();
|
803 |
break;
|
1786 |
// Make a backup
|
1787 |
$src_alb_dir = dirname( $src_path );
|
1788 |
//$src_alb_dir = $src_dir . '/album-' . wppa_get_photo_item( $id, 'album' );
|
1789 |
+
if ( ! wppa_is_dir( $src_alb_dir ) ) {
|
1790 |
|
1791 |
// Make source album folder
|
1792 |
wppa_mktree( $src_alb_dir );
|
2499 |
}
|
2500 |
}
|
2501 |
elseif ( substr( $option, 0, 8 ) == 'wppa_qr_' ) { // Is qr code setting
|
2502 |
+
if ( wppa_is_dir( WPPA_UPLOAD_PATH . '/qr' ) ) {
|
2503 |
$caches = glob( WPPA_UPLOAD_PATH . '/qr/*.svg' );
|
2504 |
if ( $caches ) foreach ( $caches as $cache ) {
|
2505 |
unlink( $cache );
|
2529 |
case 'wppa_custom_photo_proc':
|
2530 |
$err = false;
|
2531 |
$path = WPPA_UPLOAD_PATH . '/procs/' . $option . '.php';
|
2532 |
+
if ( ! wppa_is_dir( dirname( $path ) ) ) {
|
2533 |
mkdir( dirname( $path ) );
|
2534 |
}
|
2535 |
$file = wppa_fopen( $path, 'wb' );
|
2875 |
|
2876 |
case 'wppa_keep_source':
|
2877 |
$dir = wppa_opt( 'source_dir' );
|
2878 |
+
if ( ! wppa_is_dir( $dir ) ) wppa_mkdir( $dir );
|
2879 |
+
if ( ! wppa_is_dir( $dir ) || ! is_writable( $dir ) ) {
|
2880 |
wppa( 'error', '1' );
|
2881 |
$alert = sprintf( __( 'Unable to create or write to %s' , 'wp-photo-album-plus'), $dir );
|
2882 |
}
|
2891 |
}
|
2892 |
else {
|
2893 |
$dir = $value;
|
2894 |
+
if ( ! wppa_is_dir( $dir ) ) wppa_mkdir( $dir );
|
2895 |
+
if ( ! wppa_is_dir( $dir ) || ! is_writable( $dir ) ) {
|
2896 |
wppa( 'error', '1' );
|
2897 |
$alert = sprintf( __( 'Unable to create or write to %s' , 'wp-photo-album-plus'), $dir );
|
2898 |
}
|
wppa-common-functions.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-common-functions.php
|
3 |
*
|
4 |
* Functions used in admin and in themes
|
5 |
-
* Version
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -1098,7 +1098,7 @@ global $cache_path;
|
|
1098 |
|
1099 |
// Last resort: Manually remove the content of wp-content/cache/
|
1100 |
if ( $force ) {
|
1101 |
-
if (
|
1102 |
wppa_tree_empty( WPPA_CONTENT_PATH . '/cache' );
|
1103 |
wppa_log('obs', 'Generic cache cleared');
|
1104 |
}
|
@@ -1114,7 +1114,7 @@ function wppa_tree_empty( $dir ) {
|
|
1114 |
if ( is_array( $files ) ) foreach ( $files as $file ) {
|
1115 |
$name = basename( $file );
|
1116 |
if ( $name == '.' || $name == '..' ) {}
|
1117 |
-
elseif (
|
1118 |
wppa_tree_empty( $file );
|
1119 |
// @ unlink( $file );
|
1120 |
}
|
2 |
/* wppa-common-functions.php
|
3 |
*
|
4 |
* Functions used in admin and in themes
|
5 |
+
* Version 7.0.00
|
6 |
*
|
7 |
*/
|
8 |
|
1098 |
|
1099 |
// Last resort: Manually remove the content of wp-content/cache/
|
1100 |
if ( $force ) {
|
1101 |
+
if ( wppa_is_dir( WPPA_CONTENT_PATH . '/cache/' ) ) {
|
1102 |
wppa_tree_empty( WPPA_CONTENT_PATH . '/cache' );
|
1103 |
wppa_log('obs', 'Generic cache cleared');
|
1104 |
}
|
1114 |
if ( is_array( $files ) ) foreach ( $files as $file ) {
|
1115 |
$name = basename( $file );
|
1116 |
if ( $name == '.' || $name == '..' ) {}
|
1117 |
+
elseif ( wppa_is_dir( $file ) ) {
|
1118 |
wppa_tree_empty( $file );
|
1119 |
// @ unlink( $file );
|
1120 |
}
|
wppa-cron.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all cron functions
|
6 |
-
* Version
|
7 |
*
|
8 |
*
|
9 |
*/
|
@@ -257,7 +257,7 @@ global $wpdb;
|
|
257 |
wppa_exif_clean_garbage();
|
258 |
|
259 |
// Cleanup qr cache
|
260 |
-
if (
|
261 |
$qrs = glob( WPPA_UPLOAD_PATH . '/qr/*.svg' );
|
262 |
if ( ! empty( $qrs ) ) {
|
263 |
$count = count( $qrs );
|
@@ -314,7 +314,7 @@ function wppa_do_clear_cache() {
|
|
314 |
$relroot = 'cache';
|
315 |
}
|
316 |
$root = WPPA_CONTENT_PATH . '/' . $relroot;
|
317 |
-
if (
|
318 |
|
319 |
wppa_log( 'Cron', '{b}wppa_clear_cache{/b} started.' );
|
320 |
_wppa_do_clear_cache( $root );
|
@@ -328,7 +328,7 @@ function _wppa_do_clear_cache( $dir ) {
|
|
328 |
if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
|
329 |
$name = basename( $fso );
|
330 |
if ( $name == '.' || $name == '..' ) {}
|
331 |
-
elseif (
|
332 |
_wppa_do_clear_cache( $fso );
|
333 |
}
|
334 |
else {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all cron functions
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*
|
9 |
*/
|
257 |
wppa_exif_clean_garbage();
|
258 |
|
259 |
// Cleanup qr cache
|
260 |
+
if ( wppa_is_dir( WPPA_UPLOAD_PATH . '/qr' ) ) {
|
261 |
$qrs = glob( WPPA_UPLOAD_PATH . '/qr/*.svg' );
|
262 |
if ( ! empty( $qrs ) ) {
|
263 |
$count = count( $qrs );
|
314 |
$relroot = 'cache';
|
315 |
}
|
316 |
$root = WPPA_CONTENT_PATH . '/' . $relroot;
|
317 |
+
if ( wppa_is_dir( $root ) ) {
|
318 |
|
319 |
wppa_log( 'Cron', '{b}wppa_clear_cache{/b} started.' );
|
320 |
_wppa_do_clear_cache( $root );
|
328 |
if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
|
329 |
$name = basename( $fso );
|
330 |
if ( $name == '.' || $name == '..' ) {}
|
331 |
+
elseif ( wppa_is_dir( $fso ) ) {
|
332 |
_wppa_do_clear_cache( $fso );
|
333 |
}
|
334 |
else {
|
wppa-filter.php
CHANGED
@@ -345,13 +345,14 @@ global $wppa_revno;
|
|
345 |
if ( wppa_in_widget() ) $do_it = true; // A widget always works
|
346 |
if ( is_feed() ) $do_it = true; // A feed has no head section
|
347 |
if ( wppa_switch( 'render_shortcode_always' ) ) $do_it = true; // Always
|
|
|
348 |
|
349 |
if ( wppa( 'debug' ) ) {
|
350 |
if ( $do_it ) $msg = 'Doit is on'; else $msg = 'Doit is off';
|
351 |
wppa_dbg_msg( $msg );
|
352 |
}
|
353 |
|
354 |
-
// Do it also for url only shortcode
|
355 |
if ( $do_it || $wppa['is_url'] ) {
|
356 |
$result = wppa_albums(); // Get the HTML
|
357 |
}
|
345 |
if ( wppa_in_widget() ) $do_it = true; // A widget always works
|
346 |
if ( is_feed() ) $do_it = true; // A feed has no head section
|
347 |
if ( wppa_switch( 'render_shortcode_always' ) ) $do_it = true; // Always
|
348 |
+
if ( wppa( 'ajax' ) ) $do_it = true;
|
349 |
|
350 |
if ( wppa( 'debug' ) ) {
|
351 |
if ( $do_it ) $msg = 'Doit is on'; else $msg = 'Doit is off';
|
352 |
wppa_dbg_msg( $msg );
|
353 |
}
|
354 |
|
355 |
+
// Do it also for url only shortcode and when ajax
|
356 |
if ( $do_it || $wppa['is_url'] ) {
|
357 |
$result = wppa_albums(); // Get the HTML
|
358 |
}
|
wppa-gutenberg-photo.php
ADDED
@@ -0,0 +1,410 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* wppa-gutenberg-photo.php
|
3 |
+
* Pachkage: wp-photo-album-plus
|
4 |
+
*
|
5 |
+
* Version 7.0.00
|
6 |
+
*/
|
7 |
+
|
8 |
+
function wppa_gutenberg_photo_block() {
|
9 |
+
|
10 |
+
// Gutenberg installed?
|
11 |
+
if ( ! function_exists( 'register_block_type' ) ) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
wp_register_script(
|
16 |
+
'wppa-gutenberg-photo',
|
17 |
+
plugins_url( 'js/wppa-gutenberg-photo.js', __FILE__ ),
|
18 |
+
array( 'wp-blocks', 'wp-element' )
|
19 |
+
);
|
20 |
+
|
21 |
+
register_block_type( 'wppa/gutenberg-photo', array(
|
22 |
+
'editor_script' => 'wppa-gutenberg-photo',
|
23 |
+
) );
|
24 |
+
}
|
25 |
+
add_action( 'init', 'wppa_gutenberg_photo_block' );
|
26 |
+
|
27 |
+
function wppa_gutenberg_photo_inject() {
|
28 |
+
|
29 |
+
// Things that wppa-gutenberg-photo.js needs to know
|
30 |
+
echo
|
31 |
+
'<script>
|
32 |
+
var wppaImageDirectory = "' . wppa_get_imgdir() . '";
|
33 |
+
var wppaAjaxUrl = "'.admin_url('admin-ajax.php').'";
|
34 |
+
var wppaPhotoDirectory = "'.WPPA_UPLOAD_URL.'/";
|
35 |
+
</script>';
|
36 |
+
|
37 |
+
}
|
38 |
+
add_action( 'admin_head', 'wppa_gutenberg_photo_inject' );
|
39 |
+
|
40 |
+
function wppa_make_gutenberg_photo_dialog( $front = false ) {
|
41 |
+
global $wpdb;
|
42 |
+
|
43 |
+
// Prepare albuminfo
|
44 |
+
$albums = $wpdb->get_results( $wpdb->prepare( "SELECT id, name
|
45 |
+
FROM $wpdb->wppa_albums
|
46 |
+
WHERE owner = %s
|
47 |
+
OR owner = '--- public ---'
|
48 |
+
ORDER BY name ", wppa_get_user() ), ARRAY_A );
|
49 |
+
|
50 |
+
// Make the html
|
51 |
+
// Open wrapper
|
52 |
+
$result =
|
53 |
+
'<div id="wppaphoto-form" >';
|
54 |
+
|
55 |
+
// Open table
|
56 |
+
$result .=
|
57 |
+
'
|
58 |
+
<table id="wppaphoto-table" class="wppaphoto-table form-table" >' .
|
59 |
+
'<tbody>' .
|
60 |
+
|
61 |
+
// My photos selection
|
62 |
+
'
|
63 |
+
<tr id="wppaphoto-myphoto-tr" style="" >' .
|
64 |
+
'<th><label for="wppaphoto-myphoto" class="wppaphoto-myphoto" >'.__('My Photo to be used', 'wp-photo-album-plus').':</label></th>'.
|
65 |
+
'<td>'.
|
66 |
+
'<select id="wppaphoto-myphoto" name="photo" class="wppaphoto-myphoto" onchange="wppaPhotoEvaluate()" >' .
|
67 |
+
wppa_get_myphotos_selection_body_for_gutenberg() .
|
68 |
+
'</select>'.
|
69 |
+
'<input' .
|
70 |
+
' type="button"' .
|
71 |
+
' value="' . esc_attr( __( 'All photos', 'wp-photo-album-plus' ) ) . '"' .
|
72 |
+
' onclick="jQuery(\'#wppaphoto-myphoto-tr\').hide();jQuery(\'#wppaphoto-allphoto-tr\').show();wppaMyPhotoSelection=false;jQuery(\'#wppaphoto-photo-preview\').html(\'\');wppaPhotoEvaluate();"' .
|
73 |
+
' />' .
|
74 |
+
'<br />'.
|
75 |
+
'<small style="" class="wppamyphoto-photo" >'.
|
76 |
+
__('Specify the photo to be used', 'wp-photo-album-plus').'<br />'.
|
77 |
+
__('You can select one of your photos from a maximum of 100 most recently added', 'wp-photo-album-plus').'<br />'.
|
78 |
+
'</small>'.
|
79 |
+
'</td>'.
|
80 |
+
'</tr>' .
|
81 |
+
|
82 |
+
// Photo selection max 100 of all photos
|
83 |
+
'
|
84 |
+
<tr id="wppaphoto-allphoto-tr" style="display:none;" >'.
|
85 |
+
'<th><label for="wppaphoto-allphoto" class="wppaphoto-allphoto" >'.__('The Photo to be used', 'wp-photo-album-plus').':</label></th>'.
|
86 |
+
'<td>'.
|
87 |
+
'<select id="wppaphoto-allphoto" name="photo" class="wppaphoto-allphoto" onchange="wppaPhotoEvaluate()" >' .
|
88 |
+
wppa_get_allphotos_selection_body_for_gutenberg() .
|
89 |
+
'</select>' .
|
90 |
+
'<br />' .
|
91 |
+
'<small style="" class="wppaphoto-allphoto" >'.
|
92 |
+
__('Specify the photo to be used', 'wp-photo-album-plus').'<br />'.
|
93 |
+
__('You can select from a maximum of 100 most recently added photos', 'wp-photo-album-plus').'<br />'.
|
94 |
+
'</small>'.
|
95 |
+
'</td>'.
|
96 |
+
'</tr>'.
|
97 |
+
|
98 |
+
// Photo preview
|
99 |
+
'
|
100 |
+
<tr id="wppaphoto-photo-preview-tr" style="" >'.
|
101 |
+
'<th>' .
|
102 |
+
__( 'Preview image', 'wp-photo-album-plus').':' .
|
103 |
+
'</th>'.
|
104 |
+
'<td id="wppaphoto-photo-preview" style="text-align:center;" >' .
|
105 |
+
'</td>' .
|
106 |
+
'</tr>';
|
107 |
+
|
108 |
+
// Upload new photo dialog
|
109 |
+
if ( count( $albums ) > 0 ) {
|
110 |
+
$result .=
|
111 |
+
'
|
112 |
+
<tr id="wppa-gutenberg-upload-tr" >' .
|
113 |
+
'<th>' .
|
114 |
+
'<a' .
|
115 |
+
' style="cursor:pointer;"' .
|
116 |
+
' onclick="jQuery(\'#upload-td\').show();jQuery( \'#wppa-user-upload\' ).click();"' .
|
117 |
+
' >' .
|
118 |
+
__( 'Upload new photo', 'wp-photo-album-plus' ) . ':' .
|
119 |
+
'</a>' .
|
120 |
+
'</th>'.
|
121 |
+
'<td id="upload-td" style="display:none;" >' .
|
122 |
+
|
123 |
+
// Open form
|
124 |
+
'<form' .
|
125 |
+
' id="wppa-uplform"' .
|
126 |
+
' action="' . WPPA_URL . '/wppa-ajax-front.php?action=wppa&wppa-action=do-fe-upload&fromgutenberg=1"' .
|
127 |
+
' method="post"' .
|
128 |
+
' enctype="multipart/form-data"' .
|
129 |
+
' >' .
|
130 |
+
wppa_nonce_field( 'wppa-check' , 'wppa-nonce', false, false ) .
|
131 |
+
|
132 |
+
// Single album
|
133 |
+
( ( count( $albums ) == 1 ) ?
|
134 |
+
|
135 |
+
'<input' .
|
136 |
+
' type="hidden"' .
|
137 |
+
' id="wppa-upload-album"' .
|
138 |
+
' name="wppa-upload-album"' .
|
139 |
+
' value="' . $albums[0]['id'] . '"' .
|
140 |
+
' />' .
|
141 |
+
|
142 |
+
__( 'Upload to album', 'wp-photo-album-plus' ) . ': <b>' . wppa_get_album_name( $albums[0]['id'] ) . '</b>' :
|
143 |
+
|
144 |
+
|
145 |
+
// Multiple albums
|
146 |
+
__( 'Upload to album', 'wp-photo-album-plus' ) . ':' .
|
147 |
+
wppa_album_select_a( array( 'tagid' => 'wppa-upload-album',
|
148 |
+
'tagname' => 'wppa-upload-album',
|
149 |
+
'tagopen' => '<select' .
|
150 |
+
' id="wppa-upload-album"' .
|
151 |
+
' name="wppa-upload-album"' .
|
152 |
+
' style="max-width:300px;"' .
|
153 |
+
' >' ,
|
154 |
+
'addpleaseselect' => true,
|
155 |
+
'checkupload' => true,
|
156 |
+
'checkowner' => true,
|
157 |
+
|
158 |
+
) ) ) .
|
159 |
+
|
160 |
+
// The (hidden) functional button
|
161 |
+
'
|
162 |
+
<input' .
|
163 |
+
' type="file"' .
|
164 |
+
' style="' .
|
165 |
+
'display:none;' .
|
166 |
+
'"' .
|
167 |
+
' id="wppa-user-upload"' .
|
168 |
+
' name="wppa-user-upload"' .
|
169 |
+
' onchange="jQuery( \'#wppa-user-upload-submit\' ).css( \'display\', \'block\' );wppaDisplaySelectedFile(\'wppa-user-upload\', \'wppa-user-upload-submit\');"' .
|
170 |
+
' />' .
|
171 |
+
|
172 |
+
// The upload submit button
|
173 |
+
'
|
174 |
+
<input' .
|
175 |
+
' type="submit"' .
|
176 |
+
' id="wppa-user-upload-submit"' .
|
177 |
+
' onclick="if ( document.getElementById( \'wppa-upload-album\' ).value == 0 )' .
|
178 |
+
' {alert( \''.esc_js( __( 'Please select an album and try again', 'wp-photo-album-plus' ) ).'\' );return false;}"' .
|
179 |
+
' style="display:none;margin: 6px 0;"' .
|
180 |
+
' class="wppa-user-upload-submit"' .
|
181 |
+
' name="wppa-user-upload-submit"' .
|
182 |
+
' value=""' .
|
183 |
+
' />' .
|
184 |
+
|
185 |
+
// The progression bar
|
186 |
+
'
|
187 |
+
<div' .
|
188 |
+
' id="progress"' .
|
189 |
+
' class="wppa-progress "' .
|
190 |
+
' style="clear:both;width:70%;border-color:#777;height:18px;border:1px solid;padding:1px;border-radius:3px;line-height: 18px;text-align: center;"' .
|
191 |
+
' >' .
|
192 |
+
'<div id="bar" class="wppa-bar" ></div>' .
|
193 |
+
'<div id="percent" class="wppa-percent" >0%</div >' .
|
194 |
+
'</div>' .
|
195 |
+
'<div id="message" class="wppa-message" ></div>' .
|
196 |
+
|
197 |
+
|
198 |
+
// Form complete
|
199 |
+
'</form>' .
|
200 |
+
|
201 |
+
// Upload script
|
202 |
+
'<script type="text/javascript" >' .
|
203 |
+
'jQuery(function() {
|
204 |
+
|
205 |
+
var options = {
|
206 |
+
beforeSend: function() {
|
207 |
+
jQuery("#progress").show();
|
208 |
+
jQuery("#bar").width("0%");
|
209 |
+
jQuery("#message").html("");
|
210 |
+
jQuery("#percent").html("");
|
211 |
+
},
|
212 |
+
uploadProgress: function(event, position, total, percentComplete) {
|
213 |
+
jQuery("#bar").width(percentComplete+"%");
|
214 |
+
if ( percentComplete < 95 ) {
|
215 |
+
jQuery("#percent").html(percentComplete+"%");
|
216 |
+
}
|
217 |
+
else {
|
218 |
+
jQuery("#percent").html(wppaTxtProcessing);
|
219 |
+
}
|
220 |
+
},
|
221 |
+
success: function() {
|
222 |
+
jQuery("#bar").width("100%");
|
223 |
+
jQuery("#percent").html(wppaTxtDone);
|
224 |
+
},
|
225 |
+
complete: function(response) {
|
226 |
+
|
227 |
+
var resparr = response.responseText.split( "||" );
|
228 |
+
|
229 |
+
// Non fatal error uploading?
|
230 |
+
if ( resparr.length == 1 ) {
|
231 |
+
jQuery("#message").html( \'<span style="font-size: 10px;" >\'+resparr[0]+\'</span>\' );
|
232 |
+
}
|
233 |
+
else {
|
234 |
+
jQuery( "#wppaphoto-myphoto" ).html( resparr[2] );
|
235 |
+
}
|
236 |
+
wppaPhotoEvaluate();
|
237 |
+
|
238 |
+
},
|
239 |
+
error: function() {
|
240 |
+
jQuery("#message").html( \'<span style="color: red;" >\'+wppaTxtErrUnable+\'</span>\' );
|
241 |
+
}
|
242 |
+
};
|
243 |
+
jQuery("#wppa-uplform").ajaxForm(options);
|
244 |
+
});' .
|
245 |
+
'</script>' .
|
246 |
+
'</td>' .
|
247 |
+
'</tr>';
|
248 |
+
}
|
249 |
+
|
250 |
+
// Shortcode preview
|
251 |
+
$result .=
|
252 |
+
'
|
253 |
+
<tr>' .
|
254 |
+
'<th>' .
|
255 |
+
__( 'Shortcode', 'wp-photo-album-plus' ) . ':' .
|
256 |
+
'</th>' .
|
257 |
+
'<td id="wppaphoto-shortcode-preview-container" >' .
|
258 |
+
'<input type="text" id="wppaphoto-shortcode-preview" style="background-color:#ddd; width:500px; height:26px;" value="[photo]" />' .
|
259 |
+
'</td>' .
|
260 |
+
'</tr>' .
|
261 |
+
|
262 |
+
'</tbody>' .
|
263 |
+
|
264 |
+
'</table>' .
|
265 |
+
|
266 |
+
'<input
|
267 |
+
id="wppa-shortcode-photo-ready"
|
268 |
+
type="button"
|
269 |
+
style="display:none;"
|
270 |
+
value="' . __( 'Ready', 'wp-photo-album-plus' ) . '"
|
271 |
+
/ >' .
|
272 |
+
|
273 |
+
// Initial evaluate
|
274 |
+
'<script type="text/javascript" >wppaPhotoEvaluate()</script>' .
|
275 |
+
|
276 |
+
// Close main wrapper
|
277 |
+
'
|
278 |
+
</div>';
|
279 |
+
|
280 |
+
return $result;
|
281 |
+
}
|
282 |
+
|
283 |
+
// The my photos selection box body
|
284 |
+
function wppa_get_myphotos_selection_body_for_gutenberg( $selected = 0 ) {
|
285 |
+
global $wpdb;
|
286 |
+
|
287 |
+
// Init
|
288 |
+
$result = '';
|
289 |
+
|
290 |
+
// Prepare photoinfo
|
291 |
+
$my_photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, name, album, ext
|
292 |
+
FROM $wpdb->wppa_photos
|
293 |
+
WHERE owner = %s
|
294 |
+
ORDER BY timestamp DESC LIMIT 100", wppa_get_user() ), ARRAY_A );
|
295 |
+
|
296 |
+
if ( $my_photos ) {
|
297 |
+
|
298 |
+
// Please select
|
299 |
+
$result .= '<option' .
|
300 |
+
' class="wppa-photo-select-item-first"' .
|
301 |
+
' value=""' .
|
302 |
+
' disabled="disabled"' .
|
303 |
+
( $selected ? '' : ' selected="selected"' ) .
|
304 |
+
' style="color:#700"' .
|
305 |
+
' >' .
|
306 |
+
'-- ' . __( 'Please select a photo', 'wp-photo-album-plus' ) . ' --' .
|
307 |
+
'</option>';
|
308 |
+
|
309 |
+
// Most recent 100 photos of this owner
|
310 |
+
foreach ( $my_photos as $photo ) {
|
311 |
+
|
312 |
+
$name = stripslashes(__($photo['name']));
|
313 |
+
if ( strlen($name) > '50') $name = substr($name, '0', '50').'...';
|
314 |
+
|
315 |
+
if ( get_option( 'wppa_file_system' ) == 'flat' ) {
|
316 |
+
$val = $photo['id'] . '.' . $photo['ext'];
|
317 |
+
}
|
318 |
+
else {
|
319 |
+
$val = wppa_expand_id( $photo['id'] ) . '.' . $photo['ext'];
|
320 |
+
}
|
321 |
+
|
322 |
+
if ( wppa_has_audio( $photo['id'] ) && is_file( WPPA_UPLOAD_PATH . '/' . wppa_fix_poster_ext( $val, $photo['id'] ) ) ) {
|
323 |
+
$value = wppa_fix_poster_ext( $val, $photo['id'] );
|
324 |
+
}
|
325 |
+
else {
|
326 |
+
$value = $val;
|
327 |
+
}
|
328 |
+
|
329 |
+
$result .= '<option' .
|
330 |
+
' class="wppa-photo-select-item"' .
|
331 |
+
' value="' . $value . '"' .
|
332 |
+
' >' .
|
333 |
+
$name .
|
334 |
+
' (' . wppa_get_album_name( $photo['album'] ) . ')' .
|
335 |
+
'</option>';
|
336 |
+
|
337 |
+
}
|
338 |
+
}
|
339 |
+
else {
|
340 |
+
$result .= '<option value="0" >' .
|
341 |
+
__( 'You have no photos yet', 'wp-photo-album-plus' ) .
|
342 |
+
'</option>';
|
343 |
+
}
|
344 |
+
|
345 |
+
return $result;
|
346 |
+
}
|
347 |
+
|
348 |
+
// The my photos selection box body
|
349 |
+
function wppa_get_allphotos_selection_body_for_gutenberg() {
|
350 |
+
global $wpdb;
|
351 |
+
|
352 |
+
// Init
|
353 |
+
$result = '';
|
354 |
+
|
355 |
+
// Prepare photoinfo
|
356 |
+
$all_photos = $wpdb->get_results( "SELECT id, name, album, ext " .
|
357 |
+
"FROM $wpdb->wppa_photos " .
|
358 |
+
"ORDER BY timestamp DESC LIMIT 100",
|
359 |
+
ARRAY_A );
|
360 |
+
|
361 |
+
if ( $all_photos ) {
|
362 |
+
|
363 |
+
// Please select
|
364 |
+
$result .= '<option' .
|
365 |
+
' class="wppa-photo-select-item-first"' .
|
366 |
+
' value=""' .
|
367 |
+
' disabled="disabled"' .
|
368 |
+
' selected="selected"' .
|
369 |
+
' style="color:#700"' .
|
370 |
+
' >' .
|
371 |
+
'-- ' . __( 'Please select a photo', 'wp-photo-album-plus' ) . ' --' .
|
372 |
+
'</option>';
|
373 |
+
|
374 |
+
// Most recent 100 photos of all photos
|
375 |
+
foreach ( $all_photos as $photo ) {
|
376 |
+
|
377 |
+
$name = stripslashes(__($photo['name']));
|
378 |
+
if ( strlen($name) > '50') $name = substr($name, '0', '50').'...';
|
379 |
+
if ( get_option( 'wppa_file_system' ) == 'flat' ) {
|
380 |
+
$val = $photo['id'] . '.' . $photo['ext'];
|
381 |
+
}
|
382 |
+
else {
|
383 |
+
$val = wppa_expand_id( $photo['id'] ) . '.' . $photo['ext'];
|
384 |
+
}
|
385 |
+
|
386 |
+
if ( wppa_has_audio( $photo['id'] ) && is_file( WPPA_UPLOAD_PATH . '/' . wppa_fix_poster_ext( $val, $photo['id'] ) ) ) {
|
387 |
+
$value = wppa_fix_poster_ext( $val, $photo['id'] );
|
388 |
+
}
|
389 |
+
else {
|
390 |
+
$value = $val;
|
391 |
+
}
|
392 |
+
|
393 |
+
$result .= '<option' .
|
394 |
+
' class="wppa-photo-select-item"' .
|
395 |
+
' value="' . $value . '"' .
|
396 |
+
' >' .
|
397 |
+
$name .
|
398 |
+
' (' . wppa_get_album_name( $photo['album'] ) . ')' .
|
399 |
+
'</option>';
|
400 |
+
|
401 |
+
}
|
402 |
+
}
|
403 |
+
else {
|
404 |
+
$result .= '<option value="0" >' .
|
405 |
+
__( 'There are no photos yet', 'wp-photo-album-plus' ) .
|
406 |
+
'</option>';
|
407 |
+
}
|
408 |
+
|
409 |
+
return $result;
|
410 |
+
}
|
wppa-gutenberg-wppa.php
ADDED
@@ -0,0 +1,664 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* wppa-gutenberg-wppa.php
|
3 |
+
* Pachkage: wp-photo-album-plus
|
4 |
+
*
|
5 |
+
* Version 7.0.00
|
6 |
+
*/
|
7 |
+
|
8 |
+
function wppa_gutenberg_wppa_block() {
|
9 |
+
|
10 |
+
// Gutenberg installed?
|
11 |
+
if ( ! function_exists( 'register_block_type' ) ) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
wp_register_script(
|
16 |
+
'wppa-gutenberg-wppa',
|
17 |
+
plugins_url( 'js/wppa-gutenberg-wppa.js', __FILE__ ),
|
18 |
+
array( 'wp-blocks', 'wp-element' )
|
19 |
+
);
|
20 |
+
|
21 |
+
register_block_type( 'wppa/gutenberg-wppa', array(
|
22 |
+
'editor_script' => 'wppa-gutenberg-wppa',
|
23 |
+
) );
|
24 |
+
}
|
25 |
+
add_action( 'init', 'wppa_gutenberg_wppa_block' );
|
26 |
+
|
27 |
+
function wppa_gutenberg_wppa_inject() {
|
28 |
+
|
29 |
+
// Things that wppa-gutenberg-wppa.js needs to know
|
30 |
+
echo
|
31 |
+
'<script>
|
32 |
+
var wppaImageDirectory = "' . wppa_get_imgdir() . '";
|
33 |
+
var wppaAjaxUrl = "'.admin_url('admin-ajax.php').'";
|
34 |
+
var wppaPhotoDirectory = "'.WPPA_UPLOAD_URL.'/";
|
35 |
+
</script>';
|
36 |
+
|
37 |
+
}
|
38 |
+
add_action( 'admin_head', 'wppa_gutenberg_wppa_inject' );
|
39 |
+
|
40 |
+
function wppa_make_gutenberg_wppa_dialog( $front = false ) {
|
41 |
+
global $wpdb;
|
42 |
+
|
43 |
+
// Prepare albuminfo
|
44 |
+
if ( wppa_has_many_albums() ) {
|
45 |
+
$albums = null;
|
46 |
+
}
|
47 |
+
else {
|
48 |
+
$albums = $wpdb->get_results( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY timestamp DESC", ARRAY_A );
|
49 |
+
if ( wppa_switch( 'hier_albsel' ) ) {
|
50 |
+
$albums = wppa_add_paths( $albums );
|
51 |
+
$albums = wppa_array_sort( $albums, 'name' );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
// Prepare photoinfo
|
56 |
+
$photos = $wpdb->get_results( "SELECT id, name, album, ext FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 100", ARRAY_A );
|
57 |
+
|
58 |
+
// Get Tags/cats
|
59 |
+
$tags = wppa_get_taglist();
|
60 |
+
$cats = wppa_get_catlist();
|
61 |
+
|
62 |
+
// Pages suitable for landing
|
63 |
+
$query = "SELECT ID, post_title, post_content, post_parent " .
|
64 |
+
"FROM " . $wpdb->posts . " " .
|
65 |
+
"WHERE post_type = 'page' AND post_status = 'publish' " .
|
66 |
+
"ORDER BY post_title ASC";
|
67 |
+
$pages = $wpdb->get_results( $query, ARRAY_A );
|
68 |
+
|
69 |
+
if ( $pages ) {
|
70 |
+
|
71 |
+
// Add parents optionally OR translate only
|
72 |
+
if ( wppa_switch( 'hier_pagesel' ) ) $pages = wppa_add_parents( $pages );
|
73 |
+
|
74 |
+
// Just translate
|
75 |
+
else {
|
76 |
+
foreach ( array_keys( $pages ) as $index ) {
|
77 |
+
$pages[$index]['post_title'] = __( stripslashes($pages[$index]['post_title'] ) );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
// Sort alpahbetically
|
82 |
+
$pages = wppa_array_sort( $pages, 'post_title' );
|
83 |
+
}
|
84 |
+
|
85 |
+
$admins = array();
|
86 |
+
|
87 |
+
if ( wppa_user_is( 'administrator' ) ) {
|
88 |
+
$admins = get_users( array( 'role' => 'administrator' ) );
|
89 |
+
}
|
90 |
+
|
91 |
+
// Make the html
|
92 |
+
$result =
|
93 |
+
'<div id="wppagallery-form" >'.
|
94 |
+
|
95 |
+
'<table id="wppagallery-table" class="form-table">'.
|
96 |
+
|
97 |
+
// Top type selection
|
98 |
+
'<tr >'.
|
99 |
+
'<th><label for="wppagallery-top-type">'.__('Type of WPPA display:', 'wp-photo-album-plus').'</label></th>'.
|
100 |
+
'<td>'.
|
101 |
+
'<select id="wppagallery-top-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
102 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a display type', 'wp-photo-album-plus').' --</option>'.
|
103 |
+
'<option value="galerytype" >'.__('A gallery with covers and/or thumbnails', 'wp-photo-album-plus').'</option>'.
|
104 |
+
'<option value="slidestype" >'.__('A slideshow', 'wp-photo-album-plus').'</option>'.
|
105 |
+
'<option value="singletype" >'.__('A single image', 'wp-photo-album-plus').'</option>'.
|
106 |
+
'<option value="searchtype" >'.__('A search/selection box', 'wp-photo-album-plus').'</option>'.
|
107 |
+
'<option value="misceltype" >'.__('An other box type', 'wp-photo-album-plus').'</option>'.
|
108 |
+
'</select>'.
|
109 |
+
'</td>'.
|
110 |
+
'</tr>'.
|
111 |
+
|
112 |
+
// Top type I: gallery sub type
|
113 |
+
'<tr id="wppagallery-galery-type-tr" style="display:none;" >'.
|
114 |
+
'<th><label for="wppagallery-galery-type">'.__('Type of gallery display:', 'wp-photo-album-plus').'</label></th>'.
|
115 |
+
'<td>'.
|
116 |
+
'<select id="wppagallery-galery-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
117 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a gallery type', 'wp-photo-album-plus').' --</option>'.
|
118 |
+
'<option value="cover" >'.__('The cover(s) of specific album(s)', 'wp-photo-album-plus').'</option>'.
|
119 |
+
'<option value="content" >'.__('The content of specific album(s)', 'wp-photo-album-plus').'</option>'.
|
120 |
+
'<option value="covers" >'.__('The covers of the subalbums of specific album(s)', 'wp-photo-album-plus').'</option>'.
|
121 |
+
'<option value="thumbs" >'.__('The thumbnails of specific album(s)', 'wp-photo-album-plus').'</option>'.
|
122 |
+
'</select>'.
|
123 |
+
'</td>'.
|
124 |
+
'</tr>'.
|
125 |
+
|
126 |
+
// Top type II: slide sub type
|
127 |
+
'<tr id="wppagallery-slides-type-tr" style="display:none;" >'.
|
128 |
+
'<th><label for="wppagallery-slides-type">'.__('Type of slideshow:', 'wp-photo-album-plus').'</label></th>'.
|
129 |
+
'<td>'.
|
130 |
+
'<select id="wppagallery-slides-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
131 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a slideshow type', 'wp-photo-album-plus').' --</option>'.
|
132 |
+
'<option value="slide" >'.__('A fully featured slideshow', 'wp-photo-album-plus').'</option>'.
|
133 |
+
'<option value="slideonly" >'.__('A slideshow without supporting boxes', 'wp-photo-album-plus').'</option>'.
|
134 |
+
'<option value="slideonlyf" >'.__('A slideshow with a filmstrip only', 'wp-photo-album-plus').'</option>'.
|
135 |
+
'<option value="filmonly" >'.__('A filmstrip only', 'wp-photo-album-plus').'</option>'.
|
136 |
+
'</select>'.
|
137 |
+
'</td>'.
|
138 |
+
'</tr>'.
|
139 |
+
|
140 |
+
// Top type III: single sub type
|
141 |
+
'<tr id="wppagallery-single-type-tr" style="display:none;" >'.
|
142 |
+
'<th><label for="wppagallery-single-type">'.__('Type of single image:', 'wp-photo-album-plus').'</label></th>'.
|
143 |
+
'<td>'.
|
144 |
+
'<select id="wppagallery-single-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
145 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a single image type', 'wp-photo-album-plus').' --</option>'.
|
146 |
+
'<option value="photo" >'.__('A plain single photo', 'wp-photo-album-plus').'</option>'.
|
147 |
+
'<option value="mphoto" >'.__('A single photo with caption', 'wp-photo-album-plus').'</option>'.
|
148 |
+
'<option value="xphoto" >'.__('A single photo with extended caption', 'wp-photo-album-plus').'</option>'.
|
149 |
+
'<option value="slphoto" >'.__('A single photo in the style of a slideshow', 'wp-photo-album-plus').'</option>'.
|
150 |
+
'</select>'.
|
151 |
+
'</td>'.
|
152 |
+
'</tr>'.
|
153 |
+
|
154 |
+
// Top type IV: search sub type
|
155 |
+
'<tr id="wppagallery-search-type-tr" style="display:none;" >'.
|
156 |
+
'<th><label for="wppagallery-search-type">'.__('Type of search:', 'wp-photo-album-plus').'</label></th>'.
|
157 |
+
'<td>'.
|
158 |
+
'<select id="wppagallery-search-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
159 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a search type', 'wp-photo-album-plus').' --</option>'.
|
160 |
+
'<option value="search" >'.__('A search box', 'wp-photo-album-plus').'</option>'.
|
161 |
+
'<option value="supersearch" >'.__('A supersearch box', 'wp-photo-album-plus').'</option>'.
|
162 |
+
'<option value="tagcloud" >'.__('A tagcloud box', 'wp-photo-album-plus').'</option>'.
|
163 |
+
'<option value="multitag" >'.__('A multitag box', 'wp-photo-album-plus').'</option>'.
|
164 |
+
'<option value="superview" >'.__('A superview box', 'wp-photo-album-plus').'</option>'.
|
165 |
+
'<option value="calendar" >'.__('A calendar box', 'wp-photo-album-plus').'</option>'.
|
166 |
+
'</select>'.
|
167 |
+
'</td>'.
|
168 |
+
'</tr>'.
|
169 |
+
|
170 |
+
// Top type V: other sub type
|
171 |
+
'<tr id="wppagallery-miscel-type-tr" style="display:none;" >'.
|
172 |
+
'<th><label for="wppagallery-miscel-type">'.__('Type miscellaneous:', 'wp-photo-album-plus').'</label></th>'.
|
173 |
+
'<td>'.
|
174 |
+
'<select id="wppagallery-miscel-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
175 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a miscellaneous display', 'wp-photo-album-plus').' --</option>'.
|
176 |
+
'<option value="generic">'.__('A generic albums display', 'wp-photo-album-plus').'</option>'.
|
177 |
+
'<option value="upload">'.__('An upload box', 'wp-photo-album-plus').'</option>'.
|
178 |
+
'<option value="landing">'.__('A landing page shortcode', 'wp-photo-album-plus').'</option>'.
|
179 |
+
'<option value="stereo">'.__('A 3D stereo settings box', 'wp-photo-album-plus').'</option>'.
|
180 |
+
'<option value="choice">'.__('An admins choice box', 'wp-photo-album-plus').'</option>'.
|
181 |
+
'</select>'.
|
182 |
+
'</td>'.
|
183 |
+
'</tr>'.
|
184 |
+
|
185 |
+
// Administrators ( for admins choice, show admin only if current user is an admin or superuser )
|
186 |
+
'<tr id="wppagallery-admins-tr" style="display:none;" >'.
|
187 |
+
'<th><label for="wppagallery-admins">'.__('Users:', 'wp-photo-album-plus').'</label></th>'.
|
188 |
+
'<td>'.
|
189 |
+
'<select id="wppagallery-admins" name="admins" style="color:#070;" multiple="multiple" onchange="wppaGalleryEvaluate()">'.
|
190 |
+
'<option value="" selected="selected" style="color:#070;" >-- '.__('All', 'wp-photo-album-plus').' --</option>';
|
191 |
+
foreach( $admins as $user ) {
|
192 |
+
$result .=
|
193 |
+
'<option value="'.$user->data->user_login.'" class="wppagallery-admin" style="color:#070;" >'.$user->data->user_login.'</option>';
|
194 |
+
}
|
195 |
+
$users = get_option( 'wppa_super_users', array() );
|
196 |
+
foreach( $users as $user ) {
|
197 |
+
$result .=
|
198 |
+
'<option value="'.$user.'" class="wppagallery-admin" >'.$user.'</option>';
|
199 |
+
}
|
200 |
+
$result .=
|
201 |
+
'</select>'.
|
202 |
+
'</td>'.
|
203 |
+
'</tr>'.
|
204 |
+
|
205 |
+
// Real or Virtual albums
|
206 |
+
'<tr id="wppagallery-album-type-tr" style="display:none;" >'.
|
207 |
+
'<th><label for="wppagallery-album-type">'.__('Kind of selection:', 'wp-photo-album-plus').'</label></th>'.
|
208 |
+
'<td>'.
|
209 |
+
'<select id="wppagallery-album-type" name="type" onchange="wppaGalleryEvaluate()">'.
|
210 |
+
'<option value="" selected="selected" disabled="disabled" style="color:#700 !important;" >-- '.__('Please select a type of selection to be used', 'wp-photo-album-plus').' --</option>'.
|
211 |
+
'<option value="real">'.__('One or more wppa+ albums', 'wp-photo-album-plus').'</option>'.
|
212 |
+
'<option value="virtual">'.__('A special selection', 'wp-photo-album-plus').'</option>'.
|
213 |
+
'</select>'.
|
214 |
+
'</td>'.
|
215 |
+
'</tr>'.
|
216 |
+
|
217 |
+
// Virtual albums
|
218 |
+
'<tr id="wppagallery-album-virt-tr" style="display:none;" >'.
|
219 |
+
'<th><label for="wppagallery-album-virt">'.__('The selection to be used:', 'wp-photo-album-plus').'</label></th>'.
|
220 |
+
'<td>'.
|
221 |
+
'<select id="wppagallery-album-virt" name="album" class="wppagallery-album" onchange="wppaGalleryEvaluate()">'.
|
222 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a virtual album', 'wp-photo-album-plus').' --</option>'.
|
223 |
+
'<option value="#last" >'.__('The most recently modified album', 'wp-photo-album-plus').'</option>'.
|
224 |
+
'<option value="#topten" >'.__('The top rated photos', 'wp-photo-album-plus').'</option>'.
|
225 |
+
'<option value="#lasten" >'.__('The most recently uploaded photos', 'wp-photo-album-plus').'</option>'.
|
226 |
+
'<option value="#featen" >'.__('A random selection of featured photos', 'wp-photo-album-plus').'</option>'.
|
227 |
+
'<option value="#comten" >'.__('The most recently commented photos', 'wp-photo-album-plus').'</option>'.
|
228 |
+
'<option value="#tags" >'.__('Photos tagged with certain tags', 'wp-photo-album-plus').'</option>'.
|
229 |
+
'<option value="#cat" >'.__('Albums tagged with a certain category', 'wp-photo-album-plus').'</option>'.
|
230 |
+
'<option value="#owner" >'.__('Photos in albums owned by a certain user', 'wp-photo-album-plus').'</option>'.
|
231 |
+
'<option value="#upldr" >'.__('Photos uploaded by a certain user', 'wp-photo-album-plus').'</option>'.
|
232 |
+
'<option value="#all" >'.__('All photos in the system', 'wp-photo-album-plus').'</option>'.
|
233 |
+
'</select>'.
|
234 |
+
'</td>'.
|
235 |
+
'</tr>'.
|
236 |
+
|
237 |
+
// Virtual albums that have covers
|
238 |
+
'<tr id="wppagallery-album-virt-cover-tr" style="display:none;" >'.
|
239 |
+
'<th><label for="wppagallery-album-virt-cover">'.__('The selection to be used:', 'wp-photo-album-plus').'</label></th>'.
|
240 |
+
'<td>'.
|
241 |
+
'<select id="wppagallery-album-virt-cover" name="album" class="wppagallery-album" onchange="wppaGalleryEvaluate()">'.
|
242 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a virtual album', 'wp-photo-album-plus').' --</option>'.
|
243 |
+
'<option value="#last" >'.__('The most recently modified album', 'wp-photo-album-plus').'</option>'.
|
244 |
+
'<option value="#owner" >'.__('Albums owned by a certain user', 'wp-photo-album-plus').'</option>'.
|
245 |
+
'<option value="#cat" >'.__('Albums tagged with certain categories', 'wp-photo-album-plus').'</option>'.
|
246 |
+
'<option value="#all" >'.__('All albums in the system', 'wp-photo-album-plus').'</option>'.
|
247 |
+
'</select>'.
|
248 |
+
'</td>'.
|
249 |
+
'</tr>'.
|
250 |
+
|
251 |
+
// Real albums
|
252 |
+
'<tr id="wppagallery-album-real-tr" style="display:none;" >'.
|
253 |
+
'<th><label for="wppagallery-album-real">'.__('The Album(s) to be used:', 'wp-photo-album-plus').'</label></th>'.
|
254 |
+
'<td>';
|
255 |
+
if ( wppa_has_many_albums() ) {
|
256 |
+
$result .=
|
257 |
+
'<input id="wppagallery-album-real" style="max-width:400px;" name="album" onchange="wppaGalleryEvaluate()" />'.
|
258 |
+
'<br />'.
|
259 |
+
__('Enter one or more album numbers, seperated by commas', 'wp-photo-album-plus');
|
260 |
+
}
|
261 |
+
else {
|
262 |
+
$result .=
|
263 |
+
'<select id="wppagallery-album-real" style="max-width:400px;" name="album" multiple="multiple" onchange="wppaGalleryEvaluate()">';
|
264 |
+
if ( $albums ) {
|
265 |
+
|
266 |
+
// Please select
|
267 |
+
$result .= '<option id="wppagallery-album-0" value="0" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select one or more albums', 'wp-photo-album-plus').' --</option>';
|
268 |
+
|
269 |
+
// All standard albums
|
270 |
+
foreach ( $albums as $album ) {
|
271 |
+
$id = $album['id'];
|
272 |
+
$result .= '<option class="wppagallery-album-r" value="' . $id . '" >'.stripslashes( __( $album['name'] ) ) . ' (' . $id . ')</option>';
|
273 |
+
}
|
274 |
+
}
|
275 |
+
else {
|
276 |
+
$result .= '<option value="0" style="color:#700;" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>';
|
277 |
+
}
|
278 |
+
$result .= '</select>';
|
279 |
+
}
|
280 |
+
$result .=
|
281 |
+
'</td>'.
|
282 |
+
'</tr>';
|
283 |
+
if ( ! wppa_has_many_albums() ) {
|
284 |
+
$result .=
|
285 |
+
'<tr id="wppagallery-album-real-search-tr" style="display:none;" >' .
|
286 |
+
'<th><label for="">'.__('Filter album:', 'wp-photo-album-plus').'</label></th>'.
|
287 |
+
'<td>'.
|
288 |
+
'<input id="wppagallery-album-real-search" type="text" onkeyup="wppaGalleryEvaluate()" />'.
|
289 |
+
'<br />'.
|
290 |
+
'<small>'.
|
291 |
+
__('Enter a (part of) the album name to limit the options in the selection box above.', 'wp-photo-album-plus').' '.
|
292 |
+
'</small>'.
|
293 |
+
'</td>'.
|
294 |
+
'</tr>';
|
295 |
+
}
|
296 |
+
|
297 |
+
// Real albums optional
|
298 |
+
$result .=
|
299 |
+
'<tr id="wppagallery-album-realopt-tr" style="display:none;" >'.
|
300 |
+
'<th><label for="wppagallery-album-realopt">'.__('The Album(s) to be used:', 'wp-photo-album-plus').'</label></th>'.
|
301 |
+
'<td>';
|
302 |
+
if ( wppa_has_many_albums() ) {
|
303 |
+
$result .=
|
304 |
+
'<input id="wppagallery-album-realopt" style="max-width:400px;" name="album" onchange="wppaGalleryEvaluate()" value="0" />'.
|
305 |
+
'<br />'.
|
306 |
+
__('Optinally enter one or more album numbers, seperated by commas, or 0 for all albums', 'wp-photo-album-plus');
|
307 |
+
}
|
308 |
+
else {
|
309 |
+
$result .=
|
310 |
+
'<select id="wppagallery-album-realopt" style="max-width:400px;" name="album" multiple="multiple" onchange="wppaGalleryEvaluate()">';
|
311 |
+
if ( $albums ) {
|
312 |
+
|
313 |
+
// Please select
|
314 |
+
$result .= '<option id="wppagallery-album-0" class="wppagallery-album-ropt" value="0" selected="selected" >-- '.__('All albums', 'wp-photo-album-plus').' --</option>';
|
315 |
+
|
316 |
+
// All standard albums
|
317 |
+
foreach ( $albums as $album ) {
|
318 |
+
$id = $album['id'];
|
319 |
+
$result .= '<option class="wppagallery-album-ropt" value="' . $id . '" >'.stripslashes( __( $album['name'] ) ) . ' (' . $id . ')</option>';
|
320 |
+
}
|
321 |
+
}
|
322 |
+
else {
|
323 |
+
$result .= '<option value="0" >' . __('There are no albums yet', 'wp-photo-album-plus') . '</option>';
|
324 |
+
}
|
325 |
+
$result .= '</select>';
|
326 |
+
}
|
327 |
+
$result .=
|
328 |
+
'</td>'.
|
329 |
+
'</tr>'.
|
330 |
+
|
331 |
+
// Owner selection
|
332 |
+
'<tr id="wppagallery-owner-tr" style="display:none" >'.
|
333 |
+
'<th><label for="wppagallery-owner">'.__('The album owner:', 'wp-photo-album-plus').'</label></th>'.
|
334 |
+
'<td>'.
|
335 |
+
'<select id="wppagallery-owner" name="owner" class="wppagallery-owner" onchange="wppaGalleryEvaluate()">'.
|
336 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a user', 'wp-photo-album-plus').' --</option>'.
|
337 |
+
'<option value="#me" >-- '.__('The logged in visitor', 'wp-photo-album-plus').' --</option>';
|
338 |
+
$users = wppa_get_users();
|
339 |
+
if ( $users ) foreach ( $users as $user ) {
|
340 |
+
$result .= '<option value="'.$user['user_login'].'" >'.$user['display_name'].'</option>';
|
341 |
+
}
|
342 |
+
else { // Too many
|
343 |
+
$result .= '<option value="xxx" >-- '.__('Too many users, edit manually', 'wp-photo-album-plus').' --</option>';
|
344 |
+
}
|
345 |
+
$result .=
|
346 |
+
'</select>'.
|
347 |
+
'</td>'.
|
348 |
+
'</tr>'.
|
349 |
+
|
350 |
+
// Owner Parent album
|
351 |
+
'<tr id="wppagallery-owner-parent-tr" style="display:none;" >'.
|
352 |
+
'<th><label for="wppagallery-owner-parent">'.__('Parent album:', 'wp-photo-album-plus').'</label></th>'.
|
353 |
+
'<td>'.
|
354 |
+
'<select id="wppagallery-owner-parent" style="color:#070 !important;max-width:400px;" name="parentalbum" multiple="multiple" onchange="wppaGalleryEvaluate()">';
|
355 |
+
if ( $albums ) {
|
356 |
+
|
357 |
+
// Please select
|
358 |
+
$result .= '<option class="wppagallery-album-p" value="" selected="selected" >-- '.__('No parent specification', 'wp-photo-album-plus').' --</option>';
|
359 |
+
|
360 |
+
// Generic
|
361 |
+
$result .= '<option class="wppagallery-album-p" value="zero" >-- '.__('The generic parent', 'wp-photo-album-plus').' --</option>';
|
362 |
+
|
363 |
+
// All standard albums
|
364 |
+
foreach ( $albums as $album ) {
|
365 |
+
$id = $album['id'];
|
366 |
+
$result .= '<option class="wppagallery-album-p" value="'.$id.'" >'.stripslashes(__($album['name'])).' ('.$id.')</option>';
|
367 |
+
}
|
368 |
+
}
|
369 |
+
else {
|
370 |
+
$result .= '<option value="0" >'.__('There are no albums yet', 'wp-photo-album-plus').'</option>';
|
371 |
+
}
|
372 |
+
$result .= '</select>'.
|
373 |
+
'</td>'.
|
374 |
+
'</tr>'.
|
375 |
+
|
376 |
+
// Album parent
|
377 |
+
'<tr id="wppagallery-album-parent-tr" style="display:none;" >'.
|
378 |
+
'<th><label for="wppagallery-album-parent">'.__('Parent album:', 'wp-photo-album-plus').'</label></th>'.
|
379 |
+
'<td>'.
|
380 |
+
'<select id="wppagallery-album-parent-parent" style="color:#070 !important;max-width:400px;" name="parentalbum" onchange="wppaGalleryEvaluate()">';
|
381 |
+
if ($albums) {
|
382 |
+
|
383 |
+
// Please select
|
384 |
+
$result .= '<option id="wppagallery-album-0" value="0" selected="selected" style="color:#700 !important;" >-- '.__('The generic parent', 'wp-photo-album-plus').' --</option>';
|
385 |
+
|
386 |
+
// All standard albums
|
387 |
+
foreach ( $albums as $album ) {
|
388 |
+
$id = $album['id'];
|
389 |
+
$result .= '<option class="wppagallery-album" value="'.$id.'" >'.stripslashes(__($album['name'])).' ('.$id.')</option>';
|
390 |
+
}
|
391 |
+
}
|
392 |
+
else {
|
393 |
+
$result .= '<option value="0" >'.__('There are no albums yet', 'wp-photo-album-plus').'</option>';
|
394 |
+
}
|
395 |
+
$result .= '</select>'.
|
396 |
+
'</td>'.
|
397 |
+
'</tr>'.
|
398 |
+
|
399 |
+
// Album count
|
400 |
+
'<tr id="wppagallery-album-count-tr" style="display:none;" >'.
|
401 |
+
'<th><label for="wppagallery-album-count">'.__('Max Albums:', 'wp-photo-album-plus').'</label></th>'.
|
402 |
+
'<td>'.
|
403 |
+
'<input id="wppagallery-album-count" type="text" style="color:#070;" value="1" onchange="wppaGalleryEvaluate()" />'.
|
404 |
+
'</td>'.
|
405 |
+
'</tr>'.
|
406 |
+
|
407 |
+
// Photo count
|
408 |
+
'<tr id="wppagallery-photo-count-tr" style="display:none;" >'.
|
409 |
+
'<th><label for="wppagallery-photo-count">'.__('Max Photos:', 'wp-photo-album-plus').'</label></th>'.
|
410 |
+
'<td>'.
|
411 |
+
'<input id="wppagallery-photo-count" type="text" style="color:#070;" value="1" onchange="wppaGalleryEvaluate()" />'.
|
412 |
+
'</td>'.
|
413 |
+
'</tr>'.
|
414 |
+
|
415 |
+
// Albums with certain cats
|
416 |
+
'<tr id="wppagallery-albumcat-tr" style="display:none;" >'.
|
417 |
+
'<th><label for="wppagallery-albumcat">'.__('The album cat(s):', 'wp-photo-album-plus').'</label></th>'.
|
418 |
+
'<td>'.
|
419 |
+
'<select id="wppagallery-albumcat" style="color:#700 !important;" onchange="wppaGalleryEvaluate()" multiple="multiple" >'.
|
420 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >'.__('--- please select category ---', 'wp-photo-album-plus').'</option>';
|
421 |
+
if ( $cats ) foreach ( array_keys( $cats ) as $cat ) {
|
422 |
+
$result .= '<option class="wppagallery-albumcat" value="'.$cat.'" >'.$cat.'</option>';
|
423 |
+
}
|
424 |
+
$result .=
|
425 |
+
'</select>'.
|
426 |
+
'</td>'.
|
427 |
+
'</tr>'.
|
428 |
+
|
429 |
+
// Photo selection
|
430 |
+
'<tr id="wppagallery-photo-tr" style="display:none;" >'.
|
431 |
+
'<th><label for="wppagallery-photo" class="wppagallery-photo" >'.__('The Photo to be used:', 'wp-photo-album-plus').'</label></th>'.
|
432 |
+
'<td>'.
|
433 |
+
'<select id="wppagallery-photo" name="photo" class="wppagallery-photo" onchange="wppaGalleryEvaluate()" >';
|
434 |
+
if ( $photos ) {
|
435 |
+
|
436 |
+
// Please select
|
437 |
+
$result .= '<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select a photo', 'wp-photo-album-plus').' --</option>';
|
438 |
+
$result .= '<option value="#potd" >-- '.__('The photo of the day', 'wp-photo-album-plus').' --</option>';
|
439 |
+
|
440 |
+
// Most recent 100 photos
|
441 |
+
foreach ( $photos as $photo ) {
|
442 |
+
|
443 |
+
$name = stripslashes(__($photo['name']));
|
444 |
+
if ( strlen($name) > '50') $name = substr($name, '0', '50').'...';
|
445 |
+
|
446 |
+
if ( get_option( 'wppa_file_system' ) == 'flat' ) {
|
447 |
+
$val = $photo['id'] . '.' . $photo['ext'];
|
448 |
+
}
|
449 |
+
else {
|
450 |
+
$val = wppa_expand_id( $photo['id'] ) . '.' . $photo['ext'];
|
451 |
+
}
|
452 |
+
|
453 |
+
if ( wppa_has_audio( $photo['id'] ) && is_file( WPPA_UPLOAD_PATH . '/' . wppa_fix_poster_ext( $val, $photo['id'] ) ) ) {
|
454 |
+
$value = wppa_fix_poster_ext( $val, $photo['id'] );
|
455 |
+
}
|
456 |
+
else {
|
457 |
+
$value = $val;
|
458 |
+
}
|
459 |
+
|
460 |
+
$result .= '<option' .
|
461 |
+
' value="' . $value . '"' .
|
462 |
+
' >' .
|
463 |
+
$name .
|
464 |
+
' (' . wppa_get_album_name( $photo['album'] ) . ')' .
|
465 |
+
'</option>';
|
466 |
+
}
|
467 |
+
$result .= '<option value="#last" >-- '.__('The most recently uploaded photo', 'wp-photo-album-plus').' --</option>'.
|
468 |
+
'<option value="#potd" >-- '.__('The photo of the day', 'wp-photo-album-plus').' --</option>';
|
469 |
+
}
|
470 |
+
else {
|
471 |
+
$result .= '<option value="0" >'.__('There are no photos yet', 'wp-photo-album-plus').'</option>';
|
472 |
+
}
|
473 |
+
$result .=
|
474 |
+
'</select>'.
|
475 |
+
'<br />'.
|
476 |
+
'<small style="display:none;" class="wppagallery-photo" >'.
|
477 |
+
__('Specify the photo to be used', 'wp-photo-album-plus').'<br />'.
|
478 |
+
__('You can select from a maximum of 100 most recently added photos', 'wp-photo-album-plus').'<br />'.
|
479 |
+
'</small>'.
|
480 |
+
'</td>'.
|
481 |
+
'</tr>'.
|
482 |
+
|
483 |
+
// Photo preview
|
484 |
+
'<tr id="wppagallery-photo-preview-tr" style="display:none;" >'.
|
485 |
+
'<th><label for="wppagallery-photo-preview" >'.__('Preview image:', 'wp-photo-album-plus').'</label></th>'.
|
486 |
+
'<td id="wppagallery-photo-preview" style="text-align:center;" >'.
|
487 |
+
'</td >'.
|
488 |
+
'</tr>'.
|
489 |
+
|
490 |
+
// Photos with certain tags
|
491 |
+
'<tr id="wppagallery-phototags-tr" style="display:none;" >'.
|
492 |
+
'<th><label for="wppagallery-phototags">'.__('The photo tag(s):', 'wp-photo-album-plus').'</label></th>'.
|
493 |
+
'<td>'.
|
494 |
+
'<select id="wppagallery-phototags" style="color:#700 !important;" multiple="multiple" onchange="wppaGalleryEvaluate()">'.
|
495 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >'.__('--- please select tag(s) ---', 'wp-photo-album-plus').'</option>';
|
496 |
+
if ( $tags ) foreach ( array_keys($tags) as $tag ) {
|
497 |
+
$result .= '<option class="wppagallery-phototags" value="'.$tag.'" >'.$tag.'</option>';
|
498 |
+
}
|
499 |
+
$result .=
|
500 |
+
'</select>'.
|
501 |
+
'</td>'.
|
502 |
+
'</tr>'.
|
503 |
+
|
504 |
+
// Tags and cats additional settings
|
505 |
+
'<tr id="wppagallery-tags-cats-tr" style="display:none;" >'.
|
506 |
+
'<th><label>'.__('Or / And:', 'wp-photo-album-plus').'</label></th>'.
|
507 |
+
'<td>'.
|
508 |
+
'<input id="wppagallery-or" type="radio" name="andor" value="or" onchange="wppaGalleryEvaluate()"/>'.__('Meet any', 'wp-photo-album-plus').' '.
|
509 |
+
'<input id="wppagallery-and" type="radio" name="andor" value="and" onchange="wppaGalleryEvaluate()"/>'.__('Meet all', 'wp-photo-album-plus').
|
510 |
+
'</td>'.
|
511 |
+
'</tr>'.
|
512 |
+
|
513 |
+
// Search additional settings
|
514 |
+
'<tr id="wppagallery-search-tr" style="display:none;" >'.
|
515 |
+
'<th><label>'.__('Additional features:', 'wp-photo-album-plus').'</label></th>'.
|
516 |
+
'<td>'.
|
517 |
+
'<input id="wppagallery-sub" type="checkbox" name="sub" onchange="wppaGalleryEvaluate()"/>'.__('Enable Subsearch', 'wp-photo-album-plus').' '.
|
518 |
+
'<input id="wppagallery-root" type="checkbox" name="root" onchange="wppaGalleryEvaluate()"/>'.__('Enable Rootsearch', 'wp-photo-album-plus').
|
519 |
+
'</td>'.
|
520 |
+
'</tr>'.
|
521 |
+
|
522 |
+
// Optiona root album
|
523 |
+
'<tr id="wppagallery-rootalbum-tr" style="display:none;" >'.
|
524 |
+
'<th><label>'.__('Search root:', 'wp-photo-album-plus').'</label></th>'.
|
525 |
+
'<td>'.
|
526 |
+
'<select id="wppagallery-rootalbum" onchange="wppaGalleryEvaluate()" >'.
|
527 |
+
'<option value="0" selected="selected" >'.__('--- default ---', 'wp-photo-album-plus').'</option>';
|
528 |
+
if ( $albums ) {
|
529 |
+
|
530 |
+
// All standard albums
|
531 |
+
foreach ( $albums as $album ) {
|
532 |
+
$id = $album['id'];
|
533 |
+
$result .= '<option class="wppagallery-rootalbum" value="'.$id.'" >'.stripslashes(__($album['name'])).' ('.$id.')</option>';
|
534 |
+
}
|
535 |
+
}
|
536 |
+
$result .=
|
537 |
+
'</select>'.
|
538 |
+
'</td>'.
|
539 |
+
'</tr>'.
|
540 |
+
|
541 |
+
// Landing page
|
542 |
+
'<tr id="wppagallery-landing-tr" style="display:none;" >'.
|
543 |
+
'<th><label>'.__('Landing page:', 'wp-photo-album-plus').'</label></th>'.
|
544 |
+
'<td>'.
|
545 |
+
'<select id="wppagallery-landing" onchange="wppaGalleryEvaluate()" >'.
|
546 |
+
'<option value="0" selected="selected" >'.__('--- default ---', 'wp-photo-album-plus').'</option>';
|
547 |
+
if ( $pages ) {
|
548 |
+
foreach( $pages as $page ) {
|
549 |
+
$dis = '';
|
550 |
+
if ( strpos( $page['post_content'], '[wppa' ) === false ) {
|
551 |
+
$dis = ' disabled="disabled"';
|
552 |
+
}
|
553 |
+
$result .= '<option value="'.$page['ID'].'"'.$dis.' >'.__( $page['post_title'] ).'</option>';
|
554 |
+
}
|
555 |
+
}
|
556 |
+
$result .=
|
557 |
+
'</select>'.
|
558 |
+
'</td>'.
|
559 |
+
'</tr>'.
|
560 |
+
|
561 |
+
// Tagcloud/list additional settings
|
562 |
+
'<tr id="wppagallery-taglist-tr" style="display:none;" >'.
|
563 |
+
'<th><label>'.__('Additional features:', 'wp-photo-album-plus').'</label></th>'.
|
564 |
+
'<td>'.
|
565 |
+
'<input id="wppagallery-alltags" type="checkbox" checked="checked" name="alltags" onchange="wppaGalleryEvaluate()"/>'.__('Enable all tags', 'wp-photo-album-plus').' '.
|
566 |
+
'<select id="wppagallery-seltags" style="color:#070; display:none;" name="seltags" multiple="multiple" onchange="wppaGalleryEvaluate()">';
|
567 |
+
if ( $tags ) {
|
568 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('Please select the tags to show', 'wp-photo-album-plus').' --</option>';
|
569 |
+
foreach( array_keys($tags) as $tag ) {
|
570 |
+
$result .= '<option class="wppagallery-taglist-tags" value="'.$tag.'" >'.$tag.'</option>';
|
571 |
+
}
|
572 |
+
}
|
573 |
+
else {
|
574 |
+
'<option value="" disabled="disabled" selected="selected" style="color:#700 !important;" >-- '.__('There are no tags', 'wp-photo-album-plus').' --</option>';
|
575 |
+
}
|
576 |
+
$result .= '</select>'.
|
577 |
+
'</td>'.
|
578 |
+
'</tr>'.
|
579 |
+
|
580 |
+
// Superview additional settings: optional parent
|
581 |
+
'<tr id="wppagallery-album-super-tr" style="display:none;" >'.
|
582 |
+
'<th><label for="wppagallery-album-super">'.__('Parent album:', 'wp-photo-album-plus').'</label></th>'.
|
583 |
+
'<td>'.
|
584 |
+
'<select id="wppagallery-album-super-parent" style="color:#070;max-width:400px;" name="parentalbum" onchange="wppaGalleryEvaluate()">';
|
585 |
+
if ( $albums ) {
|
586 |
+
|
587 |
+
// Please select
|
588 |
+
$result .= '<option value="" selected="selected" >-- '.__('The generic parent', 'wp-photo-album-plus').' --</option>';
|
589 |
+
|
590 |
+
// All standard albums
|
591 |
+
foreach ( $albums as $album ) {
|
592 |
+
$id = $album['id'];
|
593 |
+
$result .= '<option class="wppagallery-album" value="'.$id.'" >'.stripslashes(__($album['name'])).' ('.$id.')</option>';
|
594 |
+
}
|
595 |
+
}
|
596 |
+
else {
|
597 |
+
$result .= '<option value="0" >'.__('There are no albums yet', 'wp-photo-album-plus').'</option>';
|
598 |
+
}
|
599 |
+
$result .= '</select>'.
|
600 |
+
'</td>'.
|
601 |
+
'</tr>'.
|
602 |
+
|
603 |
+
// Calendar
|
604 |
+
'<tr id="wppagallery-calendar-tr" style="display:none;" >'.
|
605 |
+
'<th><label for="wppagallery-calendar">'.__('Calendar type:', 'wp-photo-album-plus').'</lable></th>'.
|
606 |
+
'<td>'.
|
607 |
+
'<select id="wppagallery-calendar-type" style="color:#070;max-width:400px;" onchange="wppaGalleryEvaluate()" >'.
|
608 |
+
'<option value="exifdtm" >'.__('By EXIF date', 'wp-photo-album-plus').'</option>'.
|
609 |
+
'<option value="timestamp" >'.__('By date of upload', 'wp-photo-album-plus').'</option>'.
|
610 |
+
'<option value="modified" >'.__('By date last modified', 'wp-photo-album-plus').'</option>'.
|
611 |
+
'</select>'.
|
612 |
+
'<br />'.
|
613 |
+
'<input type="checkbox" id="wppagallery-calendar-reverse" onchange="wppaGalleryEvaluate()" >'.__('Last date first', 'wp-photo-album-plus').' '.
|
614 |
+
'<input type="checkbox" id="wppagallery-calendar-allopen" onchange="wppaGalleryEvaluate()" >'.__('Initially display all', 'wp-photo-album-plus').
|
615 |
+
'</td>'.
|
616 |
+
'</tr>'.
|
617 |
+
|
618 |
+
// Size
|
619 |
+
'<tr>'.
|
620 |
+
'<th><label for="wppagallery-size">'.__('The size of the display:', 'wp-photo-album-plus').'</label></th>'.
|
621 |
+
'<td>'.
|
622 |
+
'<input type="text" id="wppagallery-size" value="" style="color:#070;" onchange="wppaGalleryEvaluate();"/>'.
|
623 |
+
'<br />'.
|
624 |
+
'<small>'.
|
625 |
+
__('Specify the horizontal size in pixels or <span style="color:blue" >auto</span>.', 'wp-photo-album-plus').' '.
|
626 |
+
__('A value less than <span style="color:blue" >100</span> will automatically be interpreted as a <span style="color:blue" >percentage</span> of the available space.', 'wp-photo-album-plus').
|
627 |
+
__('For responsive with a fixed maximum, add the max to auto e.g. <span style="color:blue" >auto,550</span>', 'wp-photo-album-plus' ).'<br />'.
|
628 |
+
__('Leave this blank for default size', 'wp-photo-album-plus').
|
629 |
+
'</small>'.
|
630 |
+
'</td>'.
|
631 |
+
'</tr>'.
|
632 |
+
|
633 |
+
// Align
|
634 |
+
'<tr>'.
|
635 |
+
'<th><label for="wppagallery-align">'.__('Horizontal alignment:', 'wp-photo-album-plus').'</label></th>'.
|
636 |
+
'<td>'.
|
637 |
+
'<select id="wppagallery-align" name="align" style="color:#070;" onchange="wppaGalleryEvaluate();">'.
|
638 |
+
'<option value="none" >'.__('--- none ---', 'wp-photo-album-plus').'</option>'.
|
639 |
+
'<option value="left" >'.__('left', 'wp-photo-album-plus').'</option>'.
|
640 |
+
'<option value="center" >'.__('center', 'wp-photo-album-plus').'</option>'.
|
641 |
+
'<option value="right" >'.__('right', 'wp-photo-album-plus').'</option>'.
|
642 |
+
'</select>'.
|
643 |
+
'<br />'.
|
644 |
+
'<small>'.__('Specify the alignment to be used or --- none ---', 'wp-photo-album-plus').'</small>'.
|
645 |
+
'</td>'.
|
646 |
+
'</tr>'.
|
647 |
+
|
648 |
+
'</table>'.
|
649 |
+
'<div id="wppagallery-shortcode-preview-container" >'.
|
650 |
+
'<input type="text" id="wppagallery-shortcode-preview" style="background-color:#ddd; width:100%; height:26px;" value="[wppa]Any comment[/wppa]" />'.
|
651 |
+
'</div>'.
|
652 |
+
|
653 |
+
'<input
|
654 |
+
id="wppa-shortcode-wppa-ready"
|
655 |
+
type="button"
|
656 |
+
style="display:none;"
|
657 |
+
value="' . __( 'Ready', 'wp-photo-album-plus' ) . '"
|
658 |
+
/ >' .
|
659 |
+
|
660 |
+
'<script type="text/javascript" >wppaGalleryEvaluate();</script>' .
|
661 |
+
'</div>';
|
662 |
+
|
663 |
+
return $result;
|
664 |
+
}
|
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
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -106,7 +106,7 @@ global $wppa_session;
|
|
106 |
}
|
107 |
|
108 |
// Set import source dir ( when local )
|
109 |
-
if ( isset( $_POST['wppa-import-set-source-dir'] ) &&
|
110 |
check_admin_referer( '$wppa_nonce', WPPA_NONCE );
|
111 |
if ( isset( $_POST['wppa-source'] ) ) {
|
112 |
update_option( 'wppa_import_source_'.$user, $_POST['wppa-source'] );
|
@@ -186,7 +186,7 @@ global $wppa_session;
|
|
186 |
|
187 |
// Get current local dir setting
|
188 |
$source = get_option( 'wppa_import_source_'.$user, WPPA_DEPOT_PATH );
|
189 |
-
if ( ! $source || !
|
190 |
$source = WPPA_DEPOT_PATH;
|
191 |
update_option( 'wppa_import_source_'.$user, WPPA_DEPOT_PATH );
|
192 |
}
|
@@ -792,10 +792,10 @@ global $wppa_session;
|
|
792 |
if ( is_array( $files ) ) foreach ( $files as $file ) {
|
793 |
$ext = wppa_get_ext( $file );
|
794 |
$meta = wppa_strip_ext( $file ).'.PMF';
|
795 |
-
if ( !
|
796 |
$meta = wppa_strip_ext( $file ).'.pmf';
|
797 |
}
|
798 |
-
if ( !
|
799 |
$meta = false;
|
800 |
}
|
801 |
if ( in_array( strtolower($ext), $wppa_supported_photo_extensions ) ) {
|
@@ -1139,7 +1139,7 @@ global $wppa_session;
|
|
1139 |
foreach( $files as $dir ) {
|
1140 |
if ( basename( $dir ) == '.' ) {}
|
1141 |
elseif ( basename( $dir ) == '..' ) {}
|
1142 |
-
elseif (
|
1143 |
echo
|
1144 |
'<tr>' .
|
1145 |
'<td>' .
|
@@ -1158,7 +1158,7 @@ global $wppa_session;
|
|
1158 |
$subdircount = '0';
|
1159 |
if ( $subfiles ) {
|
1160 |
foreach ( $subfiles as $subfile ) {
|
1161 |
-
if (
|
1162 |
$subdircount++;
|
1163 |
}
|
1164 |
}
|
@@ -1231,7 +1231,7 @@ global $wppa_session;
|
|
1231 |
$ct = 0;
|
1232 |
$idx = '0';
|
1233 |
foreach( $files as $csv ) {
|
1234 |
-
if (
|
1235 |
echo
|
1236 |
'<tr>' .
|
1237 |
'<td>' .
|
@@ -1996,7 +1996,7 @@ global $wppa_supported_audio_extensions;
|
|
1996 |
|
1997 |
foreach ( $files as $file ) {
|
1998 |
if ( basename( $file ) != '.' && basename( $file ) != '..' && ( isset( $_POST['file-'.$idx] ) || isset( $_GET['continue'] ) ) ) {
|
1999 |
-
if (
|
2000 |
$iret = wppa_import_dir_to_album( $file, '0' );
|
2001 |
if ( wppa_is_time_up() && wppa_switch( 'auto_continue' ) ) {
|
2002 |
wppa( 'continue', 'continue' );
|
@@ -2054,7 +2054,7 @@ global $wppa_supported_audio_extensions;
|
|
2054 |
if ( $fs > 1024*1024*64 || $delv ) { // copy fails for files > 64 Mb
|
2055 |
|
2056 |
// Remove old version if already exists
|
2057 |
-
if (
|
2058 |
wppa_unlink( $newpath );
|
2059 |
}
|
2060 |
rename( $file, $newpath );
|
@@ -2748,7 +2748,7 @@ function wppa_get_dircount( $files ) {
|
|
2748 |
foreach ( $files as $file ) {
|
2749 |
if ( basename( $file ) == '.' ) {}
|
2750 |
elseif ( basename( $file ) == '..' ) {}
|
2751 |
-
elseif (
|
2752 |
}
|
2753 |
}
|
2754 |
return $result;
|
@@ -2759,7 +2759,7 @@ function wppa_get_csvcount( $files ) {
|
|
2759 |
$result = 0;
|
2760 |
if ( $files ) {
|
2761 |
foreach ( $files as $file ) {
|
2762 |
-
if (
|
2763 |
if ( strtolower( wppa_get_ext( $file ) ) == 'csv' ) $result++;
|
2764 |
}
|
2765 |
}
|
@@ -2792,7 +2792,7 @@ function wppa_get_meta_data( $file, $item, $opt ) {
|
|
2792 |
if ( $opt == '( ' ) $opt2 = ' )';
|
2793 |
if ( $opt == '{' ) $opt2 = '}';
|
2794 |
if ( $opt == '[' ) $opt2 = ']';
|
2795 |
-
if (
|
2796 |
$handle = wppa_fopen( WPPA_DEPOT_PATH . '/' . basename( $file ), "r" );
|
2797 |
if ( $handle ) {
|
2798 |
while ( ( $buffer = fgets( $handle, 4096 ) ) !== false ) {
|
@@ -2829,7 +2829,7 @@ function wppa_extract( $xpath, $delz ) {
|
|
2829 |
|
2830 |
// Start security fix
|
2831 |
$path = wppa_sanitize_file_name( $xpath );
|
2832 |
-
if ( !
|
2833 |
wppa_error_message( 'Zipfile '.$path.' does not exist.' );
|
2834 |
$err = '4';
|
2835 |
return $err;
|
@@ -2884,7 +2884,7 @@ global $wppa_session;
|
|
2884 |
wppa_extend_session();
|
2885 |
|
2886 |
// see if album exists
|
2887 |
-
if (
|
2888 |
|
2889 |
// Check parent
|
2890 |
if ( wppa_switch( 'import_parent_check' ) ) {
|
@@ -2947,7 +2947,7 @@ global $wppa_session;
|
|
2947 |
$xfile = str_replace( array( '[', ']', '(', ')', '{', '}', '$', '+' ), array( '\[', '\]', '\(', '\)', '\{', '\}', '\$', '\+' ), $file );
|
2948 |
$photofiles = glob( $xfile.'/*' );
|
2949 |
if ( $photofiles ) foreach ( $photofiles as $photofile ) {
|
2950 |
-
if ( !
|
2951 |
|
2952 |
if ( ! isset( $wppa_session[$photofile] ) || ! wppa_switch( 'keep_import_files' ) ) {
|
2953 |
|
@@ -2982,7 +2982,7 @@ global $wppa_session;
|
|
2982 |
// Now go deeper, process the subdirs
|
2983 |
$subdirs = glob( $xfile.'/*' );
|
2984 |
if ( $subdirs ) foreach ( $subdirs as $subdir ) {
|
2985 |
-
if (
|
2986 |
if ( basename( $subdir ) != '.' && basename( $subdir ) != '..' ) {
|
2987 |
$bret = wppa_import_dir_to_album( $subdir, $alb );
|
2988 |
if ( ! $bret ) return false; // Time out
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the import pages and functions
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
106 |
}
|
107 |
|
108 |
// Set import source dir ( when local )
|
109 |
+
if ( isset( $_POST['wppa-import-set-source-dir'] ) && wppa_is_dir( $_POST['wppa-source'] ) ) {
|
110 |
check_admin_referer( '$wppa_nonce', WPPA_NONCE );
|
111 |
if ( isset( $_POST['wppa-source'] ) ) {
|
112 |
update_option( 'wppa_import_source_'.$user, $_POST['wppa-source'] );
|
186 |
|
187 |
// Get current local dir setting
|
188 |
$source = get_option( 'wppa_import_source_'.$user, WPPA_DEPOT_PATH );
|
189 |
+
if ( ! $source || ! wppa_is_dir( $source ) ) {
|
190 |
$source = WPPA_DEPOT_PATH;
|
191 |
update_option( 'wppa_import_source_'.$user, WPPA_DEPOT_PATH );
|
192 |
}
|
792 |
if ( is_array( $files ) ) foreach ( $files as $file ) {
|
793 |
$ext = wppa_get_ext( $file );
|
794 |
$meta = wppa_strip_ext( $file ).'.PMF';
|
795 |
+
if ( ! wppa_is_file( $meta ) ) {
|
796 |
$meta = wppa_strip_ext( $file ).'.pmf';
|
797 |
}
|
798 |
+
if ( ! wppa_is_file( $meta ) ) {
|
799 |
$meta = false;
|
800 |
}
|
801 |
if ( in_array( strtolower($ext), $wppa_supported_photo_extensions ) ) {
|
1139 |
foreach( $files as $dir ) {
|
1140 |
if ( basename( $dir ) == '.' ) {}
|
1141 |
elseif ( basename( $dir ) == '..' ) {}
|
1142 |
+
elseif ( wppa_is_dir( $dir ) ) {
|
1143 |
echo
|
1144 |
'<tr>' .
|
1145 |
'<td>' .
|
1158 |
$subdircount = '0';
|
1159 |
if ( $subfiles ) {
|
1160 |
foreach ( $subfiles as $subfile ) {
|
1161 |
+
if ( wppa_is_dir( $subfile ) && basename( $subfile ) != '.' && basename( $subfile ) != '..' ) {
|
1162 |
$subdircount++;
|
1163 |
}
|
1164 |
}
|
1231 |
$ct = 0;
|
1232 |
$idx = '0';
|
1233 |
foreach( $files as $csv ) {
|
1234 |
+
if ( wppa_is_file( $csv ) && strtolower( wppa_get_ext( $csv ) ) == 'csv' ) {
|
1235 |
echo
|
1236 |
'<tr>' .
|
1237 |
'<td>' .
|
1996 |
|
1997 |
foreach ( $files as $file ) {
|
1998 |
if ( basename( $file ) != '.' && basename( $file ) != '..' && ( isset( $_POST['file-'.$idx] ) || isset( $_GET['continue'] ) ) ) {
|
1999 |
+
if ( wppa_is_dir( $file ) ) {
|
2000 |
$iret = wppa_import_dir_to_album( $file, '0' );
|
2001 |
if ( wppa_is_time_up() && wppa_switch( 'auto_continue' ) ) {
|
2002 |
wppa( 'continue', 'continue' );
|
2054 |
if ( $fs > 1024*1024*64 || $delv ) { // copy fails for files > 64 Mb
|
2055 |
|
2056 |
// Remove old version if already exists
|
2057 |
+
if ( wppa_is_file( $newpath ) ) {
|
2058 |
wppa_unlink( $newpath );
|
2059 |
}
|
2060 |
rename( $file, $newpath );
|
2748 |
foreach ( $files as $file ) {
|
2749 |
if ( basename( $file ) == '.' ) {}
|
2750 |
elseif ( basename( $file ) == '..' ) {}
|
2751 |
+
elseif ( wppa_is_dir( $file ) ) $result++;
|
2752 |
}
|
2753 |
}
|
2754 |
return $result;
|
2759 |
$result = 0;
|
2760 |
if ( $files ) {
|
2761 |
foreach ( $files as $file ) {
|
2762 |
+
if ( wppa_is_file( $file ) ) {
|
2763 |
if ( strtolower( wppa_get_ext( $file ) ) == 'csv' ) $result++;
|
2764 |
}
|
2765 |
}
|
2792 |
if ( $opt == '( ' ) $opt2 = ' )';
|
2793 |
if ( $opt == '{' ) $opt2 = '}';
|
2794 |
if ( $opt == '[' ) $opt2 = ']';
|
2795 |
+
if ( wppa_is_file( $file ) ) {
|
2796 |
$handle = wppa_fopen( WPPA_DEPOT_PATH . '/' . basename( $file ), "r" );
|
2797 |
if ( $handle ) {
|
2798 |
while ( ( $buffer = fgets( $handle, 4096 ) ) !== false ) {
|
2829 |
|
2830 |
// Start security fix
|
2831 |
$path = wppa_sanitize_file_name( $xpath );
|
2832 |
+
if ( ! wppa_is_file( $xpath ) ) {
|
2833 |
wppa_error_message( 'Zipfile '.$path.' does not exist.' );
|
2834 |
$err = '4';
|
2835 |
return $err;
|
2884 |
wppa_extend_session();
|
2885 |
|
2886 |
// see if album exists
|
2887 |
+
if ( wppa_is_dir( $file ) ) {
|
2888 |
|
2889 |
// Check parent
|
2890 |
if ( wppa_switch( 'import_parent_check' ) ) {
|
2947 |
$xfile = str_replace( array( '[', ']', '(', ')', '{', '}', '$', '+' ), array( '\[', '\]', '\(', '\)', '\{', '\}', '\$', '\+' ), $file );
|
2948 |
$photofiles = glob( $xfile.'/*' );
|
2949 |
if ( $photofiles ) foreach ( $photofiles as $photofile ) {
|
2950 |
+
if ( ! wppa_is_dir( $photofile ) ) {
|
2951 |
|
2952 |
if ( ! isset( $wppa_session[$photofile] ) || ! wppa_switch( 'keep_import_files' ) ) {
|
2953 |
|
2982 |
// Now go deeper, process the subdirs
|
2983 |
$subdirs = glob( $xfile.'/*' );
|
2984 |
if ( $subdirs ) foreach ( $subdirs as $subdir ) {
|
2985 |
+
if ( wppa_is_dir( $subdir ) ) {
|
2986 |
if ( basename( $subdir ) != '.' && basename( $subdir ) != '..' ) {
|
2987 |
$bret = wppa_import_dir_to_album( $subdir, $alb );
|
2988 |
if ( ! $bret ) return false; // Time out
|
wppa-init.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* This file loads required php files and contains all functions used in init actions.
|
6 |
*
|
7 |
-
* Version
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
@@ -71,10 +71,10 @@ require_once 'wppa-picture.php';
|
|
71 |
if ( PHP_VERSION_ID >= 50300 ) require_once 'wppa-cloudinary.php';
|
72 |
|
73 |
/* DO THE ADMIN/NON ADMIN SPECIFIC STUFF */
|
74 |
-
if ( is_admin() )
|
75 |
-
|
76 |
-
require_once 'wppa-non-admin.php';
|
77 |
}
|
|
|
78 |
|
79 |
/* ADD AJAX */
|
80 |
if ( defined( 'DOING_AJAX' ) ) {
|
@@ -307,56 +307,6 @@ function wppa_cat_message() {
|
|
307 |
wppa_error_message( __('</strong>The cats system needs to be converted. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-B17</b><strong>' , 'wp-photo-album-plus') );
|
308 |
}
|
309 |
|
310 |
-
function wppa_scripts_are_obssolete() {
|
311 |
-
global $wpdb;
|
312 |
-
|
313 |
-
// This notice dismissed?
|
314 |
-
if ( get_option( 'wppa_dismiss_admin_notice_scripts_are_obsolete', 'no' ) == 'yes' ) {
|
315 |
-
return;
|
316 |
-
}
|
317 |
-
|
318 |
-
$has_wppa_scripts = $wpdb->get_results( "SELECT ID, post_title, post_content, post_type " .
|
319 |
-
"FROM " . $wpdb->prefix . 'posts' ." " .
|
320 |
-
"WHERE post_status = 'publish' " .
|
321 |
-
"AND ( post_type = 'post' OR post_type = 'page' ) " .
|
322 |
-
"AND post_content LIKE '%\\%\\%wppa\\%\\%%' " , ARRAY_A );
|
323 |
-
|
324 |
-
if ( $has_wppa_scripts ) {
|
325 |
-
foreach( array_keys( $has_wppa_scripts ) as $key ) {
|
326 |
-
if ( strpos( $has_wppa_scripts[$key]['post_content'], '%%wppa%%' ) === false ) {
|
327 |
-
unset( $has_wppa_scripts[$key] );
|
328 |
-
}
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
-
if ( ! empty( $has_wppa_scripts ) ) {
|
333 |
-
$msg = __( 'WPPA scripts will no longer be supported in version 6.6. Please convert the %%wppa%% scripts to [wppa][/wppa] shortcodes before upgrading to version 6.6.', 'wp-photo-album-plus' );
|
334 |
-
$msg .= '<br /><br />';
|
335 |
-
$msg .= __( 'WPPA scripts found in the following Pages / Posts', 'wp-photo-album-plus' );
|
336 |
-
$msg .= '<br /><br />';
|
337 |
-
foreach( $has_wppa_scripts as $item ) {
|
338 |
-
$msg .= $item['ID'] . ' <a href="'. admin_url( 'post.php?post=' . $item['ID'] . '&action=edit' ) .'" title="Edit this ' . $item['post_type'] . '" >' . $item['post_title'] . '</a>' .
|
339 |
-
' at loc:' . strpos( $item['post_content'], '%%wppa%%' ) . ' :' . htmlspecialchars( substr( $item['post_content'] , strpos( $item['post_content'], '%%wppa%%' ), 60 ) ) . '...' .
|
340 |
-
'<br />';
|
341 |
-
}
|
342 |
-
$msg .= '<br />' .
|
343 |
-
'<div style="text-align:center;" >' .
|
344 |
-
'<em style="float:left;" >Enter your script to convert here:</em>' .
|
345 |
-
'<em>Click to convert</em>' .
|
346 |
-
'<em style="float:right;" >Copy the result into your page/post:</em>' .
|
347 |
-
'<br />' .
|
348 |
-
'<input type="text" id="script" style="width:40%; float:left;" />' .
|
349 |
-
'<input type="button" value="' . esc_attr( '>>>>>' ) . '" onclick="wppaConvertScriptToShortcode(\'script\',\'shortcode\')" />' .
|
350 |
-
'<input type="text" id="shortcode" style="width:40%; float:right;" />' .
|
351 |
-
'</div>' .
|
352 |
-
'<br />';
|
353 |
-
|
354 |
-
$msg .= '<br />' . sprintf( __( 'For more information see the %s documentation page', 'wp-photo-album-plus' ), '<a href="http://wppa.nl/changelog/script-to-shortcode-conversion/" target="_blank" >Script to shortcode conversion</a>' );
|
355 |
-
$msg .= '<br /><div style="float:right;" ><input type="checkbox" onchange="wppaDismissAdminNotice(\'dismiss_admin_notice_scripts_are_obsolete\', this);" > Dismiss this message</div><div style="clear:both;" ></div>';
|
356 |
-
$msg .= wp_nonce_field('wppa-nonce', 'wppa-nonce', false, false);
|
357 |
-
wppa_warning_message( $msg );
|
358 |
-
}
|
359 |
-
}
|
360 |
|
361 |
/* This function will add "donate" link to main plugins page */
|
362 |
function wppa_donate_link($links, $file) {
|
4 |
*
|
5 |
* This file loads required php files and contains all functions used in init actions.
|
6 |
*
|
7 |
+
* Version 7.0.00
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
71 |
if ( PHP_VERSION_ID >= 50300 ) require_once 'wppa-cloudinary.php';
|
72 |
|
73 |
/* DO THE ADMIN/NON ADMIN SPECIFIC STUFF */
|
74 |
+
if ( is_admin() ) {
|
75 |
+
require_once 'wppa-admin.php';
|
|
|
76 |
}
|
77 |
+
require_once 'wppa-non-admin.php';
|
78 |
|
79 |
/* ADD AJAX */
|
80 |
if ( defined( 'DOING_AJAX' ) ) {
|
307 |
wppa_error_message( __('</strong>The cats system needs to be converted. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-B17</b><strong>' , 'wp-photo-album-plus') );
|
308 |
}
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
/* This function will add "donate" link to main plugins page */
|
312 |
function wppa_donate_link($links, $file) {
|
wppa-local-cdn.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains routines for local cdn implementation
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -42,7 +42,7 @@ function wppa_cdn_make( $id, $x, $y ) {
|
|
42 |
|
43 |
// Create file's dir if not exists
|
44 |
$dir = dirname( $topath );
|
45 |
-
if ( !
|
46 |
wppa_mktree( $dir );
|
47 |
}
|
48 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains routines for local cdn implementation
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
42 |
|
43 |
// Create file's dir if not exists
|
44 |
$dir = dirname( $topath );
|
45 |
+
if ( ! wppa_is_dir( $dir ) ) {
|
46 |
wppa_mktree( $dir );
|
47 |
}
|
48 |
|
wppa-maintenance.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains (not yet, but in the future maybe) all the maintenance routines
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -616,7 +616,7 @@ global $wppa_timestamp_start;
|
|
616 |
// Remove dirs
|
617 |
if ( $photo_files ) {
|
618 |
foreach( array_keys( $photo_files ) as $key ) {
|
619 |
-
if (
|
620 |
unset( $photo_files[$key] );
|
621 |
}
|
622 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains (not yet, but in the future maybe) all the maintenance routines
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
616 |
// Remove dirs
|
617 |
if ( $photo_files ) {
|
618 |
foreach( array_keys( $photo_files ) as $key ) {
|
619 |
+
if ( wppa_is_dir( $photo_files[$key] ) ) {
|
620 |
unset( $photo_files[$key] );
|
621 |
}
|
622 |
}
|
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
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -277,7 +277,7 @@ add_action( 'init', 'wppa_add_js', 12 );
|
|
277 |
function wppa_add_js() {
|
278 |
global $wppa_js_page_data_file;
|
279 |
|
280 |
-
$in_footer = wppa_switch( 'defer_javascript' ) && ! wppa( 'ajax' );
|
281 |
if ( wppa( 'ajax' ) || wppa( 'cron' ) ) {
|
282 |
$in_footer = false;
|
283 |
}
|
@@ -289,7 +289,7 @@ global $wppa_js_page_data_file;
|
|
289 |
$wppa_js_page_data_file = WPPA_UPLOAD_PATH . '/temp/wppa.' . wppa_get_unique_crypt() . '.js';
|
290 |
|
291 |
$tempdir = WPPA_UPLOAD_PATH.'/temp';
|
292 |
-
if ( !
|
293 |
|
294 |
$handle = wppa_fopen( $wppa_js_page_data_file, 'wb' );
|
295 |
|
@@ -320,7 +320,7 @@ global $wppa_lang;
|
|
320 |
global $wppa_js_page_data_file;
|
321 |
global $wppa_opt;
|
322 |
|
323 |
-
$footer = $wppa_js_page_data_file !== '';
|
324 |
|
325 |
// If in footer and no wppa on the page found? Quit
|
326 |
if ( $footer && ! wppa( 'mocc' ) ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the non admin stuff
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
277 |
function wppa_add_js() {
|
278 |
global $wppa_js_page_data_file;
|
279 |
|
280 |
+
$in_footer = wppa_switch( 'defer_javascript' ) && ! wppa( 'ajax' ) && ! is_admin();
|
281 |
if ( wppa( 'ajax' ) || wppa( 'cron' ) ) {
|
282 |
$in_footer = false;
|
283 |
}
|
289 |
$wppa_js_page_data_file = WPPA_UPLOAD_PATH . '/temp/wppa.' . wppa_get_unique_crypt() . '.js';
|
290 |
|
291 |
$tempdir = WPPA_UPLOAD_PATH.'/temp';
|
292 |
+
if ( ! wppa_is_dir( $tempdir ) ) @ wppa_mktree( $tempdir );
|
293 |
|
294 |
$handle = wppa_fopen( $wppa_js_page_data_file, 'wb' );
|
295 |
|
320 |
global $wppa_js_page_data_file;
|
321 |
global $wppa_opt;
|
322 |
|
323 |
+
$footer = $wppa_js_page_data_file !== '' && ! is_admin();
|
324 |
|
325 |
// If in footer and no wppa on the page found? Quit
|
326 |
if ( $footer && ! wppa( 'mocc' ) ) {
|
wppa-photo-admin-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -136,7 +136,7 @@ global $wpdb;
|
|
136 |
$count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
|
137 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
|
138 |
WHERE album = %s
|
139 |
-
" . wppa_get_photo_order( $album ) . "
|
140 |
LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
|
141 |
|
142 |
$link = wppa_dbg_url( get_admin_url() . 'admin.php' .
|
@@ -792,7 +792,7 @@ function wppaToggleExif( id, count ) {
|
|
792 |
|
793 |
if ( wppa_opt( 'rating_display_type' ) == 'likes' ) {
|
794 |
echo __( 'Likes:', 'wp-photo-album-plus' ) . ' ' .
|
795 |
-
$entries .
|
796 |
'. ';
|
797 |
}
|
798 |
else {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* edit and delete photos
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
136 |
$count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
|
137 |
$photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
|
138 |
WHERE album = %s
|
139 |
+
" . wppa_get_photo_order( $album, 'no_random' ) . "
|
140 |
LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
|
141 |
|
142 |
$link = wppa_dbg_url( get_admin_url() . 'admin.php' .
|
792 |
|
793 |
if ( wppa_opt( 'rating_display_type' ) == 'likes' ) {
|
794 |
echo __( 'Likes:', 'wp-photo-album-plus' ) . ' ' .
|
795 |
+
strval( intval( $entries ) ) .
|
796 |
'. ';
|
797 |
}
|
798 |
else {
|
wppa-potd-admin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Pachkage: wp-photo-album-plus
|
4 |
*
|
5 |
* admin photo of the day widget
|
6 |
-
*
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -489,7 +489,7 @@ global $wppa_defaults;
|
|
489 |
// The order# and select radio box
|
490 |
echo
|
491 |
'<div style="clear:both;width:100%;margin:3px 0;position:relative;top:5px;" >' .
|
492 |
-
'<div style="font-size:9px; line-height:10px;float:left;">(#' . $photo['p_order'] . ')</div>';
|
493 |
|
494 |
if ( get_option( 'wppa_potd_method' ) == '1' ) { // Only if fixed photo
|
495 |
echo
|
3 |
* Pachkage: wp-photo-album-plus
|
4 |
*
|
5 |
* admin photo of the day widget
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
489 |
// The order# and select radio box
|
490 |
echo
|
491 |
'<div style="clear:both;width:100%;margin:3px 0;position:relative;top:5px;" >' .
|
492 |
+
'<div style="font-size:9px; line-height:10px;float:left;">(#' . strval( intval( $photo['p_order'] ) ) . ')</div>';
|
493 |
|
494 |
if ( get_option( 'wppa_potd_method' ) == '1' ) { // Only if fixed photo
|
495 |
echo
|
wppa-settings-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -233,7 +233,7 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
|
|
233 |
'document.location=' .
|
234 |
'document.location+"&' .
|
235 |
'wppa_settings_submit=Doit&' .
|
236 |
-
'wppa-nonce=' .
|
237 |
'wppa-key=' . $key . '&' .
|
238 |
'_wp_http_referer=' . esc_url( $_REQUEST['_wp_http_referer'] ) . '"' .
|
239 |
'</script>';
|
@@ -253,7 +253,7 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
|
|
253 |
'document.location=' .
|
254 |
'document.location+"&' .
|
255 |
'wppa_settings_submit=Doit&' .
|
256 |
-
'wppa-nonce=' .
|
257 |
'wppa-key=' . $key . '&' .
|
258 |
'_wp_http_referer=' . esc_url( $_REQUEST['_wp_http_referer'] ) . '"' .
|
259 |
'</script>';
|
@@ -295,9 +295,6 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
|
|
295 |
__( 'WP Charset:', 'wp-photo-album-plus') . ' ' . get_bloginfo( 'charset' ) . '. ' .
|
296 |
__( 'Current PHP version:', 'wp-photo-album-plus' ) . ' ' . phpversion() . ' ' .
|
297 |
__( 'WPPA+ API Version:', 'wp-photo-album-plus' ) . ' ' . $wppa_api_version . '.';
|
298 |
-
if ( function_exists( 'wppa_shortcodes' ) ) {
|
299 |
-
echo ' ' . __( 'Front-end code loaded', 'wp-photo-album-plus' );
|
300 |
-
}
|
301 |
?>
|
302 |
<br /><?php if ( is_multisite() ) {
|
303 |
if ( WPPA_MULTISITE_GLOBAL ) {
|
@@ -8571,15 +8568,6 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
|
|
8571 |
$tags = 'system';
|
8572 |
wppa_setting($slug, '13', $name, $desc, $html, $help, $clas, $tags);
|
8573 |
|
8574 |
-
$name = __('Load front-end code always', 'wp-photo-album-plus');
|
8575 |
-
$desc = __('Load front-end code also on admin pages', 'wp-photo-album-plus');
|
8576 |
-
$help = '';
|
8577 |
-
$slug = 'wppa_load_frontend_always';
|
8578 |
-
$html = wppa_checkbox($slug);
|
8579 |
-
$clas = '';
|
8580 |
-
$tags = 'system';
|
8581 |
-
wppa_setting($slug, '14', $name, $desc, $html, $help, $clas, $tags);
|
8582 |
-
|
8583 |
}
|
8584 |
wppa_setting_subheader( 'B', '1', __( 'WPPA+ Admin related miscellaneous settings' , 'wp-photo-album-plus') );
|
8585 |
{
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
233 |
'document.location=' .
|
234 |
'document.location+"&' .
|
235 |
'wppa_settings_submit=Doit&' .
|
236 |
+
'wppa-nonce=' . strip_tags( $_REQUEST['wppa-nonce'] ) . '&' .
|
237 |
'wppa-key=' . $key . '&' .
|
238 |
'_wp_http_referer=' . esc_url( $_REQUEST['_wp_http_referer'] ) . '"' .
|
239 |
'</script>';
|
253 |
'document.location=' .
|
254 |
'document.location+"&' .
|
255 |
'wppa_settings_submit=Doit&' .
|
256 |
+
'wppa-nonce=' . strip_tags( $_REQUEST['wppa-nonce'] ) . '&' .
|
257 |
'wppa-key=' . $key . '&' .
|
258 |
'_wp_http_referer=' . esc_url( $_REQUEST['_wp_http_referer'] ) . '"' .
|
259 |
'</script>';
|
295 |
__( 'WP Charset:', 'wp-photo-album-plus') . ' ' . get_bloginfo( 'charset' ) . '. ' .
|
296 |
__( 'Current PHP version:', 'wp-photo-album-plus' ) . ' ' . phpversion() . ' ' .
|
297 |
__( 'WPPA+ API Version:', 'wp-photo-album-plus' ) . ' ' . $wppa_api_version . '.';
|
|
|
|
|
|
|
298 |
?>
|
299 |
<br /><?php if ( is_multisite() ) {
|
300 |
if ( WPPA_MULTISITE_GLOBAL ) {
|
8568 |
$tags = 'system';
|
8569 |
wppa_setting($slug, '13', $name, $desc, $html, $help, $clas, $tags);
|
8570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8571 |
}
|
8572 |
wppa_setting_subheader( 'B', '1', __( 'WPPA+ Admin related miscellaneous settings' , 'wp-photo-album-plus') );
|
8573 |
{
|
wppa-setup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1683,8 +1683,6 @@ cursorborder:'2px solid transparent',";
|
|
1683 |
|
1684 |
'wppa_login_url' => site_url( 'wp-login.php', 'login' ), // A
|
1685 |
'wppa_cache_root' => 'cache',
|
1686 |
-
'wppa_load_frontend_always' => 'no',
|
1687 |
-
|
1688 |
|
1689 |
// IX D New
|
1690 |
'wppa_max_album_newtime' => '0', // 1
|
@@ -1922,9 +1920,9 @@ function wppa_check_dirs() {
|
|
1922 |
// check if uploads dir exists
|
1923 |
$upload_dir = wp_upload_dir();
|
1924 |
$dir = $upload_dir['basedir'];
|
1925 |
-
if ( !
|
1926 |
wppa_mktree($dir);
|
1927 |
-
if ( !
|
1928 |
wppa_error_message(__('The uploads directory does not exist, please do a regular WP upload first.', 'wp-photo-album-plus').'<br/>'.$dir);
|
1929 |
return false;
|
1930 |
}
|
@@ -1937,9 +1935,9 @@ function wppa_check_dirs() {
|
|
1937 |
|
1938 |
// check if wppa dir exists
|
1939 |
$dir = WPPA_UPLOAD_PATH;
|
1940 |
-
if ( !
|
1941 |
wppa_mktree($dir);
|
1942 |
-
if ( !
|
1943 |
wppa_error_message(__('Could not create the wppa directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1944 |
return false;
|
1945 |
}
|
@@ -1951,9 +1949,9 @@ function wppa_check_dirs() {
|
|
1951 |
|
1952 |
// check if thumbs dir exists
|
1953 |
$dir = WPPA_UPLOAD_PATH.'/thumbs';
|
1954 |
-
if ( !
|
1955 |
wppa_mktree($dir);
|
1956 |
-
if ( !
|
1957 |
wppa_error_message(__('Could not create the wppa thumbs directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1958 |
return false;
|
1959 |
}
|
@@ -1965,9 +1963,9 @@ function wppa_check_dirs() {
|
|
1965 |
|
1966 |
// check if watermarks dir exists
|
1967 |
$dir = WPPA_UPLOAD_PATH.'/watermarks';
|
1968 |
-
if ( !
|
1969 |
wppa_mktree($dir);
|
1970 |
-
if ( !
|
1971 |
wppa_error_message(__('Could not create the wppa watermarks directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1972 |
return false;
|
1973 |
}
|
@@ -1979,9 +1977,9 @@ function wppa_check_dirs() {
|
|
1979 |
|
1980 |
// check if fonts dir exists
|
1981 |
$dir = WPPA_UPLOAD_PATH.'/fonts';
|
1982 |
-
if ( !
|
1983 |
wppa_mktree($dir);
|
1984 |
-
if ( !
|
1985 |
wppa_error_message(__('Could not create the wppa fonts directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1986 |
return false;
|
1987 |
}
|
@@ -1995,9 +1993,9 @@ function wppa_check_dirs() {
|
|
1995 |
if ( ! is_multisite() ) {
|
1996 |
// check if users depot dir exists
|
1997 |
$dir = WPPA_CONTENT_PATH.'/wppa-depot';
|
1998 |
-
if ( !
|
1999 |
wppa_mktree($dir);
|
2000 |
-
if ( !
|
2001 |
wppa_error_message(__('Unable to create depot directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2002 |
return false;
|
2003 |
}
|
@@ -2010,9 +2008,9 @@ function wppa_check_dirs() {
|
|
2010 |
|
2011 |
// check the user depot directory
|
2012 |
$dir = WPPA_DEPOT_PATH;
|
2013 |
-
if ( !
|
2014 |
wppa_mktree($dir);
|
2015 |
-
if ( !
|
2016 |
wppa_error_message(__('Unable to create user depot directory', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2017 |
return false;
|
2018 |
}
|
@@ -2024,9 +2022,9 @@ function wppa_check_dirs() {
|
|
2024 |
|
2025 |
// check the temp dir
|
2026 |
$dir = WPPA_UPLOAD_PATH.'/temp/';
|
2027 |
-
if ( !
|
2028 |
wppa_mktree($dir);
|
2029 |
-
if ( !
|
2030 |
wppa_error_message(__('Unable to create temp directory', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2031 |
return false;
|
2032 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
1683 |
|
1684 |
'wppa_login_url' => site_url( 'wp-login.php', 'login' ), // A
|
1685 |
'wppa_cache_root' => 'cache',
|
|
|
|
|
1686 |
|
1687 |
// IX D New
|
1688 |
'wppa_max_album_newtime' => '0', // 1
|
1920 |
// check if uploads dir exists
|
1921 |
$upload_dir = wp_upload_dir();
|
1922 |
$dir = $upload_dir['basedir'];
|
1923 |
+
if ( ! wppa_is_dir($dir) ) {
|
1924 |
wppa_mktree($dir);
|
1925 |
+
if ( ! wppa_is_dir($dir) ) {
|
1926 |
wppa_error_message(__('The uploads directory does not exist, please do a regular WP upload first.', 'wp-photo-album-plus').'<br/>'.$dir);
|
1927 |
return false;
|
1928 |
}
|
1935 |
|
1936 |
// check if wppa dir exists
|
1937 |
$dir = WPPA_UPLOAD_PATH;
|
1938 |
+
if ( ! wppa_is_dir($dir) ) {
|
1939 |
wppa_mktree($dir);
|
1940 |
+
if ( ! wppa_is_dir($dir) ) {
|
1941 |
wppa_error_message(__('Could not create the wppa directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1942 |
return false;
|
1943 |
}
|
1949 |
|
1950 |
// check if thumbs dir exists
|
1951 |
$dir = WPPA_UPLOAD_PATH.'/thumbs';
|
1952 |
+
if ( ! wppa_is_dir($dir) ) {
|
1953 |
wppa_mktree($dir);
|
1954 |
+
if ( ! wppa_is_dir($dir) ) {
|
1955 |
wppa_error_message(__('Could not create the wppa thumbs directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1956 |
return false;
|
1957 |
}
|
1963 |
|
1964 |
// check if watermarks dir exists
|
1965 |
$dir = WPPA_UPLOAD_PATH.'/watermarks';
|
1966 |
+
if ( ! wppa_is_dir($dir) ) {
|
1967 |
wppa_mktree($dir);
|
1968 |
+
if ( ! wppa_is_dir($dir) ) {
|
1969 |
wppa_error_message(__('Could not create the wppa watermarks directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1970 |
return false;
|
1971 |
}
|
1977 |
|
1978 |
// check if fonts dir exists
|
1979 |
$dir = WPPA_UPLOAD_PATH.'/fonts';
|
1980 |
+
if ( ! wppa_is_dir($dir) ) {
|
1981 |
wppa_mktree($dir);
|
1982 |
+
if ( ! wppa_is_dir($dir) ) {
|
1983 |
wppa_error_message(__('Could not create the wppa fonts directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
1984 |
return false;
|
1985 |
}
|
1993 |
if ( ! is_multisite() ) {
|
1994 |
// check if users depot dir exists
|
1995 |
$dir = WPPA_CONTENT_PATH.'/wppa-depot';
|
1996 |
+
if ( ! wppa_is_dir($dir) ) {
|
1997 |
wppa_mktree($dir);
|
1998 |
+
if ( ! wppa_is_dir($dir) ) {
|
1999 |
wppa_error_message(__('Unable to create depot directory.', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2000 |
return false;
|
2001 |
}
|
2008 |
|
2009 |
// check the user depot directory
|
2010 |
$dir = WPPA_DEPOT_PATH;
|
2011 |
+
if ( ! wppa_is_dir($dir) ) {
|
2012 |
wppa_mktree($dir);
|
2013 |
+
if ( ! wppa_is_dir($dir) ) {
|
2014 |
wppa_error_message(__('Unable to create user depot directory', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2015 |
return false;
|
2016 |
}
|
2022 |
|
2023 |
// check the temp dir
|
2024 |
$dir = WPPA_UPLOAD_PATH.'/temp/';
|
2025 |
+
if ( ! wppa_is_dir($dir) ) {
|
2026 |
wppa_mktree($dir);
|
2027 |
+
if ( ! wppa_is_dir($dir) ) {
|
2028 |
wppa_error_message(__('Unable to create temp directory', 'wp-photo-album-plus').wppa_credirmsg($dir));
|
2029 |
return false;
|
2030 |
}
|
wppa-source.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains photo source file management routines
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -33,12 +33,12 @@ function wppa_save_source( $file, $name, $alb ) {
|
|
33 |
}
|
34 |
|
35 |
if ( $doit ) {
|
36 |
-
if ( !
|
37 |
$sourcedir = wppa_get_source_dir();
|
38 |
-
if ( !
|
39 |
$albdir = wppa_get_source_album_dir( $alb );
|
40 |
-
if ( !
|
41 |
-
if ( !
|
42 |
wppa_log( 'Err', 'Could not create source directory ' . $albdir );
|
43 |
}
|
44 |
$dest = $albdir . '/' . wppa_sanitize_file_name( $name );
|
@@ -76,7 +76,7 @@ function wppa_delete_source( $name, $alb ) {
|
|
76 |
|
77 |
// Remove album if empty
|
78 |
$dir = wppa_get_source_album_dir( $alb );
|
79 |
-
if (
|
80 |
$files = glob( $dir . '/*.*' );
|
81 |
if ( count( $files ) == 2 ) { // . and .. only
|
82 |
@ rmdir( wppa_get_source_album_dir( $alb ) ); // Ignore error
|
@@ -99,7 +99,7 @@ global $wppa_supported_photo_extensions;
|
|
99 |
$frompath = wppa_get_source_album_dir( $from ).'/'.wppa_strip_ext($name);
|
100 |
$todir = wppa_get_source_album_dir( $to );
|
101 |
$topath = wppa_get_source_album_dir( $to ).'/'.wppa_strip_ext($name);
|
102 |
-
if ( !
|
103 |
|
104 |
foreach( $supext as $ext ) {
|
105 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
@@ -134,7 +134,7 @@ global $wppa_supported_photo_extensions;
|
|
134 |
$frompath = wppa_get_source_album_dir( $from ).'/'.wppa_strip_ext($name);
|
135 |
$todir = wppa_get_source_album_dir( $to );
|
136 |
$topath = wppa_get_source_album_dir( $to ).'/'.wppa_strip_ext($name);
|
137 |
-
if ( !
|
138 |
|
139 |
foreach( $supext as $ext ) {
|
140 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains photo source file management routines
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
33 |
}
|
34 |
|
35 |
if ( $doit ) {
|
36 |
+
if ( ! wppa_is_dir( wppa_opt( 'source_dir' ) ) ) @ wppa_mktree( wppa_opt( 'source_dir' ) );
|
37 |
$sourcedir = wppa_get_source_dir();
|
38 |
+
if ( ! wppa_is_dir( $sourcedir ) ) @ wppa_mktree( $sourcedir );
|
39 |
$albdir = wppa_get_source_album_dir( $alb );
|
40 |
+
if ( ! wppa_is_dir( $albdir ) ) @ wppa_mktree( $albdir );
|
41 |
+
if ( ! wppa_is_dir( $albdir ) ) {
|
42 |
wppa_log( 'Err', 'Could not create source directory ' . $albdir );
|
43 |
}
|
44 |
$dest = $albdir . '/' . wppa_sanitize_file_name( $name );
|
76 |
|
77 |
// Remove album if empty
|
78 |
$dir = wppa_get_source_album_dir( $alb );
|
79 |
+
if ( wppa_is_dir( $dir ) ) {
|
80 |
$files = glob( $dir . '/*.*' );
|
81 |
if ( count( $files ) == 2 ) { // . and .. only
|
82 |
@ rmdir( wppa_get_source_album_dir( $alb ) ); // Ignore error
|
99 |
$frompath = wppa_get_source_album_dir( $from ).'/'.wppa_strip_ext($name);
|
100 |
$todir = wppa_get_source_album_dir( $to );
|
101 |
$topath = wppa_get_source_album_dir( $to ).'/'.wppa_strip_ext($name);
|
102 |
+
if ( ! wppa_is_dir( $todir ) ) @ wppa_mktree( $todir );
|
103 |
|
104 |
foreach( $supext as $ext ) {
|
105 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
134 |
$frompath = wppa_get_source_album_dir( $from ).'/'.wppa_strip_ext($name);
|
135 |
$todir = wppa_get_source_album_dir( $to );
|
136 |
$topath = wppa_get_source_album_dir( $to ).'/'.wppa_strip_ext($name);
|
137 |
+
if ( ! wppa_is_dir( $todir ) ) @ wppa_mktree( $todir );
|
138 |
|
139 |
foreach( $supext as $ext ) {
|
140 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
wppa-stereo.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the stereo stuff
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -91,7 +91,7 @@ static $f114;
|
|
91 |
$is_stereo = wppa_is_stereo( $id );
|
92 |
if ( ! $is_stereo ) return;
|
93 |
$stereodir = WPPA_UPLOAD_PATH . '/stereo';
|
94 |
-
if ( !
|
95 |
wppa_mkdir( $stereodir );
|
96 |
}
|
97 |
$fromfile = wppa_get_photo_path( $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the stereo stuff
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
91 |
$is_stereo = wppa_is_stereo( $id );
|
92 |
if ( ! $is_stereo ) return;
|
93 |
$stereodir = WPPA_UPLOAD_PATH . '/stereo';
|
94 |
+
if ( ! wppa_is_dir( $stereodir ) ) {
|
95 |
wppa_mkdir( $stereodir );
|
96 |
}
|
97 |
$fromfile = wppa_get_photo_path( $id );
|
wppa-utils.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
-
* Version
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -248,9 +248,9 @@ function wppa_expand_id( $xid, $makepath = false ) {
|
|
248 |
$len = strlen( $id );
|
249 |
if ( $makepath ) {
|
250 |
$path = WPPA_UPLOAD_PATH . '/' . $result;
|
251 |
-
if ( !
|
252 |
$path = WPPA_UPLOAD_PATH . '/thumbs/' . $result;
|
253 |
-
if ( !
|
254 |
}
|
255 |
}
|
256 |
$result .= $id;
|
@@ -2465,29 +2465,14 @@ function wppa_expand_enum( $enum ) {
|
|
2465 |
|
2466 |
function wppa_mktree( $path ) {
|
2467 |
if ( is_dir( $path ) ) {
|
2468 |
-
wppa_chmod( $path );
|
2469 |
return true;
|
2470 |
}
|
2471 |
$bret = wppa_mktree( dirname( $path ) );
|
2472 |
wppa_mkdir( $path );
|
2473 |
wppa_chmod( $path );
|
2474 |
-
return (
|
2475 |
}
|
2476 |
|
2477 |
-
function wppa_mkdir( $path ) {
|
2478 |
-
if ( ! is_dir( $path ) ) {
|
2479 |
-
mkdir( $path );
|
2480 |
-
if ( is_dir( $path ) ) {
|
2481 |
-
wppa_log( 'Fso', 'Created path: ' . $path );
|
2482 |
-
}
|
2483 |
-
else {
|
2484 |
-
wppa_log( 'Err', 'Could not create: ' . $path );
|
2485 |
-
}
|
2486 |
-
wppa_chmod( $path );
|
2487 |
-
}
|
2488 |
-
}
|
2489 |
-
|
2490 |
-
|
2491 |
// Compute avg rating and count and put it in photo data
|
2492 |
function wppa_rate_photo( $id ) {
|
2493 |
global $wpdb;
|
@@ -2861,7 +2846,7 @@ static $wppa_get_get_cache;
|
|
2861 |
if ( $index == 'album' ) {
|
2862 |
|
2863 |
// Encrypted?
|
2864 |
-
$result = wppa_decrypt_album( $result );
|
2865 |
|
2866 |
if ( ! wppa_is_int( $result ) ) {
|
2867 |
$temp = wppa_get_album_id_by_name( $result );
|
@@ -3248,7 +3233,7 @@ global $wpdb;
|
|
3248 |
|
3249 |
// Verify existance of zips dir
|
3250 |
$zipsdir = WPPA_UPLOAD_PATH.'/zips/';
|
3251 |
-
if ( !
|
3252 |
|
3253 |
// Compose the users zip filename
|
3254 |
$zipfile = $zipsdir.wppa_get_user().'.zip';
|
@@ -3692,9 +3677,14 @@ function wppa_chmod( $fso ) {
|
|
3692 |
|
3693 |
$fso = rtrim( $fso, '/' );
|
3694 |
|
|
|
|
|
|
|
|
|
|
|
3695 |
$perms = fileperms( $fso ) & 0777;
|
3696 |
|
3697 |
-
if (
|
3698 |
|
3699 |
// Check file permissions
|
3700 |
if ( 0755 !== ( $perms & 0755 ) ) {
|
@@ -3836,7 +3826,7 @@ function wppa_print_tree( $path ) {
|
|
3836 |
$files = glob( $path . '/*' );
|
3837 |
foreach( $files as $file ) {
|
3838 |
echo $file . '<br />';
|
3839 |
-
if (
|
3840 |
wppa_print_tree( $file );
|
3841 |
}
|
3842 |
}
|
@@ -3925,7 +3915,7 @@ function wppa_create_qrcode_cache( $qrsrc ) {
|
|
3925 |
}
|
3926 |
|
3927 |
// Make sure we have .../uploads/wppa/qr
|
3928 |
-
if ( !
|
3929 |
mkdir( WPPA_UPLOAD_PATH . '/qr' );
|
3930 |
}
|
3931 |
|
@@ -4698,7 +4688,7 @@ function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
|
|
4698 |
|
4699 |
// Copy pdf to source dir,
|
4700 |
$src = wppa_get_source_album_dir( $alb );
|
4701 |
-
if ( !
|
4702 |
mkdir( $src );
|
4703 |
}
|
4704 |
$src .= '/';
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
+
* Version 7.0.00
|
7 |
*
|
8 |
*/
|
9 |
|
248 |
$len = strlen( $id );
|
249 |
if ( $makepath ) {
|
250 |
$path = WPPA_UPLOAD_PATH . '/' . $result;
|
251 |
+
if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
|
252 |
$path = WPPA_UPLOAD_PATH . '/thumbs/' . $result;
|
253 |
+
if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
|
254 |
}
|
255 |
}
|
256 |
$result .= $id;
|
2465 |
|
2466 |
function wppa_mktree( $path ) {
|
2467 |
if ( is_dir( $path ) ) {
|
|
|
2468 |
return true;
|
2469 |
}
|
2470 |
$bret = wppa_mktree( dirname( $path ) );
|
2471 |
wppa_mkdir( $path );
|
2472 |
wppa_chmod( $path );
|
2473 |
+
return ( wppa_is_dir( $path ) );
|
2474 |
}
|
2475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2476 |
// Compute avg rating and count and put it in photo data
|
2477 |
function wppa_rate_photo( $id ) {
|
2478 |
global $wpdb;
|
2846 |
if ( $index == 'album' ) {
|
2847 |
|
2848 |
// Encrypted?
|
2849 |
+
$result = wppa_decrypt_album( $result, true, 'no_refuse' );
|
2850 |
|
2851 |
if ( ! wppa_is_int( $result ) ) {
|
2852 |
$temp = wppa_get_album_id_by_name( $result );
|
3233 |
|
3234 |
// Verify existance of zips dir
|
3235 |
$zipsdir = WPPA_UPLOAD_PATH.'/zips/';
|
3236 |
+
if ( ! wppa_is_dir( $zipsdir ) ) return false;
|
3237 |
|
3238 |
// Compose the users zip filename
|
3239 |
$zipfile = $zipsdir.wppa_get_user().'.zip';
|
3677 |
|
3678 |
$fso = rtrim( $fso, '/' );
|
3679 |
|
3680 |
+
if ( ! wppa_is_path_safe( $fso ) ) {
|
3681 |
+
wppa_log( 'War', 'Unsafe path detected in wppa_chmod() ' . sanitize_text_field( $fso ), true );
|
3682 |
+
return;
|
3683 |
+
}
|
3684 |
+
|
3685 |
$perms = fileperms( $fso ) & 0777;
|
3686 |
|
3687 |
+
if ( wppa_is_dir( $fso ) ) {
|
3688 |
|
3689 |
// Check file permissions
|
3690 |
if ( 0755 !== ( $perms & 0755 ) ) {
|
3826 |
$files = glob( $path . '/*' );
|
3827 |
foreach( $files as $file ) {
|
3828 |
echo $file . '<br />';
|
3829 |
+
if ( wppa_is_dir( $file ) ) {
|
3830 |
wppa_print_tree( $file );
|
3831 |
}
|
3832 |
}
|
3915 |
}
|
3916 |
|
3917 |
// Make sure we have .../uploads/wppa/qr
|
3918 |
+
if ( ! wppa_is_dir( WPPA_UPLOAD_PATH . '/qr' ) ) {
|
3919 |
mkdir( WPPA_UPLOAD_PATH . '/qr' );
|
3920 |
}
|
3921 |
|
4688 |
|
4689 |
// Copy pdf to source dir,
|
4690 |
$src = wppa_get_source_album_dir( $alb );
|
4691 |
+
if ( ! wppa_is_dir( $src ) ) {
|
4692 |
mkdir( $src );
|
4693 |
}
|
4694 |
$src .= '/';
|
wppa-watermark.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-watermark.php
|
3 |
*
|
4 |
* Functions used for the application of watermarks
|
5 |
-
* Version
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -376,7 +376,7 @@ function wppa_does_thumb_need_watermark( $id ) {
|
|
376 |
|
377 |
// If setting is ---none--- no watermark either.
|
378 |
$temp = wppa_get_water_file_and_pos( $id );
|
379 |
-
if ( ! $temp['file'] || basename( $temp['file'] ) == '--- none ---' || !
|
380 |
return false; // No watermark this time
|
381 |
}
|
382 |
|
@@ -400,9 +400,15 @@ function wppa_add_watermark( $id ) {
|
|
400 |
if ( basename( $waterfile ) == '--- none ---' ) {
|
401 |
return false; // No watermark this time
|
402 |
}
|
|
|
403 |
// Open the watermark file
|
|
|
|
|
|
|
|
|
|
|
404 |
$watersize = @ getimagesize( $waterfile );
|
405 |
-
if ( !is_array( $watersize ) ) return false; // Not a valid picture file
|
406 |
$waterimage = imagecreatefrompng( $waterfile );
|
407 |
if ( empty( $waterimage ) or ( !$waterimage ) ) {
|
408 |
wppa_dbg_msg( 'Watermark file '.$waterfile.' not found or corrupt' );
|
2 |
/* wppa-watermark.php
|
3 |
*
|
4 |
* Functions used for the application of watermarks
|
5 |
+
* Version 7.0.00
|
6 |
*
|
7 |
*/
|
8 |
|
376 |
|
377 |
// If setting is ---none--- no watermark either.
|
378 |
$temp = wppa_get_water_file_and_pos( $id );
|
379 |
+
if ( ! $temp['file'] || basename( $temp['file'] ) == '--- none ---' || ! wppa_is_file( $temp['file'] ) ) {
|
380 |
return false; // No watermark this time
|
381 |
}
|
382 |
|
400 |
if ( basename( $waterfile ) == '--- none ---' ) {
|
401 |
return false; // No watermark this time
|
402 |
}
|
403 |
+
|
404 |
// Open the watermark file
|
405 |
+
if ( ! wppa_is_path_safe( $waterfile ) ) {
|
406 |
+
wppa_log( 'War', 'Unsafe path found in wppa_add_watermark(): ' . sanitize_text_field( $waterfile ) );
|
407 |
+
return false;
|
408 |
+
}
|
409 |
+
|
410 |
$watersize = @ getimagesize( $waterfile );
|
411 |
+
if ( ! is_array( $watersize ) ) return false; // Not a valid picture file
|
412 |
$waterimage = imagecreatefrompng( $waterfile );
|
413 |
if ( empty( $waterimage ) or ( !$waterimage ) ) {
|
414 |
wppa_dbg_msg( 'Watermark file '.$waterfile.' not found or corrupt' );
|
wppa-wrappers.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Contains wrappers for standard php functions
|
6 |
* For security and bug reasons
|
7 |
*
|
8 |
-
* Version
|
9 |
*
|
10 |
*/
|
11 |
|
@@ -63,7 +63,7 @@ function wppa_move_uploaded_file( $from, $to ) {
|
|
63 |
|
64 |
// Wrapper for rename
|
65 |
function wppa_rename( $from, $to ) {
|
66 |
-
|
67 |
$bret = false;
|
68 |
if ( ! wppa_is_path_safe( $from ) ) {
|
69 |
wppa_log( 'War', 'Unsafe from path detected in wppa_rename(): ' . sanitize_text_field( $from ), true );
|
@@ -82,7 +82,7 @@ function wppa_rename( $from, $to ) {
|
|
82 |
else {
|
83 |
wppa_log( 'Fso', 'Could not rename non existent file ' . sanitize_text_field( $from ) . ' to ' . sanitize_text_field( $to ), true );
|
84 |
}
|
85 |
-
|
86 |
return $bret;
|
87 |
}
|
88 |
|
@@ -117,26 +117,94 @@ function wppa_glob( $pattern, $flags = null ) {
|
|
117 |
|
118 |
// Wrapper for unlink
|
119 |
function wppa_unlink( $file ) {
|
120 |
-
|
121 |
if ( ! wppa_is_path_safe( $file ) ) {
|
122 |
wppa_log( 'War', 'Unsafe path detected in wppa_unlink(): ' . sanitize_text_field( $file ), true );
|
123 |
return false;
|
124 |
}
|
125 |
-
|
126 |
return unlink( $file );
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
// Wrapper for rmdir
|
130 |
function wppa_rmdir( $dir ) {
|
131 |
-
|
132 |
if ( ! wppa_is_path_safe( $dir ) ) {
|
133 |
wppa_log( 'War', 'Unsafe path detected in wppa_rmdir(): ' . sanitize_text_field( $dir ), true );
|
134 |
return false;
|
135 |
}
|
136 |
-
|
137 |
return rmdir( $dir );
|
138 |
}
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
// Utility to check if a given full filepath is safe to manipulate upon
|
141 |
function wppa_is_path_safe( $path ) {
|
142 |
static $safe_roots;
|
@@ -144,6 +212,10 @@ static $safe_files;
|
|
144 |
global $wppa_lang;
|
145 |
global $wppa_log_file;
|
146 |
|
|
|
|
|
|
|
|
|
147 |
if ( empty( $safe_files ) ) {
|
148 |
|
149 |
// The following files are safe to read or write to
|
@@ -166,8 +238,9 @@ global $wppa_log_file;
|
|
166 |
WPPA_PATH . '/watermarks',
|
167 |
WPPA_PATH . '/wppa-dump.txt',
|
168 |
WPPA_PATH . '/dynamic',
|
169 |
-
WPPA_UPLOAD_PATH . '/temp
|
170 |
-
WPPA_UPLOAD_PATH . '/zips
|
|
|
171 |
);
|
172 |
|
173 |
}
|
5 |
* Contains wrappers for standard php functions
|
6 |
* For security and bug reasons
|
7 |
*
|
8 |
+
* Version 7.0.00
|
9 |
*
|
10 |
*/
|
11 |
|
63 |
|
64 |
// Wrapper for rename
|
65 |
function wppa_rename( $from, $to ) {
|
66 |
+
|
67 |
$bret = false;
|
68 |
if ( ! wppa_is_path_safe( $from ) ) {
|
69 |
wppa_log( 'War', 'Unsafe from path detected in wppa_rename(): ' . sanitize_text_field( $from ), true );
|
82 |
else {
|
83 |
wppa_log( 'Fso', 'Could not rename non existent file ' . sanitize_text_field( $from ) . ' to ' . sanitize_text_field( $to ), true );
|
84 |
}
|
85 |
+
|
86 |
return $bret;
|
87 |
}
|
88 |
|
117 |
|
118 |
// Wrapper for unlink
|
119 |
function wppa_unlink( $file ) {
|
120 |
+
|
121 |
if ( ! wppa_is_path_safe( $file ) ) {
|
122 |
wppa_log( 'War', 'Unsafe path detected in wppa_unlink(): ' . sanitize_text_field( $file ), true );
|
123 |
return false;
|
124 |
}
|
125 |
+
|
126 |
return unlink( $file );
|
127 |
}
|
128 |
|
129 |
+
/*
|
130 |
+
function wppa_mkdir( $path ) {
|
131 |
+
if ( ! is_dir( $path ) ) {
|
132 |
+
mkdir( $path );
|
133 |
+
if ( is_dir( $path ) ) {
|
134 |
+
wppa_log( 'Fso', 'Created path: ' . $path );
|
135 |
+
}
|
136 |
+
else {
|
137 |
+
wppa_log( 'Err', 'Could not create: ' . $path );
|
138 |
+
}
|
139 |
+
wppa_chmod( $path );
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
*/
|
144 |
+
// Wrapper for mkdir
|
145 |
+
function wppa_mkdir( $dir ) {
|
146 |
+
|
147 |
+
$bret = false;
|
148 |
+
|
149 |
+
// Path safe?
|
150 |
+
if ( ! wppa_is_path_safe( $dir ) ) {
|
151 |
+
wppa_log( 'War', 'Unsafe path detected in wppa_mkdir(): ' . sanitize_text_field( $dir ), true );
|
152 |
+
}
|
153 |
+
|
154 |
+
// Already exists?
|
155 |
+
elseif ( is_dir( $dir ) ) {
|
156 |
+
$bret = true;
|
157 |
+
}
|
158 |
+
|
159 |
+
// Create dir
|
160 |
+
else {
|
161 |
+
$bret = mkdir( $dir );
|
162 |
+
|
163 |
+
if ( is_dir( $dir ) ) {
|
164 |
+
wppa_log( 'Fso', 'Created path: ' . $dir );
|
165 |
+
}
|
166 |
+
else {
|
167 |
+
wppa_log( 'Err', 'Could not create: ' . $dir );
|
168 |
+
}
|
169 |
+
wppa_chmod( $dir );
|
170 |
+
}
|
171 |
+
|
172 |
+
return $bret;
|
173 |
+
}
|
174 |
+
|
175 |
// Wrapper for rmdir
|
176 |
function wppa_rmdir( $dir ) {
|
177 |
+
|
178 |
if ( ! wppa_is_path_safe( $dir ) ) {
|
179 |
wppa_log( 'War', 'Unsafe path detected in wppa_rmdir(): ' . sanitize_text_field( $dir ), true );
|
180 |
return false;
|
181 |
}
|
182 |
+
|
183 |
return rmdir( $dir );
|
184 |
}
|
185 |
|
186 |
+
// Wrapper for is_dir
|
187 |
+
function wppa_is_dir( $dir ) {
|
188 |
+
|
189 |
+
if ( ! wppa_is_path_safe( $dir ) ) {
|
190 |
+
wppa_log( 'War', 'Unsafe path detected in wppa_is_dir(): ' . sanitize_text_field( $dir ), true );
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
return is_dir( $dir );
|
195 |
+
}
|
196 |
+
|
197 |
+
// Wrapper for is_file
|
198 |
+
function wppa_is_file( $path ) {
|
199 |
+
|
200 |
+
if ( ! wppa_is_path_safe( $path ) ) {
|
201 |
+
wppa_log( 'War', 'Unsafe path detected in wppa_is_path(): ' . sanitize_text_field( $path ), true );
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
|
205 |
+
return is_file( $path );
|
206 |
+
}
|
207 |
+
|
208 |
// Utility to check if a given full filepath is safe to manipulate upon
|
209 |
function wppa_is_path_safe( $path ) {
|
210 |
static $safe_roots;
|
212 |
global $wppa_lang;
|
213 |
global $wppa_log_file;
|
214 |
|
215 |
+
if ( substr( strtolower( $path ), 0, 7 ) == 'phar://' ) return false;
|
216 |
+
|
217 |
+
if ( ! defined( 'WPPA_UPLOAD_PATH' ) ) return true; // During activation/setup
|
218 |
+
|
219 |
if ( empty( $safe_files ) ) {
|
220 |
|
221 |
// The following files are safe to read or write to
|
238 |
WPPA_PATH . '/watermarks',
|
239 |
WPPA_PATH . '/wppa-dump.txt',
|
240 |
WPPA_PATH . '/dynamic',
|
241 |
+
WPPA_UPLOAD_PATH . '/temp',
|
242 |
+
WPPA_UPLOAD_PATH . '/zips',
|
243 |
+
WPPA_UPLOAD_PATH . '/qr',
|
244 |
);
|
245 |
|
246 |
}
|
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 |
* 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 = '
|
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: 7.0.00
|
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 = '7000'; // WPPA db version
|
26 |
+
global $wppa_api_version; $wppa_api_version = '7-0-00-003'; // WPPA software version
|
27 |
|
28 |
/* start timers */
|
29 |
global $wppa_starttime; $wppa_starttime = microtime( true );
|