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.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.3 to 1.0.5
- app/code/community/Yireo/GooglePlusOne/Block/Default.php +6 -6
- app/code/community/Yireo/GooglePlusOne/Helper/Data.php +24 -0
- app/code/community/Yireo/GooglePlusOne/etc/config.xml +1 -1
- app/code/community/Yireo/GooglePlusOne/etc/system.xml +4 -4
- app/design/frontend/base/default/layout/googleplusone.xml +4 -0
- package.xml +3 -3
app/code/community/Yireo/GooglePlusOne/Block/Default.php
CHANGED
|
@@ -24,15 +24,15 @@ class Yireo_GooglePlusOne_Block_Default extends Mage_Core_Block_Template
|
|
| 24 |
|
| 25 |
public function getArguments($url = null)
|
| 26 |
{
|
| 27 |
-
$arguments =
|
| 28 |
-
$arguments
|
| 29 |
-
$arguments['
|
| 30 |
-
$arguments['
|
| 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.'"';
|
| 24 |
|
| 25 |
public function getArguments($url = null)
|
| 26 |
{
|
| 27 |
+
$arguments = $this->getData('arguments');
|
| 28 |
+
if(!is_array($arguments)) $arguments = array();
|
| 29 |
+
if(!isset($arguments['size'])) $arguments['size'] = $this->getConfig('size');
|
| 30 |
+
if(!isset($arguments['count'])) $arguments['count'] = ($this->getConfig('count') == 1) ? 'true' : 'false';
|
| 31 |
|
| 32 |
$output = array();
|
| 33 |
foreach($arguments as $name => $value) {
|
| 34 |
+
if(!empty($value) || $value == 0) {
|
| 35 |
+
if($this->getConfig('pagetype') != 'html5') {
|
| 36 |
$output[] = $name.'="'.$value.'"';
|
| 37 |
} else {
|
| 38 |
$output[] = 'data-'.$name.'="'.$value.'"';
|
app/code/community/Yireo/GooglePlusOne/Helper/Data.php
CHANGED
|
@@ -21,4 +21,28 @@ class Yireo_GooglePlusOne_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 21 |
{
|
| 22 |
return '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
|
| 23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 21 |
{
|
| 22 |
return '<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
|
| 23 |
}
|
| 24 |
+
|
| 25 |
+
/*
|
| 26 |
+
* Usage:
|
| 27 |
+
* echo Mage::helper('googleplusone')->getHtml($arguments);
|
| 28 |
+
* $arguments is an associative array (size, count, url)
|
| 29 |
+
|
| 30 |
+
*/
|
| 31 |
+
public function getHtml($arguments = null)
|
| 32 |
+
{
|
| 33 |
+
if (!($layout = Mage::app()->getFrontController()->getAction()->getLayout())) {
|
| 34 |
+
return '';
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
if (!($block = $layout->getBlock('googleplusone'))) {
|
| 38 |
+
return '';
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// Set the arguments
|
| 42 |
+
if(!empty($arguments) && is_array($arguments)) {
|
| 43 |
+
$block->setData('arguments', $arguments);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
return $block->toHtml();
|
| 47 |
+
}
|
| 48 |
}
|
app/code/community/Yireo/GooglePlusOne/etc/config.xml
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
<config>
|
| 14 |
<modules>
|
| 15 |
<Yireo_GooglePlusOne>
|
| 16 |
-
<version>1.0.
|
| 17 |
</Yireo_GooglePlusOne>
|
| 18 |
</modules>
|
| 19 |
|
| 13 |
<config>
|
| 14 |
<modules>
|
| 15 |
<Yireo_GooglePlusOne>
|
| 16 |
+
<version>1.0.5</version>
|
| 17 |
</Yireo_GooglePlusOne>
|
| 18 |
</modules>
|
| 19 |
|
app/code/community/Yireo/GooglePlusOne/etc/system.xml
CHANGED
|
@@ -40,12 +40,12 @@
|
|
| 40 |
</active>
|
| 41 |
<size translate="label">
|
| 42 |
<label>Size</label>
|
| 43 |
-
<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>
|
|
@@ -58,12 +58,12 @@
|
|
| 58 |
</count>
|
| 59 |
<pagetype translate="label">
|
| 60 |
<label>Page type</label>
|
| 61 |
-
<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>
|
| 40 |
</active>
|
| 41 |
<size translate="label">
|
| 42 |
<label>Size</label>
|
| 43 |
+
<frontend_type>select</frontend_type>
|
| 44 |
+
<source_model>googleplusone/backend_source_size</source_model>
|
| 45 |
<sort_order>2</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 |
</size>
|
| 50 |
<count translate="label">
|
| 51 |
<label>Show Count</label>
|
| 58 |
</count>
|
| 59 |
<pagetype translate="label">
|
| 60 |
<label>Page type</label>
|
| 61 |
+
<frontend_type>select</frontend_type>
|
| 62 |
+
<source_model>googleplusone/backend_source_pagetype</source_model>
|
| 63 |
<sort_order>3</sort_order>
|
| 64 |
<show_in_default>1</show_in_default>
|
| 65 |
<show_in_website>1</show_in_website>
|
| 66 |
<show_in_store>1</show_in_store>
|
|
|
|
| 67 |
</pagetype>
|
| 68 |
</fields>
|
| 69 |
</settings>
|
app/design/frontend/base/default/layout/googleplusone.xml
CHANGED
|
@@ -10,6 +10,10 @@
|
|
| 10 |
*/
|
| 11 |
-->
|
| 12 |
<layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
<catalog_product_view>
|
| 14 |
<reference name="alert.urls">
|
| 15 |
<block type="googleplusone/default" name="googleplusone_default" after="-" />
|
| 10 |
*/
|
| 11 |
-->
|
| 12 |
<layout>
|
| 13 |
+
<default>
|
| 14 |
+
<block type="googleplusone/default" name="googleplusone" />
|
| 15 |
+
</default>
|
| 16 |
+
|
| 17 |
<catalog_product_view>
|
| 18 |
<reference name="alert.urls">
|
| 19 |
<block type="googleplusone/default" name="googleplusone_default" after="-" />
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Yireo_GooglePlusOne</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php/">Open Software License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 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-
|
| 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="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Yireo_GooglePlusOne</name>
|
| 4 |
+
<version>1.0.5</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>
|
| 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-07-25</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="7861b6d8a5d40791ba0848d004e641dd"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Yireo"><dir name="GooglePlusOne"><dir name="Block"><file name="Default.php" hash="42bb87fb3a41c491dd9637a198576d11"/></dir><dir name="Model"><file name="Observer.php" hash="5b3aab89c03138269a8c877a8bbe1837"/></dir><dir name="Helper"><file name="Data.php" hash="e7a9f894ee468741cf7570573371454d"/></dir><dir name="etc"><file name="config.xml" hash="5f2900bf07108fa2414a4ed595c28e51"/><file name="system.xml" hash="34dae4529f07fd1db7e43fb4747ce94e"/></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>
|
