Document Gallery - Version 4.1.2

Version Description

Download this release

Release Info

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

Code changes from version 4.1.3 to 4.1.2

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.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -422,13 +422,13 @@ 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.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
431
- integration with the [Thumber.co](https://thumber.co) service. For a small fee you can generate images for all of your
432
  attachments using a service designed specifically to work well with Document Gallery. **For a limited time,
433
  Thumber.co is offering a free 7-day trial of the basic subscription. If you don't like it, all you have to do is
434
  cancel and you won't pay a penny.**
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.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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 =
426
+ * **Bug Fix:** Resolves various errors reported following 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
431
+ integration with the [Thumber.co](https://www.thumber.co) service. For a small fee you can generate images for all of your
432
  attachments using a service designed specifically to work well with Document Gallery. **For a limited time,
433
  Thumber.co is offering a free 7-day trial of the basic subscription. If you don't like it, all you have to do is
434
  cancel and you won't pay a penny.**
admin/class-admin.php CHANGED
@@ -370,7 +370,8 @@ class DG_Admin {
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;
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;
admin/tabs/thumber-co-tab.php CHANGED
@@ -114,9 +114,9 @@ function dg_render_thumber_co_section() { ?>
114
  'thumbnails for the tricky file types that Document Gallery can\'t handle on its own. Files such as ' .
115
  'Word, PowerPoint, and PDFs can all be processed, allowing you to provide a more complete experience ' .
116
  'to your users. Further information, including a complete list of supported file types is available '.
117
- '<a href="http://thumber.co/about" target="_blank">here</a>.', 'document-gallery' ); ?></p>
118
 
119
- <p><?php _e( 'Once you <a href="http://thumber.co/subscriptions">register for a Thumber.co subscription</a>, simply enter your credentials below to get started!' ); ?></p>
120
  <?php if ( ! DG_Util::isPublicSite() ) : ?>
121
  <p>
122
  <em><?php _e( 'NOTE: It appears that you are on a private server not accessible from outside your local network. ' .
114
  'thumbnails for the tricky file types that Document Gallery can\'t handle on its own. Files such as ' .
115
  'Word, PowerPoint, and PDFs can all be processed, allowing you to provide a more complete experience ' .
116
  'to your users. Further information, including a complete list of supported file types is available '.
117
+ '<a href="https://www.thumber.co/about" target="_blank">here</a>.', 'document-gallery' ); ?></p>
118
 
119
+ <p><?php _e( 'Once you <a href="https://www.thumber.co/subscriptions">register for a Thumber.co subscription</a>, simply enter your credentials below to get started!' ); ?></p>
120
  <?php if ( ! DG_Util::isPublicSite() ) : ?>
121
  <p>
122
  <em><?php _e( 'NOTE: It appears that you are on a private server not accessible from outside your local network. ' .
admin/tabs/thumbnail-management-tab.php CHANGED
@@ -1,7 +1,6 @@
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,7 +95,6 @@ function dg_render_thumbnail_section() {
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 );
1
  <?php
2
  defined( 'WPINC' ) OR exit;
3
 
 
4
  $dg_url_params = array( 'page' => DG_OPTION_NAME, 'tab' => 'thumbnail-management-tab' );
5
 
6
  /**
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 );
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.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__ ) );
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.2
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.2' );
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($options['thumber']['width'] . 'x' . $options['thumber']['height']);
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();
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[]|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[] The matched thumbs.
318
  */
319
  public static function getThumbs($dimensions = null) {
320
  self::initThumbs();
inc/class-thumber.php CHANGED
@@ -237,9 +237,6 @@ class DG_Thumber extends DG_AbstractThumber {
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,7 +292,7 @@ class DG_Thumber extends DG_AbstractThumber {
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,6 +315,5 @@ class DG_Thumber extends DG_AbstractThumber {
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
  }
237
  if ( false === ( $temp_path = $generator->getThumbnail( $ID, $pg ) ) ) {
238
  return false;
239
  }
 
 
 
240
  } else {
241
  DG_Logger::writeLog(
242
  DG_LogLevel::Error,
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
 
316
  // include all internal DG thumbers
317
  foreach ( glob( DG_PATH . 'inc/thumbers/*.php' ) as $path ) {
 
318
  include_once $path;
319
  }
inc/thumbers/class-thumber-co-thumber.php CHANGED
@@ -35,7 +35,8 @@ class DG_ThumberCoThumber extends DG_AbstractThumber {
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();
35
  */
36
  public static function init() {
37
  $options = DG_Thumber::getOptions();
38
+ $active = $options['active'];
39
+ if ( $active['thumber-co'] ) {
40
  parent::init();
41
  self::$webhook = admin_url( 'admin-post.php?action=' . self::ThumberAction );
42
  self::$client = DG_ThumberClient::getInstance();