From d72178a0ccd51712e9be0961537efcc0f4f66056 Mon Sep 17 00:00:00 2001 From: Brian Hogg Date: Tue, 19 Aug 2025 16:44:44 -0400 Subject: [PATCH 1/2] Add class_exists check so the class isn't defined twice. --- src/notifications.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/notifications.php b/src/notifications.php index ba5ec2d..57d80d6 100644 --- a/src/notifications.php +++ b/src/notifications.php @@ -8,6 +8,11 @@ * 'notifications_url' => 'https://example.com/notifications.json', * ) ); */ +defined( 'ABSPATH' ) || exit; + +if ( class_exists( 'Gocodebox_Banner_Notifier' ) ) { + return; +} class Gocodebox_Banner_Notifier { From 1d3e33a48e556ef3f06a6e96ceac348a53fba4c5 Mon Sep 17 00:00:00 2001 From: Brian Hogg Date: Tue, 19 Aug 2025 16:50:45 -0400 Subject: [PATCH 2/2] Changelog. --- .changelogs/fix_check-class-exists.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelogs/fix_check-class-exists.yml diff --git a/.changelogs/fix_check-class-exists.yml b/.changelogs/fix_check-class-exists.yml new file mode 100644 index 0000000..5149141 --- /dev/null +++ b/.changelogs/fix_check-class-exists.yml @@ -0,0 +1,3 @@ +significance: patch +type: fixed +entry: Avoid loading class if it already exists.