PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.14
Patchstack – WordPress & Plugins Security v2.1.14
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / cookie-notice.php

cookie-notice.php in Patchstack – WordPress & Plugins Security 2.1.14, at includes/cookie-notice.php

54 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Class used for the cookie notice that can be enabled by the user.
10 * This is turned off by default.
11 */
12 class P_Cookie_Notice extends P_Core {
13
14 /**
15 * Add the actions required for the cookie notice.
16 *
17 * @param Patchstack $core
18 * @return void
19 */
20 public function __construct( $core ) {
21 parent::__construct( $core );
22
23 // The cookie notice feature can only be used on an activated license.
24 if ( ! $this->license_is_active() || $this->get_option( 'patchstack_license_free', 0 ) == 1 ) {
25 return;
26 }
27
28 // Register the actions if the cookie notice message is turned on.
29 if ( $this->get_option( 'patchstack_enable_cookie_notice_message', false ) == true ) {
30 add_action( 'wp_footer', array( $this, 'add_cookie_notice' ), 1000 );
31 add_action( 'wp_enqueue_scripts', array( $this, 'public_styles' ) );
32 }
33 }
34
35 /**
36 * Cookie notice output.
37 *
38 * @return void
39 */
40 public function add_cookie_notice() {
41 require_once dirname( __FILE__ ) . '/views/cookie-notice.php';
42 }
43
44 /**
45 * Register CSS and JavaScript file for the cookie notice.
46 *
47 * @return void
48 */
49 public function public_styles() {
50 wp_enqueue_style( 'patchstack', $this->plugin->url . 'assets/css/public.min.css', array(), $this->plugin->version );
51 wp_enqueue_script( 'patchstack', $this->plugin->url . 'assets/js/public.min.js', array(), $this->plugin->version );
52 }
53 }
54