Jira_Woopra - Version 1.0.0

Version Notes

fs

Download this release

Release Info

Developer Magento Core Team
Extension Jira_Woopra
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Jira/Woopra/Block/Script.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Woopra plugin for Magento
4
+ *
5
+ * @category design_default
6
+ * @package Jira_Woopra
7
+ * @author Jisse Reitsma (Jira ICT)
8
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
9
+ * @license Open Software License
10
+ */
11
+
12
+ class Jira_Woopra_Block_Script extends Mage_Core_Block_Template
13
+ {
14
+ /*
15
+ * Constructor method
16
+ */
17
+ public function _construct()
18
+ {
19
+ parent::_construct();
20
+
21
+ // Decide whether the Woopra Plugin has been actived
22
+ $website_id = Mage::helper('woopra')->getWebsiteId();
23
+ if(Mage::helper('woopra')->enabled() == true && !empty($website_id)) {
24
+ // Setting the template-name will generate the block
25
+ $this->setTemplate('woopra/script.phtml');
26
+ }
27
+ }
28
+
29
+ /*
30
+ * Helper method to get data to show in Woopra
31
+ */
32
+ public function getSetting($key = '')
33
+ {
34
+ static $data;
35
+ if(empty($data)) {
36
+
37
+ $data = array(
38
+ 'website_id' => Mage::helper('woopra')->getWebsiteId(), // Woopra website ID
39
+ 'enabled' => Mage::helper('woopra')->enabled(), // Plugin status
40
+ 'test' => Mage::helper('woopra')->test(), // Plugin testing mode
41
+ );
42
+
43
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
44
+ if(!empty($customer)) {
45
+ $data['name'] = Mage::getSingleton('customer/session')->getCustomer()->getName();
46
+ $data['email'] = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
47
+ $data['avatar'] = '';
48
+
49
+ $address = $customer->getDefaultBillingAddress();
50
+ if(!empty($address)) $address = $customer->getDefaultShippingAddress();
51
+ if(!empty($address)) {
52
+ $data['company'] = $address->getCompany();
53
+ $data['city'] = $address->getCity() . ' (' . $address->getCountryId() . ')';
54
+ }
55
+ }
56
+ }
57
+
58
+ if(isset($data[$key])) {
59
+ return $data[$key];
60
+ } else {
61
+ return null;
62
+ }
63
+ }
64
+ }
app/code/community/Jira/Woopra/Helper/Data.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Woopra plugin for Magento
4
+ *
5
+ * @category design_default
6
+ * @package Jira_Woopra
7
+ * @author Jisse Reitsma (Jira ICT)
8
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
9
+ * @license Open Software License
10
+ */
11
+
12
+ class Jira_Woopra_Helper_Data extends Mage_Core_Helper_Abstract
13
+ {
14
+ public function getWebsiteId()
15
+ {
16
+ return Mage::getStoreConfig('woopra/settings/website_id');
17
+ }
18
+
19
+ public function enabled()
20
+ {
21
+ return (bool)Mage::getStoreConfig('woopra/settings/active');
22
+ }
23
+
24
+ public function test()
25
+ {
26
+ return (bool)Mage::getStoreConfig('woopra/settings/test');
27
+ }
28
+ }
app/code/community/Jira/Woopra/etc/config.xml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Woopra plugin for Magento
5
+ *
6
+ * @category design_default
7
+ * @package Jira_Woopra
8
+ * @author Jisse Reitsma (Jira ICT)
9
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
10
+ * @license Open Software License
11
+ */
12
+ -->
13
+ <config>
14
+
15
+ <modules>
16
+ <Jira_Woopra>
17
+ <version>1.0.0</version>
18
+ </Jira_Woopra>
19
+ </modules>
20
+
21
+ <global>
22
+ <blocks>
23
+ <woopra>
24
+ <class>Jira_Woopra_Block</class>
25
+ </woopra>
26
+ </blocks>
27
+ <helpers>
28
+ <woopra>
29
+ <class>Jira_Woopra_Helper</class>
30
+ </woopra>
31
+ </helpers>
32
+ </global>
33
+
34
+ <frontend>
35
+ <layout>
36
+ <updates>
37
+ <woopra>
38
+ <file>woopra.xml</file>
39
+ </woopra>
40
+ </updates>
41
+ </layout>
42
+ </frontend>
43
+
44
+ <adminhtml>
45
+ <acl>
46
+ <resources>
47
+ <admin>
48
+ <children>
49
+ <system>
50
+ <children>
51
+ <config>
52
+ <children>
53
+ <woopra translate="title" module="woopra">
54
+ <title>Woopra</title>
55
+ </woopra>
56
+ </children>
57
+ </config>
58
+ </children>
59
+ </system>
60
+ </children>
61
+ </admin>
62
+ </resources>
63
+ </acl>
64
+ </adminhtml>
65
+
66
+ </config>
app/code/community/Jira/Woopra/etc/system.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Woopra plugin for Magento
5
+ *
6
+ * @category design_default
7
+ * @package Jira_Woopra
8
+ * @author Jisse Reitsma (Jira ICT)
9
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
10
+ * @license Open Software License
11
+ */
12
+ -->
13
+ <config>
14
+ <sections>
15
+ <woopra translate="label" module="woopra">
16
+ <label>Woopra</label>
17
+ <tab>sales</tab>
18
+ <frontend_type>text</frontend_type>
19
+ <sort_order>342</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ <groups>
24
+ <settings translate="label">
25
+ <label>Settings</label>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>1</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ <fields>
32
+ <active translate="label">
33
+ <label>Enabled</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>adminhtml/system_config_source_yesno</source_model>
36
+ <sort_order>1</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </active>
41
+ <test translate="label">
42
+ <label>Show test-alert</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <sort_order>1</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </test>
50
+ <website_id translate="label">
51
+ <label>Website ID</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <show_in_store>1</show_in_store>
58
+ </website_id>
59
+ </fields>
60
+ </settings>
61
+ </groups>
62
+ </woopra>
63
+ </sections>
64
+ </config>
app/design/frontend/default/default/layout/woopra.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Woopra plugin for Magento
5
+ *
6
+ * @category design_default
7
+ * @package Jira_Woopra
8
+ * @author Jisse Reitsma (Jira ICT)
9
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
10
+ * @license Open Software License
11
+ *
12
+ * @todo
13
+ * - We need to initialize Woopra-block twice, to make it work
14
+ */
15
+ -->
16
+ <layout version="0.1.0">
17
+ <default>
18
+ <!--<block type="woopra/script"/>-->
19
+
20
+ <reference name="before_body_end">
21
+ <block type="woopra/script" name="woopra" as="woopra" template="woopra/script.phtml"/>
22
+ </reference>
23
+
24
+ </default>
25
+ </layout>
app/design/frontend/default/default/template/woopra/script.phtml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Woopra plugin for Magento
4
+ *
5
+ * @category design_default
6
+ * @package Jira_Woopra
7
+ * @author Jisse Reitsma (Jira ICT)
8
+ * @copyright Copyright (c) 2009 Jira ICT (http://www.jira.nl/)
9
+ * @license Open Software License
10
+ *
11
+ * @todo
12
+ * - convert woopra_array into woopra_visitor
13
+ * - introduce woopra_event['sale']
14
+ * - rewrite SSL-check from JavaScript to PHP-code (Magento class)
15
+ * - add extra information like woopra_array['fullname'] or woopra_array['']
16
+ */
17
+ ?>
18
+ <!-- BEGIN WOOPRA PLUGIN CODE -->
19
+ <script type="text/javascript" language="javascript">
20
+ <?php if($this->getSetting('test')) { ?>
21
+ alert('Woopra is installed but in test mode');
22
+ <?php } else { ?>
23
+ var woopra_id = '<?php echo $this->getSetting('website_id'); ?>';
24
+ var woopra_visitor = new Array();
25
+ woopra_visitor['name'] = '<?php echo $this->getSetting('name'); ?>';
26
+ woopra_visitor['email'] = '<?php echo $this->getSetting('email'); ?>';
27
+ woopra_visitor['avatar'] = '<?php echo $this->getSetting('avatar'); ?>';
28
+ woopra_visitor['company'] = '<?php echo $this->getSetting('company'); ?>';
29
+ woopra_visitor['city'] = '<?php echo $this->getSetting('city'); ?>';
30
+ woopra_event['title'] = '<?php echo trim($this->getLayout()->getBlock('head')->getTitle()); ?>';
31
+ var woopra_host = ((document.location.protocol=='https:') ? "https://sec1.woopra.com" : "http://static.woopra.com");
32
+ document.write(unescape("%3Cscript src='" + woopra_host + "/js/woopra.js' type='text/javascript'%3E%3C/script%3E"));
33
+ <?php } ?>
34
+ </script>
35
+ <!-- END WOOPRA PLUGIN CODE -->
app/etc/modules/Jira_Woopra.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <_>
2
+ <form_key>WYwgd975ZPtui3d9</form_key>
3
+ <name>Jira_Woopra</name>
4
+ <channel>connect.magentocommerce.com/community</channel>
5
+ <summary>This module integrates Magento with Woopra</summary>
6
+ <description>This module integrates Magento with Woopra</description>
7
+ <license>OSL v3.0</license>
8
+ <license_uri>http://www.opensource.org/licenses/osl-3.0.php</license_uri>
9
+ <release_version>1.0.0</release_version>
10
+ <api_version>1.0.0</api_version>
11
+ <release_stability>stable</release_stability>
12
+ <api_stability>stable</api_stability>
13
+ <notes>fs</notes>
14
+ <maintainers>
15
+ <role>
16
+ <role>lead</role>
17
+ <role>lead</role>
18
+ </role>
19
+ <name>
20
+ <name/>
21
+ <name>Jisse Reitsma</name>
22
+ </name>
23
+ <handle>
24
+ <handle/>
25
+ <handle/>
26
+ </handle>
27
+ <email>
28
+ <email/>
29
+ <email>jisse@jira.nl</email>
30
+ </email>
31
+ <active>
32
+ <active>0</active>
33
+ <active>1</active>
34
+ </active>
35
+ </maintainers>
36
+ <depends_php_min>5.2.0</depends_php_min>
37
+ <depends_php_max>6.0.0</depends_php_max>
38
+ <depends_php_recommended/>
39
+ <depends_php_exclude/>
40
+ <depends>
41
+ <package>
42
+ <name>
43
+ <name/>
44
+ </name>
45
+ <channel>
46
+ <channel/>
47
+ </channel>
48
+ <min>
49
+ <min/>
50
+ </min>
51
+ <max>
52
+ <max/>
53
+ </max>
54
+ <recommended>
55
+ <recommended/>
56
+ </recommended>
57
+ <exclude>
58
+ <exclude/>
59
+ </exclude>
60
+ <type>
61
+ <type>required</type>
62
+ </type>
63
+ </package>
64
+ <subpackage>
65
+ <name>
66
+ <name/>
67
+ </name>
68
+ <channel>
69
+ <channel/>
70
+ </channel>
71
+ <min>
72
+ <min/>
73
+ </min>
74
+ <max>
75
+ <max/>
76
+ </max>
77
+ <recommended>
78
+ <recommended/>
79
+ </recommended>
80
+ <exclude>
81
+ <exclude/>
82
+ </exclude>
83
+ <type>
84
+ <type>required</type>
85
+ </type>
86
+ </subpackage>
87
+ <extension>
88
+ <name>
89
+ <name>PDO</name>
90
+ </name>
91
+ <min>
92
+ <min/>
93
+ </min>
94
+ <max>
95
+ <max/>
96
+ </max>
97
+ <recommended>
98
+ <recommended/>
99
+ </recommended>
100
+ <exclude>
101
+ <exclude/>
102
+ </exclude>
103
+ <type>
104
+ <type>required</type>
105
+ </type>
106
+ </extension>
107
+ </depends>
108
+ <contents>
109
+ <role>
110
+ <role>magelocal</role>
111
+ <role>magecommunity</role>
112
+ <role>magedesign</role>
113
+ <role>magedesign</role>
114
+ <role>mageetc</role>
115
+ </role>
116
+ <path>
117
+ <path/>
118
+ <path>Jira/Woopra</path>
119
+ <path>frontend/default/default/layout/woopra.xml</path>
120
+ <path>frontend/default/default/template/woopra</path>
121
+ <path>modules/Jira_Woopra.xml</path>
122
+ </path>
123
+ <type>
124
+ <type>file</type>
125
+ <type>dir</type>
126
+ <type>file</type>
127
+ <type>dir</type>
128
+ <type>file</type>
129
+ </type>
130
+ <include>
131
+ <include/>
132
+ <include/>
133
+ <include/>
134
+ <include/>
135
+ <include/>
136
+ </include>
137
+ <ignore>
138
+ <ignore/>
139
+ <ignore/>
140
+ <ignore/>
141
+ <ignore/>
142
+ <ignore/>
143
+ </ignore>
144
+ </contents>
145
+ <page>1</page>
146
+ <limit>200</limit>
147
+ <filename/>
148
+ </_>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Jira_Woopra</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This module integrates Magento with Woopra</summary>
10
+ <description>This module integrates Magento with Woopra</description>
11
+ <notes>fs</notes>
12
+ <authors><author><name>Jisse Reitsma</name><user>auto-converted</user><email>info@jira.nl</email></author></authors>
13
+ <date>2009-04-03</date>
14
+ <time>14:03:57</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="woopra.xml" hash="a669d551ae0f420c1c0d41120bb63b1b"/></dir><dir name="template"><dir name="woopra"><file name="script.phtml" hash="b94d61eaa503f1200ceb2bce7d52c617"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Jira"><dir name="Woopra"><dir name="Block"><file name="Script.php" hash="e5ecdb8c2c9e57e122afe1e0f55deb9d"/></dir><dir name="etc"><file name="config.xml" hash="b3bca69e98758e12e11b5424f813bc07"/><file name="system.xml" hash="28ea9bbe116f4a292ec9bf2a1313c4e4"/></dir><dir name="Helper"><file name="Data.php" hash="1579ee95b1f3e3556ec5fca65856cf05"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jira_Woopra.xml" hash="7bfe9331fb9392f7ac313fa55e76ce2c"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>