DraftNotificationsPlugin   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 66
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getVersion() 0 4 1
A getDeveloper() 0 4 1
A getDeveloperUrl() 0 4 1
A defineSettings() 0 6 1
A getSettingsHtml() 0 6 1
A init() 0 7 1
1
<?php
2
3
namespace Craft;
4
5
class DraftNotificationsPlugin extends BasePlugin
6
{
7
8
    /**
9
     * @return string
10
     */
11
    public function getName()
12
    {
13
        return Craft::t('Draft Notifications');
14
    }
15
16
    /**
17
     * @return string
18
     */
19
    public function getVersion()
20
    {
21
        return '1.0.0';
22
    }
23
24
    /**
25
     * @return string
26
     */
27
    public function getDeveloper()
28
    {
29
        return 'Bart van Gennep';
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getDeveloperUrl()
36
    {
37
        return 'http://www.itmundi.nl';
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    public function defineSettings()
44
    {
45
        return array(
46
            'userGroups' => AttributeType::Mixed,
47
        );
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getSettingsHtml()
54
    {
55
        return craft()->templates->render('draftNotifications/_settings.html.twig', array(
56
            'settings' => $this->getSettings(),
57
        ));
58
    }
59
60
    /**
61
     * Initialize draft listeners
62
     */
63
    public function init()
64
    {
65
        craft()->on('entryRevisions.saveDraft', array(craft()->draftNotifications_eventCallback, 'saveDraftCallBack'));
66
        craft()->on('entryRevisions.deleteDraft', array(craft()->draftNotifications_eventCallback, 'deleteDraftCallBack'));
67
        craft()->on('entries.saveEntry', array(craft()->draftNotifications_eventCallback, 'saveEntryCallBack'));
68
        craft()->on('entries.deleteEntry', array(craft()->draftNotifications_eventCallback, 'deleteEntryCallBack'));
69
    }
70
}