PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 2.3.2 2.30.0 All 255 releases
give / src / Tracking / Helpers / Track.php

Track.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Tracking/Helpers/Track.php

58 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Tracking\Helpers;
4
5 use Give\Tracking\Repositories\Settings;
6
7 /**
8 * Class Track
9 *
10 * This class contains helpers functions related to tracks
11 *
12 * @package Give\Tracking\Helpers
13 * @since 2.10.0
14 */
15 class Track
16 {
17 /**
18 * Return whether or not admin opted in for usage tracking.
19 *
20 * @since 2.10.0
21 *
22 * @return bool True when we can track, false when we can't.
23 */
24 public static function isTrackingEnabled()
25 {
26 if ( ! self::checkEnvironment()) {
27 return false;
28 }
29
30 // Check if we're allowing tracking.
31 /* @var Settings $settings */
32 $settings = give(Settings::class);
33 $tracking = $settings->getUsageTrackingOptionValue();
34
35 return give_is_setting_enabled($tracking);
36 }
37
38 /**
39 * Return whether or not environment for tracking satisfied.
40 *
41 * @return bool
42 */
43 public static function checkEnvironment()
44 {
45 // Track data only if website is in production mode.
46 if (function_exists('wp_get_environment_type') && wp_get_environment_type() !== 'production') {
47 return false;
48 }
49
50 // Track data only if give is in live mode.
51 if (give_is_setting_enabled(give_get_option('test_mode'))) {
52 return false;
53 }
54
55 return true;
56 }
57 }
58