Skip to content

Commit 9dad20c

Browse files
committed
PCP issues addressed
1 parent 016591f commit 9dad20c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

modules/GetSiteBy/patches/40180.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @param int|null $network_id Optional. ID of the network. Default is the current network.
1717
* @return WP_Site|null The site object or null if not found.
1818
*/
19-
function get_site_by( $field, $value, $network_id = null ) {
19+
function multisyde_get_site_by( $field, $value, $network_id = null ) {
2020
$args = array();
2121

2222
if ( 'id' === $field ) {
@@ -116,3 +116,22 @@ function get_site_by( $field, $value, $network_id = null ) {
116116

117117
return array_shift( $sites );
118118
}
119+
120+
if ( ! function_exists( 'get_site_by' ) ) {
121+
/**
122+
* Wrapper for WordPress core compatibility.
123+
*
124+
* @since 4.9.0
125+
*
126+
* @param string $field Name of a field to query against. Accepts 'id', 'slug', 'url',
127+
* 'domain' (if a subdomain-install) or 'path' (if a subdirectory-install).
128+
* @param string|int $value The search value for $field.
129+
* @param int|null $network_id Optional. ID of the network. Default is the current network.
130+
* @return WP_Site|null The site object or null if not found.
131+
*
132+
* @phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
133+
*/
134+
function get_site_by( $field, $value, $network_id = null ) {
135+
return multisyde_get_site_by( $field, $value, $network_id );
136+
}
137+
}

modules/SiteActivePlugins/Feature.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ final class Feature implements LoadableFeature {
1818
const NOTICE_DEACTIVATION = 'bulk_deactivated';
1919

2020
const DEFAULT_MAX_SITES = 100;
21+
const FILTER_MAX_SITES = 'multisyde_site_active_plugins_max_sites';
2122

2223
/**
2324
* The active plugins in the sites in the network.
@@ -161,7 +162,7 @@ public function populate_active_plugins(): void {
161162
*
162163
* @param int $max_sites The maximum number of sites to show for each plugin.
163164
*/
164-
$max_sites = apply_filters( 'site_active_plugins_max_sites', self::DEFAULT_MAX_SITES );
165+
$max_sites = apply_filters( self::FILTER_MAX_SITES, self::DEFAULT_MAX_SITES );
165166
$site_ids = get_sites(
166167
array(
167168
'fields' => 'ids',

0 commit comments

Comments
 (0)