forked from zauberware/acceptcookies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AcceptCookiesPlugin.php
44 lines (38 loc) · 1.37 KB
/
AcceptCookiesPlugin.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
<?php
namespace Craft;
/**
* AcceptCookies Plugin.
*
* Plugin to display cookie acceptor on page. If user accepts, the plugin enables GoogleAnalytics
*
* @author Simon Franzen <[email protected]>
* @copyright Copyright (c) 2017, Simon Franzen @ zauberware technologies
* @license http://buildwithcraft.com/license Craft License Agreement
*
* @link http://github.com/....
* @since 1.0
*/
class AcceptCookiesPlugin extends BasePlugin {
function getName() { return 'Accept Cookies'; }
function getVersion() { return '2.0'; }
function getDeveloper() { return 'zauberware technologies'; }
function getDeveloperUrl() { return 'https://www.zauberware.com'; }
protected function defineSettings() {
return array(
'googleAnalyticsTrackingId' => array(AttributeType::String,'default' => 'UA-YYYYYYYY-X'),
'codeSnippets' => '',
'policyUrl' => '/data-policy',
'showRejectButton' => array('default' => true)
);
}
public function getSettingsHtml() {
return craft()->templates->render('acceptcookies/settings', array(
'settings' => $this->getSettings()
));
}
public function prepSettings($settings) {
// showRejectButton needs to be made a boolean?
// we're getting an empty string from the settings page
return $settings;
}
}