WooCommerce PDF Invoices - Version 2.9.10

Version Description

  • November 13, 2017 =

  • Added: Multisite compatibility by changing uploads directory.

  • Added: WC required version comments.

  • Fixed: Missing $line_items on invoice template for has_only_virtual_products().

  • Fixed: Fatal error non-numeric value.

  • Fixed: Enhanced select options not removable.

Download this release

Release Info

Developer baaaaas
Plugin Icon 128x128 WooCommerce PDF Invoices
Version 2.9.10
Comparing to
See all releases

Code changes from version 2.9.9 to 2.9.10

bootstrap.php CHANGED
@@ -3,13 +3,15 @@
3
  * Plugin Name: WooCommerce PDF Invoices
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
  * Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
- * Version: 2.9.9
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
  * Text Domain: woocommerce-pdf-invoices
12
  * Domain Path: /lang
 
 
13
  */
14
 
15
  defined( 'ABSPATH' ) or exit;
@@ -17,9 +19,9 @@ defined( 'ABSPATH' ) or exit;
17
  /**
18
  * @deprecated instead use WPI_VERSION.
19
  */
20
- define( 'BEWPI_VERSION', '2.9.9' );
21
 
22
- define( 'WPI_VERSION', '2.9.9' );
23
 
24
  /**
25
  * Load WooCommerce PDF Invoices plugin.
3
  * Plugin Name: WooCommerce PDF Invoices
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-pdf-invoices
5
  * Description: Automatically generate and attach customizable PDF Invoices to WooCommerce emails and connect with Dropbox, Google Drive, OneDrive or Egnyte.
6
+ * Version: 2.9.10
7
  * Author: Bas Elbers
8
  * Author URI: http://wcpdfinvoices.com
9
  * License: GPL-2.0+
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
  * Text Domain: woocommerce-pdf-invoices
12
  * Domain Path: /lang
13
+ * WC requires at least: 2.6.14
14
+ * WC tested up to: 3.2.3
15
  */
16
 
17
  defined( 'ABSPATH' ) or exit;
19
  /**
20
  * @deprecated instead use WPI_VERSION.
21
  */
22
+ define( 'BEWPI_VERSION', '2.9.10' );
23
 
24
+ define( 'WPI_VERSION', '2.9.10' );
25
 
26
  /**
27
  * Load WooCommerce PDF Invoices plugin.
includes/admin/settings/class-general.php CHANGED
@@ -212,12 +212,13 @@ if ( ! class_exists( 'BEWPI_General_Settings' ) ) {
212
  public function sanitize( $input ) {
213
  $output = get_option( $this->settings_key );
214
 
215
- foreach ( $input as $key => $value ) {
216
  if ( ! isset( $input[ $key ] ) ) {
 
217
  continue;
218
  }
219
 
220
- if ( is_array( $input[ $key ] ) ) {
221
  $output[ $key ] = $input[ $key ];
222
  continue;
223
  }
@@ -226,11 +227,6 @@ if ( ! class_exists( 'BEWPI_General_Settings' ) ) {
226
  $output[ $key ] = stripslashes( $input[ $key ] );
227
  }
228
 
229
- // Sanitize email.
230
- if ( isset( $input['email_it_in_account'] ) ) {
231
- $output['email_it_in_account'] = sanitize_email( $input['email_it_in_account'] );
232
- }
233
-
234
  return apply_filters( 'bewpi_sanitized_' . $this->settings_key, $output, $input );
235
  }
236
  }
212
  public function sanitize( $input ) {
213
  $output = get_option( $this->settings_key );
214
 
215
+ foreach ( $output as $key => $value ) {
216
  if ( ! isset( $input[ $key ] ) ) {
217
+ $output[ $key ] = is_array( $output[ $key ] ) ? array() : '';
218
  continue;
219
  }
220
 
221
+ if ( is_array( $output[ $key ] ) ) {
222
  $output[ $key ] = $input[ $key ];
223
  continue;
224
  }
227
  $output[ $key ] = stripslashes( $input[ $key ] );
228
  }
229
 
 
 
 
 
 
230
  return apply_filters( 'bewpi_sanitized_' . $this->settings_key, $output, $input );
231
  }
232
  }
includes/admin/settings/class-template.php CHANGED
@@ -532,18 +532,20 @@ if ( ! class_exists( 'BEWPI_Template_Settings' ) ) {
532
  * @return mixed|void
533
  */
