99class AcornFavicons
1010{
1111 protected string $ app_name = '' ;
12+ protected string $ app_slug = '' ;
1213 protected string $ app_url = '' ;
1314 protected string $ manifest_path = '' ;
15+ protected string $ prefix = '' ;
1416
1517 private array $ faviconConfig = [
1618 'appleIcon ' => [
@@ -43,6 +45,8 @@ public function __construct(
4345 private array $ paths = []
4446 ) {
4547 $ this ->app_name = htmlspecialchars_decode ($ this ->config ['appName ' ] ?? get_bloginfo ('name ' ));
48+ $ this ->app_slug = sanitize_title ($ this ->config ['appSlug ' ] ?? $ this ->app_name );
49+ $ this ->prefix = is_multisite () ? "{$ this ->app_slug }- " : '' ;
4650 $ this ->app_url = home_url ();
4751 $ this ->manifest_path = $ this ->config ['manifest_path ' ] ?? static ::MANIFEST_PATH ;
4852
@@ -64,7 +68,7 @@ protected function getPublicPath(string $path, bool $addToPaths = true): ?string
6468 }
6569
6670 $ webPath = rtrim (ABSPATH , '/wp ' );
67- $ path = ltrim ($ path , '/ ' );
71+ $ path = ltrim ("{ $ this -> prefix }{ $ path}" , '/ ' );
6872
6973 if (! file_exists ($ webPath . '/ ' . $ path )) {
7074 return null ;
@@ -309,12 +313,12 @@ public function serveSiteManifest(): void
309313 'theme_color ' => $ this ->config ['theme_color ' ] ?? '#ffffff ' ,
310314 'icons ' => [
311315 [
312- 'src ' => "{$ this ->app_url }/android-chrome-192x192.png " ,
316+ 'src ' => "{$ this ->app_url }/ { $ this -> prefix } android-chrome-192x192.png " ,
313317 'sizes ' => '192x192 ' ,
314318 'type ' => 'image/png ' ,
315319 ],
316320 [
317- 'src ' => "{$ this ->app_url }/android-chrome-512x512.png " ,
321+ 'src ' => "{$ this ->app_url }/ { $ this -> prefix } android-chrome-512x512.png " ,
318322 'sizes ' => '512x512 ' ,
319323 'type ' => 'image/png ' ,
320324 ],
0 commit comments