$message = __( 'An outdated template or action hook was used to generate the PDF. Legacy mode has been activated, please try again by reloading this page.', 'woocommerce-pdf-invoices-packing-slips' );
namespace WPO\WC\PDF_Invoices\Legacy;
defined( 'ABSPATH' ) or exit;
if ( !class_exists( '\\WPO\\WC\\PDF_Invoices\\Legacy\\WPO_WCPDF_Legacy' ) ) :
protected static $_instance = null;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
public function __construct() {
self::$version = WPO_WCPDF()->version;
$this->enabled = WPO_WCPDF()->legacy_mode_enabled();
$this->settings = include_once( 'class-wcpdf-legacy-settings.php' );
$this->export = include_once( 'class-wcpdf-legacy-export.php' );
$this->functions = include_once( 'class-wcpdf-legacy-functions.php' );
public function __call( $name, $arguments ) {
$human_readable_call = '$wpo_wcpdf->'.$name.'()';
$this->auto_enable_check( $human_readable_call );
if ( is_callable( array( WPO_WCPDF(), $name ) ) ) {
wcpdf_deprecated_function( $human_readable_call, '2.0', 'WPO_WCPDF()->'.$name.'()' );
return call_user_func_array( array( WPO_WCPDF(), $name ), $arguments );
} elseif ( is_callable( array( $this->functions, $name ) ) ) {
wcpdf_deprecated_function( $human_readable_call, '2.0', '$this->'.$name.'()' );
return call_user_func_array( array( $this->functions, $name ), $arguments );
throw new \Exception("Call to undefined method ".__CLASS__."::{$name}()", 1);
public function auto_enable_check( $call = '', $die = true ) {