-
Notifications
You must be signed in to change notification settings - Fork 3
/
AmToolsPlugin.php
67 lines (56 loc) · 1.6 KB
/
AmToolsPlugin.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
<?php
namespace Craft;
class AmToolsPlugin extends BasePlugin
{
public function getName()
{
return 'a&m Tools';
}
public function getVersion()
{
return '1.4.2';
}
public function getSchemaVersion()
{
return '1.4.2';
}
public function getDeveloper()
{
return 'a&m impact';
}
public function getDeveloperUrl()
{
return 'http://www.am-impact.nl';
}
public function getSettingsHtml()
{
return craft()->templates->render('amtools/settings', array(
'settings' => $this->getSettings()
));
}
public function init()
{
craft()->amTools_errors->initErrorHandler();
if (craft()->request->isCpRequest())
{
craft()->amTools_imageOptim->registerEvents();
}
// Don't let task bash requests
if (craft()->request->isCpRequest() && craft()->userSession->isLoggedIn() && ! craft()->request->isAjaxRequest()) {
craft()->templates->includeJs('Craft.CP.taskTrackerUpdateInterval = 60000;');
craft()->templates->includeJs('Craft.CP.taskTrackerHudUpdateInterval = 60000;');
}
}
public function addTwigExtension()
{
Craft::import('plugins.amtools.twigextensions.ToolsTwigExtension');
return new ToolsTwigExtension();
}
protected function defineSettings()
{
return array(
'useServerImageOptim' => array(AttributeType::Bool, 'default' => false),
'useImagickImageOptim' => array(AttributeType::Bool, 'default' => true),
);
}
}