diff --git a/plugins/woocommerce-admin/src/DeprecatedClassFacade.php b/plugins/woocommerce-admin/src/DeprecatedClassFacade.php index 3babaead06c..3772c144b98 100644 --- a/plugins/woocommerce-admin/src/DeprecatedClassFacade.php +++ b/plugins/woocommerce-admin/src/DeprecatedClassFacade.php @@ -30,7 +30,7 @@ class DeprecatedClassFacade { * * @var object */ - private $instance; + protected $instance; /** * Constructor. @@ -50,7 +50,7 @@ class DeprecatedClassFacade { static::$facade_over_classname . '::' . $name, static::$deprecated_in_version ); - call_user_func_array( + return call_user_func_array( array( $this->instance, $name, @@ -70,7 +70,7 @@ class DeprecatedClassFacade { static::$facade_over_classname . '::' . $name, static::$deprecated_in_version ); - call_user_func_array( + return call_user_func_array( array( static::$facade_over_classname, $name, diff --git a/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php b/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php index e5dc3513373..1a9cde0ecd3 100644 --- a/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php +++ b/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php @@ -16,6 +16,18 @@ use Automattic\WooCommerce\Admin\DeprecatedClassFacade; * WC_Admin_Note (deprecated, use Note instead). */ class WC_Admin_Note extends DeprecatedClassFacade { + // These constants must be redeclared as to not break plugins that use them. + const E_WC_ADMIN_NOTE_ERROR = Note::E_WC_ADMIN_NOTE_ERROR; + const E_WC_ADMIN_NOTE_WARNING = Note::E_WC_ADMIN_NOTE_WARNING; + const E_WC_ADMIN_NOTE_UPDATE = Note::E_WC_ADMIN_NOTE_UPDATE; + const E_WC_ADMIN_NOTE_INFORMATIONAL = Note::E_WC_ADMIN_NOTE_INFORMATIONAL; + const E_WC_ADMIN_NOTE_MARKETING = Note::E_WC_ADMIN_NOTE_MARKETING; + const E_WC_ADMIN_NOTE_SURVEY = Note::E_WC_ADMIN_NOTE_SURVEY; + const E_WC_ADMIN_NOTE_PENDING = Note::E_WC_ADMIN_NOTE_PENDING; + const E_WC_ADMIN_NOTE_UNACTIONED = Note::E_WC_ADMIN_NOTE_UNACTIONED; + const E_WC_ADMIN_NOTE_ACTIONED = Note::E_WC_ADMIN_NOTE_ACTIONED; + const E_WC_ADMIN_NOTE_SNOOZED = Note::E_WC_ADMIN_NOTE_SNOOZED; + /** * The name of the non-deprecated class that this facade covers. * @@ -29,6 +41,15 @@ class WC_Admin_Note extends DeprecatedClassFacade { * @var string */ protected static $deprecated_in_version = '1.6.0'; + + /** + * Note constructor. Loads note data. + * + * @param mixed $data Note data, object, or ID. + */ + public function __construct( $data = '' ) { + $this->instance = new static::$facade_over_classname( $data ); + } } /**