-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBootstrap.php
123 lines (108 loc) · 3.34 KB
/
Bootstrap.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* Import / export plugin for theme configurations
*
* @category Shopware
* @package Shopware\Plugins\SimklThemeSettingExport
* @author Simon Klimek <me@simonklimek.de>
* @copyright 2015 Simon Klimek ( http://simonklimek.de )
* @license http://www.gnu.org/licenses/agpl-3.0.en.html GNU AFFERO GENERAL PUBLIC LICENSE
*/
use Shopware\SimklThemeSettingExport\Bootstrap\Installer,
Shopware\SimklThemeSettingExport\Bootstrap\Updater,
Shopware\SimklThemeSettingExport\Components\ThemeImportExportService,
Shopware\SimklThemeSettingExport\Subscriber\Backend,
Shopware\SimklThemeSettingExport\Commands\ThemeImportConfigurationCommand,
Shopware\SimklThemeSettingExport\Commands\ThemeExportConfigurationCommand,
Doctrine\Common\Collections\ArrayCollection;
class Shopware_Plugins_Backend_SimklThemeSettingExport_Bootstrap extends Shopware_Components_Plugin_Bootstrap {
const VERSION = '1.1.1';
/**
* {@inheritdoc}
*/
public function getVersion() {
return $this::VERSION;
}
/**
* {@inheritdoc}
*/
public function getLabel() {
return 'Theme Setting Export';
}
/**
* {@inheritdoc}
*/
public function getCapabilities() {
return array(
'install' => true,
'enable' => true,
'update' => true,
'secureUninstall' => false
);
}
/**
* {@inheritdoc}
*/
public function getInfo() {
return array(
'version' => $this->getVersion(),
'label' => $this->getLabel(),
'autor' => 'Simon Klimek',
'link' => 'https://github.com/simkli',
'description' => 'with this simple plugin you can export and import your theme configurations'
);
}
/**
* {@inheritdoc}
*/
public function install() {
if (!$this->assertMinimumVersion('5')) {
return array('success' => false, 'message' => "this plugin requires at least Shopware version 5");
}
return (new Installer($this))->install();
}
/**
* {@inheritdoc}
*/
public function update($oldVersion) {
return (new Updater($this,$oldVersion))->update();
}
/**
* {@inheritdoc}
*/
public function enable() {
return true;
}
/**
* {@inheritdoc}
*/
public function uninstall() {
return (new Installer($this))->uninstall();
}
/**
* registers application namespace
*/
public function afterInit() {
$this->Application()->Loader()->registerNamespace(
'Shopware\SimklThemeSettingExport',
$this->Path()
);
}
/**
* adds the event subscribers
* @param Enlight_Event_EventArgs $args event args
*/
public function onStartFrontDispatch(\Enlight_Event_EventArgs $arguments) {
$this->Application()->Snippets()->addConfigDir(__DIR__ . '/Snippets/');
$this->Application()->Events()->addSubscriber(new Backend());
}
public function onThemeImportExportService() {
return new ThemeImportExportService($this->get('models'));
}
public function onAddConsoleCommand(\Enlight_Event_EventArgs $arguments) {
return new ArrayCollection([
new ThemeImportConfigurationCommand(),
new ThemeExportConfigurationCommand()
]);
}
}