PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 3.12.0
GiveWP – Donation Plugin and Fundraising Platform v3.12.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / BetaFeatures / Repositories / FeatureFlagRepository.php
FeatureFlagRepository.php
51 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 namespace Give\BetaFeatures\Repositories;
4
5 class FeatureFlagRepository
6 {
7 /**
8 * @since 3.6.0
9 */
10 public function eventTickets(): bool
11 {
12 if (defined('GIVE_FEATURE_ENABLE_EVENT_TICKETS')){
13 return GIVE_FEATURE_ENABLE_EVENT_TICKETS === true;
14 }
15
16 return $this->enabled('event_tickets', false);
17 }
18
19 /**
20 * In the future this will be dynamic, however right now we need a simple iteration of a notifications counter.
21 *
22 * @since 3.6.0
23 */
24 public function getNotificationCount(): int
25 {
26 return (int)get_option('givewp_feature_flag_notifications_count', 0);
27 }
28
29 /**
30 * @since 3.6.0
31 */
32 public function resetNotificationCount(): void
33 {
34 update_option('givewp_feature_flag_notifications_count', 0);
35 }
36
37 /**
38 * @since 3.6.0
39 */
40 public function enabled($feature, $default = false): bool
41 {
42 // Workaround so that the updated option is available at the start of the request.
43 $option = isset($_POST["enable_$feature"])
44 ? give_clean($_POST["enable_$feature"])
45 : give_get_option("enable_$feature", $default);
46
47 return give_is_setting_enabled($option);
48
49 }
50 }
51