Skip to content

Commit

Permalink
Final tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf committed Dec 12, 2024
1 parent 0608c4d commit ecd4e25
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion assets/js/admin-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ jQuery( function( $ ) {
default: // for other XML extensions
let xml = response.data.preview_data;
let xml_escaped = xml.replace( /&/g,'&amp;' ).replace( /</g,'&lt;' ).replace( />/g,'&gt;' ).replace( / /g, '&nbsp;' ).replace( /\n/g,'<br />' );
$preview.html( '<div id="preview-xml" class="preview-'+response.data.output_format+'">'+xml_escaped+'</div>' );
$preview.html( '<div id="preview-xml" class="preview-' + response.data.output_format + '">' + xml_escaped + '</div>' );
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions includes/Documents/OrderDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ public function output_html() {
*
* @param string $output_format
* @param XMLDocument $xml_document
* @return void
* @return mixed
*/
public function preview_xml( string $output_format, XMLDocument $xml_document ) {
// get last settings
Expand All @@ -1409,9 +1409,9 @@ public function preview_xml( string $output_format, XMLDocument $xml_document )
*
* @param XMLDocument $xml_document
* @param boolean $contents_only
* @return void
* @return mixed
*/
public function output_xml( XMLDocument $xml_document, $contents_only = false ) {
public function output_xml( XMLDocument $xml_document, bool $contents_only = false ) {
$xml_maker = wcpdf_get_xml_maker();

$xml_document->set_order( $this->order );
Expand Down
2 changes: 1 addition & 1 deletion includes/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public function generate_document_ajax() {
$document->output_pdf( $output_mode );
break;
default: // custom output
do_action( 'wpo_wcpdf_document_output', $document, $output_format );
do_action( 'wpo_wcpdf_document_custom_output', $document, $output_format );
break;
}
} else {
Expand Down
1 change: 1 addition & 0 deletions woocommerce-pdf-invoices-packingslips.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function includes() {

// plugin functions
include_once $this->plugin_path() . '/wpo-ips-functions.php';
include_once $this->plugin_path() . '/wpo-ips-deprecated-functions.php';

// Third party compatibility
$this->third_party_plugins = \WPO\IPS\Compatibility\ThirdPartyPlugins::instance();
Expand Down
16 changes: 16 additions & 0 deletions wpo-ips-deprecated-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Get UBL Maker
* Legacy function < v3.9.1
*
* @return WPO\IPS\Makers\XMLMaker
*/
function wcpdf_get_ubl_maker() {
wcpdf_deprecated_function( 'wcpdf_get_ubl_maker', '3.9.1', 'wcpdf_get_xml_maker' );
return wcpdf_get_xml_maker();
}
11 changes: 0 additions & 11 deletions wpo-ips-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,6 @@ function wcpdf_get_xml_maker() {
return new $class();
}

/**
* Get UBL Maker
* Legacy function < v3.9.2
*
* @return WPO\IPS\Makers\XMLMaker
*/
function wcpdf_get_ubl_maker() {
wcpdf_deprecated_function( 'wcpdf_get_ubl_maker', '3.9.2', 'wcpdf_get_xml_maker' );
return wcpdf_get_xml_maker();
}

/**
* Check if UBL is available
*
Expand Down

0 comments on commit ecd4e25

Please sign in to comment.