Document Gallery - Version 2.2.1

Version Description

  • Bug Fix: PHP installs older than 5.3 were crashing with version 2.2. This release patches the issue.
Download this release

Release Info

Developer dan.rossiter
Plugin Icon 128x128 Document Gallery
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2 to 2.2.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 3.6
6
  Tested up to: 4.0
7
- Stable tag: 2.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -392,6 +392,10 @@ To see a list of features planned for the future as well as to propose your own
392
  ideas for future Document Gallery development, take a look at our
393
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
394
 
 
 
 
 
395
  = 2.2 =
396
  * **Note:** This release is the first release where development has been done by
397
  multiple people. I would like to give a massive thank you to
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 3.6
6
  Tested up to: 4.0
7
+ Stable tag: 2.2.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
392
  ideas for future Document Gallery development, take a look at our
393
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
394
 
395
+ = 2.2.1 =
396
+ * **Bug Fix:** PHP installs older than 5.3 were crashing with version 2.2. This release
397
+ patches the issue.
398
+
399
  = 2.2 =
400
  * **Note:** This release is the first release where development has been done by
401
  multiple people. I would like to give a massive thank you to
admin/class-admin.php CHANGED
@@ -527,7 +527,7 @@ class DG_Admin {
527
 
528
  if (isset($values['ajax'])) {
529
  echo '[' . implode(',', $deleted) . ']';
530
- add_filter('wp_redirect', function(){ die; }, 1, 0);
531
  }
532
  }
533
 
@@ -828,9 +828,7 @@ var URL_params = <?php echo '{'.trim($json_like,', ').'}'; ?>;
828
  public static function renderLoggingSection() {
829
  $log_list = DG_Logger::readLog();
830
  if ($log_list) {
831
- $levels = array_map(
832
- function($e) { return '<span class="logLabel ' . strtolower($e) . '">' . strtoupper($e) . '</span>'; },
833
- array_keys(DG_LogLevel::getLogLevels()));
834
 
835
  $thead = '<tr>'.
836
  '<th scope="col" class="manage-column column-date"><span>'.__('Date', 'document-gallery').'</span></th>'.
@@ -900,6 +898,15 @@ var URL_params = <?php echo '{'.trim($json_like,', ').'}'; ?>;
900
  echo '<div class="noLog">'.__('There are no log entries at this time.', 'document-gallery').'<br />'.__('For Your information:', 'document-gallery').' <strong><i>'.__('Logging', 'document-gallery').'</i></strong> '.(DG_Logger::logEnabled()?'<span class="loggingON">'.__('is turned ON', 'document-gallery').'!</span>':'<span class="loggingOFF">'.__('is turned OFF', 'document-gallery').'!</span>').'</div>';
901
  }
902
  }
 
 
 
 
 
 
 
 
 
903
 
904
  /**
905
  * Render a checkbox field.
@@ -960,6 +967,13 @@ var URL_params = <?php echo '{'.trim($json_like,', ').'}'; ?>;
960
 
961
  print '</select> ' . $args['description'];
962
  }
 
 
 
 
 
 
 
963
 
964
  /**
965
  * Blocks instantiation. All functions are static.
527
 
528
  if (isset($values['ajax'])) {
529
  echo '[' . implode(',', $deleted) . ']';
530
+ add_filter('wp_redirect', array(__CLASS__, '_exit'), 1, 0);
531
  }
532
  }
533
 
828
  public static function renderLoggingSection() {
829
  $log_list = DG_Logger::readLog();
830
  if ($log_list) {
831
+ $levels = array_map(array(__CLASS__, 'getLogLabelSpan'), array_keys(DG_LogLevel::getLogLevels()));
 
 
832
 
833
  $thead = '<tr>'.
834
  '<th scope="col" class="manage-column column-date"><span>'.__('Date', 'document-gallery').'</span></th>'.
898
  echo '<div class="noLog">'.__('There are no log entries at this time.', 'document-gallery').'<br />'.__('For Your information:', 'document-gallery').' <strong><i>'.__('Logging', 'document-gallery').'</i></strong> '.(DG_Logger::logEnabled()?'<span class="loggingON">'.__('is turned ON', 'document-gallery').'!</span>':'<span class="loggingOFF">'.__('is turned OFF', 'document-gallery').'!</span>').'</div>';
899
  }
900
  }
901
+
902
+ /**
903
+ * Takes label name and returns SPAN tag.
904
+ * @param string $e label name.
905
+ * @return string SPAN tag
906
+ */
907
+ private static function getLogLabelSpan($e) {
908
+ return '<span class="logLabel ' . strtolower($e) . '">' . strtoupper($e) . '</span>';
909
+ }
910
 
