PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.0
GiveWP – Donation Plugin and Fundraising Platform v4.15.0
4.18.0 4.17.0 4.16.9 4.16.8.1 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 All 257 releases
give / src / BetaFeatures / Repositories / FeatureFlagRepository.php

FeatureFlagRepository.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.0, at src/BetaFeatures/Repositories/FeatureFlagRepository.php

54 lines 1.4 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 4.13.1 added filter givewp_feature_flag_notifications_count
23 * @since 3.6.0
24 */
25 public function getNotificationCount(): int
26 {
27 $count = (int)get_option('givewp_feature_flag_notifications_count', 0);
28
29 return apply_filters('givewp_feature_flag_notifications_count', $count);
30 }
31
32 /**
33 * @since 3.6.0
34 */
35 public function resetNotificationCount(): void
36 {
37 update_option('givewp_feature_flag_notifications_count', 0);
38 }
39
40 /**
41 * @since 3.6.0
42 */
43 public function enabled($feature, $default = false): bool
44 {
45 // Workaround so that the updated option is available at the start of the request.
46 $option = isset($_POST["enable_$feature"])
47 ? give_clean($_POST["enable_$feature"])
48 : give_get_option("enable_$feature", $default);
49
50 return give_is_setting_enabled($option);
51
52 }
53 }
54