Pubble_io - Version 1.1.0

Version Notes

First release

- Supports enabling/disabling the extension.
- Supports adding the messenger widget to your site via either Copy & Pasting the code directly from Pubble or just adding in the App ID and Identifier fields.

Download this release

Release Info

Developer StudioForty9
Extension Pubble_io
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.0 to 1.1.0

app/code/community/Pubble/Messenger/Block/Script.php CHANGED
@@ -5,8 +5,8 @@
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
- * @copyright 2015 Pubble (http://www.pubble.io)
9
- * @version 1.0.0
10
  */
11
 
12
  /**
@@ -22,7 +22,7 @@ class Pubble_Messenger_Block_Script extends Mage_Core_Block_Template
22
  * The pubble javascript library code URL.
23
  * @var string
24
  */
25
- protected $_url = '//www.pubble.io/resources/javascript/QAInit.js';
26
 
27
  /**
28
  * Render the javascript to initialize the pubble messenger.
@@ -30,67 +30,14 @@ class Pubble_Messenger_Block_Script extends Mage_Core_Block_Template
30
  * @return string
31
  */
32
  public function render()
33
- {
34
- return ($this->isCopyPaste()) ? $this->renderCode() : $this->renderCredentials();
35
- }
36
-
37
- /**
38
- * Is the configuration method set to 'Copy & Paste'?
39
- *
40
- * @return bool
41
- */
42
- protected function isCopyPaste()
43
- {
44
- return $this->_getHelper()->isMethodCopyPaste();
45
- }
46
-
47
- /**
48
- * Render the copy and pasted code.
49
- *
50
- * @return string
51
- */
52
- protected function renderCode()
53
- {
54
- return $this->_getHelper()->getCode();
55
- }
56
-
57
- /**
58
- * Render the tag to fetch the pubble javascript library code.
59
- *
60
- * @return string
61
- */
62
- protected function renderJsUrl()
63
- {
64
- return sprintf('<script type="text/javascript" src="%s"></script>', $this->_url);
65
- }
66
-
67
- /**
68
- * Render the javascript to initialize the pubble messenger.
69
- *
70
- * @return string
71
- */
72
- protected function renderJsScript()
73
  {
74
  $appId = $this->_getHelper()->getAppId();
75
  $identifier = $this->_getHelper()->getIdentifier();
76
-
77
- $html = sprintf(
78
- '<script type="text/javascript">var lpQA = lpQA({appID: "%s", identifier: "%s"});</script>',
79
- $appId,
80
- $identifier
81
- );
82
 
83
- return $html;
84
- }
85
-
86
- /**
87
- * Render the javascript using credential variables.
88
- *
89
- * @return string
90
- */
91
- protected function renderCredentials()
92
- {
93
- return sprintf("%s\n%s", $this->renderJsUrl(), $this->renderJsScript());
94
  }
95
 
96
  /**
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
+ * @copyright 2016 Pubble (http://www.pubble.io)
9
+ * @version 1.1.0
10
  */
11
 
12
  /**
22
  * The pubble javascript library code URL.
23
  * @var string
24
  */
25
+ protected $_url = '//d2dfzm19238yrf.cloudfront.net/javascript/loader.js';
26
 
27
  /**
28
  * Render the javascript to initialize the pubble messenger.
30
  * @return string
31
  */
32
  public function render()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  {
34
  $appId = $this->_getHelper()->getAppId();
35
  $identifier = $this->_getHelper()->getIdentifier();
 
 
 
 
 
 
36
 
37
+ return sprintf(
38
+ '<div class="pubble-app" data-app-id="%s" data-app-identifier="%s"></div><script type="text/javascript" src="%s" defer></script>',
39
+ $appId, $identifier, $this->_url
40
+ );
 
 
 
 
 
 
 
41
  }
42
 
43
  /**
app/code/community/Pubble/Messenger/Helper/Data.php CHANGED
@@ -5,8 +5,8 @@
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
- * @copyright 2015 Pubble (http://www.pubble.io)
9
- * @version 1.0.0
10
  */
11
 
12
  /**
@@ -18,14 +18,6 @@
18
  */
19
  class Pubble_Messenger_Helper_Data extends Mage_Core_Helper_Abstract
20
  {
21
- /**#@+
22
- * Configuration Method Types
23
- * @var int
24
- */
25
- const METHOD_CREDENTIALS = 1;
26
- const METHOD_COPYPASTE = 2;
27
- /**#@-*/
28
-
29
  /**
30
  * Determine whether the module is enabled via admin configuration.
31
  *
@@ -36,36 +28,6 @@ class Pubble_Messenger_Helper_Data extends Mage_Core_Helper_Abstract
36
  return Mage::getStoreConfigFlag('pubble/messenger/enabled');
37
  }
38
 
39
- /**
40
- * Get the method configuration type.
41
- *
42
- * @return int
43
- */
44
- public function getMethod()
45
- {
46
- return (int) Mage::getStoreConfig('pubble/messenger/method');
47
- }
48
-
49
- /**
50
- * Determine if the method type is 'credentials'.
51
- *
52
- * @return bool
53
- */
54
- public function isMethodCredentials()
55
- {
56
- return ($this->getMethod() === static::METHOD_CREDENTIALS);
57
- }
58
-
59
- /**
60
- * Determine if the method type is 'copy and paste'.
61
- *
62
- * @return bool
63
- */
64
- public function isMethodCopyPaste()
65
- {
66
- return ($this->getMethod() === static::METHOD_COPYPASTE);
67
- }
68
-
69
  /**
70
  * Get the configuration setting for App Id.
71
  *
@@ -85,14 +47,4 @@ class Pubble_Messenger_Helper_Data extends Mage_Core_Helper_Abstract
85
  {
86
  return Mage::getStoreConfig('pubble/messenger/identifier');
87
  }
88
-
89
- /**
90
- * Get the copy and pasted code from Pubble saved in the configuration.
91
- *
92
- * @return int
93
- */
94
- public function getCode()
95
- {
96
- return Mage::getStoreConfig('pubble/messenger/code');
97
- }
98
  }
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
+ * @copyright 2016 Pubble (http://www.pubble.io)
9
+ * @version 1.1.0
10
  */
11
 
12
  /**
18
  */
19
  class Pubble_Messenger_Helper_Data extends Mage_Core_Helper_Abstract
20
  {
 
 
 
 
 
 
 
 
21
  /**
22
  * Determine whether the module is enabled via admin configuration.
23
  *
28
  return Mage::getStoreConfigFlag('pubble/messenger/enabled');
29
  }
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  /**
32
  * Get the configuration setting for App Id.
33
  *
47
  {
48
  return Mage::getStoreConfig('pubble/messenger/identifier');
49
  }
 
 
 
 
 
 
 
 
 
 
50
  }
app/code/community/Pubble/Messenger/Model/Observer.php CHANGED
@@ -5,8 +5,8 @@
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
- * @copyright 2015 Pubble (http://www.pubble.io)
9
- * @version 1.0.0
10
  */
11
 
12
  /**
@@ -27,7 +27,7 @@ class Pubble_Messenger_Model_Observer
27
  const BLOCK_TEMPLATE = 'pubble/messenger/script.phtml';
28
  const BLOCK_TARGET = 'before_body_end';
29
  /**#@-*/
30
-
31
  /**
32
  * Add Pubble script to the footer.
33
  *
@@ -43,7 +43,7 @@ class Pubble_Messenger_Model_Observer
43
  if (! $this->_getHelper()->isEnabled()) {
44
  return $this;
45
  }
46
-
47
  try {
48
  /** @var Mage_Core_Model_Layout $layout */
49
  /** @var Pubble_Messenger_Block_Script $pubble */
@@ -51,14 +51,14 @@ class Pubble_Messenger_Model_Observer
51
  $pubble = $layout->createBlock(self::BLOCK_NAME, self::BLOCK_ALIAS);
52
  $pubble->setTemplate(self::BLOCK_TEMPLATE);
53
  $layout->getBlock(self::BLOCK_TARGET)->append($pubble);
54
-
55
  return $pubble;
56
  } catch (Exception $e) {
57
  Mage::logException($e);
58
  return false;
59
  }
60
  }
61
-
62
  /**
63
  * Get an instance of the Pubble Data helper.
64
  *
5
  * @category Pubble
6
  * @package Pubble_Messenger
7
  * @author Pubble <ross@pubble.io>
8
+ * @copyright 2016 Pubble (http://www.pubble.io)
9
+ * @version 1.1.0
10
  */
11
 
12
  /**
27
  const BLOCK_TEMPLATE = 'pubble/messenger/script.phtml';
28
  const BLOCK_TARGET = 'before_body_end';
29
  /**#@-*/
30
+
31
  /**
32
  * Add Pubble script to the footer.
33
  *
43
  if (! $this->_getHelper()->isEnabled()) {
44
  return $this;
45
  }
46
+
47
  try {
48
  /** @var Mage_Core_Model_Layout $layout */
49
  /** @var Pubble_Messenger_Block_Script $pubble */
51
  $pubble = $layout->createBlock(self::BLOCK_NAME, self::BLOCK_ALIAS);
52
  $pubble->setTemplate(self::BLOCK_TEMPLATE);
53
  $layout->getBlock(self::BLOCK_TARGET)->append($pubble);
54
+
55
  return $pubble;
56
  } catch (Exception $e) {
57
  Mage::logException($e);
58
  return false;
59
  }
