PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / app / SiteVisibility.php

SiteVisibility.php in Extendify 3.2.1, at app/SiteVisibility.php

56 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Controls whether the site is publicly visible
5 */
6
7 namespace Extendify;
8
9 defined('ABSPATH') || die('No direct access.');
10
11 /**
12 * This class reads and writes the site's public visibility.
13 */
14
15 class SiteVisibility
16 {
17 /**
18 * The option holding the visibility state
19 *
20 * @var string
21 */
22 // phpcs:ignore PSR12.Properties.ConstantVisibility.NotFound -- 7.0 floor: no const visibility
23 const OPTION = 'extendify_site_visibility';
24
25 /**
26 * Whether the site is visible to anonymous visitors.
27 *
28 * @return boolean
29 */
30 public static function isPublished()
31 {
32 // A site with no marker predates the partner flag, so it stays public.
33 return \get_option(self::OPTION) !== 'unpublished';
34 }
35
36 /**
37 * Hide the site from anonymous visitors until the owner publishes it.
38 *
39 * @return void
40 */
41 public static function markUnpublished()
42 {
43 \update_option(self::OPTION, 'unpublished');
44 }
45
46 /**
47 * Make the site visible to anonymous visitors.
48 *
49 * @return void
50 */
51 public static function markPublished()
52 {
53 \update_option(self::OPTION, 'published');
54 }
55 }
56