Version Notes
This module adds Google Plus One to Magento
Download this release
Release Info
Developer | Magento Core Team |
Extension | Yireo_GooglePlusOne |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Yireo/GooglePlusOne/Block/Default.php +48 -0
- app/code/community/Yireo/GooglePlusOne/Helper/Data.php +24 -0
- app/code/community/Yireo/GooglePlusOne/Model/Observer.php +34 -0
- app/code/community/Yireo/GooglePlusOne/etc/config.xml +80 -0
- app/code/community/Yireo/GooglePlusOne/etc/system.xml +73 -0
- app/design/frontend/base/default/layout/googleplusone.xml +18 -0
- app/design/frontend/base/default/template/googleplusone/default.phtml +18 -0
- app/etc/modules/Yireo_GooglePlusOne.xml +19 -0
- package.xml +18 -0
app/code/community/Yireo/GooglePlusOne/Block/Default.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GooglePlusOne plugin for Magento
|
4 |
+
*
|
5 |
+
* @category design_default
|
6 |
+
* @package Yireo_GooglePlusOne
|
7 |
+
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright (c) 2010 Yireo (http://www.yireo.com/)
|
9 |
+
* @license Open Software License
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Yireo_GooglePlusOne_Block_Default extends Mage_Core_Block_Template
|
13 |
+
{
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
$this->setTemplate('googleplusone/default.phtml');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getConfig($key = null, $default_value = null)
|
21 |
+
{
|
22 |
+
return Mage::helper('googleplusone')->getConfigValue($key, $default_value);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getArguments($url = null)
|
26 |
+
{
|
27 |
+
$arguments = array();
|
28 |
+
$arguments['size'] = $this->getConfig('size');
|
29 |
+
$arguments['count'] = (bool)$this->getConfig('count');
|
30 |
+
$arguments['url'] = $url;
|
31 |
+
|
32 |
+
$output = array();
|
33 |
+
foreach($arguments as $name => $value) {
|
34 |
+
if(!empty($value)) {
|
35 |
+
if($this->getConfig('html5')) {
|
36 |
+
$output[] = $name.'="'.$value.'"';
|
37 |
+
} else {
|
38 |
+
$output[] = 'data-'.$name.'="'.$value.'"';
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
if(empty($output)) {
|
44 |
+
return null;
|
45 |
+
}
|
46 |
+
return ' '.implode(' ', $output);
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Yireo/GooglePlusOne/Helper/Data.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GooglePlusOne plugin for Magento
|
4 |
+
*
|
5 |
+
* @package Yireo_GooglePlusOne
|
6 |
+
* @author Yireo
|
7 |
+
* @copyright Copyright (c) 2011 Yireo (http://www.yireo.com/)
|
8 |
+
* @license Open Software License
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Yireo_GooglePlusOne_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
public function getConfigValue($key = null, $default_value = null)
|
14 |
+
{
|
15 |
+
$value = Mage::getStoreConfig('googleplusone/settings/'.$key);
|
16 |
+
if(empty($value)) $value = $default_value;
|
17 |
+
return $value;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getHeaderScript()
|
21 |
+
{
|
22 |
+
return '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Yireo/GooglePlusOne/Model/Observer.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GooglePlusOne plugin for Magento
|
4 |
+
*
|
5 |
+
* @category design_default
|
6 |
+
* @package Yireo_GooglePlusOne
|
7 |
+
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright (c) 2010 Yireo (http://www.yireo.com/)
|
9 |
+
* @license Open Software License
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Yireo_GooglePlusOne_Model_Observer
|
13 |
+
{
|
14 |
+
/*
|
15 |
+
* Listen to the event core_block_abstract_to_html_after
|
16 |
+
*
|
17 |
+
* @access public
|
18 |
+
* @parameter Varien_Event_Observer $observer
|
19 |
+
* @return $this
|
20 |
+
*/
|
21 |
+
public function coreBlockAbstractToHtmlAfter($observer)
|
22 |
+
{
|
23 |
+
$transport = $observer->getEvent()->getTransport();
|
24 |
+
$block = $observer->getEvent()->getBlock();
|
25 |
+
|
26 |
+
if($block->getNameInLayout() == 'head') {
|
27 |
+
$layout = Mage::app()->getLayout();
|
28 |
+
$html = $transport->getHtml()."\n".Mage::helper('googleplusone')->getHeaderScript();
|
29 |
+
$transport->setHtml($html);
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Yireo/GooglePlusOne/etc/config.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* GooglePlusOne plugin for Magento
|
5 |
+
*
|
6 |
+
* @category design_default
|
7 |
+
* @package Yireo_GooglePlusOne
|
8 |
+
* @author Yireo
|
9 |
+
* @copyright Copyright (c) 2011 Yireo (http://www.yireo.com/)
|
10 |
+
* @license Open Software License
|
11 |
+
*/
|
12 |
+
-->
|
13 |
+
<config>
|
14 |
+
<modules>
|
15 |
+
<Yireo_GooglePlusOne>
|
16 |
+
<version>1.0.0</version>
|
17 |
+
</Yireo_GooglePlusOne>
|
18 |
+
</modules>
|
19 |
+
|
20 |
+
<global>
|
21 |
+
<blocks>
|
22 |
+
<googleplusone>
|
23 |
+
<class>Yireo_GooglePlusOne_Block</class>
|
24 |
+
</googleplusone>
|
25 |
+
</blocks>
|
26 |
+
<helpers>
|
27 |
+
<googleplusone>
|
28 |
+
<class>Yireo_GooglePlusOne_Helper</class>
|
29 |
+
</googleplusone>
|
30 |
+
</helpers>
|
31 |
+
<models>
|
32 |
+
<googleplusone>
|
33 |
+
<class>Yireo_GooglePlusOne_Model</class>
|
34 |
+
</googleplusone>
|
35 |
+
</models>
|
36 |
+
<events>
|
37 |
+
<core_block_abstract_to_html_after>
|
38 |
+
<observers>
|
39 |
+
<googleplusone_observer>
|
40 |
+
<type>singleton</type>
|
41 |
+
<class>Yireo_GooglePlusOne_Model_Observer</class>
|
42 |
+
<method>coreBlockAbstractToHtmlAfter</method>
|
43 |
+
</googleplusone_observer>
|
44 |
+
</observers>
|
45 |
+
</core_block_abstract_to_html_after>
|
46 |
+
</events>
|
47 |
+
</global>
|
48 |
+
|
49 |
+
<frontend>
|
50 |
+
<layout>
|
51 |
+
<updates>
|
52 |
+
<googleplusone>
|
53 |
+
<file>googleplusone.xml</file>
|
54 |
+
</googleplusone>
|
55 |
+
</updates>
|
56 |
+
</layout>
|
57 |
+
</frontend>
|
58 |
+
|
59 |
+
<adminhtml>
|
60 |
+
<acl>
|
61 |
+
<resources>
|
62 |
+
<admin>
|
63 |
+
<children>
|
64 |
+
<system>
|
65 |
+
<children>
|
66 |
+
<config>
|
67 |
+
<children>
|
68 |
+
<googleplusone translate="title" module="googleplusone">
|
69 |
+
<title>GooglePlusOne</title>
|
70 |
+
</googleplusone>
|
71 |
+
</children>
|
72 |
+
</config>
|
73 |
+
</children>
|
74 |
+
</system>
|
75 |
+
</children>
|
76 |
+
</admin>
|
77 |
+
</resources>
|
78 |
+
</acl>
|
79 |
+
</adminhtml>
|
80 |
+
</config>
|
app/code/community/Yireo/GooglePlusOne/etc/system.xml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* GooglePlusOne plugin for Magento
|
5 |
+
*
|
6 |
+
* @category design_default
|
7 |
+
* @package Yireo_GooglePlusOne
|
8 |
+
* @author Yireo
|
9 |
+
* @copyright Copyright (c) 2011 Yireo (http://www.yireo.com/)
|
10 |
+
* @license Open Software License
|
11 |
+
*/
|
12 |
+
-->
|
13 |
+
<config>
|
14 |
+
<sections>
|
15 |
+
<googleplusone translate="label" module="googleplusone">
|
16 |
+
<label>Google Plus One</label>
|
17 |
+
<tab>catalog</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 |
+
<size translate="label">
|
42 |
+
<label>Size</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>2</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<!-- @todo: select small / standard / medium / tall -->
|
49 |
+
</size>
|
50 |
+
<count translate="label">
|
51 |
+
<label>Show Count</label>
|
52 |
+
<frontend_type>select</frontend_type>
|
53 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
54 |
+
<sort_order>3</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
</count>
|
59 |
+
<pagetype translate="label">
|
60 |
+
<label>Page type</label>
|
61 |
+
<frontend_type>text</frontend_type>
|
62 |
+
<sort_order>3</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
<!-- @todo: select default / html5 -->
|
67 |
+
</pagetype>
|
68 |
+
</fields>
|
69 |
+
</settings>
|
70 |
+
</groups>
|
71 |
+
</googleplusone>
|
72 |
+
</sections>
|
73 |
+
</config>
|
app/design/frontend/base/default/layout/googleplusone.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* GoogleAnalytics extension for Magento
|
5 |
+
*
|
6 |
+
* @package Yireo_GA
|
7 |
+
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright (c) 2010 Yireo (http://www.yireo.com/)
|
9 |
+
* @license Open Source License (OSL)
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<layout>
|
13 |
+
<catalog_product_view>
|
14 |
+
<reference name="alert.urls">
|
15 |
+
<block type="googleplusone/default" name="googleplusone_default" after="-" />
|
16 |
+
</reference>
|
17 |
+
</catalog_product_view>
|
18 |
+
</layout>
|
app/design/frontend/base/default/template/googleplusone/default.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* GooglePlusOne plugin for Magento
|
4 |
+
*
|
5 |
+
* @category design_default
|
6 |
+
* @package Yireo_GooglePlusOne
|
7 |
+
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright (c) 2010 Yireo (http://www.yireo.com/)
|
9 |
+
* @license Open Software License
|
10 |
+
*/
|
11 |
+
?>
|
12 |
+
<div class="googleplusone">
|
13 |
+
<?php if($this->getConfig('pagetype') == 'html5') { ?>
|
14 |
+
<div class="g-plusone"<?php echo $this->getArguments(); ?>></div>
|
15 |
+
<?php } else { ?>
|
16 |
+
<g:plusone<?php echo $this->getArguments(); ?>></g:plusone>
|
17 |
+
<?php } ?>
|
18 |
+
</div>
|
app/etc/modules/Yireo_GooglePlusOne.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Yireo GooglePlusOne-module for Magento
|
5 |
+
*
|
6 |
+
* @package Yireo_GooglePlusOne
|
7 |
+
* @author Yireo (http://www.yireo.com/)
|
8 |
+
* @copyright Copyright (c) 2011 Yireo (http://www.yireo.com/)
|
9 |
+
* @license Open Software License
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
<config>
|
13 |
+
<modules>
|
14 |
+
<Yireo_GooglePlusOne>
|
15 |
+
<active>true</active>
|
16 |
+
<codePool>community</codePool>
|
17 |
+
</Yireo_GooglePlusOne>
|
18 |
+
</modules>
|
19 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Yireo_GooglePlusOne</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php/">Open Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This module adds Google Plus One to Magento</summary>
|
10 |
+
<description>This module adds Google Plus One to Magento</description>
|
11 |
+
<notes>This module adds Google Plus One to Magento</notes>
|
12 |
+
<authors><author><name>Yireo</name><user>auto-converted</user><email>info@yireo.com</email></author></authors>
|
13 |
+
<date>2011-06-09</date>
|
14 |
+
<time>15:38:57</time>
|
15 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="googleplusone"><file name="default.phtml" hash="a31423250199274bc9289792ca6e66fc"/></dir></dir><dir name="layout"><file name="googleplusone.xml" hash="6f79b163732c094cfbefcc0759159141"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Yireo"><dir name="GooglePlusOne"><dir name="Block"><file name="Default.php" hash="df292ad373f42ad84bd0f628bd088a0a"/></dir><dir name="Model"><file name="Observer.php" hash="5b3aab89c03138269a8c877a8bbe1837"/></dir><dir name="Helper"><file name="Data.php" hash="f2e53ece4f2eccd43849a5c3eea398f7"/></dir><dir name="etc"><file name="config.xml" hash="e5ffdf3cd03d8df12792982d78e9ff04"/><file name="system.xml" hash="a5112c1642381228a2e21788e7a9e40c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Yireo_GooglePlusOne.xml" hash="db7a93cca2a6d87f9b4d8021cace5cf0"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|