Document Gallery - Version 4.1.3

Version Description

Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.3

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: attachments, library, thumbnail, documents, gallery, word, 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: 4.1
6
  Tested up to: 4.4
7
- Stable tag: 4.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -306,10 +306,7 @@ The following is an example taken from the Document Gallery source (with a few
306
  modifications for ease of readability), where we add thumbnail generation for
307
  all Audio/Video filetypes supported by WordPress:
308
 
309
- `// tells DG_AbstractThumber to create an instance of the class and apply to dg_thumbers filter
310
- ImageThumber::init();
311
-
312
- class ImageThumber extends DG_AbstractThumber {
313
 
314
  /**
315
  * @return string[] The extensions supported by this thumber.
@@ -341,7 +338,10 @@ ImageThumber::init();
341
  public function getPriority() {
342
  return 100;
343
  }
344
- }`
 
 
 
345
 
346
  **Filter Inclusion of Default Document Gallery CSS**
347
 
@@ -422,6 +422,9 @@ To see a list of features planned for the future as well as to propose your own
422
  ideas for future Document Gallery development, take a look at our
423
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
424
 
 
 
 
425
  = 4.1 =
426
  * **Enhancement:** At long last, support for Microsoft Office files (Word, PowerPoint, Publisher, Visio), as well as a
427
  boat-load of [other formats](https://www.thumber.co/about#filetypes), has been re-added to Document Gallery by way of
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: 4.1
6
  Tested up to: 4.4
7
+ Stable tag: 4.1.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
306
  modifications for ease of readability), where we add thumbnail generation for
307
  all Audio/Video filetypes supported by WordPress:
308
 
309
+ `class ImageThumber extends DG_AbstractThumber {
 
 
 
310
 
311
  /**
312
  * @return string[] The extensions supported by this thumber.
338
  public function getPriority() {
339
  return 100;
340
  }
341
+ }
342
+
343
+ // tells DG_AbstractThumber to create an instance of the class and apply to dg_thumbers filter
344
+ ImageThumber::init();`
345
 
346
  **Filter Inclusion of Default Document Gallery CSS**
347
 
422
  ideas for future Document Gallery development, take a look at our
423
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
424
 
425
+ = 4.1.1 & 4.1.2 & 4.1.3 =
426
+ * **Bug Fix:** Resolves various errors reported following `4.1` release.
427
+
428
  = 4.1 =
429
  * **Enhancement:** At long last, support for Microsoft Office files (Word, PowerPoint, Publisher, Visio), as well as a
