- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCloudbustingPlugin.php
More file actions
Latest commit
77 lines (65 loc) · 1.75 KB
/
Copy pathCloudbustingPlugin.php
File metadata and controls
77 lines (65 loc) · 1.75 KB
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
<?php
/**
* cloudbusting plugin for Craft CMS
*
* Purge cloudflare cache for Craft CMS entries on save
*
* @author Piaras Hoban
* @copyright Copyright (c) 2017 Piaras Hoban
* @link https://www.itma.ie
* @package Cloudbusting
* @since 1.0.0
*/
namespaceCraft;
class CloudbustingPlugin extends BasePlugin
{
publicfunctioninit()
{
parent::init();
craft()->on('entries.saveEntry', function(Event$event) {
craft()->cloudbusting->purgeCache($event->params['entry']['url']);
});
}
publicfunctiongetName()
{
return Craft::t('cloudbusting');
}
publicfunctiongetDescription()
{
return Craft::t('Purge Cloudflare cache for Craft CMS entries on save');
}
publicfunctiongetDocumentationUrl()
{
return'https://github.com/TaisceCheol/cloudbusting/blob/master/README.md';
}
publicfunctiongetVersion()
{
return'1.0.0';
}
publicfunctiongetSchemaVersion()
{
return'1.0.0';
}
publicfunctiongetDeveloper()
{
return'Piaras Hoban';
}
publicfunctiongetDeveloperUrl()
{
return'https://www.itma.ie';
}
protectedfunctiondefineSettings()
{
returnarray(
'apiKey' => array(AttributeType::String, 'required' => true, 'label' => 'API Key'),
'zone' => array(AttributeType::String, 'required' => true, 'label' => 'Zone ID'),
'email' => array(AttributeType::String, 'required' => true, 'label' => 'Cloudflare Email')
);
}
publicfunctiongetSettingsHtml()
{
returncraft()->templates->render('cloudbusting/_settings', array(
'settings' => $this->getSettings()
));
}
}