PluginProbe
SureCookie – GDPR Cookie Consent Banner, Cookie Scanner & Script Blocking / trunk
SureCookie – GDPR Cookie Consent Banner, Cookie Scanner & Script Blocking vtrunk
1.5.0 1.4.0 1.3.0 1.3.1 trunk 0.0.0-alpha.1 0.0.0-alpha.2 0.0.0-alpha.3 0.0.1-beta.1 0.0.1-beta.2 0.0.1-beta.3 0.0.1-beta.4 1.0.0 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4
surecookie / inc / modules / nudges / utils.php

utils.php in SureCookie – GDPR Cookie Consent Banner, Cookie Scanner & Script Blocking trunk, at inc/modules/nudges/utils.php

51 lines 879 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Utils class.
4 *
5 * @package SureCookie\Inc\Modules\Nudges
6 * @since 0.0.1
7 */
8
9 namespace SureCookie\Inc\Modules\Nudges;
10
11 use SureCookie\Inc\Traits\GetInstance;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * The Utils class.
19 *
20 * @package SureCookie\Inc\Modules\Nudges
21 * @since 0.0.1
22 */
23 class Utils {
24 use GetInstance;
25
26 /**
27 * Get Pro Nudges.
28 *
29 * @return array<string, array<string, mixed>>
30 */
31 public function get_nudges() {
32 $nudges = get_option( SURECOOKIE_NUDGES, [] );
33
34 if ( empty( $nudges ) ) {
35 return [];
36 }
37
38 foreach ( $nudges as $key => $nudge ) {
39
40 if ( isset( $nudge['display'] ) && $nudge['display'] === false ) {
41 continue;
42 }
43
44 if ( isset( $nudge['next_time_to_display'] ) && time() < $nudge['next_time_to_display'] ) {
45 $nudges[ $key ]['display'] = false;
46 }
47 }
48 return $nudges;
49 }
50 }
51