60
  }
61
+
62
  /**
63
  * Get an instance of the Pubble Data helper.
64
  *
app/code/community/Pubble/Messenger/Model/Source/Method.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
- /**
3
- * Pubble_Messenger
4
- *
5
- * @category Pubble
6
- * @package Pubble_Messenger
7
- * @author Pubble <ross@pubble.io>
8
- * @copyright 2015 Pubble (http://www.pubble.io)
9
- * @version 1.0.0
10
- */
11
-
12
- /**
13
- * Pubble_Messenger_Model_Source_Method
14
- *
15
- * @category Pubble
16
- * @package Pubble_Messenger
17
- * @subpackage Model
18
- */
19
- class Pubble_Messenger_Model_Source_Method
20
- {
21
- /**
22
- * Provide the methods as options to the select box.
23
- *
24
- * @return array
25
- */
26
- public function toOptionArray()
27
- {
28
- return array(
29
- Pubble_Messenger_Helper_Data::METHOD_COPYPASTE => $this->_getHelper()->__('Copy & Paste'),
30
- Pubble_Messenger_Helper_Data::METHOD_CREDENTIALS => $this->_getHelper()->__('Credentials'),
31
- );
32
- }
33
-
34
- /**
35
- * Get an instance of the Pubble Data helper.
36
- *
37
- * @return Pubble_Messenger_Helper_Data
38
- */
39
- private function _getHelper()
40
- {
41
- return Mage::helper('pubble_messenger');
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Pubble/Messenger/data/pubble_messenger_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // No data to update
app/code/community/Pubble/Messenger/data/pubble_messenger_setup/data-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $paths = array('pubble/messenger/method', 'pubble/messenger/code');
4
+ foreach ($paths as $path) {
5
+ Mage::getConfig()->deleteConfig($path);
6
+ }
7
+
8
+ if (2 === Mage::getStoreConfigFlag('pubble/messenger/method')) {
9
+ Mage::getConfig()->saveConfig('pubble/messenger/enabled', 0);
10
+ }
app/code/community/Pubble/Messenger/etc/config.xml CHANGED
@@ -6,14 +6,14 @@
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
- * @copyright 2015 Pubble (http://www.pubble.io)
10
- * @version 1.0.0
11
  */
12
  -->
13
  <config>
14
  <modules>
15
  <Pubble_Messenger>
16
- <version>1.0.0</version>
17
  </Pubble_Messenger>
18
  </modules>
19
  <global>
@@ -32,6 +32,13 @@
32
  <class>Pubble_Messenger_Model</class>
33
  </pubble_messenger>
34
  </models>
 
 
 
 
 
 
 
35
  </global>
36
  <frontend>
37
  <events>
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
+ * @copyright 2016 Pubble (http://www.pubble.io)
10
+ * @version 1.1.0
11
  */
12
  -->
13
  <config>
14
  <modules>
15
  <Pubble_Messenger>
16
+ <version>1.1.0</version>
17
  </Pubble_Messenger>
18
  </modules>
19
  <global>
32
  <class>Pubble_Messenger_Model</class>
33
  </pubble_messenger>
34
  </models>
35
+ <resources>
36
+ <pubble_messenger_setup>
37
+ <setup>
38
+ <module>Pubble_Messenger</module>
39
+ </setup>
40
+ </pubble_messenger_setup>
41
+ </resources>
42
  </global>
43
  <frontend>
44
  <events>
app/code/community/Pubble/Messenger/etc/system.xml CHANGED
@@ -6,8 +6,8 @@
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
- * @copyright 2015 Pubble (http://www.pubble.io)
10
- * @version 1.0.0
11
  */
12
  -->
13
  <config>
@@ -44,15 +44,6 @@
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </enabled>
47
- <method translate="label">
48
- <label>Method</label>
49
- <frontend_type>select</frontend_type>
50
- <source_model>pubble_messenger/source_method</source_model>
51
- <sort_order>20</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- </method>
56
  <app_id translate="label" module="pubble_messenger">
57
  <label>App ID</label>
58
  <frontend_type>text</frontend_type>
@@ -60,7 +51,6 @@
60
  <show_in_default>1</show_in_default>
61
  <show_in_website>1</show_in_website>
62
  <show_in_store>1</show_in_store>
63
- <depends><method>1</method></depends>
64
  </app_id>
65
  <identifier translate="label" module="pubble_messenger">
66
  <label>Identifier</label>
@@ -69,17 +59,7 @@
69
  <show_in_default>1</show_in_default>
70
  <show_in_website>1</show_in_website>
71
  <show_in_store>1</show_in_store>
72
- <depends><method>1</method></depends>
73
  </identifier>
74
- <code translate="label" module="pubble_messenger">
75
- <label>Copy &amp; Paste Your Tracking Code</label>
76
- <frontend_type>textarea</frontend_type>
77
- <sort_order>30</sort_order>
78
- <show_in_default>1</show_in_default>
79
- <show_in_website>1</show_in_website>
80
- <show_in_store>1</show_in_store>
81
- <depends><method>2</method></depends>
82
- </code>
83
  </fields>
84
  </messenger>
85
  </groups>
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
+ * @copyright 2016 Pubble (http://www.pubble.io)
10
+ * @version 1.1.0
11
  */
12
  -->
13
  <config>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  </enabled>
 
 
 
 
 
 
 
 
 
47
  <app_id translate="label" module="pubble_messenger">
48
  <label>App ID</label>
49
  <frontend_type>text</frontend_type>
51
  <show_in_default>1</show_in_default>
52
  <show_in_website>1</show_in_website>
53
  <show_in_store>1</show_in_store>
 
54
  </app_id>
55
  <identifier translate="label" module="pubble_messenger">
56
  <label>Identifier</label>
59
  <show_in_default>1</show_in_default>
60
  <show_in_website>1</show_in_website>
61
  <show_in_store>1</show_in_store>
 
62
  </identifier>
 
 
 
 
 
 
 
 
 
63
  </fields>
64
  </messenger>
65
  </groups>
app/etc/modules/Pubble_Messenger.xml CHANGED
@@ -6,8 +6,8 @@
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
- * @copyright 2015 Pubble (http://www.pubble.io)
10
- * @version 1.0.0
11
  */
12
  -->
13
  <config>
6
  * @category Pubble
7
  * @package Pubble_Messenger
8
  * @author Pubble <ross@pubble.io>
9
+ * @copyright 2016 Pubble (http://www.pubble.io)
10
+ * @version 1.1.0
11
  */
12
  -->
13
  <config>
package.xml CHANGED
@@ -1,22 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Pubble_io</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/BSD-3-Clause">BSDL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Easily install your Pubble messenger code on Magento via the admin configuration panel.</summary>
10
  <description>&lt;p&gt;Supports enabling/disabling the extension.&lt;/p&gt;&#xD;
11
- &lt;p&gt;Supports adding the messenger widget to your site via either Copy &amp; Pasting the code directly from Pubble or just adding in the App ID and Identifier fields.&lt;/p&gt;</description>
12
  <notes>First release&#xD;
13
  &#xD;
14
  - Supports enabling/disabling the extension.&#xD;
15
  - Supports adding the messenger widget to your site via either Copy &amp; Pasting the code directly from Pubble or just adding in the App ID and Identifier fields.</notes>
16
  <authors><author><name>StudioForty9</name><user>SF9</user><email>info@studioforty9.com</email></author><author><name>Eoghan O'Brien</name><user>eoghanobrien</user><email>eoghan@eoghanobrien.com</email></author><author><name>Pubble</name><user>soleary</user><email>shane@pubble.co</email></author></authors>
17
- <date>2015-11-09</date>
18
- <time>15:15:15</time>
19
- <contents><target name="magecommunity"><dir name="Pubble"><dir name="Messenger"><dir name="Block"><file name="Script.php" hash="a96a1d8ad303585ab6acdc5deebd6c93"/></dir><dir name="Helper"><file name="Data.php" hash="7aad922f7fcc70ded4b0325ffd6c2915"/></dir><dir name="Model"><file name="Observer.php" hash="dfd1caca574a6aaf23464a9e1ecd796f"/><dir name="Source"><file name="Method.php" hash="3fd1cb931b9de16434f24b8fa59afe90"/></dir></dir><dir name="etc"><file name="config.xml" hash="5265b17a5e29a7065d2017959e8d1efa"/><file name="system.xml" hash="3ad88728ac8523ba6947afb91ccd20d2"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pubble"><file name="messenger" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pubble_Messenger.xml" hash="299e7218c4c3f9de5a9f26cd68e92f53"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.00.00</min><max>7.99.99</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Pubble_io</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/BSD-3-Clause">BSDL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Easily install your Pubble messenger code on Magento via the admin configuration panel.</summary>
10
  <description>&lt;p&gt;Supports enabling/disabling the extension.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;Supports adding the messenger widget to your site by adding in the App ID and Identifier fields.&lt;/p&gt;</description>
12
  <notes>First release&#xD;
13
  &#xD;
14
  - Supports enabling/disabling the extension.&#xD;
15
  - Supports adding the messenger widget to your site via either Copy &amp; Pasting the code directly from Pubble or just adding in the App ID and Identifier fields.</notes>
16
  <authors><author><name>StudioForty9</name><user>SF9</user><email>info@studioforty9.com</email></author><author><name>Eoghan O'Brien</name><user>eoghanobrien</user><email>eoghan@eoghanobrien.com</email></author><author><name>Pubble</name><user>soleary</user><email>shane@pubble.co</email></author></authors>
17
+ <date>2016-05-18</date>
18
+ <time>01:29:29</time>
19
+ <contents><target name="magecommunity"><dir name="Pubble"><dir name="Messenger"><dir name="Block"><file name="Script.php" hash="a9e10c0429e4dd8727deb2896f5bd156"/></dir><dir name="Helper"><file name="Data.php" hash="f9f8e5fd410049d31d5b29313213e768"/></dir><dir name="Model"><file name="Observer.php" hash="2471552e9808ae2c6c227ae9ab203588"/></dir><dir name="data"><dir name="pubble_messenger_setup"><file name="data-install-1.0.0.php" hash="fc5613da1937dd4047c05e6aced07583"/><file name="data-upgrade-1.0.0-1.1.0.php" hash="1f9b0d9f43fa30f6a03567cc775aaf85"/></dir></dir><dir name="etc"><file name="config.xml" hash="cced71628d9ccb4ebc85d7dda743a662"/><file name="system.xml" hash="148a3011f62260f83be52fe1a3818b3c"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pubble"><file name="messenger" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pubble_Messenger.xml" hash="b4ad026649e3c24dc6059d70241e07e0"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.00.00</min><max>7.99.99</max></php></required></dependencies>
22
  </package>