From e334037e24bcdb44a87689950b323a5178c34614 Mon Sep 17 00:00:00 2001 From: Mario Shtika Date: Fri, 14 Oct 2022 11:18:22 +0300 Subject: [PATCH 1/2] Create a unique namespace to load the JWT & Key classes of this plugin --- includes/class-jwt-auth.php | 6 ++++++ includes/extend-classes.php | 11 +++++++++++ public/class-jwt-auth-public.php | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 includes/extend-classes.php mode change 100755 => 100644 public/class-jwt-auth-public.php diff --git a/includes/class-jwt-auth.php b/includes/class-jwt-auth.php index ea74e94..7212ddf 100755 --- a/includes/class-jwt-auth.php +++ b/includes/class-jwt-auth.php @@ -104,6 +104,12 @@ 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 + */ + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/extend-classes.php'; + /** * The class responsible for defining all actions that occur in the public-facing * side of the site. diff --git a/includes/extend-classes.php b/includes/extend-classes.php new file mode 100644 index 0000000..82f7b6e --- /dev/null +++ b/includes/extend-classes.php @@ -0,0 +1,11 @@ + Date: Fri, 14 Oct 2022 13:14:52 -0500 Subject: [PATCH 2/2] 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 @@ +