430
  boat-load of [other formats](https://www.thumber.co/about#filetypes), has been re-added to Document Gallery by way of
admin/class-admin.php CHANGED
@@ -370,8 +370,7 @@ class DG_Admin {
370
  $ID = - 1;
371
  }
372
 
373
- $thumbs = DG_Thumb::getThumbs();
374
- if ( isset( $_POST[DG_OPTION_NAME]['upload'] ) && isset( $_FILES['file'] ) && isset( $thumbs[$ID] ) ) {
375
  $uploaded_filename = self::validateUploadedFile();
376
  if ( $uploaded_filename && ( $thumb = DG_Thumber::setThumbnail( $ID, $uploaded_filename ) ) ) {
377
  $responseArr['result'] = true;
370
  $ID = - 1;
371
  }
372
 
373
+ if ( isset( $_POST[DG_OPTION_NAME]['upload'] ) && isset( $_FILES['file'] ) ) {
 
374
  $uploaded_filename = self::validateUploadedFile();
375
  if ( $uploaded_filename && ( $thumb = DG_Thumber::setThumbnail( $ID, $uploaded_filename ) ) ) {
376
  $responseArr['result'] = true;
admin/tabs/thumbnail-management-tab.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
 
4
  $dg_url_params = array( 'page' => DG_OPTION_NAME, 'tab' => 'thumbnail-management-tab' );
5
 
6
  /**
@@ -95,6 +96,7 @@ function dg_render_thumbnail_section() {
95
  $order = $dg_url_params['order'] = dg_get_order_param( $order_options );
96
  $limit = $dg_url_params['limit'] = dg_get_limit_param();
97
 
 
98
  $thumbs = DG_Thumb::getThumbs( $options['width'] . 'x' . $options['height'] );
99
  uasort( $thumbs, 'dg_cmp_thumb' );
100
  $thumbs_number = count( $thumbs );
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
4
+ global $dg_url_params;
5
  $dg_url_params = array( 'page' => DG_OPTION_NAME, 'tab' => 'thumbnail-management-tab' );
6
 
7
  /**
96
  $order = $dg_url_params['order'] = dg_get_order_param( $order_options );
97
  $limit = $dg_url_params['limit'] = dg_get_limit_param();
98
 
99
+ /** @var DG_Thumb[] $thumbs */
100
  $thumbs = DG_Thumb::getThumbs( $options['width'] . 'x' . $options['height'] );
101
  uasort( $thumbs, 'dg_cmp_thumb' );
102
  $thumbs_number = count( $thumbs );
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: 4.1.1
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv3
12
  Text Domain: document-gallery
13
  */
14
 
15
- define( 'DG_VERSION', '4.1.1' );
16
 
17
  // define helper paths & URLs
18
  define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
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: 4.1.3
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv3
12
  Text Domain: document-gallery
13
  */
14
 
15
+ define( 'DG_VERSION', '4.1.3' );
16
 
17
  // define helper paths & URLs
18
  define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
inc/class-setup.php CHANGED
@@ -406,7 +406,7 @@ class DG_Setup {
406
  'mime_types' => array()
407
  );
408
 
409
- $old_thumbs = DG_Thumb::getThumbs();
410
  DG_Thumb::purgeThumbs();
411
  foreach ( $old_thumbs as $thumb ) {
412
  if ( $thumb->isSuccess() ) {
406
  'mime_types' => array()
407
  );
408
 
409
+ $old_thumbs = DG_Thumb::getThumbs($options['thumber']['width'] . 'x' . $options['thumber']['height']);
410
  DG_Thumb::purgeThumbs();
411
  foreach ( $old_thumbs as $thumb ) {
412
  if ( $thumb->isSuccess() ) {
inc/class-thumb.php CHANGED
@@ -314,7 +314,7 @@ class DG_Thumb {
314
  * Gets either a nested associative array mapping ID to dimension to thumb or an associative array mapping ID to thumb.
315
  *
316
  * @param $dimensions string WIDTHxHEIGHT
317
- * @return DG_Thumb[] The matched thumbs.
318
  */
319
  public static function getThumbs($dimensions = null) {
320
  self::initThumbs();
314
  * Gets either a nested associative array mapping ID to dimension to thumb or an associative array mapping ID to thumb.
315
  *
316
  * @param $dimensions string WIDTHxHEIGHT
317
+ * @return DG_Thumb[]|DG_Thumb[][] The matched thumbs.
318
  */
319
  public static function getThumbs($dimensions = null) {
320
  self::initThumbs();
inc/class-thumber.php CHANGED
@@ -237,6 +237,9 @@ class DG_Thumber extends DG_AbstractThumber {
237
  if ( false === ( $temp_path = $generator->getThumbnail( $ID, $pg ) ) ) {
238
  return false;
239
  }
 
 
 
240
  } else {
241
  DG_Logger::writeLog(
242
  DG_LogLevel::Error,
@@ -292,7 +295,7 @@ class DG_Thumber extends DG_AbstractThumber {
292
  $thumb->setDimensions( $options['width'] . 'x' . $options['height'] );
293
  $thumb->setTimestamp( time() );
294
  $thumb->setRelativePath( substr( $thumb_path, strlen( $upload['basedir'] ) + 1 ) );
295
- $thumb->setGenerator( get_class( $generator ) );
296
  $thumb->save();
297
 
298
  return $thumb;
@@ -315,5 +318,6 @@ class DG_Thumber extends DG_AbstractThumber {
315
 
316
  // include all internal DG thumbers
317
  foreach ( glob( DG_PATH . 'inc/thumbers/*.php' ) as $path ) {
 
318
  include_once $path;
319
  }
237
  if ( false === ( $temp_path = $generator->getThumbnail( $ID, $pg ) ) ) {
238
  return false;
239
  }
240
+
241
+ // NOTE: get string representation to be stored with thumb in DB
242
+ $generator = get_class( $generator );
243
  } else {
244
  DG_Logger::writeLog(
245
  DG_LogLevel::Error,
295
  $thumb->setDimensions( $options['width'] . 'x' . $options['height'] );
296
  $thumb->setTimestamp( time() );
297
  $thumb->setRelativePath( substr( $thumb_path, strlen( $upload['basedir'] ) + 1 ) );
298
+ $thumb->setGenerator( $generator );
299
  $thumb->save();
300
 
301
  return $thumb;
318
 
319
  // include all internal DG thumbers
320
  foreach ( glob( DG_PATH . 'inc/thumbers/*.php' ) as $path ) {
321
+ /** @noinspection PhpIncludeInspection */
322
  include_once $path;
323
  }
inc/thumbers/class-audio-video-thumber.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
4
- DG_AudioVideoThumber::init();
5
-
6
  class DG_AudioVideoThumber extends DG_AbstractThumber {
7
 
8
  /**
@@ -85,4 +83,6 @@ class DG_AudioVideoThumber extends DG_AbstractThumber {
85
  public function getPriority() {
86
  return 95;
87
  }
88
- }
 
 
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
 
 
4
  class DG_AudioVideoThumber extends DG_AbstractThumber {
5
 
6
  /**
83
  public function getPriority() {
84
  return 95;
85
  }
86
+ }
87
+
88
+ DG_AudioVideoThumber::init();
inc/thumbers/class-ghostscript-thumber.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
4
- DG_GhostscriptThumber::init();
5
-
6
  class DG_GhostscriptThumber extends DG_AbstractThumber {
7
 
8
  /**
@@ -147,4 +145,6 @@ class DG_GhostscriptThumber extends DG_AbstractThumber {
147
  public function getPriority() {
148
  return 75;
149
  }
150
- }
 
 
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
 
 
4
  class DG_GhostscriptThumber extends DG_AbstractThumber {
5
 
6
  /**
145
  public function getPriority() {
146
  return 75;
147
  }
148
+ }
149
+
150
+ DG_GhostscriptThumber::init();
inc/thumbers/class-image-thumber.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
4
- DG_ImageThumber::init();
5
-
6
  class DG_ImageThumber extends DG_AbstractThumber {
7
 
8
  /**
@@ -35,4 +33,6 @@ class DG_ImageThumber extends DG_AbstractThumber {
35
  public function getPriority() {
36
  return 100;
37
  }
38
- }
 
 
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
 
 
4
  class DG_ImageThumber extends DG_AbstractThumber {
5
 
6
  /**
33
  public function getPriority() {
34
  return 100;
35
  }
36
+ }
37
+
38
+ DG_ImageThumber::init();
inc/thumbers/class-imagick-thumber.php CHANGED
@@ -3,8 +3,6 @@ defined( 'WPINC' ) OR exit;
3
 
4
  include_once DG_PATH . 'inc/class-image-editor-imagick.php';
5
 
6
- DG_ImagickThumber::init();
7
-
8
  class DG_ImagickThumber extends DG_AbstractThumber {
9
 
10
  /**
@@ -85,4 +83,6 @@ class DG_ImagickThumber extends DG_AbstractThumber {
85
  {
86
  return 50;
87
  }
88
- }
 
 
3
 
4
  include_once DG_PATH . 'inc/class-image-editor-imagick.php';
5
 
 
 
6
  class DG_ImagickThumber extends DG_AbstractThumber {
7
 
8
  /**
83
  {
84
  return 50;
85
  }
86
+ }
87
+
88
+ DG_ImagickThumber::init();
inc/thumbers/class-thumber-co-thumber.php CHANGED
@@ -8,8 +8,6 @@ add_filter( 'allowed_http_origin', array( 'DG_ThumberCoThumber', 'allowThumberWe
8
  add_filter( 'upload_mimes', array( 'DG_ThumberCoThumber', 'customMimeTypes' ) );
9
  add_action( 'admin_post_nopriv_' . DG_ThumberCoThumber::ThumberAction, array( DG_ThumberClient::getInstance(), 'receiveThumbResponse' ), 5, 0);
10
 
11
- DG_ThumberCoThumber::init();
12
-
13
  class DG_ThumberCoThumber extends DG_AbstractThumber {
14
 
15
  /**
@@ -37,8 +35,7 @@ class DG_ThumberCoThumber extends DG_AbstractThumber {
37
  */
38
  public static function init() {
39
  $options = DG_Thumber::getOptions();
40
- $active = $options['active'];
41
- if ( $active['thumber-co'] ) {
42
  parent::init();
43
  self::$webhook = admin_url( 'admin-post.php?action=' . self::ThumberAction );
44
  self::$client = DG_ThumberClient::getInstance();
@@ -169,4 +166,6 @@ class DG_ThumberCoThumber extends DG_AbstractThumber {
169
  $sub = self::$client->getSubscription();
170
  return ( ! $sub || empty( $sub['thumb_size_limit'] ) ) || ( $width <= $sub['thumb_size_limit'] && $height <= $sub['thumb_size_limit'] );
171
  }
172
- }
 
 
8
  add_filter( 'upload_mimes', array( 'DG_ThumberCoThumber', 'customMimeTypes' ) );
9
  add_action( 'admin_post_nopriv_' . DG_ThumberCoThumber::ThumberAction, array( DG_ThumberClient::getInstance(), 'receiveThumbResponse' ), 5, 0);
10
 
 
 
11
  class DG_ThumberCoThumber extends DG_AbstractThumber {
12
 
13
  /**
35
  */
36
  public static function init() {
37
  $options = DG_Thumber::getOptions();
38
+ if ( $options['active']['thumber-co'] ) {
 
39
  parent::init();
40
  self::$webhook = admin_url( 'admin-post.php?action=' . self::ThumberAction );
41
  self::$client = DG_ThumberClient::getInstance();
166
  $sub = self::$client->getSubscription();
167
  return ( ! $sub || empty( $sub['thumb_size_limit'] ) ) || ( $width <= $sub['thumb_size_limit'] && $height <= $sub['thumb_size_limit'] );
168
  }
169
+ }
170
+
171
+ DG_ThumberCoThumber::init();