WP Photo Album Plus - Version 7.7.07.004

Version Description

= 7.7.07 =

  • This version addresses various minor bug fixes and feature requests.
Download this release

Release Info

Developer opajaap
Plugin Icon wp plugin WP Photo Album Plus
Version 7.7.07.004
Comparing to
See all releases

Code changes from version 7.7.07.003 to 7.7.07.004

Files changed (5) hide show
  1. wppa-common-functions.php +5 -1
  2. wppa-filter.php +16 -7
  3. wppa-functions.php +18 -13
  4. wppa-utils.php +34 -1
  5. wppa.php +2 -2
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 7.7.06.007
6
  *
7
  */
8
 
@@ -92,8 +92,12 @@ global $wppa_revno;
92
  global $wppa_api_version;
93
  global $thumbs;
94
  static $first_pla = true;
 
 
95
 
96
  $thumbs = false;
 
 
97
 
98
  wppa_cache_thumb( 'invalidate' );
99
  wppa_cache_album( 'invalidate' );
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.7.07.004
6
  *
7
  */
8
 
92
  global $wppa_api_version;
93
  global $thumbs;
94
  static $first_pla = true;
95
+ global $wppa_current_shortcode;
96
+ global $wppa_current_shortcode_atts;
97
 
98
  $thumbs = false;
99
+ $wppa_current_shortcode = false;
100
+ $wppa_current_shortcode_atts = false;
101
 
102
  wppa_cache_thumb( 'invalidate' );
103
  wppa_cache_album( 'invalidate' );
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version 7.7.07.003
7
  *
8
  */
9
 
