WooCommerce PDF Invoices & Packing Slips - Version 2.10.1

Version Description

  • Fix: prevent fatal errors if template functions cannot be loaded
Download this release

Release Info

Developer pomegranate
Plugin Icon 128x128 WooCommerce PDF Invoices & Packing Slips
Version 2.10.1
Comparing to
See all releases

Code changes from version 2.10.0 to 2.10.1

includes/class-wcpdf-main.php CHANGED
@@ -29,10 +29,7 @@ class Main {
29
  }
30
 
31
  // include template specific custom functions
32
- $template_path = WPO_WCPDF()->settings->get_template_path();
33
- if ( file_exists( $template_path . '/template-functions.php' ) ) {
34
- require_once( $template_path . '/template-functions.php' );
35
- }
36
 
37
  // test mode
38
  add_filter( 'wpo_wcpdf_document_use_historical_settings', array( $this, 'test_mode_settings' ), 15, 2 );
@@ -396,6 +393,19 @@ class Main {
396
  exit;
397
  }
398
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  /**
400
  * Return tmp path for different plugin processes
401
  */
29
  }
30
 
31
  // include template specific custom functions
32
+ $this->load_template_functions();
 
 
 
33
 
34
  // test mode
35
  add_filter( 'wpo_wcpdf_document_use_historical_settings', array( $this, 'test_mode_settings' ), 15, 2 );
393
  exit;
394
  }
395
 
396
+ /**
397
+ * Include template specific custom functions
398
+ */
399
+ private function load_template_functions() {
400
+ $file = trailingslashit( WPO_WCPDF()->settings->get_template_path() ) . 'template-functions.php';
401
+ if ( file_exists( $file ) ) {
402
+ $loaded = @include_once( $file );
403
+ if ( $loaded === false ) {
404
+ wcpdf_log_error( sprintf( 'Failed to load template functions: %s', $file ), 'critical' );
405
+ }
406
+ }
407
+ }
408
+
409
  /**
410
  * Return tmp path for different plugin processes
411
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, pdf, invoices, packing slips, print, delivery notes, invoice,
5
  Requires at least: 3.5
6
  Tested up to: 5.8
7
  Requires PHP: 7.1
8
- Stable tag: 2.10.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -102,6 +102,9 @@ There's a setting on the Status tab of the settings page that allows you to togg
102
 
103
  == Changelog ==
104
 
 
 
 
105
  = 2.10.0 =
106
  * New: Use minified JS & CSS files to reduce load time on live sites (enabling `SCRIPT_DEBUG` will load full versions)
107
  * New: Selected template setting is now stored as a reference ID rather than a fixed path ([#209](https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/pull/209))
5
  Requires at least: 3.5
6
  Tested up to: 5.8
7
  Requires PHP: 7.1
8
+ Stable tag: 2.10.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
102
 
103
  == Changelog ==
104
 
105
+ = 2.10.1 =
106
+ * Fix: prevent fatal errors if template functions cannot be loaded
107
+
108
  = 2.10.0 =
109
  * New: Use minified JS & CSS files to reduce load time on live sites (enabling `SCRIPT_DEBUG` will load full versions)
110
  * New: Selected template setting is now stored as a reference ID rather than a fixed path ([#209](https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips/pull/209))
woocommerce-pdf-invoices-packingslips.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
- * Version: 2.10.0
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
@@ -21,7 +21,7 @@ if ( !class_exists( 'WPO_WCPDF' ) ) :
21
 
22
  class WPO_WCPDF {
23
 
24
- public $version = '2.10.0';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
  public $legacy_textdomain;
3
  * Plugin Name: WooCommerce PDF Invoices & Packing Slips
4
  * Plugin URI: http://www.wpovernight.com
5
  * Description: Create, print & email PDF invoices & packing slips for WooCommerce orders.
6
+ * Version: 2.10.1
7
  * Author: Ewout Fernhout
8
  * Author URI: http://www.wpovernight.com
9
  * License: GPLv2 or later
21
 
22
  class WPO_WCPDF {
23
 
24
+ public $version = '2.10.1';
25
  public $plugin_basename;
26
  public $legacy_mode;
27
  public $legacy_textdomain;