Version Notes
Tested on Magento versions: 1.7.0.2, 1.8.0.0, 1.8.1.0, 1.9.0.1 and 1.9.1.0. See https://travis-ci.org/StudioForty9/Recaptcha for more.
Download this release
Release Info
Developer | StudioForty9 |
Extension | Studioforty9_Recaptcha |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.0.1 to 1.3.0
- app/code/community/Studioforty9/Recaptcha/Block/Explicit.php +8 -2
- app/code/community/Studioforty9/Recaptcha/Helper/Data.php +1 -0
- app/code/community/Studioforty9/Recaptcha/Helper/Request.php +2 -1
- app/code/community/Studioforty9/Recaptcha/Helper/Response.php +8 -0
- app/code/community/Studioforty9/Recaptcha/Model/Observer.php +2 -1
- package.xml +4 -4
app/code/community/Studioforty9/Recaptcha/Block/Explicit.php
CHANGED
@@ -88,9 +88,15 @@ class Studioforty9_Recaptcha_Block_Explicit extends Mage_Core_Block_Template
|
|
88 |
}
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
return sprintf(
|
92 |
-
'<script src="https://www.google.com/recaptcha/api.js
|
93 |
-
$
|
94 |
);
|
95 |
}
|
96 |
|
88 |
}
|
89 |
}
|
90 |
|
91 |
+
$query = array(
|
92 |
+
'onload' => 'onloadCallback',
|
93 |
+
'render' => 'explicit',
|
94 |
+
'hl' => $lang
|
95 |
+
);
|
96 |
+
|
97 |
return sprintf(
|
98 |
+
'<script src="https://www.google.com/recaptcha/api.js?%s" async defer></script>',
|
99 |
+
http_build_query($query)
|
100 |
);
|
101 |
}
|
102 |
|
app/code/community/Studioforty9/Recaptcha/Helper/Data.php
CHANGED
@@ -139,6 +139,7 @@ class Studioforty9_Recaptcha_Helper_Data extends Mage_Core_Helper_Abstract
|
|
139 |
*/
|
140 |
public function getRedirectUrl()
|
141 |
{
|
|
|
142 |
$_session = Mage::getSingleton('core/session');
|
143 |
|
144 |
if (! $_session->hasVisitorData() && !$_session->hasLastUrl()) {
|
139 |
*/
|
140 |
public function getRedirectUrl()
|
141 |
{
|
142 |
+
/** @var Mage_Core_Model_Session $_session */
|
143 |
$_session = Mage::getSingleton('core/session');
|
144 |
|
145 |
if (! $_session->hasVisitorData() && !$_session->hasLastUrl()) {
|
app/code/community/Studioforty9/Recaptcha/Helper/Request.php
CHANGED
@@ -77,7 +77,8 @@ class Studioforty9_Recaptcha_Helper_Request extends Mage_Core_Helper_Abstract
|
|
77 |
|
78 |
try {
|
79 |
$response = $client->request('GET');
|
80 |
-
$
|
|
|
81 |
if (array_key_exists('error-codes', $data)) {
|
82 |
$errors = $data['error-codes'];
|
83 |
}
|
77 |
|
78 |
try {
|
79 |
$response = $client->request('GET');
|
80 |
+
$body = $response->decodeGzip($response->getRawBody());
|
81 |
+
$data = Mage::helper('core')->jsonDecode($body);
|
82 |
if (array_key_exists('error-codes', $data)) {
|
83 |
$errors = $data['error-codes'];
|
84 |
}
|
app/code/community/Studioforty9/Recaptcha/Helper/Response.php
CHANGED
@@ -148,14 +148,22 @@ class Studioforty9_Recaptcha_Helper_Response extends Mage_Core_Helper_Abstract
|
|
148 |
|
149 |
/**
|
150 |
* Log the error to file.
|
|
|
|
|
151 |
*/
|
152 |
public function log()
|
153 |
{
|
|
|
|
|
|
|
|
|
154 |
Mage::log(
|
155 |
sprintf(
|
156 |
'reCAPTCHA Errors: %1$s',
|
157 |
implode(', ', $this->getErrors())
|
158 |
)
|
159 |
);
|
|
|
|
|
160 |
}
|
161 |
}
|
148 |
|
149 |
/**
|
150 |
* Log the error to file.
|
151 |
+
*
|
152 |
+
* @return bool
|
153 |
*/
|
154 |
public function log()
|
155 |
{
|
156 |
+
if (Mage::getStoreConfigFlag('dev/log/active')) {
|
157 |
+
return false;
|
158 |
+
}
|
159 |
+
|
160 |
Mage::log(
|
161 |
sprintf(
|
162 |
'reCAPTCHA Errors: %1$s',
|
163 |
implode(', ', $this->getErrors())
|
164 |
)
|
165 |
);
|
166 |
+
|
167 |
+
return true;
|
168 |
}
|
169 |
}
|
app/code/community/Studioforty9/Recaptcha/Model/Observer.php
CHANGED
@@ -50,7 +50,7 @@ class Studioforty9_Recaptcha_Model_Observer
|
|
50 |
* - controller_action_predispatch_review_product_post
|
51 |
*
|
52 |
* @param Varien_Event_Observer $observer The observer from the controller
|
53 |
-
* @return Varien_Event_Observer
|
54 |
*/
|
55 |
public function onPostPreDispatch(Varien_Event_Observer $observer)
|
56 |
{
|
@@ -85,6 +85,7 @@ class Studioforty9_Recaptcha_Model_Observer
|
|
85 |
|
86 |
$flag = Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH;
|
87 |
$redirectUrl = $this->getHelper()->getRedirectUrl();
|
|
|
88 |
$controller->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
89 |
$controller->getRequest()->setDispatched(true);
|
90 |
$controller->setFlag('', $flag, true);
|
50 |
* - controller_action_predispatch_review_product_post
|
51 |
*
|
52 |
* @param Varien_Event_Observer $observer The observer from the controller
|
53 |
+
* @return Varien_Event_Observer|Mage_Core_Controller_Front_Action
|
54 |
*/
|
55 |
public function onPostPreDispatch(Varien_Event_Observer $observer)
|
56 |
{
|
85 |
|
86 |
$flag = Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH;
|
87 |
$redirectUrl = $this->getHelper()->getRedirectUrl();
|
88 |
+
|
89 |
$controller->getResponse()->setRedirect($redirectUrl)->sendResponse();
|
90 |
$controller->getRequest()->setDispatched(true);
|
91 |
$controller->setFlag('', $flag, true);
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Studioforty9_Recaptcha</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/BSD-3-Clause">BSDL</license>
|
7 |
<channel>community</channel>
|
@@ -38,9 +38,9 @@
|
|
38 |
</ol></description>
|
39 |
<notes>Tested on Magento versions: 1.7.0.2, 1.8.0.0, 1.8.1.0, 1.9.0.1 and 1.9.1.0. See https://travis-ci.org/StudioForty9/Recaptcha for more.</notes>
|
40 |
<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@studioforty9.com</email></author></authors>
|
41 |
-
<date>2015-
|
42 |
-
<time>
|
43 |
-
<contents><target name="magecommunity"><dir name="Studioforty9"><dir name="Recaptcha"><dir name="Block"><file name="Autorender.php" hash="3df0dfcfb1ba0f0b3f5d32e31f3cc518"/><file name="Explicit.php" hash="
|
44 |
<compatible/>
|
45 |
<dependencies><required><php><min>5.3.0</min><max>5.5.99</max></php></required></dependencies>
|
46 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Studioforty9_Recaptcha</name>
|
4 |
+
<version>1.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/BSD-3-Clause">BSDL</license>
|
7 |
<channel>community</channel>
|
38 |
</ol></description>
|
39 |
<notes>Tested on Magento versions: 1.7.0.2, 1.8.0.0, 1.8.1.0, 1.9.0.1 and 1.9.1.0. See https://travis-ci.org/StudioForty9/Recaptcha for more.</notes>
|
40 |
<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@studioforty9.com</email></author></authors>
|
41 |
+
<date>2015-11-23</date>
|
42 |
+
<time>17:25:31</time>
|
43 |
+
<contents><target name="magecommunity"><dir name="Studioforty9"><dir name="Recaptcha"><dir name="Block"><file name="Autorender.php" hash="3df0dfcfb1ba0f0b3f5d32e31f3cc518"/><file name="Explicit.php" hash="649ff1a9de638588bf572db9b9512f18"/></dir><dir name="Helper"><file name="Data.php" hash="763de6e020251c35daa38c071ec96df9"/><file name="Request.php" hash="e6b95473f655f4d257c4190aa0d4c47f"/><file name="Response.php" hash="0f1eddc9990edeb4888b7539c5b8d593"/></dir><dir name="Model"><file name="Observer.php" hash="13950565f0d6aa220795b3d428ce5775"/><dir name="Source"><file name="Theme.php" hash="56ae66ec779f3cc00b6924f949ac4622"/></dir></dir><dir name="etc"><file name="config.xml" hash="ac7337edd5b3d6a20f15b439ffe3aea5"/><file name="system.xml" hash="2be67850cc9a964bb09d1cbadc26bd59"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="studioforty9_recaptcha.xml" hash="f8ae24e28f183c843e6cec09ad7019c6"/></dir><dir name="template"><dir name="studioforty9"><dir name="recaptcha"><file name="autorender.phtml" hash="4f616a52fe671f9f6346347427f7b35b"/><file name="explicit.phtml" hash="b30f113ba2a141d6e0bc8a5eb351bfe0"/><dir name="samples"><dir name="base"><dir name="contacts"><file name="form.phtml" hash="d5b584b9863a06fe7adab490584b7e89"/></dir><dir name="persistent"><dir name="customer"><dir name="form"><file name="register.phtml" hash="2d899bd409bad8762b29fee173133858"/></dir></dir></dir><dir name="review"><file name="form.phtml" hash="7be198faa94a0f2b9b1f859f0605adaf"/></dir><dir name="sendfriend"><file name="send.phtml" hash="80d86c444318d2ba30912619653044fb"/></dir></dir><dir name="rwd"><dir name="contacts"><file name="form.phtml" hash="5e32e7445434930b51a86747ecebf553"/></dir><dir name="customer"><dir name="form"><file name="register.phtml" hash="13fa3ff4732b01ebabb382da4b710c21"/></dir></dir><dir name="review"><file name="form.phtml" hash="e4df65a5b3022d8a80f11647c7475cfa"/></dir><dir name="sendfriend"><file name="send.phtml" hash="3adf035329dc6c6cf01a7712cd707760"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Studioforty9_Recaptcha.csv" hash="6387abc316e524840fa3b1fcc49dc25d"/></dir></target><target name="mageetc"><dir name="modules"><file name="Studioforty9_Recaptcha.xml" hash="4ea774e9a930bddc77ab8d408b81e008"/></dir></target></contents>
|
44 |
<compatible/>
|
45 |
<dependencies><required><php><min>5.3.0</min><max>5.5.99</max></php></required></dependencies>
|
46 |
</package>
|