From e386725776302b1df00906d75d4d0019a388ad19 Mon Sep 17 00:00:00 2001 From: Tmeister Date: Fri, 14 Oct 2022 13:14:52 -0500 Subject: [PATCH] Add a wrapper namespace to prevent conflicts with other plugins using the same JWT library --- includes/class-jwt-auth.php | 7 ++++--- includes/class-jwt-namespace-wrapper.php | 18 ++++++++++++++++++ includes/extend-classes.php | 11 ----------- jwt-auth.php | 2 +- readme.txt | 5 ++++- 5 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 includes/class-jwt-namespace-wrapper.php delete mode 100644 includes/extend-classes.php diff --git a/includes/class-jwt-auth.php b/includes/class-jwt-auth.php index 7212ddf..cb1f9d2 100755 --- a/includes/class-jwt-auth.php +++ b/includes/class-jwt-auth.php @@ -105,10 +105,11 @@ private function load_dependencies() { require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-jwt-auth-i18n.php'; /** - * The class responsible for creating a unique namespace to load the JWT & Key - * classes of this plugin + * Class responsible for creating a `wrapper namespace` to load the Firebase's JWT & Key + * classes and prevent conflicts with other plugins using the same library + * with different versions. */ - require_once plugin_dir_path(dirname(__FILE__)) . 'includes/extend-classes.php'; + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-jwt-namespace-wrapper.php'; /** * The class responsible for defining all actions that occur in the public-facing diff --git a/includes/class-jwt-namespace-wrapper.php b/includes/class-jwt-namespace-wrapper.php new file mode 100644 index 0000000..befcf08 --- /dev/null +++ b/includes/class-jwt-namespace-wrapper.php @@ -0,0 +1,18 @@ +