@@ -35,6 +35,12 @@ function wppa_add_shortcode_to_post( $post ) {
35
  // Shortcode [wppa_div style="{style specs}"][/wppa_div]
36
  function wppa_shortcode_div( $xatts, $content = '' ) {
37
  static $seqno;
 
 
 
 
 
 
38
 
39
  if ( ! $seqno ) $seqno = 0;
40
  $seqno++;
@@ -107,10 +113,14 @@ global $wppa_api_version;
107
  global $wppa_revno;
108
  global $wppa_no_timer;
109
  global $wpdb;
 
110
  global $wppa_current_shortcode_atts;
111
 
112
  // Init
 
113
  $wppa_current_shortcode_atts = $xatts;
 
 
114
 
115
  $atts = shortcode_atts( array(
116
  'type' => 'generic',
@@ -157,10 +167,6 @@ global $wppa_current_shortcode_atts;
157
  $atts['cache'] = ( $atts['cache'] ? strval( intval( $atts['cache'] ) ) : '0' );
158
  }
159
 
160
- // Init
161
- wppa_reset_occurrance();
162
- $wppa_no_timer = false;
163
-
164
  // Caching?
165
  $wppa['cache'] = $atts['cache'];
166
  if ( wppa_switch( 'defer_javascript' ) ) { // When defer js: can not cache slideshows
@@ -497,7 +503,7 @@ global $wppa_current_shortcode_atts;
497
  break;
498
 
499
  default:
500
- wppa_dbg_msg ( 'Invalid type: '.htmlentities($atts['type']).' in wppa shortcode.', 'red', 'force' );
501
  return '';
502
  }
503
 
@@ -544,7 +550,6 @@ global $wppa_current_shortcode_atts;
544
  if ( wppa_switch( 'render_shortcode_always' ) ) $do_it = true; // Always
545
  if ( wppa( 'ajax' ) ) $do_it = true;
546
 
547
-
548
  if ( wppa( 'debug' ) ) {
549
  if ( $do_it ) $msg = 'Doit is on'; else $msg = 'Doit is off';
550
  wppa_dbg_msg( $msg );
@@ -728,9 +733,13 @@ global $wppa;
728
  global $wppa_postid;
729
  global $wpdb;
730
  static $seed;
 
 
731
 
732
  // Init
733
  wppa_reset_occurrance();
 
 
734
 
735
  // Get and validate photo id
736
  if ( isset( $xatts[0] ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 7.7.07.004
7
  *
8
  */
9
 
35
  // Shortcode [wppa_div style="{style specs}"][/wppa_div]
36
  function wppa_shortcode_div( $xatts, $content = '' ) {
37
  static $seqno;
38
+ global $wppa_current_shortcode;
39
+ global $wppa_current_shortcode_atts;
40
+
41
+ // Init
42
+ $wppa_current_shortcode_atts = $xatts;
43
+ $wppa_current_shortcode = wppa_get_shortcode( 'wppa_div', $xatts );
44
 
45
  if ( ! $seqno ) $seqno = 0;
46
  $seqno++;
113
  global $wppa_revno;
114
  global $wppa_no_timer;
115
  global $wpdb;
116
+ global $wppa_current_shortcode;
117
  global $wppa_current_shortcode_atts;
118
 
119
  // Init
120
+ wppa_reset_occurrance();
121
  $wppa_current_shortcode_atts = $xatts;
122
+ $wppa_current_shortcode = wppa_get_shortcode( 'wppa', $xatts );
123
+ $wppa_no_timer = false;
124
 
125
  $atts = shortcode_atts( array(
126
  'type' => 'generic',
167
  $atts['cache'] = ( $atts['cache'] ? strval( intval( $atts['cache'] ) ) : '0' );
168
  }
169
 
 
 
 
 
170
  // Caching?
171
  $wppa['cache'] = $atts['cache'];
172
  if ( wppa_switch( 'defer_javascript' ) ) { // When defer js: can not cache slideshows
503
  break;
504
 
505
  default:
506
+ wppa_dbg_msg ( 'Invalid type: ' . htmlentities( $atts['type'] ) . ' in wppa shortcode ' . $wppa_current_shortcode . '.', 'red', 'force' );
507
  return '';
508
  }
509
 
550
  if ( wppa_switch( 'render_shortcode_always' ) ) $do_it = true; // Always
551
  if ( wppa( 'ajax' ) ) $do_it = true;
552
 
 
553
  if ( wppa( 'debug' ) ) {
554
  if ( $do_it ) $msg = 'Doit is on'; else $msg = 'Doit is off';
555
  wppa_dbg_msg( $msg );
733
  global $wppa_postid;
734
  global $wpdb;
735
  static $seed;
736
+ global $wppa_current_shortcode;
737
+ global $wppa_current_shortcode_atts;
738
 
739
  // Init
740
  wppa_reset_occurrance();
741
+ $wppa_current_shortcode_atts = $xatts;
742
+ $wppa_current_shortcode = wppa_get_shortcode( 'photo', $xatts );
743
 
744
  // Get and validate photo id
745
  if ( isset( $xatts[0] ) ) {
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.7.07.003
7
  *
8
  */
9
 
@@ -20,6 +20,8 @@ global $thumbs;
20
  global $wppa_session;
21
  global $wppa;
22
  global $locale;
 
 
23
 
24
  wppa_occur_timer( 'init' );
25
 
@@ -321,15 +323,13 @@ global $locale;
321
 
322
  // Cache?
323
  if ( $caching ) {
324
- wppa_log( 'fso', 'Writring cachefile ' . str_replace( WPPA_CONTENT_PATH, '...', $cache_file ) );
325
  wppa_put_contents( $cache_file, $out );
326
  }
327
 
328
- // Prepare for next wppa box
329
- wppa_reset_occurrance();
330
-
331
  // Done
332
- $tim = wppa_occur_timer( 'show', $_SERVER['REQUEST_URI'], false, true );
 
333
  return $out . $tim;
334
  }
335
  if ( wppa( 'is_admins_choice' ) ) {
@@ -402,7 +402,9 @@ global $locale;
402
  $temp = explode( ',', wppa( 'start_album' ) );
403
  if ( isset( $temp['1'] ) ) $parent = wppa_album_name_to_number( $temp['1'] );
404
  else $parent = '0';
405
- if ( $parent === false ) return;
 
 
406
  if ( isset( $temp['2'] ) ) $limit = $temp['2'];
407
  else $limit = false;
408
  if ( $limit ) {
@@ -992,10 +994,12 @@ global $locale;
992
  if ( $caching ) {
993
  $extra = '';
994
  $size = strlen( $out );
995
- if ( $size > 25 * 1024 ) {
996
- global $wppa_current_shortcode_atts;
997
- if ( ! defined( 'DOING_AJAX' ) && ! isset( $wppa_current_shortcode_atts['delay'] ) ) {
998
- $extra = '. Occ ' . wppa( 'mocc' ) . ' file > 25k, maybe delay it? Shortcode atts = ' . var_export( $wppa_current_shortcode_atts, true );
 
 
999
  }
1000
  }
1001
  wppa_log( 'fso', 'Writring cachefile ' . str_replace( WPPA_CONTENT_PATH, '...', $cache_file ) . $extra );
@@ -1003,8 +1007,8 @@ global $locale;
1003
  }
1004
 
1005
  // Reset
1006
- wppa_reset_occurrance();
1007
  $timer = wppa_occur_timer( 'show', $_SERVER['REQUEST_URI'] . ' oc ' . wppa( 'mocc' ) );
 
1008
 
1009
  return $out . $timer;
1010
  }
@@ -5992,6 +5996,7 @@ function wppa_occur_timer( $key = '', $title = '', $cached = false, $delay = fal
5992
  static $queries;
5993
  static $time;
5994
  global $wppa_no_timer;
 
5995
 
5996
  // Do they want us?
5997
  if ( $wppa_no_timer ) return '';
@@ -6006,7 +6011,7 @@ global $wppa_no_timer;
6006
  $nqueries = get_num_queries() - $queries;
6007
  $ntime = microtime( true ) - $time;
6008
  $result = "\n" .
6009
- '<!-- End ' . $title . ' ' .
6010
  sprintf( '%d queries in %3.1f ms. at %s',
6011
  $nqueries,
6012
  $ntime * 1000,
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.7.07.004
7
  *
8
  */
9
 
20
  global $wppa_session;
21
  global $wppa;
22
  global $locale;
23
+ global $wppa_current_shortcode;
24
+ global $wppa_current_shortcode_atts;
25
 
26
  wppa_occur_timer( 'init' );
27
 
323
 
324
  // Cache?
325
  if ( $caching ) {
326
+ wppa_log( 'fso', 'Writring cachefile ' . str_replace( WPPA_CONTENT_PATH, '...', $cache_file ) . ' for shortcode {b}' . $wppa_current_shortcode . '{/b}. ' );
327
  wppa_put_contents( $cache_file, $out );
328
  }
329
 
 
 
 
330
  // Done
331
+ $tim = wppa_occur_timer( 'show', $_SERVER['REQUEST_URI'] . ' oc ' . wppa( 'mocc' ) , false, true );
332
+ wppa_reset_occurrance();
333
  return $out . $tim;
334
  }
335
  if ( wppa( 'is_admins_choice' ) ) {
402
  $temp = explode( ',', wppa( 'start_album' ) );
403
  if ( isset( $temp['1'] ) ) $parent = wppa_album_name_to_number( $temp['1'] );
404
  else $parent = '0';
405
+ if ( $parent === false ) {
406
+ return;
407
+ }
408
  if ( isset( $temp['2'] ) ) $limit = $temp['2'];
409
  else $limit = false;
410
  if ( $limit ) {
994
  if ( $caching ) {
995
  $extra = '';
996
  $size = strlen( $out );
997
+ if ( ! defined( 'DOING_AJAX' ) ) {
998
+ $extra = ' for shortcode {b}' . $wppa_current_shortcode . '{/b}. ';
999
+ if ( $size > 25 * 1024 ) {
1000
+ if ( ! isset( $wppa_current_shortcode_atts['delay'] ) ) {
1001
+ $extra .= ' File > 25k, maybe delay it?';
1002
+ }
1003
  }
1004
  }
1005
  wppa_log( 'fso', 'Writring cachefile ' . str_replace( WPPA_CONTENT_PATH, '...', $cache_file ) . $extra );
1007
  }
1008
 
1009
  // Reset
 
1010
  $timer = wppa_occur_timer( 'show', $_SERVER['REQUEST_URI'] . ' oc ' . wppa( 'mocc' ) );
1011
+ wppa_reset_occurrance();
1012
 
1013
  return $out . $timer;
1014
  }
5996
  static $queries;
5997
  static $time;
5998
  global $wppa_no_timer;
5999
+ global $wppa_current_shortcode;
6000
 
6001
  // Do they want us?
6002
  if ( $wppa_no_timer ) return '';
6011
  $nqueries = get_num_queries() - $queries;
6012
  $ntime = microtime( true ) - $time;
6013
  $result = "\n" .
6014
+ '<!-- End ' . $wppa_current_shortcode . ' ' . $title . ' ' .
6015
  sprintf( '%d queries in %3.1f ms. at %s',
6016
  $nqueries,
6017
  $ntime * 1000,
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.7.07.002
7
  *
8
  */
9
 
@@ -1577,6 +1577,7 @@ function wppa_is_enum( $var ) {
1577
  function wppa_log( $xtype, $msg, $trace = false, $listuri = false ) {
1578
  global $wppa_session;
1579
  global $wppa_log_file;
 
1580
  static $busy;
1581
  static $last_msg;
1582
  static $last_type;
@@ -1602,6 +1603,9 @@ static $repeat_count;
1602
  }
1603
  $busy = true;
1604
 
 
 
 
1605
  // Sanitize type
1606
  $t = strtolower( substr( $xtype, 0, 1 ) );
1607
  $u = strtolower( substr( $xtype, 1, 1 ) );
@@ -1645,6 +1649,7 @@ static $repeat_count;
1645
  switch( $u ) {
1646
  case 'r':
1647
  $type = '{span style="color:red;" }Err{/span}';
 
1648
  break;
1649
  case 'm':
1650
  if ( wppa_get_option( 'wppa_log_email' ) == 'no' ) {
@@ -1754,6 +1759,9 @@ static $repeat_count;
1754
  // Write log message
1755
  $msg = strip_tags( $msg );
1756
  $msg = wppa_nl2sp( $msg );
 
 
 
1757
  array_push( $contents, '{b}'.$type.'{/b}: on:'.wppa_local_date( 'd.m.Y H:i:s', time()).': '.wppa_get_user().' ('.getmypid().'): '.$msg. "\n" );
1758
 
1759
  // Log stacktrace 5 levels
@@ -5158,3 +5166,28 @@ global $wpdb;
5158
 
5159
  return $album;
5160
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.7.07.004
7
  *
8
  */
9
 
1577
  function wppa_log( $xtype, $msg, $trace = false, $listuri = false ) {
1578
  global $wppa_session;
1579
  global $wppa_log_file;
1580
+ global $wppa_current_shortcode;
1581
  static $busy;
1582
  static $last_msg;
1583
  static $last_type;
1603
  }
1604
  $busy = true;
1605
 
1606
+ // Init
1607
+ $err = false;
1608
+
1609
  // Sanitize type
1610
  $t = strtolower( substr( $xtype, 0, 1 ) );
1611
  $u = strtolower( substr( $xtype, 1, 1 ) );
1649
  switch( $u ) {
1650
  case 'r':
1651
  $type = '{span style="color:red;" }Err{/span}';
1652
+ $err = true;
1653
  break;
1654
  case 'm':
1655
  if ( wppa_get_option( 'wppa_log_email' ) == 'no' ) {
1759
  // Write log message
1760
  $msg = strip_tags( $msg );
1761
  $msg = wppa_nl2sp( $msg );
1762
+ if ( $err ) {
1763
+ $msg .= ' related shortcode: ' . $wppa_current_shortcode;
1764
+ }
1765
  array_push( $contents, '{b}'.$type.'{/b}: on:'.wppa_local_date( 'd.m.Y H:i:s', time()).': '.wppa_get_user().' ('.getmypid().'): '.$msg. "\n" );
1766
 
1767
  // Log stacktrace 5 levels
5166
 
5167
  return $album;
5168
  }
5169
+
5170
+ // Construct current shortcode
5171
+ function wppa_get_shortcode( $key, $atts ) {
5172
+
5173
+ // Init
5174
+ $result = '';
5175
+
5176
+ if ( $key && is_array( $atts ) ) {
5177
+
5178
+ $result = '[' . $key;
5179
+
5180
+ foreach ( array_keys( $atts ) as $key ) {
5181
+ if ( is_numeric( $key ) ) {
5182
+ $result .= ' ' . $atts[$key];
5183
+ }
5184
+ else {
5185
+ $result .= ' ' . $key . '="' . $atts[$key] . '"';
5186
+ }
5187
+ }
5188
+
5189
+ $result .= ']';
5190
+ }
5191
+
5192
+ return $result;
5193
+ }
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: 7.7.07.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,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '7.7.07.003'; // WPPA software version
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: 7.7.07.004
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 = '7.7.07.004'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30