← All changes
|
jetpack_vendor/automattic/jetpack-sync/src/class-functions.php
+19
-0
16.2
→
16.3-a.7
View file →
| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | use Automattic\Jetpack\Connection\Manager; |
| 11 | 11 | use Automattic\Jetpack\Connection\Urls; |
| 12 | 12 | use Automattic\Jetpack\Constants; |
| 13 | 13 | use Automattic\Jetpack\Modules as Jetpack_Modules; |
| 14 | +use Automattic\Jetpack\Status; | |
| 14 | 15 | |
| 15 | 16 | /** |
| 16 | 17 | * Utility functions to generate data synced to wpcom |
| 17 | 18 | */ |
| @@ -589,8 +590,26 @@ | ||
| 589 | 590 | * @return bool Theme is a Full Site Editing theme. |
| 590 | 591 | */ |
| 591 | 592 | public static function get_is_fse_theme() { |
| 592 | 593 | return wp_is_block_theme(); |
| 594 | + } | |
| 595 | + | |
| 596 | + /** | |
| 597 | + * Returns the site's visibility as a `blog_public` value, or -1 when Jetpack considers the site private. | |
| 598 | + * | |
| 599 | + * Lets `jetpack_is_private_site` report the site as private to WordPress.com without changing | |
| 600 | + * the `blog_public` option itself, since core and other plugins do not expect a -1 there. | |
| 601 | + * | |
| 602 | + * @since 5.2.0 | |
| 603 | + * | |
| 604 | + * @return int -1 when private, otherwise the stored `blog_public` value. | |
| 605 | + */ | |
| 606 | + public static function get_site_visibility() { | |
| 607 | + if ( ( new Status() )->is_private_site() ) { | |
| 608 | + return -1; | |
| 609 | + } | |
| 610 | + | |
| 611 | + return (int) get_option( 'blog_public', 1 ); | |
| 593 | 612 | } |
| 594 | 613 | |
| 595 | 614 | /** |
| 596 | 615 | * Wraps data in a way so that we can distinguish between objects and array and also prevent object recursion. |