• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/legacy/class-wcpdf-legacy.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
                $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' );
     
    1
    <?php
    2
    namespace WPO\WC\PDF_Invoices\Legacy;
    3
    ​
    4
    defined( 'ABSPATH' ) or exit;
    5
    ​
    6
    if ( !class_exists( '\\WPO\\WC\\PDF_Invoices\\Legacy\\WPO_WCPDF_Legacy' ) ) :
    7
    ​
    8
    class WPO_WCPDF_Legacy {
    9
        public static $version;
    10
        public $enabled;
    11
        public $settings;
    12
        public $export;
    13
        public $functions;
    14
    ​
    15
        protected static $_instance = null;
    16
    ​
    17
        /**
    18
         * Main Plugin Instance
    19
         *
    20
         * Ensures only one instance of plugin is loaded or can be loaded.
    21
         */
    22
        public static function instance() {
    23
            if ( is_null( self::$_instance ) ) {
    24
                self::$_instance = new self();
    25
            }
    26
            return self::$_instance;
    27
        }
    28
    ​
    29
        /**
    30
         * Constructor
    31
         */
    32
        public function __construct() {
    33
            self::$version   = WPO_WCPDF()->version;
    34
            $this->enabled   = WPO_WCPDF()->legacy_mode_enabled();
    35
            $this->settings  = include_once( 'class-wcpdf-legacy-settings.php' );
    36
            $this->export    = include_once( 'class-wcpdf-legacy-export.php' );
    37
            $this->functions = include_once( 'class-wcpdf-legacy-functions.php' );
    38
        }
    39
    ​
    40
        /**
    41
         * Redirect function calls directly to legacy functions class
    42
         */
    43
        public function __call( $name, $arguments ) {
    44
            $human_readable_call = '$wpo_wcpdf->'.$name.'()';
    45
            $this->auto_enable_check( $human_readable_call );
    46
    ​
    47
            if ( is_callable( array( WPO_WCPDF(), $name ) ) ) {
    48
                wcpdf_deprecated_function( $human_readable_call, '2.0', 'WPO_WCPDF()->'.$name.'()' );
    49
                return call_user_func_array( array( WPO_WCPDF(), $name ), $arguments );
    50
            } elseif ( is_callable( array( $this->functions, $name ) ) ) {
    51
                wcpdf_deprecated_function( $human_readable_call, '2.0', '$this->'.$name.'()' );
    52
                return call_user_func_array( array( $this->functions, $name ), $arguments );
    53
            } else {
    54
                throw new \Exception("Call to undefined method ".__CLASS__."::{$name}()", 1);
    55
            }
    56
        }
    57
    ​
    58
        /**
    59
         * Fired when a call is made to the legacy class (also used by sub classes).
    60
         * If legacy mode was not enabled, it is automatically enabled and an error message is shown to the user
    61
         * Reloading the page should then work in legacy mode
    62
         */
    63
        public function auto_enable_check( $call = '', $die = true ) {
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.