-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathBootstrap.php
More file actions
100 lines (92 loc) · 3.98 KB
/
Bootstrap.php
File metadata and controls
100 lines (92 loc) · 3.98 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/*
* (c) shopware AG <info@shopware.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
/**
* Piwik - Open source web analytics
* @link http://www.shopware.de
* @package Plugins
* @subpackage Frontend
* @copyright Copyright (c) 2012, shopware AG
* @version 1.0.2
* @author shopware AG (s.kloepper)
*/
class Shopware_Plugins_Frontend_SwagPiwik_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
/**
* standard install method - subscribe an event
* define destination of piwik-installation
* an define the site-id
* @return bool
*/
public function install()
{
$this->subscribeEvent('Enlight_Controller_Action_PostDispatch', 'onPostDispatch');
$form = $this->Form();
$form->setElement('text', 'p_url', array('label'=>'Pfad zu Piwik (mit Slash am Ende)', 'value'=>'www.meinshop.de/piwik/', 'scope'=> \Shopware\Models\Config\Element::SCOPE_SHOP));
$form->setElement('text', 'p_ID', array('label'=>'Seiten-ID Piwik', 'value'=>'1', 'scope'=> \Shopware\Models\Config\Element::SCOPE_SHOP));
$form->save();
return true;
}
/**
* Returns the version of this plugin
*
* @return string
*/
public function getVersion()
{
$info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR .'plugin.json'), true);
if ($info) {
return $info['currentVersion'];
} else {
throw new Exception('The plugin has an invalid version file.');
}
}
/**
* Define template and variables
* @param Enlight_Event_EventArgs $args
*/
public function onPostDispatch(Enlight_Event_EventArgs $args)
{
$request = $args->getSubject()->Request();
$response = $args->getSubject()->Response();
$view = $args->getSubject()->View();
$config = Shopware()->Plugins()->Frontend()->SwagPiwik()->Config();
if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend' || !$view->hasTemplate()) {
return;
}
$view->SwagPiwik = $config;
$view->addTemplateDir($this->Path() . 'Views/');
$args->getSubject()->View()->extendsTemplate('frontend/plugins/swag_piwik/index.tpl');
}
/**
* standard meta description
* @return unknown
*/
public function getInfo()
{
return array(
'version' => $this->getVersion(),
'autor' => 'shopware AG',
'copyright' => 'Copyright � 2012, shopware AG',
'label' => 'Piwik - Open source web analytics',
'source' => $this->getSource(),
'description' => 'Mit diesem Plugin kann der Shopware Shop an die Open Source Analytics Software Piwik angebunden werden. Piwik ist eine Open-Source (GPL lizenzierte) Webanalyse-Software, die heruntergeladen werden kann. Piwik bietet Ihnen detaillierte Echtzeit-Berichte über die Besucher Ihrer Homepage, die genutzten Suchmaschinen und Suchbegriffe, die Sprache, Ihre beliebten Seiten… und vieles mehr. Folgende Funktion unterstützt das Plugin aktuell: Allgemeines Tracking (Zugriffe / Besucher usw.) Erfassen von Bestellungen (inkl. Artikelnummern, Artikelnamen und Brutto-Endbetrag) Erfassen von Warenkörben Erfassen von Detailseiten Erfassen von Kategorien Weitere Informationen zu Piwik: http://de.piwik.org/ http://de.piwik.org/dokumentation/piwik-installieren/ ',
'license' => '',
'support' => 'http://forum.shopware.de',
'link' => 'http://www.shopware.de',
'changes' => array(
'1.0.1'=>array('releasedate'=>'2011-06-20', 'lines' => array(
'First release'
)),
'1.0.2'=>array('releasedate'=>'2012-10-22', 'lines' => array(
'Updated for Shopware 4.0.0'
))
),
);
}
}