Version Description
= 8.0.06 =
- This version addresses various minor bug fixes and feature requests.
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 8.0.06.003 |
Comparing to | |
See all releases |
Code changes from version 8.0.06.002 to 8.0.06.003
- changelog.txt +1 -0
- wppa-encrypt.php +4 -1
- wppa-init.php +1 -12
- wppa-links.php +110 -71
- wppa.php +2 -2
changelog.txt
CHANGED
@@ -6,6 +6,7 @@ WP Photo Album Plus Changelog
|
|
6 |
Enables you to select a userrole, and show the number of comments given by userts with that role separately, only visible to users of that role.
|
7 |
* Pagination is now switched off when a photo enumeration is given.
|
8 |
* Fixed wrong links when photo names in urls is activated.
|
|
|
9 |
|
10 |
= 8.0.05 =
|
11 |
|
6 |
Enables you to select a userrole, and show the number of comments given by userts with that role separately, only visible to users of that role.
|
7 |
* Pagination is now switched off when a photo enumeration is given.
|
8 |
* Fixed wrong links when photo names in urls is activated.
|
9 |
+
* In case of duplicate names in 'names in urls' they will not be converted to avoid confusion.
|
10 |
|
11 |
= 8.0.05 =
|
12 |
|
wppa-encrypt.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all ecryption/decryption logic
|
6 |
-
* Version 8.0.
|
7 |
*
|
8 |
*/
|
9 |
|
@@ -286,6 +286,9 @@ global $wpdb;
|
|
286 |
// Encrypt a full url
|
287 |
function wppa_encrypt_url( $url ) {
|
288 |
|
|
|
|
|
|
|
289 |
// Feature enabled?
|
290 |
if ( ! wppa_switch( 'use_encrypted_links' ) ) {
|
291 |
return $url;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Contains all ecryption/decryption logic
|
6 |
+
* Version 8.0.06.003
|
7 |
*
|
8 |
*/
|
9 |
|
286 |
// Encrypt a full url
|
287 |
function wppa_encrypt_url( $url ) {
|
288 |
|
289 |
+
// Names to numbers
|
290 |
+
$url = wppa_numbers_to_names_in_uri( $url );
|
291 |
+
|
292 |
// Feature enabled?
|
293 |
if ( ! wppa_switch( 'use_encrypted_links' ) ) {
|
294 |
return $url;
|
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.0.
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
@@ -337,17 +337,6 @@ global $wpdb;
|
|
337 |
$any = false;
|
338 |
$text = __( 'WPPA detected the following configuration conflict(s)', 'wp-photo-album-plus' ) . '<br />';
|
339 |
|
340 |
-
// Album names in urls
|
341 |
-
if ( wppa_switch( 'use_album_names_in_urls' ) ) {
|
342 |
-
$nalbs = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums" );
|
343 |
-
$ualbs = $wpdb->get_col( "SELECT DISTINCT name FROM $wpdb->wppa_albums" );
|
344 |
-
if ( $nalbs > count ( $ualbs ) ) {
|
345 |
-
$text .= '<br />' . __( 'Album names in urls is activated, but there are duplicate album names.', 'wp-photo-album-plus' ) .
|
346 |
-
'<br />' . wppa_see_also( 'system', '1', '5' );
|
347 |
-
$any = true;
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
// Direct comment/ratings
|
352 |
if ( wppa_switch( 'direct_comment' ) ) {
|
353 |
if ( ! wppa_switch( 'use_encrypted_links' ) || ! wppa_switch( 'refuse_unencrypted' ) ) {
|
4 |
*
|
5 |
* This file loads required php files and contains all functions used in init actions.
|
6 |
*
|
7 |
+
* Version 8.0.06.003
|
8 |
*/
|
9 |
|
10 |
/* LOAD SIDEBAR WIDGETS */
|
337 |
$any = false;
|
338 |
$text = __( 'WPPA detected the following configuration conflict(s)', 'wp-photo-album-plus' ) . '<br />';
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
// Direct comment/ratings
|
341 |
if ( wppa_switch( 'direct_comment' ) ) {
|
342 |
if ( ! wppa_switch( 'use_encrypted_links' ) || ! wppa_switch( 'refuse_unencrypted' ) ) {
|
wppa-links.php
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Frontend links
|
6 |
-
|
|
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
@@ -576,45 +577,8 @@ function wppa_convert_to_pretty( $xuri, $no_names = false, $overrule = false ) {
|
|
576 |
// First filter for short query args
|
577 |
$uri = wppa_trim_wppa_( $uri );
|
578 |
|
579 |
-
// Now filter for
|
580 |
-
$uri =
|
581 |
-
|
582 |
-
// Now filter for photo names in urls
|
583 |
-
if ( wppa_switch( 'use_photo_names_in_urls' ) && ! $no_names ) {
|
584 |
-
$start = 0;
|
585 |
-
$end = 0;
|
586 |
-
$ppos = strpos( $uri, 'photo=' );
|
587 |
-
if ( $ppos !== false ) {
|
588 |
-
$start = $ppos + '6';
|
589 |
-
$end = strpos( $uri, '&', $start );
|
590 |
-
}
|
591 |
-
$before = substr( $uri, 0, $start );
|
592 |
-
if ( $end ) {
|
593 |
-
$id = substr( $uri, $start, $end - $start );
|
594 |
-
if ( wppa_is_int( $id ) ) { // Can convert single integer photo ids only
|
595 |
-
$after = substr( $uri, $end );
|
596 |
-
$pname = stripslashes( wppa_get_photo_item( $id, 'sname' ) );
|
597 |
-
if ( ! $pname ) { // Back compat: fix missing pname
|
598 |
-
$pname = wppa_sanitize_album_photo_name( wppa_get_photo_item( $id, 'name' ) );
|
599 |
-
wppa_update_photo( array( 'id' => $id, 'sname' => $pname ) );
|
600 |
-
}
|
601 |
-
$pname = wppa_encode_uri_component( $pname );
|
602 |
-
$uri = $before . $pname . $after;
|
603 |
-
}
|
604 |
-
}
|
605 |
-
else {
|
606 |
-
$id = substr( $uri, $start );
|
607 |
-
if ( wppa_is_int( $id ) ) { // Can convert single integer photo ids only
|
608 |
-
$pname = stripslashes( wppa_get_photo_item( $id, 'sname' ) );
|
609 |
-
if ( ! $pname ) { // Back compat: fix missing pname
|
610 |
-
$pname = wppa_sanitize_album_photo_name( wppa_get_photo_item( $id, 'name' ) );
|
611 |
-
wppa_update_photo( array( 'id' => $id, 'sname' => $pname ) );
|
612 |
-
}
|
613 |
-
$pname = wppa_encode_uri_component( $pname );
|
614 |
-
$uri = $before . $pname;
|
615 |
-
}
|
616 |
-
}
|
617 |
-
}
|
618 |
|
619 |
// Now urlencode for funny chars
|
620 |
$uri = str_replace( array( ' ', '[', ']' ), array( '%20', '%5B', '%5D' ), $uri );
|
@@ -918,53 +882,127 @@ function wppa_compress_pretty( $uri ) {
|
|
918 |
$result .= '?' . $after;
|
919 |
}
|
920 |
|
921 |
-
// Done
|
922 |
-
// wppa_log( 'dbg', $result );
|
923 |
-
|
924 |
-
// return $uri; // debug
|
925 |
return $result;
|
926 |
}
|
927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
928 |
// Replace album number by name in url
|
929 |
function wppa_album_number_to_name_in_uri( $uri ) {
|
930 |
|
931 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
932 |
|
933 |
-
|
934 |
|
935 |
-
|
|
|
|
|
936 |
return $uri;
|
937 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
else {
|
939 |
-
$
|
940 |
-
$end = strpos( $uri, '&', $start );
|
941 |
}
|
942 |
|
943 |
-
|
944 |
-
if ( $
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
}
|
953 |
-
$albnam = wppa_encode_uri_component( $albnam );
|
954 |
-
$uri = $before . $albnam . $after;
|
955 |
}
|
956 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
else {
|
958 |
-
$
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
}
|
969 |
}
|
970 |
|
@@ -1613,6 +1651,7 @@ global $wpdb;
|
|
1613 |
$result['ajax_url'] = str_replace( wppa_get_permalink( $page ), wppa_get_ajaxlink(), $result['url'] );
|
1614 |
$result['ajax_url'] = str_replace( '&', '&', $result['ajax_url'] );
|
1615 |
}
|
|
|
1616 |
$result['url'] = wppa_convert_to_pretty( $result['url'] );
|
1617 |
return $result;
|
1618 |
break;
|
3 |
* Package: wp-photo-album-plus
|
4 |
*
|
5 |
* Frontend links
|
6 |
+
|
7 |
+
* Version 8.0.06.003
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
|
577 |
// First filter for short query args
|
578 |
$uri = wppa_trim_wppa_( $uri );
|
579 |
|
580 |
+
// Now filter for names in urls
|
581 |
+
// $uri = wppa_numbers_to_names_in_uri( $uri );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
582 |
|
583 |
// Now urlencode for funny chars
|
584 |
$uri = str_replace( array( ' ', '[', ']' ), array( '%20', '%5B', '%5D' ), $uri );
|
882 |
$result .= '?' . $after;
|
883 |
}
|
884 |
|
|
|
|
|
|
|
|
|
885 |
return $result;
|
886 |
}
|
887 |
|
888 |
+
// Repalace numbers to names in uri
|
889 |
+
function wppa_numbers_to_names_in_uri( $xuri ) {
|
890 |
+
|
891 |
+
$uri = $xuri;
|
892 |
+
$uri = wppa_album_number_to_name_in_uri( $uri );
|
893 |
+
$uri = wppa_photo_number_to_name_in_uri( $uri );
|
894 |
+
|
895 |
+
if ( $xuri != $uri ) {
|
896 |
+
// wppa_log( 'obs', $xuri . ' converted to ' . $uri );
|
897 |
+
}
|
898 |
+
return $uri;
|
899 |
+
}
|
900 |
+
|
901 |
// Replace album number by name in url
|
902 |
function wppa_album_number_to_name_in_uri( $uri ) {
|
903 |
|
904 |
+
$uri = wppa_convert_item_number_to_name_in_uri( $uri, 'album' );
|
905 |
+
|
906 |
+
return $uri;
|
907 |
+
}
|
908 |
+
|
909 |
+
// Replace photo number by name in url
|
910 |
+
function wppa_photo_number_to_name_in_uri( $uri ) {
|
911 |
+
|
912 |
+
$uri = wppa_convert_item_number_to_name_in_uri( $uri, 'photo' );
|
913 |
+
|
914 |
+
return $uri;
|
915 |
+
}
|
916 |
+
|
917 |
+
// Convert item number to name in uri
|
918 |
+
function wppa_convert_item_number_to_name_in_uri( $xuri, $what ) {
|
919 |
+
global $wpdb;
|
920 |
|
921 |
+
$uri = $xuri;
|
922 |
|
923 |
+
// Init $what specific
|
924 |
+
if ( $what == 'album' ) {
|
925 |
+
if ( ! wppa_switch( 'use_album_names_in_urls' ) ) {
|
926 |
return $uri;
|
927 |
}
|
928 |
+
$token = 'album=';
|
929 |
+
$table = $wpdb->wppa_albums;
|
930 |
+
}
|
931 |
+
elseif ( $what == 'photo' ) {
|
932 |
+
if ( ! wppa_switch( 'use_photo_names_in_urls' ) ) {
|
933 |
+
return $uri;
|
934 |
+
}
|
935 |
+
$token = 'photo=';
|
936 |
+
$table = $wpdb->wppa_photos;
|
937 |
+
}
|
938 |
+
else {
|
939 |
+
wppa_log( 'err', 'Unimplemented $what in wppa_convert_item_number_to_name_in_uri(): ' . $what );
|
940 |
+
}
|
941 |
+
|
942 |
+
// Find the token
|
943 |
+
$start = 0;
|
944 |
+
$end = 0;
|
945 |
+
$token_pos = strpos( $uri, $token );
|
946 |
+
if ( $token_pos === false ) {
|
947 |
+
return $uri; // Not found
|
948 |
+
}
|
949 |
+
|
950 |
+
// Find the id, and the parts surrounding
|
951 |
+
$start = $token_pos + '6';
|
952 |
+
$end = strpos( $uri, '&', $start );
|
953 |
+
$before = substr( $uri, 0, $start );
|
954 |
+
if ( $end ) {
|
955 |
+
$id = substr( $uri, $start, $end - $start );
|
956 |
+
$after = substr( $uri, $end );
|
957 |
+
}
|
958 |
+
else {
|
959 |
+
$id = substr( $uri, $start );
|
960 |
+
$after = '';
|
961 |
+
}
|
962 |
+
|
963 |
+
|
964 |
+
// Can only process single ints
|
965 |
+
if ( $id && wppa_is_int( $id ) ) {
|
966 |
+
|
967 |
+
if ( $what == 'album' ) {
|
968 |
+
$sname = wppa_get_album_item( $id, 'sname' );
|
969 |
+
}
|
970 |
else {
|
971 |
+
$sname = wppa_get_photo_item( $id, 'sname' );
|
|
|
972 |
}
|
973 |
|
974 |
+
// Backward compat: if no sname yet, create it
|
975 |
+
if ( ! $sname ) {
|
976 |
+
if ( $what == 'album' ) {
|
977 |
+
$sname = wppa_sanitize_album_photo_name( wppa_strip_tags( wppa_get_album_item( $id, 'name' ) ) );
|
978 |
+
wppa_update_album( array( 'id' => $id, 'sname' => $sname ) );
|
979 |
+
}
|
980 |
+
else {
|
981 |
+
$sname = wppa_sanitize_album_photo_name( wppa_strip_tags( wppa_get_photo_item( $id, 'name' ) ) );
|
982 |
+
wppa_update_photo( array( 'id' => $id, 'sname' => $sname ) );
|
|
|
|
|
|
|
983 |
}
|
984 |
}
|
985 |
+
|
986 |
+
// If still no name, give up
|
987 |
+
if ( ! $sname ) {
|
988 |
+
return $uri;
|
989 |
+
}
|
990 |
+
|
991 |
+
// Can only convert when no duplicates
|
992 |
+
if ( $what == 'album' ) {
|
993 |
+
$n = wppa_get_album_item( $id, 'sname' );
|
994 |
+
}
|
995 |
else {
|
996 |
+
$n = wppa_get_photo_item( $id, 'sname' );
|
997 |
+
}
|
998 |
+
$c = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table WHERE sname = %s", $n ) );
|
999 |
+
if ( $c == '1' ) {
|
1000 |
+
|
1001 |
+
// All ok, do it
|
1002 |
+
$uri = $before . $sname . $after;
|
1003 |
+
}
|
1004 |
+
else {
|
1005 |
+
wppa_log( 'obs', 'Uri conversion skipped due to not unique name ' . $sname );
|
1006 |
}
|
1007 |
}
|
1008 |
|
1651 |
$result['ajax_url'] = str_replace( wppa_get_permalink( $page ), wppa_get_ajaxlink(), $result['url'] );
|
1652 |
$result['ajax_url'] = str_replace( '&', '&', $result['ajax_url'] );
|
1653 |
}
|
1654 |
+
// $result['url'] = wppa_numbers_to_names_in_uri( $result['url'] );
|
1655 |
$result['url'] = wppa_convert_to_pretty( $result['url'] );
|
1656 |
return $result;
|
1657 |
break;
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 8.0.06.
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
@@ -24,7 +24,7 @@ global $wp_version;
|
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
-
$wppa_api_version = '8.0.06.
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
+
* Version: 8.0.06.003
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_api_version;
|
27 |
+
$wppa_api_version = '8.0.06.003'; // WPPA software version
|
28 |
global $wppa_revno;
|
29 |
$wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
|
30 |
|