Version Description
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 6.4.10 |
Comparing to | |
See all releases |
Code changes from version 6.4.09 to 6.4.10
- js/wppa-admin-scripts.js +28 -5
- readme.txt +17 -3
- wppa-admin-functions.php +19 -12
- wppa-admins-choice-widget.php +9 -3
- wppa-ajax.php +10 -1
- wppa-boxes-html.php +2 -2
- wppa-cloudinary.php +11 -4
- wppa-common-functions.php +37 -513
- wppa-functions.php +11 -3
- wppa-maintenance.php +8 -2
- wppa-photo-files.php +559 -0
- wppa-session.php +2 -2
- wppa-settings-autosave.php +22 -2
- wppa-setup.php +7 -4
- wppa-source.php +11 -3
- wppa-upload.php +2 -1
- wppa-utils.php +23 -14
- wppa.php +4 -3
js/wppa-admin-scripts.js
CHANGED
@@ -1501,6 +1501,8 @@ function wppaAjaxUpdateOptionCheckBox(slug, elem) {
|
|
1501 |
xmlhttp.send();
|
1502 |
}
|
1503 |
|
|
|
|
|
1504 |
function wppaMaintenanceProc(slug, intern) {
|
1505 |
|
1506 |
// If running: stop
|
@@ -1583,15 +1585,36 @@ function wppaMaintenanceProc(slug, intern) {
|
|
1583 |
error: function( xhr, status, error ) {
|
1584 |
wppaConsoleLog( 'wppaMaintenanceProc failed. Error = ' + error + ', status = ' + status, 'force' );
|
1585 |
jQuery("#"+slug+"_status").html('Server error');
|
1586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1587 |
if ( slug == 'wppa_remake' ) {
|
1588 |
-
wppaAjaxUpdateOptionValue('wppa_remake_skip_one', 0);
|
1589 |
}
|
1590 |
-
if ( slug == 'wppa_regen_thumbs') {
|
1591 |
-
wppaAjaxUpdateOptionValue('wppa_regen_thumbs_skip_one', 0);
|
|
|
|
|
|
|
1592 |
}
|
1593 |
setTimeout('wppaMaintenanceProc(\''+slug+'\', true)', 2000);
|
1594 |
-
}
|
1595 |
},
|
1596 |
|
1597 |
complete: function( xhr, status, newurl ) {
|
1501 |
xmlhttp.send();
|
1502 |
}
|
1503 |
|
1504 |
+
var wppaAlwaysContinue = 0;
|
1505 |
+
|
1506 |
function wppaMaintenanceProc(slug, intern) {
|
1507 |
|
1508 |
// If running: stop
|
1585 |
error: function( xhr, status, error ) {
|
1586 |
wppaConsoleLog( 'wppaMaintenanceProc failed. Error = ' + error + ', status = ' + status, 'force' );
|
1587 |
jQuery("#"+slug+"_status").html('Server error');
|
1588 |
+
var wppaContinue = false;
|
1589 |
+
if ( wppaAlwaysContinue < 1 ) {
|
1590 |
+
wppaContinue = confirm( 'Server error.\nDo you want to continue?' );
|
1591 |
+
if ( wppaContinue ) {
|
1592 |
+
if ( wppaAlwaysContinue == 0 ) {
|
1593 |
+
if ( slug == 'wppa_remake' ||
|
1594 |
+
slug == 'wppa_regen_thumbs' ||
|
1595 |
+
slug == 'wppa_create_o1_files' ) {
|
1596 |
+
if ( confirm( 'Always continue after server error?' ) ) {
|
1597 |
+
wppaAlwaysContinue = 1;
|
1598 |
+
}
|
1599 |
+
}
|
1600 |
+
else {
|
1601 |
+
wppaAlwaysContinue = -1;
|
1602 |
+
}
|
1603 |
+
}
|
1604 |
+
}
|
1605 |
+
}
|
1606 |
+
if ( wppaContinue || wppaAlwaysContinue == 1 ) {
|
1607 |
if ( slug == 'wppa_remake' ) {
|
1608 |
+
wppaAjaxUpdateOptionValue( 'wppa_remake_skip_one', 0 );
|
1609 |
}
|
1610 |
+
if ( slug == 'wppa_regen_thumbs' ) {
|
1611 |
+
wppaAjaxUpdateOptionValue( 'wppa_regen_thumbs_skip_one', 0 );
|
1612 |
+
}
|
1613 |
+
if ( slug == 'wppa_create_o1_files' ) {
|
1614 |
+
wppaAjaxUpdateOptionValue( 'wppa_create_o1_files_skip_one', 0 );
|
1615 |
}
|
1616 |
setTimeout('wppaMaintenanceProc(\''+slug+'\', true)', 2000);
|
1617 |
+
}
|
1618 |
},
|
1619 |
|
1620 |
complete: function( xhr, status, newurl ) {
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: opajaap
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source¤cy_code=USD&lc=US
|
4 |
Tags: photo, album, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
|
5 |
-
Version: 6.4.
|
6 |
-
Stable tag: 6.4.
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
@@ -180,6 +180,20 @@ Oh, just Google on 'picture resizer' and you will find a bunch of free programs
|
|
180 |
|
181 |
See for additional information: http://wppa.opajaap.nl/changelog/
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
= 6.4.09 =
|
184 |
|
185 |
= Bug Fixes =
|
@@ -187,7 +201,7 @@ See for additional information: http://wppa.opajaap.nl/changelog/
|
|
187 |
* Fixed wrong aspect ratios of videos on lightbox. Make sure you set ether the default size values correct in Table I-H or on the individual edit photo pages.
|
188 |
* Auto started video on lightbox is no longer stopped by other running slideshows.
|
189 |
* Links with spaces not worked correctly when pretty links are enabled. Fixed.
|
190 |
-
* The Upload photo
|
191 |
|
192 |
= New Features =
|
193 |
|
2 |
Contributors: opajaap
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source¤cy_code=USD&lc=US
|
4 |
Tags: photo, album, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
|
5 |
+
Version: 6.4.10
|
6 |
+
Stable tag: 6.4.09
|
7 |
Author: J.N. Breetvelt
|
8 |
Author URI: http://www.opajaap.nl/
|
9 |
Requires at least: 3.9
|
180 |
|
181 |
See for additional information: http://wppa.opajaap.nl/changelog/
|
182 |
|
183 |
+
= 6.4.10 =
|
184 |
+
|
185 |
+
= Bug Fixes =
|
186 |
+
|
187 |
+
* Non-standard oriented photos ( from mobile devices ) will now properly be displayed in all cases, including when Cloudinary is active and sources are used for lightbox, etc.
|
188 |
+
To fix existing photos, run Table VIII-A15.
|
189 |
+
* Admins choice widget damages layout for the logged in user having a zipfile. Fixed.
|
190 |
+
|
191 |
+
= Other Changes =
|
192 |
+
|
193 |
+
* Improved integrity check on settings, leading to performance improvement, especially when using qTranslate-x.
|
194 |
+
* The Admins choice widget no longer automaticly switches the feature on, but gives a warning when it is used and not switched on.
|
195 |
+
* If selecting album by $Name has more than one match, all album ids are returned.
|
196 |
+
|
197 |
= 6.4.09 =
|
198 |
|
199 |
= Bug Fixes =
|
201 |
* Fixed wrong aspect ratios of videos on lightbox. Make sure you set ether the default size values correct in Table I-H or on the individual edit photo pages.
|
202 |
* Auto started video on lightbox is no longer stopped by other running slideshows.
|
203 |
* Links with spaces not worked correctly when pretty links are enabled. Fixed.
|
204 |
+
* The Upload photo dialog on thumbnail areas of real albums now do no longer display an album selection list, but upload takes place to the album involved.
|
205 |
|
206 |
= New Features =
|
207 |
|
wppa-admin-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* gp admin functions
|
6 |
-
* Version 6.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -616,12 +616,12 @@ static $everything_ok;
|
|
616 |
}
|
617 |
$idx++;
|
618 |
}
|
619 |
-
|
620 |
// Report errors
|
621 |
if ( $any_error ) {
|
622 |
if ( $verbose ) wppa_error_message( __( 'Please de-activate and re-activate the plugin. If this problem persists, ask your administrator.' , 'wp-photo-album-plus'), 'red', 'force' );
|
623 |
}
|
624 |
-
|
625 |
// No errors, save result
|
626 |
else {
|
627 |
$everything_ok = true;
|
@@ -686,6 +686,9 @@ global $wpdb;
|
|
686 |
// Save source
|
687 |
wppa_save_source( $file, $name, $photo['album'] );
|
688 |
|
|
|
|
|
|
|
689 |
// Update filename if not present. this is for backward compatibility when there were no filenames saved yet
|
690 |
if ( ! wppa_get_photo_item( $id, 'filename' ) ) {
|
691 |
wppa_update_photo( array( 'id' => $id, 'filename' => $name ) );
|
@@ -740,6 +743,9 @@ global $allphotos;
|
|
740 |
// Save the new source
|
741 |
wppa_save_source( $file, basename( $file ), $alb );
|
742 |
|
|
|
|
|
|
|
743 |
// Update filename if still empty ( Old )
|
744 |
if ( ! $photo['filename'] ) {
|
745 |
$wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_PHOTOS."` SET `filename` = %s WHERE `id` = %s", wppa_sanitize_file_name( basename( $file ) ), $id ) );
|
@@ -877,6 +883,7 @@ global $warning_given_small;
|
|
877 |
}
|
878 |
else { // Save the source
|
879 |
wppa_save_source( $file, $filename, $alb );
|
|
|
880 |
wppa_flush_treecounts( $alb );
|
881 |
wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
|
882 |
wppa_flush_upldr_cache( 'photoid', $id );
|
@@ -954,13 +961,13 @@ global $wpdb;
|
|
954 |
if ( ! $file ) {
|
955 |
return false;
|
956 |
}
|
957 |
-
|
958 |
// Init output buffer
|
959 |
$result = '';
|
960 |
-
|
961 |
// Get the fieldnames
|
962 |
$fields = $wpdb->get_results( "DESCRIBE `".$table."`", ARRAY_A );
|
963 |
-
|
964 |
// Write the .csv header
|
965 |
if ( is_array( $fields ) ) {
|
966 |
foreach( $fields as $field ) {
|
@@ -969,17 +976,17 @@ global $wpdb;
|
|
969 |
$result = rtrim( $result, ',') . "\n";
|
970 |
}
|
971 |
fwrite( $file, $result );
|
972 |
-
|
973 |
// Init getting the data
|
974 |
$count = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $table . "`" );
|
975 |
$iters = ceil( $count / 1000 );
|
976 |
$iter = 0;
|
977 |
-
|
978 |
// Read chunks of 1000 rows
|
979 |
while ( $iter < $iters ) {
|
980 |
$query = "SELECT * FROM `" . $table . "` ORDER BY `id` LIMIT " . 1000 * $iter . ",1000";
|
981 |
$data = $wpdb->get_results( $query, ARRAY_N );
|
982 |
-
|
983 |
// Process rows
|
984 |
if ( $data ) {
|
985 |
foreach( $data as $row ) {
|
@@ -988,17 +995,17 @@ global $wpdb;
|
|
988 |
$result .= wppa_prep_for_csv( $item ) . ',';
|
989 |
}
|
990 |
$result = rtrim( $result, ',') . "\n";
|
991 |
-
|
992 |
// Write to file
|
993 |
fwrite( $file, $result );
|
994 |
}
|
995 |
}
|
996 |
$iter++;
|
997 |
}
|
998 |
-
|
999 |
// Close file
|
1000 |
fclose( $file );
|
1001 |
-
|
1002 |
// Done !
|
1003 |
return true;
|
1004 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* gp admin functions
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
616 |
}
|
617 |
$idx++;
|
618 |
}
|
619 |
+
|
620 |
// Report errors
|
621 |
if ( $any_error ) {
|
622 |
if ( $verbose ) wppa_error_message( __( 'Please de-activate and re-activate the plugin. If this problem persists, ask your administrator.' , 'wp-photo-album-plus'), 'red', 'force' );
|
623 |
}
|
624 |
+
|
625 |
// No errors, save result
|
626 |
else {
|
627 |
$everything_ok = true;
|
686 |
// Save source
|
687 |
wppa_save_source( $file, $name, $photo['album'] );
|
688 |
|
689 |
+
// Make proper oriented source
|
690 |
+
wppa_make_o1_source( $id );
|
691 |
+
|
692 |
// Update filename if not present. this is for backward compatibility when there were no filenames saved yet
|
693 |
if ( ! wppa_get_photo_item( $id, 'filename' ) ) {
|
694 |
wppa_update_photo( array( 'id' => $id, 'filename' => $name ) );
|
743 |
// Save the new source
|
744 |
wppa_save_source( $file, basename( $file ), $alb );
|
745 |
|
746 |
+
// Make proper oriented source
|
747 |
+
wppa_make_o1_source( $id );
|
748 |
+
|
749 |
// Update filename if still empty ( Old )
|
750 |
if ( ! $photo['filename'] ) {
|
751 |
$wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_PHOTOS."` SET `filename` = %s WHERE `id` = %s", wppa_sanitize_file_name( basename( $file ) ), $id ) );
|
883 |
}
|
884 |
else { // Save the source
|
885 |
wppa_save_source( $file, $filename, $alb );
|
886 |
+
wppa_make_o1_source( $id );
|
887 |
wppa_flush_treecounts( $alb );
|
888 |
wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
|
889 |
wppa_flush_upldr_cache( 'photoid', $id );
|
961 |
if ( ! $file ) {
|
962 |
return false;
|
963 |
}
|
964 |
+
|
965 |
// Init output buffer
|
966 |
$result = '';
|
967 |
+
|
968 |
// Get the fieldnames
|
969 |
$fields = $wpdb->get_results( "DESCRIBE `".$table."`", ARRAY_A );
|
970 |
+
|
971 |
// Write the .csv header
|
972 |
if ( is_array( $fields ) ) {
|
973 |
foreach( $fields as $field ) {
|
976 |
$result = rtrim( $result, ',') . "\n";
|
977 |
}
|
978 |
fwrite( $file, $result );
|
979 |
+
|
980 |
// Init getting the data
|
981 |
$count = $wpdb->get_var( "SELECT COUNT(*) FROM `" . $table . "`" );
|
982 |
$iters = ceil( $count / 1000 );
|
983 |
$iter = 0;
|
984 |
+
|
985 |
// Read chunks of 1000 rows
|
986 |
while ( $iter < $iters ) {
|
987 |
$query = "SELECT * FROM `" . $table . "` ORDER BY `id` LIMIT " . 1000 * $iter . ",1000";
|
988 |
$data = $wpdb->get_results( $query, ARRAY_N );
|
989 |
+
|
990 |
// Process rows
|
991 |
if ( $data ) {
|
992 |
foreach( $data as $row ) {
|
995 |
$result .= wppa_prep_for_csv( $item ) . ',';
|
996 |
}
|
997 |
$result = rtrim( $result, ',') . "\n";
|
998 |
+
|
999 |
// Write to file
|
1000 |
fwrite( $file, $result );
|
1001 |
}
|
1002 |
}
|
1003 |
$iter++;
|
1004 |
}
|
1005 |
+
|
1006 |
// Close file
|
1007 |
fclose( $file );
|
1008 |
+
|
1009 |
// Done !
|
1010 |
return true;
|
1011 |
}
|
wppa-admins-choice-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the admins-choice widget
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -40,7 +40,12 @@ class AdminsChoice extends WP_Widget {
|
|
40 |
|
41 |
if ( !empty( $widget_title ) ) { echo $before_title . $widget_title . $after_title; }
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
echo '<div style="clear:both"></div>';
|
46 |
echo $after_widget;
|
@@ -60,7 +65,8 @@ class AdminsChoice extends WP_Widget {
|
|
60 |
|
61 |
// Make sure the feature is enabled
|
62 |
if ( ! wppa_switch( 'enable_admins_choice' ) ) {
|
63 |
-
|
|
|
64 |
}
|
65 |
|
66 |
//Defaults
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* display the admins-choice widget
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
40 |
|
41 |
if ( !empty( $widget_title ) ) { echo $before_title . $widget_title . $after_title; }
|
42 |
|
43 |
+
if ( ! wppa_switch( 'enable_admins_choice' ) ) {
|
44 |
+
echo __('This feature is not enabled', 'wp-photo-album-plus');
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
echo '<div class="wppa-admins-choice-widget" >'.wppa_get_admins_choice_html().'</div>';
|
48 |
+
}
|
49 |
|
50 |
echo '<div style="clear:both"></div>';
|
51 |
echo $after_widget;
|
65 |
|
66 |
// Make sure the feature is enabled
|
67 |
if ( ! wppa_switch( 'enable_admins_choice' ) ) {
|
68 |
+
echo '<p style="color:red;" >'.__('Please enable this feature in Table IV-A27', 'wp-photo-album-plus').'</p>';
|
69 |
+
// wppa_update_option( 'wppa_enable_admins_choice', 'yes' );
|
70 |
}
|
71 |
|
72 |
//Defaults
|
wppa-ajax.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
-
* Version 6.4.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -1489,6 +1489,9 @@ global $wppa_session;
|
|
1489 |
// Save new source
|
1490 |
wppa_save_source( $_FILES['photo']['tmp_name'], wppa_get_photo_item( $photo, 'filename' ), wppa_get_photo_item( $photo, 'album') );
|
1491 |
|
|
|
|
|
|
|
1492 |
// Make the files
|
1493 |
$bret = wppa_make_the_photo_files( $_FILES['photo']['tmp_name'], $photo, strtolower( wppa_get_ext( $_FILES['photo']['name'] ) ) );
|
1494 |
if ( $bret ) {
|
@@ -2243,6 +2246,12 @@ global $wppa_session;
|
|
2243 |
$skip = $last + '1';
|
2244 |
update_option( 'wppa_remake_last', $skip );
|
2245 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
2246 |
|
2247 |
case 'wppa_errorlog_purge':
|
2248 |
@ unlink( WPPA_CONTENT_PATH.'/wppa-depot/admin/error.log' );
|
2 |
/* wppa-ajax.php
|
3 |
*
|
4 |
* Functions used in ajax requests
|
5 |
+
* Version 6.4.10
|
6 |
*
|
7 |
*/
|
8 |
|
1489 |
// Save new source
|
1490 |
wppa_save_source( $_FILES['photo']['tmp_name'], wppa_get_photo_item( $photo, 'filename' ), wppa_get_photo_item( $photo, 'album') );
|
1491 |
|
1492 |
+
// Make proper oriented source
|
1493 |
+
wppa_make_o1_source( $photo );
|
1494 |
+
|
1495 |
// Make the files
|
1496 |
$bret = wppa_make_the_photo_files( $_FILES['photo']['tmp_name'], $photo, strtolower( wppa_get_ext( $_FILES['photo']['name'] ) ) );
|
1497 |
if ( $bret ) {
|
2246 |
$skip = $last + '1';
|
2247 |
update_option( 'wppa_remake_last', $skip );
|
2248 |
break;
|
2249 |
+
|
2250 |
+
case 'wppa_create_o1_files_skip_one':
|
2251 |
+
$last = get_option( 'wppa_create_o1_files_last', '0' );
|
2252 |
+
$skip = $last + '1';
|
2253 |
+
update_option( 'wppa_create_o1_files_last', $skip );
|
2254 |
+
break;
|
2255 |
|
2256 |
case 'wppa_errorlog_purge':
|
2257 |
@ unlink( WPPA_CONTENT_PATH.'/wppa-depot/admin/error.log' );
|
wppa-boxes-html.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*
|
9 |
*/
|
@@ -892,7 +892,7 @@ function wppa_get_admins_choice_html() {
|
|
892 |
'<a' .
|
893 |
' onclick="wppaAjaxDeleteMyZip();"' .
|
894 |
' style="float:right;cursor:pointer;" >' .
|
895 |
-
__('Delete', 'wp-photo-album-plus')
|
896 |
'</a>';
|
897 |
}
|
898 |
$result .= '</li>';
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various wppa boxes
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*
|
9 |
*/
|
892 |
'<a' .
|
893 |
' onclick="wppaAjaxDeleteMyZip();"' .
|
894 |
' style="float:right;cursor:pointer;" >' .
|
895 |
+
__('Delete', 'wp-photo-album-plus') .
|
896 |
'</a>';
|
897 |
}
|
898 |
$result .= '</li>';
|
wppa-cloudinary.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/* Only loads when php version >= 5.3
|
3 |
*
|
4 |
-
* Version 6.
|
5 |
*
|
6 |
*/
|
7 |
|
@@ -37,11 +37,18 @@ function wppa_upload_to_cloudinary( $id ) {
|
|
37 |
"invalidate" => true
|
38 |
);
|
39 |
|
40 |
-
// Try source
|
41 |
-
$file =
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
// No source, use photofile
|
44 |
if ( ! is_file( $file ) ) {
|
|
|
|
|
45 |
$file = wppa_get_photo_path( $id );
|
46 |
}
|
47 |
|
1 |
<?php
|
2 |
/* Only loads when php version >= 5.3
|
3 |
*
|
4 |
+
* Version 6.4.10
|
5 |
*
|
6 |
*/
|
7 |
|
37 |
"invalidate" => true
|
38 |
);
|
39 |
|
40 |
+
// Try proper oriented source
|
41 |
+
$file = wppa_get_o1_source_path( $id );
|
42 |
+
|
43 |
+
if ( ! is_file( $file ) ) {
|
44 |
+
|
45 |
+
// Try source
|
46 |
+
$file = wppa_get_source_path( $id );
|
47 |
+
}
|
48 |
|
|
|
49 |
if ( ! is_file( $file ) ) {
|
50 |
+
|
51 |
+
// Use display file
|
52 |
$file = wppa_get_photo_path( $id );
|
53 |
}
|
54 |
|
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.4.
|
6 |
*
|
7 |
*/
|
8 |
|
@@ -36,18 +36,35 @@ global $wppa_defaults;
|
|
36 |
|
37 |
// Get the cache version of all settings
|
38 |
$wppa_opt = get_option( 'wppa_cached_options', false );
|
39 |
-
|
40 |
-
// Check for validity
|
41 |
-
if (
|
42 |
-
$wppa_opt
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
49 |
|
50 |
-
// Rebuild cached options
|
51 |
if ( ! is_array( $wppa_opt ) ) {
|
52 |
wppa_set_defaults();
|
53 |
$wppa_opt = $wppa_defaults;
|
@@ -57,8 +74,15 @@ global $wppa_defaults;
|
|
57 |
$wppa_opt[$option] = $optval;
|
58 |
}
|
59 |
}
|
60 |
-
update_option( 'wppa_cached_options', $wppa_opt );
|
61 |
-
update_option( 'wppa_md5_options', md5( serialize( $wppa_opt ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
if ( isset( $_GET['debug'] ) && wppa_switch( 'allow_debug' ) ) {
|
@@ -715,219 +739,6 @@ global $current_user;
|
|
715 |
return false;
|
716 |
}
|
717 |
|
718 |
-
// Make the display and thumbnails from a given source or upload temp image file.
|
719 |
-
// The id and extension must be supplied.
|
720 |
-
function wppa_make_the_photo_files( $file, $id, $ext ) {
|
721 |
-
global $wpdb;
|
722 |
-
|
723 |
-
$thumb = wppa_cache_thumb( $id );
|
724 |
-
|
725 |
-
$src_size = @getimagesize( $file, $info );
|
726 |
-
|
727 |
-
// If the given file is an image file, process it
|
728 |
-
if ( $src_size ) {
|
729 |
-
|
730 |
-
// Find output path photo file
|
731 |
-
$newimage = wppa_get_photo_path( $id );
|
732 |
-
if ( $ext ) {
|
733 |
-
$newimage = wppa_strip_ext( $newimage ) . '.' . strtolower( $ext );
|
734 |
-
}
|
735 |
-
|
736 |
-
// If Resize on upload is checked
|
737 |
-
if ( wppa_switch( 'resize_on_upload' ) ) {
|
738 |
-
|
739 |
-
// Picture sizes
|
740 |
-
$src_width = $src_size[0];
|
741 |
-
|
742 |
-
// Temp convert to logical width if stereo
|
743 |
-
if ( $thumb['stereo'] ) {
|
744 |
-
$src_width /= 2;
|
745 |
-
}
|
746 |
-
$src_height = $src_size[1];
|
747 |
-
|
748 |
-
// Max sizes
|
749 |
-
if ( wppa_opt( 'resize_to' ) == '0' ) { // from fullsize
|
750 |
-
$max_width = wppa_opt( 'fullsize' );
|
751 |
-
$max_height = wppa_opt( 'maxheight' );
|
752 |
-
}
|
753 |
-
else { // from selection
|
754 |
-
$screen = explode( 'x', wppa_opt( 'resize_to' ) );
|
755 |
-
$max_width = $screen[0];
|
756 |
-
$max_height = $screen[1];
|
757 |
-
}
|
758 |
-
|
759 |
-
// If orientation needs +/- 90 deg rotation, swap max x and max y
|
760 |
-
$ori = wppa_get_exif_orientation( $file );
|
761 |
-
if ( $ori >= 5 && $ori <= 8 ) {
|
762 |
-
$t = $max_width;
|
763 |
-
$max_width = $max_height;
|
764 |
-
$max_height = $t;
|
765 |
-
}
|
766 |
-
|
767 |
-
// Is source more landscape or more portrait than max window
|
768 |
-
if ( $src_width/$src_height > $max_width/$max_height ) { // focus on width
|
769 |
-
$focus = 'W';
|
770 |
-
$need_downsize = ( $src_width > $max_width );
|
771 |
-
}
|
772 |
-
else { // focus on height
|
773 |
-
$focus = 'H';
|
774 |
-
$need_downsize = ( $src_height > $max_height );
|
775 |
-
}
|
776 |
-
|
777 |
-
// Convert back to physical size
|
778 |
-
if ( $thumb['stereo'] ) {
|
779 |
-
$src_width *= 2;
|
780 |
-
}
|
781 |
-
|
782 |
-
// Downsize required ?
|
783 |
-
if ( $need_downsize ) {
|
784 |
-
|
785 |
-
// Find mime type
|
786 |
-
$mime = $src_size[2];
|
787 |
-
|
788 |
-
// Create the source image
|
789 |
-
switch ( $mime ) { // mime type
|
790 |
-
case 1: // gif
|
791 |
-
$temp = @ imagecreatefromgif( $file );
|
792 |
-
if ( $temp ) {
|
793 |
-
$src = imagecreatetruecolor( $src_width, $src_height );
|
794 |
-
imagecopy( $src, $temp, 0, 0, 0, 0, $src_width, $src_height );
|
795 |
-
imagedestroy( $temp );
|
796 |
-
}
|
797 |
-
else $src = false;
|
798 |
-
break;
|
799 |
-
case 2: // jpeg
|
800 |
-
if ( ! function_exists( 'imagecreatefromjpeg' ) ) {
|
801 |
-
wppa_log( 'Error', 'Function imagecreatefromjpeg does not exist.' );
|
802 |
-
}
|
803 |
-
$src = @ imagecreatefromjpeg( $file );
|
804 |
-
break;
|
805 |
-
case 3: // png
|
806 |
-
$src = @ imagecreatefrompng( $file );
|
807 |
-
break;
|
808 |
-
}
|
809 |
-
|
810 |
-
if ( ! $src ) {
|
811 |
-
wppa_log( 'Error', 'Image file '.$file.' is corrupt while downsizing photo' );
|
812 |
-
return false;
|
813 |
-
}
|
814 |
-
|
815 |
-
// Create the ( empty ) destination image
|
816 |
-
if ( $focus == 'W') {
|
817 |
-
if ( $thumb['stereo'] ) $max_width *= 2;
|
818 |
-
$dst_width = $max_width;
|
819 |
-
$dst_height = round( $max_width * $src_height / $src_width );
|
820 |
-
}
|
821 |
-
else {
|
822 |
-
$dst_height = $max_height;
|
823 |
-
$dst_width = round( $max_height * $src_width / $src_height );
|
824 |
-
}
|
825 |
-
$dst = imagecreatetruecolor( $dst_width, $dst_height );
|
826 |
-
|
827 |
-
// If Png, save transparancy
|
828 |
-
if ( $mime == 3 ) {
|
829 |
-
imagealphablending( $dst, false );
|
830 |
-
imagesavealpha( $dst, true );
|
831 |
-
}
|
832 |
-
|
833 |
-
// Do the copy
|
834 |
-
imagecopyresampled( $dst, $src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height );
|
835 |
-
|
836 |
-
// Remove source image
|
837 |
-
imagedestroy( $src );
|
838 |
-
|
839 |
-
// Save the photo
|
840 |
-
switch ( $mime ) { // mime type
|
841 |
-
case 1:
|
842 |
-
imagegif( $dst, $newimage );
|
843 |
-
break;
|
844 |
-
case 2:
|
845 |
-
imagejpeg( $dst, $newimage, wppa_opt( 'jpeg_quality' ) );
|
846 |
-
break;
|
847 |
-
case 3:
|
848 |
-
imagepng( $dst, $newimage, 6 );
|
849 |
-
break;
|
850 |
-
}
|
851 |
-
|
852 |
-
// Remove destination image
|
853 |
-
imagedestroy( $dst );
|
854 |
-
}
|
855 |
-
else { // No downsize needed, picture is small enough
|
856 |
-
copy( $file, $newimage );
|
857 |
-
}
|
858 |
-
} // No resize on upload checked
|
859 |
-
else {
|
860 |
-
copy( $file, $newimage );
|
861 |
-
}
|
862 |
-
|
863 |
-
// File successfully created ?
|
864 |
-
if ( is_file ( $newimage ) ) {
|
865 |
-
|
866 |
-
// Optimize file
|
867 |
-
wppa_optimize_image_file( $newimage );
|
868 |
-
|
869 |
-
// // Create thumbnail...
|
870 |
-
// wppa_create_thumbnail( $id );
|
871 |
-
}
|
872 |
-
else {
|
873 |
-
if ( is_admin() ) wppa_error_message( __( 'ERROR: Resized or copied image could not be created.' , 'wp-photo-album-plus') );
|
874 |
-
else wppa_alert( __( 'ERROR: Resized or copied image could not be created.', 'wp-photo-album-plus') );
|
875 |
-
return false;
|
876 |
-
}
|
877 |
-
|
878 |
-
// Process the iptc data
|
879 |
-
wppa_import_iptc( $id, $info );
|
880 |
-
|
881 |
-
// Process the exif data
|
882 |
-
wppa_import_exif( $id, $file );
|
883 |
-
|
884 |
-
// GPS
|
885 |
-
wppa_get_coordinates( $file, $id );
|
886 |
-
|
887 |
-
// Set ( update ) exif date-time if available
|
888 |
-
$exdt = wppa_get_exif_datetime( $file );
|
889 |
-
if ( $exdt ) {
|
890 |
-
wppa_update_photo( array( 'id' => $id, 'exifdtm' => $exdt ) );
|
891 |
-
}
|
892 |
-
|
893 |
-
// Create thumbnail...
|
894 |
-
wppa_create_thumbnail( $id );
|
895 |
-
|
896 |
-
// Check orientation
|
897 |
-
wppa_orientate_image( $id, wppa_get_exif_orientation( $file ) );
|
898 |
-
|
899 |
-
// Compute and save sizes
|
900 |
-
wppa_get_photox( $id, 'force' );
|
901 |
-
|
902 |
-
// Show progression
|
903 |
-
if ( is_admin() && ! wppa( 'ajax' ) ) echo( '.' );
|
904 |
-
|
905 |
-
// Update CDN
|
906 |
-
$cdn = wppa_cdn( 'admin' );
|
907 |
-
if ( $cdn ) {
|
908 |
-
switch ( $cdn ) {
|
909 |
-
case 'cloudinary':
|
910 |
-
wppa_upload_to_cloudinary( $id );
|
911 |
-
break;
|
912 |
-
default:
|
913 |
-
wppa_dbg_msg( 'Missing upload instructions for '.$cdn, 'red', 'force' );
|
914 |
-
}
|
915 |
-
}
|
916 |
-
|
917 |
-
// Create stereo images
|
918 |
-
wppa_create_stereo_images( $id );
|
919 |
-
|
920 |
-
// Clear (super)cache
|
921 |
-
wppa_clear_cache();
|
922 |
-
return true;
|
923 |
-
}
|
924 |
-
else {
|
925 |
-
if ( is_admin() ) wppa_error_message( sprintf( __( 'ERROR: File %s is not a valid picture file.' , 'wp-photo-album-plus'), $file ) );
|
926 |
-
else wppa_alert( sprintf( __( 'ERROR: File %s is not a valid picture file.', 'wp-photo-album-plus'), $file ) );
|
927 |
-
return false;
|
928 |
-
}
|
929 |
-
}
|
930 |
-
|
931 |
// See if this image is the default cover image
|
932 |
function wppa_check_coverimage( $id ) {
|
933 |
if ( wppa_opt( 'default_coverimage_name' ) ) { // Feature enabled
|
@@ -981,228 +792,6 @@ function wppa_get_minisize() {
|
|
981 |
return $result;
|
982 |
}
|
983 |
|
984 |
-
// Create thubnail
|
985 |
-
function wppa_create_thumbnail( $id, $use_source = true ) {
|
986 |
-
|
987 |
-
// Find file to make thumbnail from
|
988 |
-
$source_path = wppa_fix_poster_ext( wppa_get_source_path( $id ), $id );
|
989 |
-
|
990 |
-
// Use source if requested and available
|
991 |
-
if ( $use_source ) {
|
992 |
-
|
993 |
-
if ( ! wppa_switch( 'watermark_thumbs' ) && is_file( $source_path ) ) {
|
994 |
-
$file = $source_path; // Use sourcefile
|
995 |
-
}
|
996 |
-
else {
|
997 |
-
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
998 |
-
}
|
999 |
-
|
1000 |
-
// Non standard orientation files: never use source
|
1001 |
-
$orient = wppa_get_exif_orientation( $file );
|
1002 |
-
if ( $orient > '1' ) {
|
1003 |
-
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
else {
|
1007 |
-
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
// Max side
|
1011 |
-
$max_side = wppa_get_minisize();
|
1012 |
-
|
1013 |
-
// Check file
|
1014 |
-
if ( ! file_exists( $file ) ) return false; // No file, fail
|
1015 |
-
$img_attr = getimagesize( $file );
|
1016 |
-
if ( ! $img_attr ) return false; // Not an image, fail
|
1017 |
-
|
1018 |
-
// Retrieve aspect
|
1019 |
-
$asp_attr = explode( ':', wppa_opt( 'thumb_aspect' ) );
|
1020 |
-
|
1021 |
-
// Get output path
|
1022 |
-
$thumbpath = wppa_get_thumb_path( $id );
|
1023 |
-
if ( wppa_get_ext( $thumbpath ) == 'xxx' ) { // Video poster
|
1024 |
-
$thumbpath = wppa_strip_ext( $thumbpath ) . '.jpg';
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
// Source size
|
1028 |
-
$src_size_w = $img_attr[0];
|
1029 |
-
$src_size_h = $img_attr[1];
|
1030 |
-
|
1031 |
-
// Temp convert width if stereo
|
1032 |
-
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
1033 |
-
$src_size_w /= 2;
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
// Mime type and thumb type
|
1037 |
-
$mime = $img_attr[2];
|
1038 |
-
$type = $asp_attr[2];
|
1039 |
-
|
1040 |
-
// Source native aspect
|
1041 |
-
$src_asp = $src_size_h / $src_size_w;
|
1042 |
-
|
1043 |
-
// Required aspect
|
1044 |
-
if ( $type == 'none' ) {
|
1045 |
-
$dst_asp = $src_asp;
|
1046 |
-
}
|
1047 |
-
else {
|
1048 |
-
$dst_asp = $asp_attr[0] / $asp_attr[1];
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
// Convert back width if stereo
|
1052 |
-
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
1053 |
-
$src_size_w *= 2;
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
// Create the source image
|
1057 |
-
switch ( $mime ) { // mime type
|
1058 |
-
case 1: // gif
|
1059 |
-
$temp = @ imagecreatefromgif( $file );
|
1060 |
-
if ( $temp ) {
|
1061 |
-
$src = imagecreatetruecolor( $src_size_w, $src_size_h );
|
1062 |
-
imagecopy( $src, $temp, 0, 0, 0, 0, $src_size_w, $src_size_h );
|
1063 |
-
imagedestroy( $temp );
|
1064 |
-
}
|
1065 |
-
else $src = false;
|
1066 |
-
break;
|
1067 |
-
case 2: // jpeg
|
1068 |
-
if ( ! function_exists( 'imagecreatefromjpeg' ) ) wppa_log( 'Error', 'Function imagecreatefromjpeg does not exist.' );
|
1069 |
-
$src = @ imagecreatefromjpeg( $file );
|
1070 |
-
break;
|
1071 |
-
case 3: // png
|
1072 |
-
$src = @ imagecreatefrompng( $file );
|
1073 |
-
break;
|
1074 |
-
}
|
1075 |
-
if ( ! $src ) {
|
1076 |
-
wppa_log( 'Error', 'Image file '.$file.' is corrupt while creating thmbnail' );
|
1077 |
-
return true;
|
1078 |
-
}
|
1079 |
-
|
1080 |
-
// Compute the destination image size
|
1081 |
-
if ( $dst_asp < 1.0 ) { // Landscape
|
1082 |
-
$dst_size_w = $max_side;
|
1083 |
-
$dst_size_h = round( $max_side * $dst_asp );
|
1084 |
-
}
|
1085 |
-
else { // Portrait
|
1086 |
-
$dst_size_w = round( $max_side / $dst_asp );
|
1087 |
-
$dst_size_h = $max_side;
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
// Create the ( empty ) destination image
|
1091 |
-
$dst = imagecreatetruecolor( $dst_size_w, $dst_size_h );
|
1092 |
-
if ( $mime == 3 ) { // Png, save transparancy
|
1093 |
-
imagealphablending( $dst, false );
|
1094 |
-
imagesavealpha( $dst, true );
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
// Fill with the required color
|
1098 |
-
$c = trim( strtolower( wppa_opt( 'bgcolor_thumbnail' ) ) );
|
1099 |
-
if ( $c != '#000000' ) {
|
1100 |
-
$r = hexdec( substr( $c, 1, 2 ) );
|
1101 |
-
$g = hexdec( substr( $c, 3, 2 ) );
|
1102 |
-
$b = hexdec( substr( $c, 5, 2 ) );
|
1103 |
-
$color = imagecolorallocate( $dst, $r, $g, $b );
|
1104 |
-
if ( $color === false ) {
|
1105 |
-
wppa_log( 'Err', 'Unable to set background color to: '.$r.', '.$g.', '.$b.' in wppa_create_thumbnail' );
|
1106 |
-
}
|
1107 |
-
else {
|
1108 |
-
imagefilledrectangle( $dst, 0, 0, $dst_size_w, $dst_size_h, $color );
|
1109 |
-
}
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
// Switch on what we have to do
|
1113 |
-
switch ( $type ) {
|
1114 |
-
case 'none': // Use aspect from fullsize image
|
1115 |
-
$src_x = 0;
|
1116 |
-
$src_y = 0;
|
1117 |
-
$src_w = $src_size_w;
|
1118 |
-
$src_h = $src_size_h;
|
1119 |
-
$dst_x = 0;
|
1120 |
-
$dst_y = 0;
|
1121 |
-
$dst_w = $dst_size_w;
|
1122 |
-
$dst_h = $dst_size_h;
|
1123 |
-
break;
|
1124 |
-
case 'clip': // Clip image to given aspect ratio
|
1125 |
-
if ( $src_asp < $dst_asp ) { // Source image more landscape than destination
|
1126 |
-
$dst_x = 0;
|
1127 |
-
$dst_y = 0;
|
1128 |
-
$dst_w = $dst_size_w;
|
1129 |
-
$dst_h = $dst_size_h;
|
1130 |
-
$src_x = round( ( $src_size_w - $src_size_h / $dst_asp ) / 2 );
|
1131 |
-
$src_y = 0;
|
1132 |
-
$src_w = round( $src_size_h / $dst_asp );
|
1133 |
-
$src_h = $src_size_h;
|
1134 |
-
}
|
1135 |
-
else {
|
1136 |
-
$dst_x = 0;
|
1137 |
-
$dst_y = 0;
|
1138 |
-
$dst_w = $dst_size_w;
|
1139 |
-
$dst_h = $dst_size_h;
|
1140 |
-
$src_x = 0;
|
1141 |
-
$src_y = round( ( $src_size_h - $src_size_w * $dst_asp ) / 2 );
|
1142 |
-
$src_w = $src_size_w;
|
1143 |
-
$src_h = round( $src_size_w * $dst_asp );
|
1144 |
-
}
|
1145 |
-
break;
|
1146 |
-
case 'padd': // Padd image to given aspect ratio
|
1147 |
-
if ( $src_asp < $dst_asp ) { // Source image more landscape than destination
|
1148 |
-
$dst_x = 0;
|
1149 |
-
$dst_y = round( ( $dst_size_h - $dst_size_w * $src_asp ) / 2 );
|
1150 |
-
$dst_w = $dst_size_w;
|
1151 |
-
$dst_h = round( $dst_size_w * $src_asp );
|
1152 |
-
$src_x = 0;
|
1153 |
-
$src_y = 0;
|
1154 |
-
$src_w = $src_size_w;
|
1155 |
-
$src_h = $src_size_h;
|
1156 |
-
}
|
1157 |
-
else {
|
1158 |
-
$dst_x = round( ( $dst_size_w - $dst_size_h / $src_asp ) / 2 );
|
1159 |
-
$dst_y = 0;
|
1160 |
-
$dst_w = round( $dst_size_h / $src_asp );
|
1161 |
-
$dst_h = $dst_size_h;
|
1162 |
-
$src_x = 0;
|
1163 |
-
$src_y = 0;
|
1164 |
-
$src_w = $src_size_w;
|
1165 |
-
$src_h = $src_size_h;
|
1166 |
-
}
|
1167 |
-
break;
|
1168 |
-
default: // Not implemented
|
1169 |
-
return false;
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
// Copy left half if stereo
|
1173 |
-
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
1174 |
-
$src_w /= 2;
|
1175 |
-
}
|
1176 |
-
|
1177 |
-
// Do the copy
|
1178 |
-
imagecopyresampled( $dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
|
1179 |
-
|
1180 |
-
// Save the thumb
|
1181 |
-
$thumbpath = wppa_strip_ext( $thumbpath );
|
1182 |
-
switch ( $mime ) { // mime type
|
1183 |
-
case 1:
|
1184 |
-
imagegif( $dst, $thumbpath . '.gif' );
|
1185 |
-
break;
|
1186 |
-
case 2:
|
1187 |
-
imagejpeg( $dst, $thumbpath . '.jpg', wppa_opt( 'jpeg_quality' ) );
|
1188 |
-
break;
|
1189 |
-
case 3:
|
1190 |
-
imagepng( $dst, $thumbpath . '.png', 6 );
|
1191 |
-
break;
|
1192 |
-
}
|
1193 |
-
|
1194 |
-
// Cleanup
|
1195 |
-
imagedestroy( $src );
|
1196 |
-
imagedestroy( $dst );
|
1197 |
-
|
1198 |
-
// Optimize
|
1199 |
-
wppa_optimize_image_file( $thumbpath );
|
1200 |
-
|
1201 |
-
// Compute and save sizes
|
1202 |
-
wppa_get_thumbx( $id, 'force' ); // forces recalc x and y
|
1203 |
-
|
1204 |
-
return true;
|
1205 |
-
}
|
1206 |
|
1207 |
function wppa_test_for_search( $at_session_start = false ) {
|
1208 |
global $wppa;
|
@@ -1271,7 +860,7 @@ static $tables;
|
|
1271 |
|
1272 |
// Some sqls do not show tables, benefit of the doubt: assume table exists
|
1273 |
if ( $tables === false ) return true;
|
1274 |
-
|
1275 |
if ( empty( $tables ) ) {
|
1276 |
$tables = $wpdb->get_results( "SHOW TABLES FROM `".DB_NAME."`", ARRAY_A );
|
1277 |
}
|
@@ -1441,71 +1030,6 @@ function wppa_get_exif_item( $file, $item ) {
|
|
1441 |
return false;
|
1442 |
}
|
1443 |
|
1444 |
-
function wppa_orientate_image( $id, $ori ) {
|
1445 |
-
|
1446 |
-
// If orientation right, do nothing
|
1447 |
-
if ( ! $ori || $ori == '1' ) {
|
1448 |
-
return;
|
1449 |
-
}
|
1450 |
-
|
1451 |
-
wppa_orientate_image_file( wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ), $ori );
|
1452 |
-
wppa_bump_photo_rev();
|
1453 |
-
}
|
1454 |
-
|
1455 |
-
function wppa_orientate_image_file( $file, $ori ) {
|
1456 |
-
|
1457 |
-
// Validate args
|
1458 |
-
if ( ! is_file( $file ) ) {
|
1459 |
-
wppa_log( 'Err', 'File not found (wppa_orientate_image_file())' );
|
1460 |
-
return false;
|
1461 |
-
}
|
1462 |
-
if ( ! wppa_is_int( $ori ) || $ori < '2' || $ori > '8' ) {
|
1463 |
-
wppa_log( 'Err', 'Bad arg $ori:'.$ori.' (wppa_orientate_image_file())' );
|
1464 |
-
return false;
|
1465 |
-
}
|
1466 |
-
|
1467 |
-
// Load image
|
1468 |
-
$source = imagecreatefromjpeg( $file );
|
1469 |
-
|
1470 |
-
// Perform operation
|
1471 |
-
switch ( $ori ) {
|
1472 |
-
case '2':
|
1473 |
-
$orientate = $source;
|
1474 |
-
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
1475 |
-
break;
|
1476 |
-
case '3':
|
1477 |
-
$orientate = imagerotate( $source, 180, 0 );
|
1478 |
-
break;
|
1479 |
-
case '4':
|
1480 |
-
$orientate = $source;
|
1481 |
-
imageflip( $orientate, IMG_FLIP_VERTICAL );
|
1482 |
-
break;
|
1483 |
-
case '5':
|
1484 |
-
$orientate = imagerotate( $source, 270, 0 );
|
1485 |
-
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
1486 |
-
break;
|
1487 |
-
case '6':
|
1488 |
-
$orientate = imagerotate( $source, 270, 0 );
|
1489 |
-
break;
|
1490 |
-
case '7':
|
1491 |
-
$orientate = imagerotate( $source, 90, 0 );
|
1492 |
-
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
1493 |
-
break;
|
1494 |
-
case '8':
|
1495 |
-
$orientate = imagerotate( $source, 90, 0 );
|
1496 |
-
break;
|
1497 |
-
}
|
1498 |
-
|
1499 |
-
// Output
|
1500 |
-
imagejpeg( $orientate, $file, wppa_opt( 'jpeg_quality' ) );
|
1501 |
-
|
1502 |
-
// Free the memory
|
1503 |
-
imagedestroy( $source );
|
1504 |
-
@ imagedestroy( $orientate );
|
1505 |
-
|
1506 |
-
// Done
|
1507 |
-
return true;
|
1508 |
-
}
|
1509 |
|
1510 |
function wppa_import_exif( $id, $file, $nodelete = false ) {
|
1511 |
global $wpdb;
|
2 |
/* wppa-common-functions.php
|
3 |
*
|
4 |
* Functions used in admin and in themes
|
5 |
+
* Version 6.4.10
|
6 |
*
|
7 |
*/
|
8 |
|
36 |
|
37 |
// Get the cache version of all settings
|
38 |
$wppa_opt = get_option( 'wppa_cached_options', false );
|
39 |
+
|
40 |
+
// Check for validity, only on admin pages (due to qTranslate behaviour), non ajax (to keep performance at front-end ajax).
|
41 |
+
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
|
42 |
+
if ( is_array( $wppa_opt ) && ( md5( serialize( $wppa_opt ) ) != get_option( 'wppa_md5_options', 'nil' ) ) ) {
|
43 |
+
|
44 |
+
// Log hash error
|
45 |
+
wppa_log('Obs', 'Read hash:'.get_option( 'wppa_md5_options', 'nil' ).', computed hash:'. md5( serialize( $wppa_opt )));
|
46 |
+
|
47 |
+
// Something wrong. Let us see what, if not intentional!
|
48 |
+
if ( ! $force ) {
|
49 |
+
foreach( array_keys( $wppa_opt ) as $key ) {
|
50 |
+
if ( $wppa_opt[$key] != get_option( $key ) ) {
|
51 |
+
wppa_log( 'dbg', 'Corrupted setting found. Cached value=' . $wppa_opt[$key] . ', option value=' . get_option( $key ) );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
$count = count( $wppa_opt );
|
56 |
+
|
57 |
+
// Report fix only if not intentional, with stacktrace
|
58 |
+
if ( ! $force ) {
|
59 |
+
wppa_log( 'Fix', 'Option cache. Count=' . $count );
|
60 |
+
}
|
61 |
+
|
62 |
+
// Clear cached options to force rebuild
|
63 |
+
$wppa_opt = false;
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
// Rebuild cached options if required, i.e. when not yet existing or deleted.
|
68 |
if ( ! is_array( $wppa_opt ) ) {
|
69 |
wppa_set_defaults();
|
70 |
$wppa_opt = $wppa_defaults;
|
74 |
$wppa_opt[$option] = $optval;
|
75 |
}
|
76 |
}
|
77 |
+
update_option( 'wppa_cached_options', $wppa_opt, true );
|
78 |
+
update_option( 'wppa_md5_options', md5( serialize( $wppa_opt ) ), true );
|
79 |
+
|
80 |
+
// Verify success
|
81 |
+
$temp = get_option( 'wppa_cached_options' );
|
82 |
+
$hash = get_option( 'wppa_md5_options' );
|
83 |
+
if ( md5( serialize( $temp ) ) != $hash ) {
|
84 |
+
wppa_log( 'Err', 'Discrepancy found. Count='.count($temp) );
|
85 |
+
}
|
86 |
}
|
87 |
|
88 |
if ( isset( $_GET['debug'] ) && wppa_switch( 'allow_debug' ) ) {
|
739 |
return false;
|
740 |
}
|
741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
// See if this image is the default cover image
|
743 |
function wppa_check_coverimage( $id ) {
|
744 |
if ( wppa_opt( 'default_coverimage_name' ) ) { // Feature enabled
|
792 |
return $result;
|
793 |
}
|
794 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
795 |
|
796 |
function wppa_test_for_search( $at_session_start = false ) {
|
797 |
global $wppa;
|
860 |
|
861 |
// Some sqls do not show tables, benefit of the doubt: assume table exists
|
862 |
if ( $tables === false ) return true;
|
863 |
+
|
864 |
if ( empty( $tables ) ) {
|
865 |
$tables = $wpdb->get_results( "SHOW TABLES FROM `".DB_NAME."`", ARRAY_A );
|
866 |
}
|
1030 |
return false;
|
1031 |
}
|
1032 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
|
1034 |
function wppa_import_exif( $id, $file, $nodelete = false ) {
|
1035 |
global $wpdb;
|
wppa-functions.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various funcions
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -801,7 +801,7 @@ function wppa_album_name_to_number( $xalb ) {
|
|
801 |
$xalb = strip_tags( $xalb );
|
802 |
if ( $xalb && ! wppa_is_int( $xalb ) ) {
|
803 |
if ( substr( $xalb, 0, 1 ) == '$' ) { // Name
|
804 |
-
$id = wppa_get_album_id_by_name( substr( $xalb, 1 ), '
|
805 |
if ( $id > '0' ) return $id;
|
806 |
elseif ( $id < '0' ) {
|
807 |
wppa_dbg_msg( 'Duplicate album names found: '.$xalb, 'red', 'force' );
|
@@ -4023,9 +4023,16 @@ global $allalbums;
|
|
4023 |
}
|
4024 |
else {
|
4025 |
wppa_dbg_msg( 'Dups found for '.$xname );
|
4026 |
-
if ( $report_dups ) {
|
4027 |
$aid = false;
|
4028 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4029 |
else {
|
4030 |
|
4031 |
// Find the best match
|
@@ -4285,6 +4292,7 @@ global $wpdb;
|
|
4285 |
}
|
4286 |
else {
|
4287 |
wppa_save_source( $file['tmp_name'], $filename, $alb );
|
|
|
4288 |
wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
|
4289 |
wppa_flush_treecounts( $alb );
|
4290 |
wppa_flush_upldr_cache( 'photoid', $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Various funcions
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
801 |
$xalb = strip_tags( $xalb );
|
802 |
if ( $xalb && ! wppa_is_int( $xalb ) ) {
|
803 |
if ( substr( $xalb, 0, 1 ) == '$' ) { // Name
|
804 |
+
$id = wppa_get_album_id_by_name( substr( $xalb, 1 ), 'return_dups' );
|
805 |
if ( $id > '0' ) return $id;
|
806 |
elseif ( $id < '0' ) {
|
807 |
wppa_dbg_msg( 'Duplicate album names found: '.$xalb, 'red', 'force' );
|
4023 |
}
|
4024 |
else {
|
4025 |
wppa_dbg_msg( 'Dups found for '.$xname );
|
4026 |
+
if ( $report_dups == 'report_dups' ) {
|
4027 |
$aid = false;
|
4028 |
}
|
4029 |
+
elseif ( $report_dups == 'return_dups' ) {
|
4030 |
+
$aid = '';
|
4031 |
+
foreach ( $albs as $alb ) {
|
4032 |
+
$aid .= $alb['id'] . '.';
|
4033 |
+
}
|
4034 |
+
$aid = rtrim( $aid, '.' );
|
4035 |
+
}
|
4036 |
else {
|
4037 |
|
4038 |
// Find the best match
|
4292 |
}
|
4293 |
else {
|
4294 |
wppa_save_source( $file['tmp_name'], $filename, $alb );
|
4295 |
+
wppa_make_o1_source( $id );
|
4296 |
wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
|
4297 |
wppa_flush_treecounts( $alb );
|
4298 |
wppa_flush_upldr_cache( 'photoid', $id );
|
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 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -54,6 +54,7 @@ global $wppa_supported_audio_extensions;
|
|
54 |
'wppa_test_proc',
|
55 |
'wppa_crypt_photos',
|
56 |
'wppa_crypt_albums',
|
|
|
57 |
|
58 |
|
59 |
);
|
@@ -235,6 +236,7 @@ global $wppa_supported_audio_extensions;
|
|
235 |
case 'wppa_sanitize_tags':
|
236 |
case 'wppa_crypt_photos':
|
237 |
case 'wppa_test_proc':
|
|
|
238 |
|
239 |
// Process photos
|
240 |
$table = WPPA_PHOTOS;
|
@@ -590,6 +592,10 @@ global $wppa_supported_audio_extensions;
|
|
590 |
wppa_update_photo( array( 'id' => $photo['id'], 'tags' => wppa_sanitize_tags( $tags ) ) );
|
591 |
break;
|
592 |
|
|
|
|
|
|
|
|
|
593 |
}
|
594 |
// Test for timeout / ready
|
595 |
$lastid = $id;
|
@@ -939,7 +945,7 @@ global $wpdb;
|
|
939 |
</div><div style="clear:both;"></div>';
|
940 |
|
941 |
break;
|
942 |
-
|
943 |
case 'wppa_list_comments':
|
944 |
$total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_COMMENTS."`" );
|
945 |
$order = wppa_opt( 'list_comments_by' );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains (not yet, but in the future maybe) all the maintenance routines
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
54 |
'wppa_test_proc',
|
55 |
'wppa_crypt_photos',
|
56 |
'wppa_crypt_albums',
|
57 |
+
'wppa_create_o1_files',
|
58 |
|
59 |
|
60 |
);
|
236 |
case 'wppa_sanitize_tags':
|
237 |
case 'wppa_crypt_photos':
|
238 |
case 'wppa_test_proc':
|
239 |
+
case 'wppa_create_o1_files':
|
240 |
|
241 |
// Process photos
|
242 |
$table = WPPA_PHOTOS;
|
592 |
wppa_update_photo( array( 'id' => $photo['id'], 'tags' => wppa_sanitize_tags( $tags ) ) );
|
593 |
break;
|
594 |
|
595 |
+
case 'wppa_create_o1_files':
|
596 |
+
wppa_make_o1_source( $photo['id'] );
|
597 |
+
break;
|
598 |
+
|
599 |
}
|
600 |
// Test for timeout / ready
|
601 |
$lastid = $id;
|
945 |
</div><div style="clear:both;"></div>';
|
946 |
|
947 |
break;
|
948 |
+
|
949 |
case 'wppa_list_comments':
|
950 |
$total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_COMMENTS."`" );
|
951 |
$order = wppa_opt( 'list_comments_by' );
|
wppa-photo-files.php
ADDED
@@ -0,0 +1,559 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* wppa-photo-files.php
|
3 |
+
*
|
4 |
+
* Functions used to create/manipulate photofiles
|
5 |
+
* Version 6.4.10
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
10 |
+
|
11 |
+
// Unfortunately there is no php function to rotate or resize an image file while the exif data is preserved.
|
12 |
+
// The origianal sourcefile is normally saved, to be available for download or hires uses e.g. in lightbox.
|
13 |
+
// The orientation of photos made by mobile devices is often non-standard ( 1 ), so we need a higres file,
|
14 |
+
// rotated and/or mirrored to the correct position.
|
15 |
+
// When the sourefile name is e.g.: .../wp-content/uploads/wppa-source/album-1/MyImage.jpg,
|
16 |
+
// We create the correct oriented file: .../wp-content/uploads/wppa-source/album-1/MyImage-o1.jpg. ( o1 stands for orientation=1 ).
|
17 |
+
// Note: wppa_get_source_path() should return the un-oriented file always, while wppa_get_hires_url() must return the -o1 file, if available.
|
18 |
+
function wppa_make_o1_source( $id ) {
|
19 |
+
|
20 |
+
// Init
|
21 |
+
$src_path = wppa_get_source_path( $id );
|
22 |
+
|
23 |
+
// Source available?
|
24 |
+
if ( ! is_file( $src_path ) ) return false;
|
25 |
+
|
26 |
+
// Only needed for non-standard orientations
|
27 |
+
$orient = wppa_get_exif_orientation( $src_path );
|
28 |
+
if ( ! in_array( $orient, array( '2', '3', '4', '5', '6', '7', '8' ) ) ) return false;
|
29 |
+
|
30 |
+
// Only on jpg file type
|
31 |
+
$ext = wppa_get_ext( $src_path );
|
32 |
+
if ( ! in_array( $ext, array( 'jpg', 'JPG', 'jpeg', 'JPEG' ) ) ) return false;
|
33 |
+
|
34 |
+
// Make destination path
|
35 |
+
$dst_path = wppa_get_o1_source_path( $id );
|
36 |
+
|
37 |
+
// Copy source to destination
|
38 |
+
copy( $src_path, $dst_path );
|
39 |
+
|
40 |
+
// Correct orientation
|
41 |
+
if ( ! wppa_orientate_image_file( $dst_path, $orient ) ) {
|
42 |
+
unlink( $dst_path );
|
43 |
+
return false;
|
44 |
+
}
|
45 |
+
|
46 |
+
// Done
|
47 |
+
return true;
|
48 |
+
}
|
49 |
+
|
50 |
+
// Convert source file path to proper oriented source file path
|
51 |
+
function wppa_get_o1_source_path( $id ) {
|
52 |
+
|
53 |
+
$src_path = wppa_get_source_path( $id );
|
54 |
+
if ( $src_path ) {
|
55 |
+
$src_path = wppa_strip_ext( $src_path ) . '-o1.' . wppa_get_ext( $src_path );
|
56 |
+
}
|
57 |
+
|
58 |
+
return $src_path;
|
59 |
+
}
|
60 |
+
|
61 |
+
// Rotate/mirror a photo display image by id
|
62 |
+
function wppa_orientate_image( $id, $ori ) {
|
63 |
+
|
64 |
+
// If orientation right, do nothing
|
65 |
+
if ( ! $ori || $ori == '1' ) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
wppa_orientate_image_file( wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ), $ori );
|
70 |
+
wppa_bump_photo_rev();
|
71 |
+
}
|
72 |
+
|
73 |
+
// Rotate/mirror an image file by pathname
|
74 |
+
function wppa_orientate_image_file( $file, $ori ) {
|
75 |
+
|
76 |
+
// Validate args
|
77 |
+
if ( ! is_file( $file ) ) {
|
78 |
+
wppa_log( 'Err', 'File not found (wppa_orientate_image_file())' );
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
if ( ! wppa_is_int( $ori ) || $ori < '2' || $ori > '8' ) {
|
82 |
+
wppa_log( 'Err', 'Bad arg $ori:'.$ori.' (wppa_orientate_image_file())' );
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
// Load image
|
87 |
+
$source = imagecreatefromjpeg( $file );
|
88 |
+
|
89 |
+
// Perform operation
|
90 |
+
switch ( $ori ) {
|
91 |
+
case '2':
|
92 |
+
$orientate = $source;
|
93 |
+
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
94 |
+
break;
|
95 |
+
case '3':
|
96 |
+
$orientate = imagerotate( $source, 180, 0 );
|
97 |
+
break;
|
98 |
+
case '4':
|
99 |
+
$orientate = $source;
|
100 |
+
imageflip( $orientate, IMG_FLIP_VERTICAL );
|
101 |
+
break;
|
102 |
+
case '5':
|
103 |
+
$orientate = imagerotate( $source, 270, 0 );
|
104 |
+
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
105 |
+
break;
|
106 |
+
case '6':
|
107 |
+
$orientate = imagerotate( $source, 270, 0 );
|
108 |
+
break;
|
109 |
+
case '7':
|
110 |
+
$orientate = imagerotate( $source, 90, 0 );
|
111 |
+
imageflip( $orientate, IMG_FLIP_HORIZONTAL );
|
112 |
+
break;
|
113 |
+
case '8':
|
114 |
+
$orientate = imagerotate( $source, 90, 0 );
|
115 |
+
break;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Output
|
119 |
+
imagejpeg( $orientate, $file, wppa_opt( 'jpeg_quality' ) );
|
120 |
+
|
121 |
+
// Free the memory
|
122 |
+
imagedestroy( $source );
|
123 |
+
@ imagedestroy( $orientate );
|
124 |
+
|
125 |
+
// Done
|
126 |
+
return true;
|
127 |
+
}
|
128 |
+
|
129 |
+
// Make the display and thumbnails from a given pathname or upload temp image file.
|
130 |
+
// The id and extension must be supplied.
|
131 |
+
function wppa_make_the_photo_files( $file, $id, $ext ) {
|
132 |
+
global $wpdb;
|
133 |
+
|
134 |
+
$thumb = wppa_cache_thumb( $id );
|
135 |
+
|
136 |
+
$src_size = @getimagesize( $file, $info );
|
137 |
+
|
138 |
+
// If the given file is not an image file, log error and exit
|
139 |
+
if ( ! $src_size ) {
|
140 |
+
if ( is_admin() ) wppa_error_message( sprintf( __( 'ERROR: File %s is not a valid picture file.' , 'wp-photo-album-plus'), $file ) );
|
141 |
+
else wppa_alert( sprintf( __( 'ERROR: File %s is not a valid picture file.', 'wp-photo-album-plus'), $file ) );
|
142 |
+
return false;
|
143 |
+
}
|
144 |
+
|
145 |
+
// Find output path photo file
|
146 |
+
$newimage = wppa_get_photo_path( $id );
|
147 |
+
if ( $ext ) {
|
148 |
+
$newimage = wppa_strip_ext( $newimage ) . '.' . strtolower( $ext );
|
149 |
+
}
|
150 |
+
|
151 |
+
// If Resize on upload is checked
|
152 |
+
if ( wppa_switch( 'resize_on_upload' ) ) {
|
153 |
+
|
154 |
+
// Picture sizes
|
155 |
+
$src_width = $src_size[0];
|
156 |
+
|
157 |
+
// Temp convert to logical width if stereo
|
158 |
+
if ( $thumb['stereo'] ) {
|
159 |
+
$src_width /= 2;
|
160 |
+
}
|
161 |
+
$src_height = $src_size[1];
|
162 |
+
|
163 |
+
// Max sizes
|
164 |
+
if ( wppa_opt( 'resize_to' ) == '0' ) { // from fullsize
|
165 |
+
$max_width = wppa_opt( 'fullsize' );
|
166 |
+
$max_height = wppa_opt( 'maxheight' );
|
167 |
+
}
|
168 |
+
else { // from selection
|
169 |
+
$screen = explode( 'x', wppa_opt( 'resize_to' ) );
|
170 |
+
$max_width = $screen[0];
|
171 |
+
$max_height = $screen[1];
|
172 |
+
}
|
173 |
+
|
174 |
+
// If orientation needs +/- 90 deg rotation, swap max x and max y
|
175 |
+
$ori = wppa_get_exif_orientation( $file );
|
176 |
+
if ( $ori >= 5 && $ori <= 8 ) {
|
177 |
+
$t = $max_width;
|
178 |
+
$max_width = $max_height;
|
179 |
+
$max_height = $t;
|
180 |
+
}
|
181 |
+
|
182 |
+
// Is source more landscape or more portrait than max window
|
183 |
+
if ( $src_width/$src_height > $max_width/$max_height ) { // focus on width
|
184 |
+
$focus = 'W';
|
185 |
+
$need_downsize = ( $src_width > $max_width );
|
186 |
+
}
|
187 |
+
else { // focus on height
|
188 |
+
$focus = 'H';
|
189 |
+
$need_downsize = ( $src_height > $max_height );
|
190 |
+
}
|
191 |
+
|
192 |
+
// Convert back to physical size
|
193 |
+
if ( $thumb['stereo'] ) {
|
194 |
+
$src_width *= 2;
|
195 |
+
}
|
196 |
+
|
197 |
+
// Downsize required ?
|
198 |
+
if ( $need_downsize ) {
|
199 |
+
|
200 |
+
// Find mime type
|
201 |
+
$mime = $src_size[2];
|
202 |
+
|
203 |
+
// Create the source image
|
204 |
+
switch ( $mime ) { // mime type
|
205 |
+
case 1: // gif
|
206 |
+
$temp = @ imagecreatefromgif( $file );
|
207 |
+
if ( $temp ) {
|
208 |
+
$src = imagecreatetruecolor( $src_width, $src_height );
|
209 |
+
imagecopy( $src, $temp, 0, 0, 0, 0, $src_width, $src_height );
|
210 |
+
imagedestroy( $temp );
|
211 |
+
}
|
212 |
+
else $src = false;
|
213 |
+
break;
|
214 |
+
case 2: // jpeg
|
215 |
+
if ( ! function_exists( 'imagecreatefromjpeg' ) ) {
|
216 |
+
wppa_log( 'Error', 'Function imagecreatefromjpeg does not exist.' );
|
217 |
+
}
|
218 |
+
$src = @ imagecreatefromjpeg( $file );
|
219 |
+
break;
|
220 |
+
case 3: // png
|
221 |
+
$src = @ imagecreatefrompng( $file );
|
222 |
+
break;
|
223 |
+
}
|
224 |
+
|
225 |
+
if ( ! $src ) {
|
226 |
+
wppa_log( 'Error', 'Image file '.$file.' is corrupt while downsizing photo' );
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
|
230 |
+
// Create the ( empty ) destination image
|
231 |
+
if ( $focus == 'W') {
|
232 |
+
if ( $thumb['stereo'] ) $max_width *= 2;
|
233 |
+
$dst_width = $max_width;
|
234 |
+
$dst_height = round( $max_width * $src_height / $src_width );
|
235 |
+
}
|
236 |
+
else {
|
237 |
+
$dst_height = $max_height;
|
238 |
+
$dst_width = round( $max_height * $src_width / $src_height );
|
239 |
+
}
|
240 |
+
$dst = imagecreatetruecolor( $dst_width, $dst_height );
|
241 |
+
|
242 |
+
// If Png, save transparancy
|
243 |
+
if ( $mime == 3 ) {
|
244 |
+
imagealphablending( $dst, false );
|
245 |
+
imagesavealpha( $dst, true );
|
246 |
+
}
|
247 |
+
|
248 |
+
// Do the copy
|
249 |
+
imagecopyresampled( $dst, $src, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height );
|
250 |
+
|
251 |
+
// Remove source image
|
252 |
+
imagedestroy( $src );
|
253 |
+
|
254 |
+
// Save the photo
|
255 |
+
switch ( $mime ) { // mime type
|
256 |
+
case 1:
|
257 |
+
imagegif( $dst, $newimage );
|
258 |
+
break;
|
259 |
+
case 2:
|
260 |
+
imagejpeg( $dst, $newimage, wppa_opt( 'jpeg_quality' ) );
|
261 |
+
break;
|
262 |
+
case 3:
|
263 |
+
imagepng( $dst, $newimage, 6 );
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
|
267 |
+
// Remove destination image
|
268 |
+
imagedestroy( $dst );
|
269 |
+
}
|
270 |
+
else { // No downsize needed, picture is small enough
|
271 |
+
copy( $file, $newimage );
|
272 |
+
}
|
273 |
+
} // No resize on upload checked
|
274 |
+
else {
|
275 |
+
copy( $file, $newimage );
|
276 |
+
}
|
277 |
+
|
278 |
+
// File successfully created ?
|
279 |
+
if ( is_file ( $newimage ) ) {
|
280 |
+
|
281 |
+
// Optimize file
|
282 |
+
wppa_optimize_image_file( $newimage );
|
283 |
+
}
|
284 |
+
else {
|
285 |
+
if ( is_admin() ) wppa_error_message( __( 'ERROR: Resized or copied image could not be created.' , 'wp-photo-album-plus') );
|
286 |
+
else wppa_alert( __( 'ERROR: Resized or copied image could not be created.', 'wp-photo-album-plus') );
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
|
290 |
+
// Process the iptc data
|
291 |
+
wppa_import_iptc( $id, $info );
|
292 |
+
|
293 |
+
// Process the exif data
|
294 |
+
wppa_import_exif( $id, $file );
|
295 |
+
|
296 |
+
// GPS
|
297 |
+
wppa_get_coordinates( $file, $id );
|
298 |
+
|
299 |
+
// Set ( update ) exif date-time if available
|
300 |
+
$exdt = wppa_get_exif_datetime( $file );
|
301 |
+
if ( $exdt ) {
|
302 |
+
wppa_update_photo( array( 'id' => $id, 'exifdtm' => $exdt ) );
|
303 |
+
}
|
304 |
+
|
305 |
+
// Create thumbnail...
|
306 |
+
wppa_create_thumbnail( $id );
|
307 |
+
|
308 |
+
// Check orientation
|
309 |
+
wppa_orientate_image( $id, wppa_get_exif_orientation( $file ) );
|
310 |
+
|
311 |
+
// Compute and save sizes
|
312 |
+
wppa_get_photox( $id, 'force' );
|
313 |
+
|
314 |
+
// Show progression
|
315 |
+
if ( is_admin() && ! wppa( 'ajax' ) ) echo( '.' );
|
316 |
+
|
317 |
+
// Update CDN
|
318 |
+
$cdn = wppa_cdn( 'admin' );
|
319 |
+
if ( $cdn ) {
|
320 |
+
switch ( $cdn ) {
|
321 |
+
case 'cloudinary':
|
322 |
+
wppa_upload_to_cloudinary( $id );
|
323 |
+
break;
|
324 |
+
default:
|
325 |
+
wppa_dbg_msg( 'Missing upload instructions for '.$cdn, 'red', 'force' );
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
// Create stereo images
|
330 |
+
wppa_create_stereo_images( $id );
|
331 |
+
|
332 |
+
// Clear (super)cache
|
333 |
+
wppa_clear_cache();
|
334 |
+
return true;
|
335 |
+
|
336 |
+
}
|
337 |
+
|
338 |
+
// Create thubnail
|
339 |
+
function wppa_create_thumbnail( $id, $use_source = true ) {
|
340 |
+
|
341 |
+
// Find file to make thumbnail from
|
342 |
+
$source_path = wppa_fix_poster_ext( wppa_get_source_path( $id ), $id );
|
343 |
+
|
344 |
+
// Use source if requested and available
|
345 |
+
if ( $use_source ) {
|
346 |
+
|
347 |
+
if ( ! wppa_switch( 'watermark_thumbs' ) && is_file( $source_path ) ) {
|
348 |
+
$file = $source_path; // Use sourcefile
|
349 |
+
}
|
350 |
+
else {
|
351 |
+
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
352 |
+
}
|
353 |
+
|
354 |
+
// Non standard orientation files: never use source
|
355 |
+
$orient = wppa_get_exif_orientation( $file );
|
356 |
+
if ( $orient > '1' ) {
|
357 |
+
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
358 |
+
}
|
359 |
+
}
|
360 |
+
else {
|
361 |
+
$file = wppa_fix_poster_ext( wppa_get_photo_path( $id ), $id ); // Use photofile
|
362 |
+
}
|
363 |
+
|
364 |
+
// Max side
|
365 |
+
$max_side = wppa_get_minisize();
|
366 |
+
|
367 |
+
// Check file
|
368 |
+
if ( ! file_exists( $file ) ) return false; // No file, fail
|
369 |
+
$img_attr = getimagesize( $file );
|
370 |
+
if ( ! $img_attr ) return false; // Not an image, fail
|
371 |
+
|
372 |
+
// Retrieve aspect
|
373 |
+
$asp_attr = explode( ':', wppa_opt( 'thumb_aspect' ) );
|
374 |
+
|
375 |
+
// Get output path
|
376 |
+
$thumbpath = wppa_get_thumb_path( $id );
|
377 |
+
if ( wppa_get_ext( $thumbpath ) == 'xxx' ) { // Video poster
|
378 |
+
$thumbpath = wppa_strip_ext( $thumbpath ) . '.jpg';
|
379 |
+
}
|
380 |
+
|
381 |
+
// Source size
|
382 |
+
$src_size_w = $img_attr[0];
|
383 |
+
$src_size_h = $img_attr[1];
|
384 |
+
|
385 |
+
// Temp convert width if stereo
|
386 |
+
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
387 |
+
$src_size_w /= 2;
|
388 |
+
}
|
389 |
+
|
390 |
+
// Mime type and thumb type
|
391 |
+
$mime = $img_attr[2];
|
392 |
+
$type = $asp_attr[2];
|
393 |
+
|
394 |
+
// Source native aspect
|
395 |
+
$src_asp = $src_size_h / $src_size_w;
|
396 |
+
|
397 |
+
// Required aspect
|
398 |
+
if ( $type == 'none' ) {
|
399 |
+
$dst_asp = $src_asp;
|
400 |
+
}
|
401 |
+
else {
|
402 |
+
$dst_asp = $asp_attr[0] / $asp_attr[1];
|
403 |
+
}
|
404 |
+
|
405 |
+
// Convert back width if stereo
|
406 |
+
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
407 |
+
$src_size_w *= 2;
|
408 |
+
}
|
409 |
+
|
410 |
+
// Create the source image
|
411 |
+
switch ( $mime ) { // mime type
|
412 |
+
case 1: // gif
|
413 |
+
$temp = @ imagecreatefromgif( $file );
|
414 |
+
if ( $temp ) {
|
415 |
+
$src = imagecreatetruecolor( $src_size_w, $src_size_h );
|
416 |
+
imagecopy( $src, $temp, 0, 0, 0, 0, $src_size_w, $src_size_h );
|
417 |
+
imagedestroy( $temp );
|
418 |
+
}
|
419 |
+
else $src = false;
|
420 |
+
break;
|
421 |
+
case 2: // jpeg
|
422 |
+
if ( ! function_exists( 'imagecreatefromjpeg' ) ) wppa_log( 'Error', 'Function imagecreatefromjpeg does not exist.' );
|
423 |
+
$src = @ imagecreatefromjpeg( $file );
|
424 |
+
break;
|
425 |
+
case 3: // png
|
426 |
+
$src = @ imagecreatefrompng( $file );
|
427 |
+
break;
|
428 |
+
}
|
429 |
+
if ( ! $src ) {
|
430 |
+
wppa_log( 'Error', 'Image file '.$file.' is corrupt while creating thmbnail' );
|
431 |
+
return true;
|
432 |
+
}
|
433 |
+
|
434 |
+
// Compute the destination image size
|
435 |
+
if ( $dst_asp < 1.0 ) { // Landscape
|
436 |
+
$dst_size_w = $max_side;
|
437 |
+
$dst_size_h = round( $max_side * $dst_asp );
|
438 |
+
}
|
439 |
+
else { // Portrait
|
440 |
+
$dst_size_w = round( $max_side / $dst_asp );
|
441 |
+
$dst_size_h = $max_side;
|
442 |
+
}
|
443 |
+
|
444 |
+
// Create the ( empty ) destination image
|
445 |
+
$dst = imagecreatetruecolor( $dst_size_w, $dst_size_h );
|
446 |
+
if ( $mime == 3 ) { // Png, save transparancy
|
447 |
+
imagealphablending( $dst, false );
|
448 |
+
imagesavealpha( $dst, true );
|
449 |
+
}
|
450 |
+
|
451 |
+
// Fill with the required color
|
452 |
+
$c = trim( strtolower( wppa_opt( 'bgcolor_thumbnail' ) ) );
|
453 |
+
if ( $c != '#000000' ) {
|
454 |
+
$r = hexdec( substr( $c, 1, 2 ) );
|
455 |
+
$g = hexdec( substr( $c, 3, 2 ) );
|
456 |
+
$b = hexdec( substr( $c, 5, 2 ) );
|
457 |
+
$color = imagecolorallocate( $dst, $r, $g, $b );
|
458 |
+
if ( $color === false ) {
|
459 |
+
wppa_log( 'Err', 'Unable to set background color to: '.$r.', '.$g.', '.$b.' in wppa_create_thumbnail' );
|
460 |
+
}
|
461 |
+
else {
|
462 |
+
imagefilledrectangle( $dst, 0, 0, $dst_size_w, $dst_size_h, $color );
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
// Switch on what we have to do
|
467 |
+
switch ( $type ) {
|
468 |
+
case 'none': // Use aspect from fullsize image
|
469 |
+
$src_x = 0;
|
470 |
+
$src_y = 0;
|
471 |
+
$src_w = $src_size_w;
|
472 |
+
$src_h = $src_size_h;
|
473 |
+
$dst_x = 0;
|
474 |
+
$dst_y = 0;
|
475 |
+
$dst_w = $dst_size_w;
|
476 |
+
$dst_h = $dst_size_h;
|
477 |
+
break;
|
478 |
+
case 'clip': // Clip image to given aspect ratio
|
479 |
+
if ( $src_asp < $dst_asp ) { // Source image more landscape than destination
|
480 |
+
$dst_x = 0;
|
481 |
+
$dst_y = 0;
|
482 |
+
$dst_w = $dst_size_w;
|
483 |
+
$dst_h = $dst_size_h;
|
484 |
+
$src_x = round( ( $src_size_w - $src_size_h / $dst_asp ) / 2 );
|
485 |
+
$src_y = 0;
|
486 |
+
$src_w = round( $src_size_h / $dst_asp );
|
487 |
+
$src_h = $src_size_h;
|
488 |
+
}
|
489 |
+
else {
|
490 |
+
$dst_x = 0;
|
491 |
+
$dst_y = 0;
|
492 |
+
$dst_w = $dst_size_w;
|
493 |
+
$dst_h = $dst_size_h;
|
494 |
+
$src_x = 0;
|
495 |
+
$src_y = round( ( $src_size_h - $src_size_w * $dst_asp ) / 2 );
|
496 |
+
$src_w = $src_size_w;
|
497 |
+
$src_h = round( $src_size_w * $dst_asp );
|
498 |
+
}
|
499 |
+
break;
|
500 |
+
case 'padd': // Padd image to given aspect ratio
|
501 |
+
if ( $src_asp < $dst_asp ) { // Source image more landscape than destination
|
502 |
+
$dst_x = 0;
|
503 |
+
$dst_y = round( ( $dst_size_h - $dst_size_w * $src_asp ) / 2 );
|
504 |
+
$dst_w = $dst_size_w;
|
505 |
+
$dst_h = round( $dst_size_w * $src_asp );
|
506 |
+
$src_x = 0;
|
507 |
+
$src_y = 0;
|
508 |
+
$src_w = $src_size_w;
|
509 |
+
$src_h = $src_size_h;
|
510 |
+
}
|
511 |
+
else {
|
512 |
+
$dst_x = round( ( $dst_size_w - $dst_size_h / $src_asp ) / 2 );
|
513 |
+
$dst_y = 0;
|
514 |
+
$dst_w = round( $dst_size_h / $src_asp );
|
515 |
+
$dst_h = $dst_size_h;
|
516 |
+
$src_x = 0;
|
517 |
+
$src_y = 0;
|
518 |
+
$src_w = $src_size_w;
|
519 |
+
$src_h = $src_size_h;
|
520 |
+
}
|
521 |
+
break;
|
522 |
+
default: // Not implemented
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
|
526 |
+
// Copy left half if stereo
|
527 |
+
if ( wppa_get_photo_item( $id, 'stereo' ) ) {
|
528 |
+
$src_w /= 2;
|
529 |
+
}
|
530 |
+
|
531 |
+
// Do the copy
|
532 |
+
imagecopyresampled( $dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
|
533 |
+
|
534 |
+
// Save the thumb
|
535 |
+
$thumbpath = wppa_strip_ext( $thumbpath );
|
536 |
+
switch ( $mime ) { // mime type
|
537 |
+
case 1:
|
538 |
+
imagegif( $dst, $thumbpath . '.gif' );
|
539 |
+
break;
|
540 |
+
case 2:
|
541 |
+
imagejpeg( $dst, $thumbpath . '.jpg', wppa_opt( 'jpeg_quality' ) );
|
542 |
+
break;
|
543 |
+
case 3:
|
544 |
+
imagepng( $dst, $thumbpath . '.png', 6 );
|
545 |
+
break;
|
546 |
+
}
|
547 |
+
|
548 |
+
// Cleanup
|
549 |
+
imagedestroy( $src );
|
550 |
+
imagedestroy( $dst );
|
551 |
+
|
552 |
+
// Optimize
|
553 |
+
wppa_optimize_image_file( $thumbpath );
|
554 |
+
|
555 |
+
// Compute and save sizes
|
556 |
+
wppa_get_thumbx( $id, 'force' ); // forces recalc x and y
|
557 |
+
|
558 |
+
return true;
|
559 |
+
}
|
wppa-session.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all session routines
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
* Firefox modifies data in the superglobal $_SESSION.
|
9 |
* See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
|
@@ -176,7 +176,7 @@ static $last_query;
|
|
176 |
}
|
177 |
|
178 |
// No luck, maybe attemt to save a session that never started. Start new session
|
179 |
-
wppa_log('Dbg', 'Attempt to save a session that was not started. ip='.$_SERVER['REMOTE_ADDR']
|
180 |
$wppa_session = false;
|
181 |
$last_query = false;
|
182 |
wppa_session_start();
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all session routines
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
* Firefox modifies data in the superglobal $_SESSION.
|
9 |
* See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
|
176 |
}
|
177 |
|
178 |
// No luck, maybe attemt to save a session that never started. Start new session
|
179 |
+
wppa_log('Dbg', 'Attempt to save a session that was not started. ip='.$_SERVER['REMOTE_ADDR']);
|
180 |
$wppa_session = false;
|
181 |
$last_query = false;
|
182 |
wppa_session_start();
|
wppa-settings-autosave.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -24,6 +24,12 @@ global $wppa_revno;
|
|
24 |
global $no_default;
|
25 |
global $wppa_tags;
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
// Test area
|
29 |
// echo '<!-- Start Test area ---><br />';
|
@@ -6222,7 +6228,7 @@ global $wppa_tags;
|
|
6222 |
$html2 = '';
|
6223 |
$html = array( $html1, $html2 );
|
6224 |
$clas = '';
|
6225 |
-
$tags = 'system';
|
6226 |
wppa_setting($slug, '7', $name, $desc, $html, $help, $clas, $tags);
|
6227 |
|
6228 |
$name = __('Blacklist user', 'wp-photo-album-plus');
|
@@ -6628,6 +6634,20 @@ global $wppa_tags;
|
|
6628 |
$tags = 'system';
|
6629 |
wppa_setting(false, '14', $name, $desc, $html, $help, $clas, $tags);
|
6630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6631 |
|
6632 |
wppa_setting_subheader('B', '4', __('Clearing and other irreverseable actions', 'wp-photo-album-plus'));
|
6633 |
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* manage all options
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
24 |
global $no_default;
|
25 |
global $wppa_tags;
|
26 |
|
27 |
+
//update_option('test_option', '[:en]New[:nl]Nieuw[:fr]Nouveau[:]');
|
28 |
+
//echo get_option('test_option').'<br />';
|
29 |
+
//update_option('test_array_option', array('1'=>'[:en]New[:nl]Nieuw[:fr]Nouveau[:]'));
|
30 |
+
//$temp = get_option('test_array_option');
|
31 |
+
//echo $temp['1'].'<br />';
|
32 |
+
//echo serialize($temp);
|
33 |
|
34 |
// Test area
|
35 |
// echo '<!-- Start Test area ---><br />';
|
6228 |
$html2 = '';
|
6229 |
$html = array( $html1, $html2 );
|
6230 |
$clas = '';
|
6231 |
+
$tags = 'system,upload';
|
6232 |
wppa_setting($slug, '7', $name, $desc, $html, $help, $clas, $tags);
|
6233 |
|
6234 |
$name = __('Blacklist user', 'wp-photo-album-plus');
|
6634 |
$tags = 'system';
|
6635 |
wppa_setting(false, '14', $name, $desc, $html, $help, $clas, $tags);
|
6636 |
|
6637 |
+
$name = __('Create orietation sources', 'wp-photo-album-plus');
|
6638 |
+
$desc = __('Creates correctly oriented pseudo source file.', 'wp-photo-album-plus');
|
6639 |
+
$help = '';
|
6640 |
+
$slug1 = 'wppa_create_o1_files_skip_one';
|
6641 |
+
$slug2 = 'wppa_create_o1_files';
|
6642 |
+
$html1 = wppa_ajax_button(__('Skip one', 'wp-photo-album-plus'), $slug1, '0', true );
|
6643 |
+
$html2 = wppa_maintenance_button( $slug2 );
|
6644 |
+
$html3 = wppa_status_field( $slug2 );
|
6645 |
+
$html4 = wppa_togo_field( $slug2 );
|
6646 |
+
$html = array($html1, $html2, $html3, $html4);
|
6647 |
+
$clas = '';
|
6648 |
+
$tags = 'system';
|
6649 |
+
wppa_setting(false, '15', $name, $desc, $html, $help, $clas, $tags);
|
6650 |
+
|
6651 |
|
6652 |
wppa_setting_subheader('B', '4', __('Clearing and other irreverseable actions', 'wp-photo-album-plus'));
|
6653 |
|
wppa-setup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -410,9 +410,10 @@ global $silent;
|
|
410 |
else {
|
411 |
update_option( 'wppa_comment_email_required', 'none' );
|
412 |
}
|
413 |
-
|
414 |
-
|
415 |
-
|
|
|
416 |
}
|
417 |
|
418 |
}
|
@@ -1253,6 +1254,8 @@ Hide Camera info
|
|
1253 |
'wppa_comp_sizes' => '',
|
1254 |
'wppa_crypt_photos' => '',
|
1255 |
'wppa_crypt_albums' => '',
|
|
|
|
|
1256 |
|
1257 |
// B Irreversable
|
1258 |
'wppa_rating_clear' => 'no',
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the setup stuff
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
410 |
else {
|
411 |
update_option( 'wppa_comment_email_required', 'none' );
|
412 |
}
|
413 |
+
}
|
414 |
+
|
415 |
+
if ( $old_rev <= '6410' ) {
|
416 |
+
@ $wpdb->query( "UPDATE `wp_options` SET `autoload` = 'no' WHERE `option_name` LIKE 'wppa_%'");
|
417 |
}
|
418 |
|
419 |
}
|
1254 |
'wppa_comp_sizes' => '',
|
1255 |
'wppa_crypt_photos' => '',
|
1256 |
'wppa_crypt_albums' => '',
|
1257 |
+
'wppa_create_o1_files' => '',
|
1258 |
+
'wppa_create_o1_files_skip_one' => '',
|
1259 |
|
1260 |
// B Irreversable
|
1261 |
'wppa_rating_clear' => 'no',
|
wppa-source.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains photo source file management routines
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -54,7 +54,10 @@ function wppa_delete_source( $name, $alb ) {
|
|
54 |
if ( wppa_switch('wppa_keep_sync') ) {
|
55 |
$path = wppa_get_source_album_dir( $alb ).'/'.$name;
|
56 |
$path = wppa_strip_ext( $path );
|
57 |
-
|
|
|
|
|
|
|
58 |
|
59 |
// Delete all possible file-extensions
|
60 |
foreach( $all_paths as $p ) if ( is_file( $p ) ) {
|
@@ -87,11 +90,15 @@ global $wppa_supported_photo_extensions;
|
|
87 |
|
88 |
// rename. Will fail if target already exists
|
89 |
@ rename( $frompath.'.'.$ext, $topath.'.'.$ext );
|
|
|
90 |
|
91 |
// therefor delete if still exists
|
92 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
93 |
@ unlink( $frompath.'.'.$ext );
|
94 |
}
|
|
|
|
|
|
|
95 |
}
|
96 |
}
|
97 |
}
|
@@ -115,7 +122,8 @@ global $wppa_supported_photo_extensions;
|
|
115 |
|
116 |
foreach( $supext as $ext ) {
|
117 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
118 |
-
@ copy( $frompath.'.'.$ext, $topath.'.'.$ext );
|
|
|
119 |
}
|
120 |
}
|
121 |
}
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains photo source file management routines
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
54 |
if ( wppa_switch('wppa_keep_sync') ) {
|
55 |
$path = wppa_get_source_album_dir( $alb ).'/'.$name;
|
56 |
$path = wppa_strip_ext( $path );
|
57 |
+
|
58 |
+
$paths = glob( $path . '.*' );
|
59 |
+
$o1paths = glob( $path . '-o1.*' );
|
60 |
+
$all_paths = array_merge( $paths, $o1paths );
|
61 |
|
62 |
// Delete all possible file-extensions
|
63 |
foreach( $all_paths as $p ) if ( is_file( $p ) ) {
|
90 |
|
91 |
// rename. Will fail if target already exists
|
92 |
@ rename( $frompath.'.'.$ext, $topath.'.'.$ext );
|
93 |
+
@ rename( $frompath.'-o1.'.$ext, $topath.'-o1.'.$ext );
|
94 |
|
95 |
// therefor delete if still exists
|
96 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
97 |
@ unlink( $frompath.'.'.$ext );
|
98 |
}
|
99 |
+
if ( is_file( $frompath.'-o1.'.$ext ) ) {
|
100 |
+
@ unlink( $frompath.'-o1.'.$ext );
|
101 |
+
}
|
102 |
}
|
103 |
}
|
104 |
}
|
122 |
|
123 |
foreach( $supext as $ext ) {
|
124 |
if ( is_file( $frompath.'.'.$ext ) ) {
|
125 |
+
@ copy( $frompath.'.'.$ext, $topath.'.'.$ext );
|
126 |
+
@ copy( $frompath.'-o1.'.$ext, $topath.'-o1.'.$ext );
|
127 |
}
|
128 |
}
|
129 |
}
|
wppa-upload.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the upload/import pages and functions
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -1679,6 +1679,7 @@ global $wppa_supported_audio_extensions;
|
|
1679 |
if ( $bret ) { // Success
|
1680 |
if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files_done', true );
|
1681 |
wppa_save_source( $file, basename( $file ), $alb );
|
|
|
1682 |
$pcount++;
|
1683 |
$totpcount += $bret;
|
1684 |
if ( $delp ) {
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all the upload/import pages and functions
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
1679 |
if ( $bret ) { // Success
|
1680 |
if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files_done', true );
|
1681 |
wppa_save_source( $file, basename( $file ), $alb );
|
1682 |
+
wppa_make_o1_source( $is_poster );
|
1683 |
$pcount++;
|
1684 |
$totpcount += $bret;
|
1685 |
if ( $delp ) {
|
wppa-utils.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
-
* Version 6.4.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -676,13 +676,13 @@ function wppa_update_option( $option, $value ) {
|
|
676 |
global $wppa_opt;
|
677 |
|
678 |
// Update the option
|
679 |
-
update_option($option, $value);
|
680 |
|
681 |
// Update the local cache
|
682 |
$wppa_opt[$option] = $value;
|
683 |
|
684 |
// Delete the cached options
|
685 |
-
delete_option('wppa_cached_options');
|
686 |
|
687 |
// See if wppa-init.[lang].js needs remake
|
688 |
$init_js_critical = array( 'wppa_slideshow_linktype',
|
@@ -1628,7 +1628,7 @@ function wppa_is_enum( $var ) {
|
|
1628 |
return '' === str_replace( array( '0','1','2','3','4','5','6','7','8','9','.' ), '', $var );
|
1629 |
}
|
1630 |
|
1631 |
-
function wppa_log( $xtype, $msg, $trace = false ) {
|
1632 |
global $wppa_session;
|
1633 |
|
1634 |
// Sanitize type
|
@@ -1691,15 +1691,17 @@ global $wppa_session;
|
|
1691 |
// Write log message
|
1692 |
@ fwrite( $file, '{b}'.$type.'{/b}: on:'.wppa_local_date(get_option('date_format', "F j, Y,").' '.get_option('time_format', "g:i a"), time()).': '.wppa_get_user().': '.strip_tags($msg)."\n" );
|
1693 |
|
1694 |
-
// Trace
|
1695 |
if ( $trace ) {
|
1696 |
ob_start();
|
1697 |
debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 12 );
|
1698 |
$trace = ob_get_contents();
|
1699 |
ob_end_clean();
|
1700 |
@ fwrite( $file, $trace."\n" );
|
|
|
1701 |
|
1702 |
-
|
|
|
1703 |
@ fwrite( $file, 'Uri history:'."\n" );
|
1704 |
if ( is_array( $wppa_session ) ) {
|
1705 |
foreach ( $wppa_session['uris'] as $uri ) {
|
@@ -1708,6 +1710,8 @@ global $wppa_session;
|
|
1708 |
@ fwrite( $file, "\n\n" );
|
1709 |
}
|
1710 |
}
|
|
|
|
|
1711 |
@ fclose( $file );
|
1712 |
}
|
1713 |
|
@@ -1965,21 +1969,26 @@ function wppa_get_hires_url( $id ) {
|
|
1965 |
if ( $url ) return $url;
|
1966 |
}
|
1967 |
|
1968 |
-
// Try the source url
|
1969 |
-
$source_path = wppa_get_source_path( $id );
|
1970 |
$wp_content = trim( str_replace( site_url(), '', content_url() ), '/' );
|
|
|
|
|
|
|
1971 |
if ( is_file( $source_path ) ) {
|
1972 |
$temp = explode( $wp_content, $source_path );
|
1973 |
-
|
1974 |
}
|
1975 |
|
1976 |
-
// Try the
|
1977 |
-
|
1978 |
-
|
|
|
|
|
1979 |
}
|
|
|
|
|
|
|
1980 |
$temp = explode( '?', $hires_url );
|
1981 |
-
|
1982 |
-
return $hires_url;
|
1983 |
}
|
1984 |
function wppa_get_lores_url( $id ) {
|
1985 |
$lores_url = wppa_fix_poster_ext( wppa_get_photo_url( $id ), $id );
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains low-level utility routines
|
6 |
+
* Version 6.4.10
|
7 |
*
|
8 |
*/
|
9 |
|
676 |
global $wppa_opt;
|
677 |
|
678 |
// Update the option
|
679 |
+
update_option( $option, $value, false );
|
680 |
|
681 |
// Update the local cache
|
682 |
$wppa_opt[$option] = $value;
|
683 |
|
684 |
// Delete the cached options
|
685 |
+
delete_option( 'wppa_cached_options' );
|
686 |
|
687 |
// See if wppa-init.[lang].js needs remake
|
688 |
$init_js_critical = array( 'wppa_slideshow_linktype',
|
1628 |
return '' === str_replace( array( '0','1','2','3','4','5','6','7','8','9','.' ), '', $var );
|
1629 |
}
|
1630 |
|
1631 |
+
function wppa_log( $xtype, $msg, $trace = false, $listuri = false ) {
|
1632 |
global $wppa_session;
|
1633 |
|
1634 |
// Sanitize type
|
1691 |
// Write log message
|
1692 |
@ fwrite( $file, '{b}'.$type.'{/b}: on:'.wppa_local_date(get_option('date_format', "F j, Y,").' '.get_option('time_format', "g:i a"), time()).': '.wppa_get_user().': '.strip_tags($msg)."\n" );
|
1693 |
|
1694 |
+
// Trace 12 levels if trace requested
|
1695 |
if ( $trace ) {
|
1696 |
ob_start();
|
1697 |
debug_print_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 12 );
|
1698 |
$trace = ob_get_contents();
|
1699 |
ob_end_clean();
|
1700 |
@ fwrite( $file, $trace."\n" );
|
1701 |
+
}
|
1702 |
|
1703 |
+
// Add uri history
|
1704 |
+
if ( $listuri ) {
|
1705 |
@ fwrite( $file, 'Uri history:'."\n" );
|
1706 |
if ( is_array( $wppa_session ) ) {
|
1707 |
foreach ( $wppa_session['uris'] as $uri ) {
|
1710 |
@ fwrite( $file, "\n\n" );
|
1711 |
}
|
1712 |
}
|
1713 |
+
|
1714 |
+
// Done
|
1715 |
@ fclose( $file );
|
1716 |
}
|
1717 |
|
1969 |
if ( $url ) return $url;
|
1970 |
}
|
1971 |
|
|
|
|
|
1972 |
$wp_content = trim( str_replace( site_url(), '', content_url() ), '/' );
|
1973 |
+
|
1974 |
+
// Try the orientation corrected source url
|
1975 |
+
$source_path = wppa_get_o1_source_path( $id );
|
1976 |
if ( is_file( $source_path ) ) {
|
1977 |
$temp = explode( $wp_content, $source_path );
|
1978 |
+
return site_url().'/'.$wp_content.$temp['1'];
|
1979 |
}
|
1980 |
|
1981 |
+
// Try the source url
|
1982 |
+
$source_path = wppa_get_source_path( $id );
|
1983 |
+
if ( is_file( $source_path ) ) {
|
1984 |
+
$temp = explode( $wp_content, $source_path );
|
1985 |
+
return site_url().'/'.$wp_content.$temp['1'];
|
1986 |
}
|
1987 |
+
|
1988 |
+
// The medium res url
|
1989 |
+
$hires_url = wppa_get_photo_url( $id );
|
1990 |
$temp = explode( '?', $hires_url );
|
1991 |
+
return $temp['0'];
|
|
|
1992 |
}
|
1993 |
function wppa_get_lores_url( $id ) {
|
1994 |
$lores_url = wppa_fix_poster_ext( wppa_get_photo_url( $id ), $id );
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 6.4.
|
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/
|
@@ -29,12 +29,12 @@ global $wpdb;
|
|
29 |
/* when new options are added and when the wppa_setup() routine
|
30 |
/* must be called right after update for any other reason.
|
31 |
*/
|
32 |
-
global $wppa_revno; $wppa_revno = '
|
33 |
|
34 |
/* This is the api interface version number
|
35 |
/* It is incremented at any code change.
|
36 |
*/
|
37 |
-
global $wppa_api_version; $wppa_api_version = '6-4-
|
38 |
|
39 |
/* start timers */
|
40 |
global $wppa_starttime; $wppa_starttime = microtime(true);
|
@@ -277,6 +277,7 @@ require_once 'wppa-audio.php';
|
|
277 |
require_once 'wppa-mobile.php';
|
278 |
require_once 'wppa-stereo.php';
|
279 |
require_once 'wppa-encrypt.php';
|
|
|
280 |
|
281 |
/* SET UP array $wppa, array $wppa_opt, and LANGUAGE */
|
282 |
add_action( 'init', 'wppa_initialize_runtime', '8' );
|
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.4.10
|
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/
|
29 |
/* when new options are added and when the wppa_setup() routine
|
30 |
/* must be called right after update for any other reason.
|
31 |
*/
|
32 |
+
global $wppa_revno; $wppa_revno = '6410';
|
33 |
|
34 |
/* This is the api interface version number
|
35 |
/* It is incremented at any code change.
|
36 |
*/
|
37 |
+
global $wppa_api_version; $wppa_api_version = '6-4-10-005';
|
38 |
|
39 |
/* start timers */
|
40 |
global $wppa_starttime; $wppa_starttime = microtime(true);
|
277 |
require_once 'wppa-mobile.php';
|
278 |
require_once 'wppa-stereo.php';
|
279 |
require_once 'wppa-encrypt.php';
|
280 |
+
require_once 'wppa-photo-files.php';
|
281 |
|
282 |
/* SET UP array $wppa, array $wppa_opt, and LANGUAGE */
|
283 |
add_action( 'init', 'wppa_initialize_runtime', '8' );
|