From b4dbc5777622043c4089c7707f83fe7d17fbf1c9 Mon Sep 17 00:00:00 2001
From: Chris Reynolds
Date: Fri, 19 Jul 2024 12:54:52 -0600
Subject: [PATCH] [SITE-372] allow subdirectory networks warning to be filtered
(#51)
* add a new function for the message
the message applies the filter so the individual calls don't need to do a check
* add a test for the function and filter
* update the @\since tag
* bump the version
* update the error message so it's standardized across all implementations
it's not actually standard in the source because WP is dumb and no one looks at this page.
* break test cases out into separate tests.
Co-authored-by: Phil Tyler
* fix linting
---------
Co-authored-by: Phil Tyler
---
inc/network/includes-network.php | 24 +++++++++++++++++++++---
pantheon.php | 4 ++--
tests/phpunit/test-network.php | 10 ++++++++++
3 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/inc/network/includes-network.php b/inc/network/includes-network.php
index fefa86b..a38957e 100644
--- a/inc/network/includes-network.php
+++ b/inc/network/includes-network.php
@@ -99,6 +99,22 @@ function get_clean_basedomain() {
return $domain;
}
+/**
+ * Returns the warning message about subdirectory multisites not liking custom wp-content directories.
+ *
+ * Applies the 'pantheon.subdirectory_networks_message' filter.
+ *
+ * @since 1.4.5
+ * @return string Warning message or empty string.
+ */
+function pantheon_get_subdirectory_networks_message() {
+ if ( apply_filters( 'pantheon.enable_subdirectory_networks_message', true ) ) {
+ return '
' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '