From d3b51e524a103791e10f5e0bca4e0879ec64acda Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 4 Jul 2025 14:51:25 -0700 Subject: [PATCH 01/19] Add methods for slugs with DID Signed-off-by: Andy Fragen --- inc/namespace.php | 1 + inc/plugins/namespace.php | 103 ++++++++++++++++++++++++++++++++++++++ plugin.php | 1 + 3 files changed, 105 insertions(+) create mode 100644 inc/plugins/namespace.php diff --git a/inc/namespace.php b/inc/namespace.php index e85ccd8..bfde5c9 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -34,6 +34,7 @@ function bootstrap() { Icons\bootstrap(); Importers\bootstrap(); Pings\bootstrap(); + Plugins\bootstrap(); Salts\bootstrap(); Settings\bootstrap(); Updater\bootstrap(); diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php new file mode 100644 index 0000000..5ec68ae --- /dev/null +++ b/inc/plugins/namespace.php @@ -0,0 +1,103 @@ + 'Plugin ID' ] )['PluginID']; + $did = get_short_did( $did ); + } + if ( ! empty( $did ) ) { + $slug = str_replace( '-' . get_short_did( $did ), '', $slug ); + } + + return $slug; +} + +/** + * Hide notice reporting DID-less plugin is inactive because it doesn't exist. + * + * @param string $markup Markup of notice. + * @param string $message Message of notice. + * @param array $args Args of notice. + * + * @return string + */ +function hide_notice( $markup, $message, $args ) { + $active = get_option( 'active_plugins' ); + if ( $args['id'] === 'message' ) { + foreach ( $active as $plugin ) { + if ( str_contains( $message, $plugin ) && str_contains( $markup, 'error' ) ) { + remove_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice' ); + return ''; + } + } + } + + return $markup; +} diff --git a/plugin.php b/plugin.php index 0f70352..9ba1128 100644 --- a/plugin.php +++ b/plugin.php @@ -30,6 +30,7 @@ require_once __DIR__ . '/inc/disable-openverse/namespace.php'; require_once __DIR__ . '/inc/icons/namespace.php'; require_once __DIR__ . '/inc/importers/namespace.php'; require_once __DIR__ . '/inc/pings/namespace.php'; +require_once __DIR__ . '/inc/plugins/namespace.php'; require_once __DIR__ . '/inc/salts/namespace.php'; require_once __DIR__ . '/inc/settings/namespace.php'; require_once __DIR__ . '/inc/updater/namespace.php'; From fa47c07ccbfc38b5f58a6e46309d6b98b5145d78 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 4 Jul 2025 16:13:04 -0700 Subject: [PATCH 02/19] Wants to be escaped for CI Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 5ec68ae..9693d72 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -17,7 +17,7 @@ use function FAIR\Updater\init; function bootstrap() { add_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); add_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice', 10, 3 ); - if ( is_plugin_active( 'git-updater/git-updater.php' ) ) { + if ( \is_plugin_active( 'git-updater/git-updater.php' ) ) { wp_admin_notice( 'Git Updater is active' ); } } From a794e8004659fc53248ca70b8874f6a5206e4fb7 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 4 Jul 2025 16:17:51 -0700 Subject: [PATCH 03/19] just for CI testing Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 9693d72..6d7154b 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -17,7 +17,12 @@ use function FAIR\Updater\init; function bootstrap() { add_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); add_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice', 10, 3 ); - if ( \is_plugin_active( 'git-updater/git-updater.php' ) ) { + + // just for testing. + if ( ! function_exists( 'is_plugin_active' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + if ( is_plugin_active( 'git-updater/git-updater.php' ) ) { wp_admin_notice( 'Git Updater is active' ); } } From a3939548010761eec131ab6d9b0b270e7558241c Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 4 Jul 2025 16:31:18 -0700 Subject: [PATCH 04/19] update for renamed function Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 6d7154b..ffce930 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -7,7 +7,7 @@ namespace FAIR\Plugins; -use function FAIR\Updater\init; +use function FAIR\Updater\get_packages; /** * Bootstrap @@ -36,7 +36,7 @@ function bootstrap() { */ function set_as_active( $active_plugins ) { remove_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); - $packages = init(); + $packages = get_packages(); $plugins = $packages['plugins'] ?? []; foreach ( $plugins as $plugin ) { if ( is_plugin_active( plugin_basename( $plugin ) ) ) { From 147f576149fb2bcaac7256c7f8698402c7b677ab Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Sat, 5 Jul 2025 17:51:34 -0700 Subject: [PATCH 05/19] Update inc/plugins/namespace.php Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com> Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index ffce930..82cdf36 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -94,8 +94,8 @@ function get_didless_slug( $slug, $did = '' ) { * @return string */ function hide_notice( $markup, $message, $args ) { - $active = get_option( 'active_plugins' ); if ( $args['id'] === 'message' ) { + $active = get_option( 'active_plugins' ); foreach ( $active as $plugin ) { if ( str_contains( $message, $plugin ) && str_contains( $markup, 'error' ) ) { remove_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice' ); From 5795d008f1be7f7d9a4f35a4c3fc87cce784dc0e Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Sat, 5 Jul 2025 22:58:31 -0700 Subject: [PATCH 06/19] refactor a bit Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 48 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 82cdf36..8726313 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -9,6 +9,8 @@ namespace FAIR\Plugins; use function FAIR\Updater\get_packages; +use WP_Error; + /** * Bootstrap * @@ -36,52 +38,58 @@ function bootstrap() { */ function set_as_active( $active_plugins ) { remove_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); + $active_without_did_id = []; $packages = get_packages(); $plugins = $packages['plugins'] ?? []; foreach ( $plugins as $plugin ) { if ( is_plugin_active( plugin_basename( $plugin ) ) ) { - $plugins[] = get_didless_slug( $plugin ); + $active_without_did_id[] = get_slug_without_did_id( $plugin ); } } - $active_plugins = array_map( 'plugin_basename', array_merge( $active_plugins, $plugins ) ); + $active_plugins = array_map( 'plugin_basename', array_merge( $active_plugins, $active_without_did_id ) ); return array_unique( $active_plugins ); } /** - * Return shortened DID withou `did:plc|web'. + * Return DID parts. * - * @param string $did Full DID. + * @param string $id Full DID. * - * @return string|void + * @return string|WP_Error */ -function get_short_did( $did ) { - if ( ! empty( $did ) ) { - if ( str_contains( $did, ':' ) ) { - $did = (string) explode( ':', $did )[2]; - } - return $did; +function get_did_parts( $id ) { + $parts = explode( ':', $id, 3 ); + if ( count( $parts ) !== 3 ) { + return new WP_Error( 'fair.packages.validate_did.not_uri', __( 'DID could not be parsed as a URI.', 'fair' ) ); } + + return [ + 'method' => $parts[1], + 'id' => $parts[2], + ]; } /** - * Return slug without DID. + * Return plugin file path without DID. * - * @param string $slug Current slug. + * @param string $plugin Filepath or plugin basename. * @param string $did Full DID. * - * @return string|void + * @return string */ -function get_didless_slug( $slug, $did = '' ) { +function get_slug_without_did_id( $plugin, $did = '' ) { if ( empty( $did ) ) { - $did = get_file_data( $slug, [ 'PluginID' => 'Plugin ID' ] )['PluginID']; - $did = get_short_did( $did ); + $plugin = trailingslashit( WP_PLUGIN_DIR ) . plugin_basename( $plugin ); + $did = get_file_data( $plugin, [ 'PluginID' => 'Plugin ID' ] )['PluginID']; } - if ( ! empty( $did ) ) { - $slug = str_replace( '-' . get_short_did( $did ), '', $slug ); + $did = get_did_parts( $did ); + if ( is_wp_error( $did ) ) { + return $plugin; } + $plugin = str_replace( '-' . $did['id'], '', $plugin ); - return $slug; + return $plugin; } /** From 829ae96752c508b81b5f1186e6a7de8a02535fbf Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 09:10:59 -0700 Subject: [PATCH 07/19] assume slug-hash and drop hash to return slug Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 8726313..9e4b63f 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -71,25 +71,24 @@ function get_did_parts( $id ) { } /** - * Return plugin file path without DID. + * Return plugin slug without DID hash. + * + * Assumes pattern of -. * * @param string $plugin Filepath or plugin basename. - * @param string $did Full DID. * * @return string */ -function get_slug_without_did_id( $plugin, $did = '' ) { - if ( empty( $did ) ) { - $plugin = trailingslashit( WP_PLUGIN_DIR ) . plugin_basename( $plugin ); - $did = get_file_data( $plugin, [ 'PluginID' => 'Plugin ID' ] )['PluginID']; - } - $did = get_did_parts( $did ); - if ( is_wp_error( $did ) ) { - return $plugin; - } - $plugin = str_replace( '-' . $did['id'], '', $plugin ); +function get_slug_without_did_id( $plugin ) : string { + $plugin = plugin_basename( $plugin ); + $slug = explode( '/', $plugin, 2 )[0]; + $slug_parts = explode( '-', $slug ); - return $plugin; + // Remove hash. + array_pop( $slug_parts ); + $slug = implode( '-', $slug_parts ); + + return $slug; } /** From ed04e7d5e4406ff43b8fb7acedfa129d3767fc16 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 09:13:32 -0700 Subject: [PATCH 08/19] rename as likely to be DID hash Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 9e4b63f..db8dbbe 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -43,7 +43,7 @@ function set_as_active( $active_plugins ) { $plugins = $packages['plugins'] ?? []; foreach ( $plugins as $plugin ) { if ( is_plugin_active( plugin_basename( $plugin ) ) ) { - $active_without_did_id[] = get_slug_without_did_id( $plugin ); + $active_without_did_id[] = get_slug_without_did_hash( $plugin ); } } $active_plugins = array_map( 'plugin_basename', array_merge( $active_plugins, $active_without_did_id ) ); @@ -79,7 +79,7 @@ function get_did_parts( $id ) { * * @return string */ -function get_slug_without_did_id( $plugin ) : string { +function get_slug_without_did_hash( $plugin ) : string { $plugin = plugin_basename( $plugin ); $slug = explode( '/', $plugin, 2 )[0]; $slug_parts = explode( '-', $slug ); From 2f0f59dcf96c1453549bdcb7b3df6f95be0ac341 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 09:15:22 -0700 Subject: [PATCH 09/19] no longer needed Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index db8dbbe..b09df2c 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -51,25 +51,6 @@ function set_as_active( $active_plugins ) { return array_unique( $active_plugins ); } -/** - * Return DID parts. - * - * @param string $id Full DID. - * - * @return string|WP_Error - */ -function get_did_parts( $id ) { - $parts = explode( ':', $id, 3 ); - if ( count( $parts ) !== 3 ) { - return new WP_Error( 'fair.packages.validate_did.not_uri', __( 'DID could not be parsed as a URI.', 'fair' ) ); - } - - return [ - 'method' => $parts[1], - 'id' => $parts[2], - ]; -} - /** * Return plugin slug without DID hash. * From 108c5a688feaf3c6f4704672ca76b10882eb151d Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 10:09:54 -0700 Subject: [PATCH 10/19] refactor and simplify Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index b09df2c..f8201a6 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -7,9 +7,7 @@ namespace FAIR\Plugins; -use function FAIR\Updater\get_packages; - -use WP_Error; +use function FAIR\Updater\init; /** * Bootstrap @@ -38,15 +36,15 @@ function bootstrap() { */ function set_as_active( $active_plugins ) { remove_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); - $active_without_did_id = []; - $packages = get_packages(); + $packages = init(); $plugins = $packages['plugins'] ?? []; + $plugins = array_map( 'plugin_basename', $plugins ); foreach ( $plugins as $plugin ) { - if ( is_plugin_active( plugin_basename( $plugin ) ) ) { - $active_without_did_id[] = get_slug_without_did_hash( $plugin ); + if ( is_plugin_active( $plugin ) ) { + $plugins[] = get_slug_without_did_hash( $plugin ); } } - $active_plugins = array_map( 'plugin_basename', array_merge( $active_plugins, $active_without_did_id ) ); + $active_plugins = array_merge( $active_plugins, $plugins ); return array_unique( $active_plugins ); } @@ -61,15 +59,14 @@ function set_as_active( $active_plugins ) { * @return string */ function get_slug_without_did_hash( $plugin ) : string { - $plugin = plugin_basename( $plugin ); - $slug = explode( '/', $plugin, 2 )[0]; - $slug_parts = explode( '-', $slug ); + $file = explode( '/', $plugin, 2 ); + $slug_parts = explode( '-', $file[0] ); // Remove hash. array_pop( $slug_parts ); $slug = implode( '-', $slug_parts ); - return $slug; + return $slug . '/' . $file[1]; } /** From c5d57a5b85b0bf38255edac6facc093fdabb30bb Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 12:06:19 -0700 Subject: [PATCH 11/19] keep prior function name Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index f8201a6..ff271d4 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -7,7 +7,7 @@ namespace FAIR\Plugins; -use function FAIR\Updater\init; +use function FAIR\Updater\get_packages; /** * Bootstrap @@ -36,7 +36,7 @@ function bootstrap() { */ function set_as_active( $active_plugins ) { remove_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); - $packages = init(); + $packages = get_packages(); $plugins = $packages['plugins'] ?? []; $plugins = array_map( 'plugin_basename', $plugins ); foreach ( $plugins as $plugin ) { From 8286b678270a9ee2546b3ce429df32c5946d5256 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 16:04:36 -0700 Subject: [PATCH 12/19] rename function as more file than slug Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index ff271d4..3db6683 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -41,7 +41,7 @@ function set_as_active( $active_plugins ) { $plugins = array_map( 'plugin_basename', $plugins ); foreach ( $plugins as $plugin ) { if ( is_plugin_active( $plugin ) ) { - $plugins[] = get_slug_without_did_hash( $plugin ); + $plugins[] = get_file_without_did_hash( $plugin ); } } $active_plugins = array_merge( $active_plugins, $plugins ); @@ -50,7 +50,7 @@ function set_as_active( $active_plugins ) { } /** - * Return plugin slug without DID hash. + * Return plugin file without DID hash. * * Assumes pattern of -. * @@ -58,7 +58,7 @@ function set_as_active( $active_plugins ) { * * @return string */ -function get_slug_without_did_hash( $plugin ) : string { +function get_file_without_did_hash( $plugin ) : string { $file = explode( '/', $plugin, 2 ); $slug_parts = explode( '-', $file[0] ); From 90c79e28f1c152ce1405b933fa382c34646fc3e0 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 19:39:50 -0700 Subject: [PATCH 13/19] pass DID as key Signed-off-by: Andy Fragen --- inc/updater/namespace.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/updater/namespace.php b/inc/updater/namespace.php index bd5404e..71b56f6 100644 --- a/inc/updater/namespace.php +++ b/inc/updater/namespace.php @@ -41,7 +41,7 @@ function get_packages() { $plugin_id = get_file_data( $plugin_path . $file, [ 'PluginID' => 'Plugin ID' ] )['PluginID']; if ( ! empty( $plugin_id ) ) { - $packages['plugins'][] = $plugin_path . $file; + $packages['plugins'][ $plugin_id ] = $plugin_path . $file; } } @@ -54,7 +54,7 @@ function get_packages() { $theme_id = get_file_data( $theme_path . $file . '/style.css', [ 'ThemeID' => 'Theme ID' ] )['ThemeID']; if ( ! empty( $theme_id ) ) { - $packages['themes'][] = $theme_path . $file . '/style.css'; + $packages['themes'][ $theme_id ] = $theme_path . $file . '/style.css'; } } From ba17062dfeb9f01b402af9fe8346449c380c4a30 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jul 2025 19:43:13 -0700 Subject: [PATCH 14/19] check that did-hash is actually what is being removed Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 3db6683..6571a25 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -7,6 +7,7 @@ namespace FAIR\Plugins; +use function FAIR\Packages\get_did_hash; use function FAIR\Updater\get_packages; /** @@ -39,14 +40,13 @@ function set_as_active( $active_plugins ) { $packages = get_packages(); $plugins = $packages['plugins'] ?? []; $plugins = array_map( 'plugin_basename', $plugins ); - foreach ( $plugins as $plugin ) { + foreach ( $plugins as $did => $plugin ) { if ( is_plugin_active( $plugin ) ) { - $plugins[] = get_file_without_did_hash( $plugin ); + $active_plugins[] = get_file_without_did_hash( $did, $plugin ); } } - $active_plugins = array_merge( $active_plugins, $plugins ); - return array_unique( $active_plugins ); + return array_filter( array_unique( $active_plugins ) ); } /** @@ -54,19 +54,18 @@ function set_as_active( $active_plugins ) { * * Assumes pattern of -. * - * @param string $plugin Filepath or plugin basename. + * @param string $did DID. + * @param string $plugin Plugin basename. * * @return string */ -function get_file_without_did_hash( $plugin ) : string { +function get_file_without_did_hash( $did, $plugin ) : string { $file = explode( '/', $plugin, 2 ); $slug_parts = explode( '-', $file[0] ); - - // Remove hash. - array_pop( $slug_parts ); + $did_hash = array_pop( $slug_parts ); $slug = implode( '-', $slug_parts ); - return $slug . '/' . $file[1]; + return $did_hash === get_did_hash( $did ) ? $slug . '/' . $file[1] : ''; } /** From 267505af35f24508b2419931af1180e9ff43615b Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 9 Jul 2025 06:42:22 -0700 Subject: [PATCH 15/19] Colin's string functions instead of my array functions Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 6571a25..7713176 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -60,12 +60,10 @@ function set_as_active( $active_plugins ) { * @return string */ function get_file_without_did_hash( $did, $plugin ) : string { - $file = explode( '/', $plugin, 2 ); - $slug_parts = explode( '-', $file[0] ); - $did_hash = array_pop( $slug_parts ); - $slug = implode( '-', $slug_parts ); + list( $slug, $file ) = explode( '/', $plugin, 2 ); + $slug = str_replace( '-' . get_did_hash( $did ), '', $slug ); - return $did_hash === get_did_hash( $did ) ? $slug . '/' . $file[1] : ''; + return $slug . '/' . $file; } /** From 153fdf680c4c8045a6ed66463b41a9526f62ce6d Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 9 Jul 2025 06:48:30 -0700 Subject: [PATCH 16/19] load during load-plugins.php Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 7713176..9dd2521 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -16,6 +16,10 @@ use function FAIR\Updater\get_packages; * @return void */ function bootstrap() { + add_action( 'load-plugins.php' , __NAMESPACE__ . '\\load_filters' ); +} + +function load_filters() { add_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); add_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice', 10, 3 ); From dcc9df05d7dd78b2fd9656e7da8706801dadadb5 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 9 Jul 2025 06:54:41 -0700 Subject: [PATCH 17/19] D'oh Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 9dd2521..e27aa15 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -16,7 +16,7 @@ use function FAIR\Updater\get_packages; * @return void */ function bootstrap() { - add_action( 'load-plugins.php' , __NAMESPACE__ . '\\load_filters' ); + add_action( 'load-plugins.php', __NAMESPACE__ . '\\load_filters' ); } function load_filters() { From 01aa00b40ba8c67b5bf74138a95b5ac091eeb760 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 9 Jul 2025 06:56:19 -0700 Subject: [PATCH 18/19] Need moor cooofffeee Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index e27aa15..422d9f0 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -11,7 +11,7 @@ use function FAIR\Packages\get_did_hash; use function FAIR\Updater\get_packages; /** - * Bootstrap + * Bootstrap. * * @return void */ @@ -19,6 +19,11 @@ function bootstrap() { add_action( 'load-plugins.php', __NAMESPACE__ . '\\load_filters' ); } +/** + * Load filters. + * + * @return void + */ function load_filters() { add_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); add_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice', 10, 3 ); From 05bbaf886bba47f01e29678a050e5aa8c22eb052 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 9 Jul 2025 16:50:32 -0700 Subject: [PATCH 19/19] Just for Colin Signed-off-by: Andy Fragen --- inc/plugins/namespace.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/inc/plugins/namespace.php b/inc/plugins/namespace.php index 422d9f0..2adf1be 100644 --- a/inc/plugins/namespace.php +++ b/inc/plugins/namespace.php @@ -17,6 +17,14 @@ use function FAIR\Updater\get_packages; */ function bootstrap() { add_action( 'load-plugins.php', __NAMESPACE__ . '\\load_filters' ); + + // just for testing. + if ( ! function_exists( 'is_plugin_active' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + if ( is_plugin_active( 'git-updater/git-updater.php' ) ) { + wp_admin_notice( 'Git Updater is active' ); + } } /** @@ -27,14 +35,6 @@ function bootstrap() { function load_filters() { add_filter( 'option_active_plugins', __NAMESPACE__ . '\\set_as_active' ); add_filter( 'wp_admin_notice_markup', __NAMESPACE__ . '\\hide_notice', 10, 3 ); - - // just for testing. - if ( ! function_exists( 'is_plugin_active' ) ) { - require_once ABSPATH . 'wp-admin/includes/plugin.php'; - } - if ( is_plugin_active( 'git-updater/git-updater.php' ) ) { - wp_admin_notice( 'Git Updater is active' ); - } } /**