534
  public function sanitize( $input ) {
535
- $output = array();
536
 
537
- // strip strings.
538
- foreach ( $input as $key => $value ) {
 
 
 
539
 
540
- if ( is_array( $input[ $key ] ) ) {
541
  $output[ $key ] = $input[ $key ];
542
  continue;
543
  }
544
 
545
  if ( 'bewpi_company_logo' === $key ) {
546
- $output[ $key ] = '';
547
  continue;
548
  }
549
 
532
  * @return mixed|void
533
  */
534
  public function sanitize( $input ) {
535
+ $output = get_option( $this->settings_key );
536
 
537
+ foreach ( $output as $key => $value ) {
538
+ if ( ! isset( $input[ $key ] ) ) {
539
+ $output[ $key ] = is_array( $output[ $key ] ) ? array() : '';
540
+ continue;
541
+ }
542
 
543
+ if ( is_array( $output[ $key ] ) ) {
544
  $output[ $key ] = $input[ $key ];
545
  continue;
546
  }
547
 
548
  if ( 'bewpi_company_logo' === $key ) {
 
549
  continue;
550
  }
551
 
includes/admin/views/html-rate-notice.php CHANGED
@@ -10,13 +10,10 @@
10
  * @version 1.0.0
11
  */
12
 
13
- $current_user = wp_get_current_user();
14
- $user_firstname = '';
15
- if ( ! empty( $current_user->user_firstname ) ) {
16
- $user_firstname = ' ' . $current_user->user_firstname;
17
- }
18
- $rate_url = 'https://wordpress.org/support/view/plugin-reviews/woocommerce-pdf-invoices?rate=5#postform';
19
  ?>
20
- <div class="updated notice notice-success is-dismissible" data-dismissible="rate-forever">
21
  <p><?php printf( __( 'Hi%1$s! You\'re using <b>WooCommerce PDF Invoices</b> for some time now and we would appreciate your <a href="%2$s" target="_blank">★★★★★</a> rating. It will support future development big-time.', 'woocommerce-pdf-invoices' ), esc_html( $user_firstname ), $rate_url ); ?></p>
22
  </div>
10
  * @version 1.0.0
11
  */
12
 
13
+ $current_user = wp_get_current_user();
14
+ $user_firstname = ! empty( $current_user->user_firstname ) ? ' ' . $current_user->user_firstname : '';
15
+ $rate_url = 'https://wordpress.org/support/view/plugin-reviews/woocommerce-pdf-invoices?rate=5#postform';
 
 
 
16
  ?>
17
+ <div class="updated notice notice-success is-dismissible">
18
  <p><?php printf( __( 'Hi%1$s! You\'re using <b>WooCommerce PDF Invoices</b> for some time now and we would appreciate your <a href="%2$s" target="_blank">★★★★★</a> rating. It will support future development big-time.', 'woocommerce-pdf-invoices' ), esc_html( $user_firstname ), $rate_url ); ?></p>
19
  </div>
includes/templates/invoice/simple/minimal/body.php CHANGED
@@ -18,6 +18,7 @@
18
  $templater = WPI()->templater();
19
  $order = $templater->order;
20
  $invoice = $templater->invoice;
 
21
  $formatted_shipping_address = $order->get_formatted_shipping_address();
22
  $formatted_billing_address = $order->get_formatted_billing_address();
23
  $columns = $invoice->get_columns();
18
  $templater = WPI()->templater();
19
  $order = $templater->order;
20
  $invoice = $templater->invoice;
21
+ $line_items = $order->get_items( 'line_item' );
22
  $formatted_shipping_address = $order->get_formatted_shipping_address();
23
  $formatted_billing_address = $order->get_formatted_billing_address();
24
  $columns = $invoice->get_columns();
includes/woocommerce-pdf-invoices.php CHANGED
@@ -54,10 +54,30 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
54
  return self::$_instance;
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * WooCommerce Constructor.
59
  */
60
  private function __construct() {
 
 
 
 
61
  $this->define_constants();
62
  $this->load_plugin_textdomain();
63
  $this->init_hooks();
@@ -178,6 +198,7 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
178
  'add_plugin_action_links',
179
  ) );
180
  add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
 
181
 
182
  BEWPI_Abstract_Settings::init_hooks();
183
  BEWPI_Admin_Notices::init_hooks();
@@ -846,6 +867,41 @@ if ( ! class_exists( 'BE_WooCommerce_PDF_Invoices' ) ) {
846
  return in_array( $email, (array) $this->get_option( 'general', 'email_types' ), true );
847
  }
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  /**
850
  * Get invoice by order ID.
851
  *
54
  return self::$_instance;
55
  }
56
 
57
+ /**
58
+ * Setup multisite sepcific upload dir.
59
+ *
60
+ * @param array $upload_dir uploads dir data.
61
+ *
62
+ * @return array
63
+ */
64
+ public function setup_multisite_upload_dir( $upload_dir ) {
65
+ $upload_dir['basedir'] = $upload_dir['basedir'] . '/sites/' . get_current_blog_id();
66
+ $upload_dir['path'] = $upload_dir['basedir'] . $upload_dir['subdir'];
67
+ $upload_dir['baseurl'] = $upload_dir['baseurl'] . '/sites/' . get_current_blog_id();
68
+ $upload_dir['url'] = $upload_dir['baseurl'] . $upload_dir['subdir'];
69
+
70
+ return $upload_dir;
71
+ }
72
+
73
  /**
74
  * WooCommerce Constructor.
75
  */
76
  private function __construct() {
77
+ if ( is_multisite() ) {
78
+ add_filter( 'upload_dir', array( $this, 'setup_multisite_upload_dir' ) );
79
+ }
80
+
81
  $this->define_constants();
82
  $this->load_plugin_textdomain();
83
  $this->init_hooks();
198
  'add_plugin_action_links',
199
  ) );
200
  add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
201
+ add_action( 'admin_notices', array( $this, 'admin_notice_rate' ) );
202
 
203
  BEWPI_Abstract_Settings::init_hooks();
204
  BEWPI_Admin_Notices::init_hooks();
867
  return in_array( $email, (array) $this->get_option( 'general', 'email_types' ), true );
868
  }
869
 
870
+ /**
871
+ * Get plugin install date.
872
+ *
873
+ * @return DateTime|bool
874
+ */
875
+ private function get_install_date() {
876
+ if ( version_compare( WPI_VERSION, '2.6.1' ) >= 0 ) {
877
+ // since 2.6.1+ option name changed and date has mysql format.
878
+ return DateTime::createFromFormat( 'Y-m-d H:i:s', get_site_option( 'bewpi_install_date' ) );
879
+ }
880
+
881
+ return DateTime::createFromFormat( 'Y-m-d', get_site_option( 'bewpi-install-date' ) );
882
+ }
883
+
884
+ /**
885
+ * Display rate notice after 10 days based on installation date.
886
+ */
887
+ public function admin_notice_rate() {
888
+ if ( get_site_transient( 'wpi_admin_notice_rate' ) ) {
889
+ return;
890
+ }
891
+
892
+ // install date should be valid.
893
+ $install_date = $this->get_install_date();
894
+ if ( false === $install_date ) {
895
+ return;
896
+ }
897
+
898
+ // at least 10 days should be past to display notice.
899
+ if ( new DateTime( '10 days ago' ) >= $install_date ) {
900
+ include WPI_DIR . '/includes/admin/views/html-rate-notice.php';
901
+ set_site_transient( 'wpi_admin_notice_rate', true );
902
+ }
903
+ }
904
+
905
  /**
906
  * Get invoice by order ID.
907
  *
lang/woocommerce-pdf-invoices-nl_NL.mo CHANGED
Binary file
lang/woocommerce-pdf-invoices-nl_NL.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices\n"
4
  "POT-Creation-Date: 2017-10-19 11:37+0200\n"
5
- "PO-Revision-Date: 2017-10-19 11:37+0200\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
@@ -33,6 +33,9 @@ msgid ""
33
  "premium support, we offer you a 30%% discount when you <a href=\"%2$s\" "
34
  "target=\"_blank\">renew your license</a>."
35
  msgstr ""
 
 
 
36
 
37
  #: woocommerce-pdf-invoices-premium/includes/admin/settings/class-premium.php:225
38
  msgid "Premium Options"
@@ -73,6 +76,10 @@ msgid ""
73
  "<strong>Global invoices are only supported when using the micro template!</"
74
  "strong>"
75
  msgstr ""
 
 
 
 
76
 
77
  #: woocommerce-pdf-invoices-premium/includes/admin/settings/class-premium.php:245
78
  msgid "Reminder Options"
@@ -435,8 +442,6 @@ msgid "Reminder sent?"
435
  msgstr "Herinnering verstuurd?"
436
 
437
  #: woocommerce-pdf-invoices-premium/includes/class-invoice-reminder.php:296
438
- #, fuzzy
439
- #| msgid "Order Date: %s"
440
  msgid "Due Date:"
441
  msgstr "Besteldatum: %s"
442
 
2
  msgstr ""
3
  "Project-Id-Version: WooCommerce PDF Invoices\n"
4
  "POT-Creation-Date: 2017-10-19 11:37+0200\n"
5
+ "PO-Revision-Date: 2017-11-13 18:33+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: nl_NL\n"
33
  "premium support, we offer you a 30%% discount when you <a href=\"%2$s\" "
34
  "target=\"_blank\">renew your license</a>."
35
  msgstr ""
36
+ "Oeps, de licentie voor %1$s is verlopen. Blijf in aanmerking komen voor "
37
+ "updates en premium support en <a href=\"%2$s\" target=\"_blank\">verleng de "
38
+ "licentie nu</a> met 30%% korting."
39
 
40
  #: woocommerce-pdf-invoices-premium/includes/admin/settings/class-premium.php:225
41
  msgid "Premium Options"
76
  "<strong>Global invoices are only supported when using the micro template!</"
77
  "strong>"
78
  msgstr ""
79
+ "Genereer globale facturen op de bestellingen pagina door meerdere "
80
+ "bestellingen te selecteren en de actielijst te gebruiken of laat klanten "
81
+ "periodiek genereren op de account pagina. <strong>Globale facturen worden "
82
+ "alleen door de micro template ondersteund!</strong> "
83
 
84
  #: woocommerce-pdf-invoices-premium/includes/admin/settings/class-premium.php:245
85
  msgid "Reminder Options"
442
  msgstr "Herinnering verstuurd?"
443
 
444
  #: woocommerce-pdf-invoices-premium/includes/class-invoice-reminder.php:296
 
 
445
  msgid "Due Date:"
446
  msgstr "Besteldatum: %s"
447
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
- Stable tag: 2.9.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -314,6 +314,14 @@ add_filter( 'wpi_invoice_information_meta', 'add_invoice_information_meta', 10,
314
 
315
  == Changelog ==
316
 
 
 
 
 
 
 
 
 
317
  = 2.9.9 - October 19, 2017 =
318
 
319
  - Fixed: Parse error: syntax error, unexpected '::'.
4
  Tags: woocommerce pdf invoices, invoice, packing slips, delivery note, packing list, shipping list, generate, pdf, woocommerce, attachment, email, customer invoice, processing, vat, tax, sequential, number, dropbox, google drive, onedrive, egnyte, cloud, storage
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
+ Stable tag: 2.9.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
314
 
315
  == Changelog ==
316
 
317
+ = 2.9.10 - November 13, 2017 =
318
+
319
+ - Added: Multisite compatibility by changing uploads directory.
320
+ - Added: WC required version comments.
321
+ - Fixed: Missing $line_items on invoice template for has_only_virtual_products().
322
+ - Fixed: Fatal error non-numeric value.
323
+ - Fixed: Enhanced select options not removable.
324
+
325
  = 2.9.9 - October 19, 2017 =
326
 
327
  - Fixed: Parse error: syntax error, unexpected '::'.