PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / NonLoggedInUsers / Visibility / VisibilitySettings.php

VisibilitySettings.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Addons/NonLoggedInUsers/Visibility/VisibilitySettings.php

47 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\NonLoggedInUsers\Visibility;
2
3 use TierPricingTable\Settings\CustomOptions\TPTCheckboxListOption;
4 use TierPricingTable\Settings\Settings;
5
6 class VisibilitySettings {
7
8 const PREFIX = Settings::SETTINGS_PREFIX . 'visibility_';
9
10 public static function optionId( string $key ): string {
11 return self::PREFIX . $key;
12 }
13
14 protected static function get( string $key, $default = null ) {
15 return get_option( self::optionId( $key ), $default );
16 }
17
18 /**
19 * Role-based catalog visibility: the "Who can see" rules on products and categories. Off by default,
20 * so the product and category screens stay as they are for stores that do not need it.
21 */
22 public static function isEnabled(): bool {
23 return 'yes' === self::get( 'enabled', 'no' );
24 }
25
26 /**
27 * Closed store: visitors who are not logged in are sent to the login page.
28 */
29 public static function isClosedStore(): bool {
30 return 'yes' === self::get( 'closed_store', 'no' );
31 }
32
33 /**
34 * @return int[] page ids visitors may open while the store is closed (besides My Account and the wholesale registration page)
35 */
36 public static function getOpenPageIds(): array {
37 return array_values( array_filter( array_map( 'intval', TPTCheckboxListOption::toArray( self::get( 'closed_store_pages', '' ) ) ) ) );
38 }
39
40 /**
41 * A guest who opens a hidden product or category: login page (yes) or a not-found page (no).
42 */
43 public static function redirectGuestsFromHidden(): bool {
44 return 'yes' === self::get( 'hidden_redirect', 'yes' );
45 }
46 }
47