Techninja_Share - Version 1.0.1

Version Notes

First release

Download this release

Release Info

Developer Mike The Tech Ninja Whittenberger
Extension Techninja_Share
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Techninja/Share/Block/Share.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Techninja_Share_Block_Share
3
+ extends Mage_Core_Block_Abstract
4
+ implements Mage_Widget_Block_Interface
5
+ {
6
+
7
+ /**
8
+ *
9
+ *
10
+ * @return string
11
+ */
12
+ protected function _toHtml()
13
+ {
14
+ $pageTitle = '';
15
+ $headBlock = $this->getLayout()->getBlock('head');
16
+ if ($headBlock) {
17
+ $pageTitle = $headBlock->getTitle();
18
+ }
19
+
20
+ if(Mage::getStoreConfig('share/share_group/button_size') == "large")
21
+ $size = "_large";
22
+ else
23
+ $size = "";
24
+
25
+
26
+ if(Mage::getStoreConfig('share/share_group/st_button'))
27
+ {
28
+ $html .= "<span class='st_sharethis".$size."' displayText='ShareThis'></span>";
29
+ }
30
+ if(Mage::getStoreConfig('share/share_group/fb_button'))
31
+ {
32
+ $html .= "<span class='st_facebook".$size."' displayText='Facebook'></span>";
33
+ }
34
+ if(Mage::getStoreConfig('share/share_group/tweet_button'))
35
+ {
36
+ $html .= "<span class='st_twitter".$size."' displayText='Tweet'></span>";
37
+ }
38
+ if(Mage::getStoreConfig('share/share_group/li_button'))
39
+ {
40
+ $html .= "<span class='st_linkedin".$size."' displayText='LinkedIn'></span>";
41
+ }
42
+ if(Mage::getStoreConfig('share/share_group/pin_button'))
43
+ {
44
+ $html .= "<span class='st_pinterest".$size."' displayText='Pinterest'></span>";
45
+ }
46
+ if(Mage::getStoreConfig('share/share_group/email_button'))
47
+ {
48
+ $html .= "<span class='st_email".$size."' displayText='Email'></span>";
49
+ }
50
+
51
+ $html = $html . '<script type="text/javascript">var switchTo5x=true;</script>
52
+ <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
53
+ <script type="text/javascript">stLight.options({publisher: "'.$this->getPubKey().'", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>';
54
+
55
+ return $html;
56
+ }
57
+
58
+ }
59
+
app/code/community/Techninja/Share/Block/Thebuttons.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Techninja_Share_Block_Thebuttons
4
+ extends Mage_Core_Block_Template
5
+ {
6
+ public function isEnabled()
7
+ {
8
+ return Mage::getStoreConfig('share/share_group/enabled');
9
+ }
10
+
11
+ public function getPubKey()
12
+ {
13
+ return Mage::getStoreConfig('share/share_group/pub_key');
14
+ }
15
+
16
+ public function showSTbutton()
17
+ {
18
+ return Mage::getStoreConfig('share/share_group/st_button');
19
+ }
20
+
21
+ public function showFBbutton()
22
+ {
23
+ return Mage::getStoreConfig('share/share_group/fb_button');
24
+ }
25
+
26
+ public function showTweetbutton()
27
+ {
28
+ return Mage::getStoreConfig('share/share_group/tweet_button');
29
+ }
30
+
31
+ public function showLIbutton()
32
+ {
33
+ return Mage::getStoreConfig('share/share_group/li_button');
34
+ }
35
+
36
+ public function showPinbutton()
37
+ {
38
+ return Mage::getStoreConfig('share/share_group/pin_button');
39
+ }
40
+
41
+ public function showEmailbutton()
42
+ {
43
+ return Mage::getStoreConfig('share/share_group/email_button');
44
+ }
45
+ }
app/code/community/Techninja/Share/Block/Widget.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Techninja_Share_Block_Widget
3
+ extends Mage_Core_Block_Abstract
4
+ implements Mage_Widget_Block_Interface
5
+ {
6
+
7
+ /**
8
+ *
9
+ *
10
+ * @return string
11
+ */
12
+ protected function _toHtml()
13
+ {
14
+ $pageTitle = '';
15
+ $headBlock = $this->getLayout()->getBlock('head');
16
+ if ($headBlock) {
17
+ $pageTitle = $headBlock->getTitle();
18
+ }
19
+
20
+ $html = '
21
+ <script type="text/javascript">var switchTo5x=true;</script>
22
+ <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
23
+ <script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
24
+
25
+ <script type="text/javascript">stLight.options({publisher: "'.$this->getPubKey().'", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
26
+ <script>
27
+ var options={ "publisher": "'.$this->getPubKey().'", "position": "'.Mage::getStoreConfig('share/share_group/buttons_side').'", "ad": { "visible": false, "openDelay": 5, "closeDelay": 0}, "chicklets": { "items": ["facebook", "twitter", "linkedin", "pinterest", "email", "sharethis"]}};
28
+ var st_hover_widget = new sharethis.widgets.hoverbuttons(options);
29
+ </script>';
30
+
31
+ return $html;
32
+ }
33
+
34
+ }
35
+
app/code/community/Techninja/Share/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Techninja Widget Helper
4
+ */
5
+ class Techninja_Share_Helper_Data extends Mage_Core_Helper_Abstract
6
+ {
7
+ }
app/code/community/Techninja/Share/Model/System/Config/Source/Side.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ *
5
+ */
6
+
7
+
8
+
9
+ class Techninja_Share_Model_System_Config_Source_Side extends Mage_Core_Block_Template
10
+ {
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array(
15
+ 'value' => 'left',
16
+ 'label' => 'Left',
17
+ ),
18
+ array(
19
+ 'value' => 'right',
20
+ 'label' => 'Right',
21
+ ),
22
+ );
23
+ }
24
+
25
+
26
+ }
app/code/community/Techninja/Share/Model/System/Config/Source/Size.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ *
5
+ */
6
+
7
+
8
+
9
+ class Techninja_Share_Model_System_Config_Source_Size extends Mage_Core_Block_Template
10
+ {
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array(
15
+ 'value' => 'large',
16
+ 'label' => 'Large',
17
+ ),
18
+ array(
19
+ 'value' => 'small',
20
+ 'label' => 'Small',
21
+ ),
22
+ );
23
+ }
24
+
25
+
26
+ }
app/code/community/Techninja/Share/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+
4
+
5
+ <acl>
6
+ <resources>
7
+ <admin>
8
+ <children>
9
+ <system>
10
+ <children>
11
+ <config>
12
+ <children>
13
+ <techninja_share_section translate="title" module="share">
14
+ <title>Share This</title>
15
+ <sort_order>100</sort_order>
16
+ </techninja_share_section>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Techninja/Share/etc/config.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Techninja_Share>
5
+ <version>0.0.1</version>
6
+ </Techninja_Share>
7
+ </modules>
8
+ <global>
9
+
10
+ <models>
11
+ <share>
12
+ <class>Techninja_Share_Model</class>
13
+ </share>
14
+ </models>
15
+ <helpers>
16
+ <share>
17
+ <class>Techninja_Share_Helper</class>
18
+ </share>
19
+ </helpers>
20
+ <resources>
21
+ <share_setup>
22
+ <setup>
23
+ <module>Techninja_Sharethis</module>
24
+ </setup>
25
+ <connection>
26
+ <use>core_setup</use>
27
+ </connection>
28
+ </share_setup>
29
+ <share_write>
30
+ <connection>
31
+ <use>core_write</use>
32
+ </connection>
33
+ </share_write>
34
+ <share_read>
35
+ <connection>
36
+ <use>core_read</use>
37
+ </connection>
38
+ </share_read>
39
+ </resources>
40
+ <!-- blocks section -->
41
+ <blocks>
42
+ <share>
43
+ <class>Techninja_Share_Block</class>
44
+ </share>
45
+ </blocks>
46
+
47
+
48
+
49
+ </global>
50
+
51
+ <frontend>
52
+ <layout>
53
+ <updates>
54
+
55
+ <share module="Techninja_Share">
56
+
57
+ <!-- the name of the layout file we are adding -->
58
+ <file>techninja_share.xml</file>
59
+
60
+ </share>
61
+
62
+ </updates>
63
+
64
+ </layout>
65
+ </frontend>
66
+
67
+ <default>
68
+ <share>
69
+ <share_group>
70
+ <enabled>1</enabled>
71
+ <pub_key>Include your pub key here</pub_key>
72
+ <st_button>1</st_button>
73
+ <fb_button>1</fb_button>
74
+ <tweet_button>1</tweet_button>
75
+ <li_button>1</li_button>
76
+ <pin_button>1</pin_button>
77
+ <email_button>1</email_button>
78
+ <button_size>large</button_size>
79
+ <buttons_side>left</buttons_side>
80
+ </share_group>
81
+ </share>
82
+ </default>
83
+
84
+ <adminhtml>
85
+ <acl>
86
+ <resources>
87
+ <all>
88
+ <title>Allow Everything</title>
89
+ </all>
90
+ <admin>
91
+ <children>
92
+ <system>
93
+ <children>
94
+ <config>
95
+ <children>
96
+ <share>
97
+ <title>Share This</title>
98
+ </share>
99
+ </children>
100
+ </config>
101
+ </children>
102
+ </system>
103
+ </children>
104
+ </admin>
105
+ </resources>
106
+ </acl>
107
+ </adminhtml>
108
+
109
+
110
+ </config>
111
+
app/code/community/Techninja/Share/etc/system.xml ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+
3
+
4
+ <config>
5
+
6
+
7
+
8
+ <tabs>
9
+ <techninja_tab module="share" translate="label">
10
+ <label>Tech Ninja</label>
11
+ <sort_order>1000</sort_order>
12
+ </techninja_tab>
13
+ </tabs>
14
+ <sections>
15
+ <share module="share" translate="label">
16
+ <label>ShareThis Buttons</label>
17
+ <sort_order>200</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <tab>techninja_tab</tab>
22
+ <groups>
23
+ <share_group translate="label">
24
+ <label>Share This</label>
25
+ <comment>Make sure to add your Pub Key below. Register for an account at http://sharethis.com, login, and click on your name at the top right to get your Pub Key.</comment>
26
+ <sort_order>10</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <fields>
31
+ <enabled translate="label">
32
+ <label>Show Share This buttons on product page?</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_yesno</source_model>
35
+ <sort_order>30</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </enabled>
40
+ <pub_key translate="label">
41
+ <label>ShareThis Pub Key</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>40</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </pub_key>
48
+ <st_button translate="label">
49
+ <label>Include the Share This button?</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>adminhtml/system_config_source_yesno</source_model>
52
+ <sort_order>50</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </st_button>
57
+ <fb_button translate="label">
58
+ <label>Include the Facebook button?</label>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>60</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </fb_button>
66
+ <tweet_button translate="label">
67
+ <label>Include the Twitter button?</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>70</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </tweet_button>
75
+ <li_button translate="label">
76
+ <label>Include the Linked In button?</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>80</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </li_button>
84
+ <pin_button translate="label">
85
+ <label>Include the Pinterest button?</label>
86
+ <frontend_type>select</frontend_type>
87
+ <source_model>adminhtml/system_config_source_yesno</source_model>
88
+ <sort_order>90</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </pin_button>
93
+ <email_button translate="label">
94
+ <label>Include the email button?</label>
95
+ <frontend_type>select</frontend_type>
96
+ <source_model>adminhtml/system_config_source_yesno</source_model>
97
+ <sort_order>100</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </email_button>
102
+ <button_size translate="label">
103
+ <label>Widget Button Size</label>
104
+ <frontend_type>select</frontend_type>
105
+ <source_model>share/system_config_source_size</source_model>
106
+ <sort_order>110</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ </button_size>
111
+ <buttons_side translate="label">
112
+ <label>Side to display sidebar Widget on?</label>
113
+ <frontend_type>select</frontend_type>
114
+ <source_model>share/system_config_source_side</source_model>
115
+ <sort_order>120</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </buttons_side>
120
+
121
+ </fields>
122
+ </share_group>
123
+ </groups>
124
+ </share>
125
+ </sections>
126
+ </config>
127
+
app/code/community/Techninja/Share/etc/widget.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <share_primary type="share/share">
4
+ <name>Share This Buttons Widget</name>
5
+ <description type="desc">This widget adds a standard set of Share This buttons</description>
6
+ </share_primary>
7
+
8
+ <share_widget type="share/widget">
9
+ <name>Sidebar style Share This Buttons Widget</name>
10
+ <description type="desc">This widget adds a sidebar style of Share This buttons</description>
11
+ </share_widget>
12
+ </widgets>
app/design/frontend/base/default/layout/techninja_share.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <layout>
4
+
5
+ <catalog_product_view>
6
+
7
+ <reference name="product.info">
8
+ <block type="core/text_list" name="product.info.other3" as="other">
9
+
10
+ <block type="share/thebuttons"
11
+ name="share_thebuttons"
12
+ template="share/thebuttons.phtml" />
13
+ </block>
14
+ </reference>
15
+
16
+ </catalog_product_view>
17
+
18
+ </layout>
19
+
app/etc/modules/Techninja_Share.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Techninja_Share>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Cms />
9
+ </depends>
10
+ </Techninja_Share>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Techninja_Share</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>ShareThis.com module for Magento</summary>
10
+ <description>Installing this module will allow a user to easily add a set of ShareThis.com buttons to the product page, under the product description.&#xD;
11
+ &#xD;
12
+ In addition, two widgets are included which do the same, and can be added to a Magento site anywhere that widgets are excepted. One widget displays the standard style buttons, and one displays them in a floating side bar.&#xD;
13
+ &#xD;
14
+ The current buttons included are the official ShareThis.com button, and also Facebook, Twitter, LinkedIn, Pinterest, and Email.</description>
15
+ <notes>First release</notes>
16
+ <authors><author><name>Mike The Tech Ninja Whittenberger</name><user>mwhittenberger</user><email>mwhittenberger@yahoo.com</email></author></authors>
17
+ <date>2014-06-25</date>
18
+ <time>05:20:58</time>
19
+ <contents><target name="magecommunity"><dir name="Techninja"><dir name="Share"><dir name="Block"><file name="Share.php" hash="b93f63a659eb6380596437a982a192d8"/><file name="Thebuttons.php" hash="6b9af518ac9afaa96e3346d7d769a0f7"/><file name="Widget.php" hash="3fb5cc4d39ad28c390810268e3ac5390"/></dir><dir name="Helper"><file name="Data.php" hash="a0b3e76b941126caed62830ecb659547"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Side.php" hash="cdb5a3d4394b965ed088b74793097b86"/><file name="Size.php" hash="7f576614efcc4ce41b55cf8d86314957"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="11abb62074e32eda1501dc44de9a9dea"/><file name="config.xml" hash="f33b452d22af5b604b1cb01cdf917a7e"/><file name="system.xml" hash="ad560b56ffbcbec1ef6438e73aacdf83"/><file name="widget.xml" hash="a7def7467a6c898683572cf70a3cc764"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="techninja_share.xml" hash="fa8040da8ffebc774b502aea1d810271"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="techninja_share"><file name="buttons.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Techninja_Share.xml" hash="1c3dfaa4f95f1db3e4798e3ffda6921e"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
22
+ </package>