-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathe_header.php
79 lines (65 loc) · 1.72 KB
/
e_header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file
* Class instantiation to prepare JavaScript configurations and include css/js
* files to page header.
*/
if(!defined('e107_INIT'))
{
exit;
}
// [PLUGINS]/cookie_consent/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('cookie_consent', false, true);
/**
* Class cookie_consent_e_header.
*/
class cookie_consent_e_header
{
/**
* Constructor.
*/
function __construct()
{
if(USER_AREA)
{
self::include_components();
}
}
/**
* Include necessary CSS and JS files
*/
function include_components()
{
$prefs = e107::getPlugConfig('cookie_consent')->getPref();
$theme = vartrue($prefs['theme'], 'light-floating');
if((int) vartrue($prefs['cdn'], 0) === 0)
{
$theme = false;
}
$settings = array(
'message' => deftrue($prefs['message'], $prefs['message']),
'dismiss' => deftrue($prefs['dismiss'], $prefs['dismiss']),
'learnMore' => deftrue($prefs['learnMore'], $prefs['learnMore']),
'link' => !empty($prefs['link']) ? $prefs['link'] : null,
'container' => !empty($prefs['container']) ? $prefs['container'] : null,
'theme' => $theme,
'path' => vartrue($prefs['path'], '/'),
'domain' => vartrue($prefs['domain'], $_SERVER['HTTP_HOST']),
'expiryDays' => vartrue($prefs['expiryDays'], 365),
'target' => vartrue($prefs['target'], '_self'),
);
e107::library('load', 'jquery.once');
e107::js('settings', array('cookie_consent' => $settings));
e107::js('cookie_consent', 'js/cookie_consent.js', 'jquery', 4);
if((int) vartrue($prefs['cdn'], 0) === 1)
{
e107::library('load', 'cdn.cookieconsent2');
}
else
{
e107::library('load', 'cookieconsent2');
}
}
}
// Class instantiation.
new cookie_consent_e_header;