911
  /**
912
  * Render a checkbox field.
967
 
968
  print '</select> ' . $args['description'];
969
  }
970
+
971
+ /**
972
+ * Wraps the PHP exit language construct.
973
+ */
974
+ private static function _exit() {
975
+ exit;
976
+ }
977
 
978
  /**
979
  * Blocks instantiation. All functions are static.
document-gallery.php CHANGED
@@ -5,14 +5,14 @@ defined('WPINC') OR exit;
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
- Version: 2.2
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
- define('DG_VERSION', '2.2');
16
 
17
  // define helper paths & URLs
18
  define('DG_BASENAME', plugin_basename(__FILE__));
@@ -38,10 +38,7 @@ DG_Setup::maybeUpdate();
38
 
39
  // validate options if desired
40
  if ($dg_options['validation']) {
41
- add_action('init', function(){
42
- add_filter('pre_update_option_' . DG_OPTION_NAME,
43
- array('DocumentGallery', 'validateOptionsStructure'), 10, 2);
44
- });
45
  }
46
 
47
  // I18n
@@ -209,6 +206,13 @@ class DocumentGallery {
209
  }
210
  }
211
 
 
 
 
 
 
 
 
212
  /**
213
  * Checks whether the given options match the option schema.
214
  * @param multivar $new The new options to be validated.
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
+ Version: 2.2.1
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
+ define('DG_VERSION', '2.2.1');
16
 
17
  // define helper paths & URLs
18
  define('DG_BASENAME', plugin_basename(__FILE__));
38
 
39
  // validate options if desired
40
  if ($dg_options['validation']) {
41
+ add_action('init', array('DocumentGallery', 'addValidation'));
 
 
 
42
  }
43
 
44
  // I18n
206
  }
207
  }
208
 
209
+ /**
210
+ * Adds hook to validate DG options every time save is attempted.
211
+ */
212
+ public static function addValidation() {
213
+ add_filter('pre_update_option_' . DG_OPTION_NAME, array('DocumentGallery', 'validateOptionsStructure'), 10, 2);
214
+ }
215
+
216
  /**
217
  * Checks whether the given options match the option schema.
218
  * @param multivar $new The new options to be validated.
inc/class-logger.php CHANGED
@@ -51,9 +51,7 @@ class DG_Logger {
51
  if (isset($node['function'])) {
52
  $args = '';
53
  if (isset($node['args'])) {
54
- $args = implode(', ', array_map(
55
- function($v) { return print_r($v, true); },
56
- $node['args']));
57
  }
58
 
59
  $trace_str .= "{$node['function']}($args)" . PHP_EOL;
@@ -75,6 +73,15 @@ class DG_Logger {
75
  }
76
  }
77
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Reads the current blog's log file, placing the values in to a 2-dimensional array.
80
  * @param int $skip How many lines to skip before returning rows.
51
  if (isset($node['function'])) {
52
  $args = '';
53
  if (isset($node['args'])) {
54
+ $args = implode(', ', array_map(array(__CLASS__, 'print_r'), $node['args']));
 
 
55
  }
56
 
57
  $trace_str .= "{$node['function']}($args)" . PHP_EOL;
73
  }
74
  }
75
 
76
+ /**
77
+ * Wraps print_r passing true for the return argument.
78
+ * @param unknown $v
79
+ * @return mixed
80
+ */
81
+ private static function print_r($v) {
82
+ return print_r($v, true);
83
+ }
84
+
85
  /**
86
  * Reads the current blog's log file, placing the values in to a 2-dimensional array.
87
  * @param int $skip How many lines to skip before returning rows.