Version Notes
"Contacts Form Captcha" extension add in easy way the captcha to "Contact Us" form.
Download this release
Release Info
Developer | Magento Core Team |
Extension | contactsformcaptcha |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- app/code/community/OlegKoval/ContactsFormCaptcha/Model/System/Config/Source/Dropdown/Lang.php +42 -0
- app/code/community/OlegKoval/ContactsFormCaptcha/Model/System/Config/Source/Dropdown/Theme.php +26 -0
- app/code/community/OlegKoval/ContactsFormCaptcha/controllers/IndexController.php +21 -1
- app/code/community/OlegKoval/ContactsFormCaptcha/etc/config.xml +6 -0
- app/code/community/OlegKoval/ContactsFormCaptcha/etc/system.xml +20 -0
- app/design/frontend/base/default/template/contactsformcaptcha/form.phtml +9 -1
- package.xml +4 -4
app/code/community/OlegKoval/ContactsFormCaptcha/Model/System/Config/Source/Dropdown/Lang.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom options for "reCaptcha Language" dropdown of "Contacts Form Captcha" customization
|
4 |
+
*/
|
5 |
+
class OlegKoval_ContactsFormCaptcha_Model_System_Config_Source_Dropdown_Lang {
|
6 |
+
public function toOptionArray() {
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => 'en',
|
10 |
+
'label' => 'English (default)',
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
'value' => 'nl',
|
14 |
+
'label' => 'Dutch',
|
15 |
+
),
|
16 |
+
array(
|
17 |
+
'value' => 'fr',
|
18 |
+
'label' => 'French',
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'value' => 'de',
|
22 |
+
'label' => 'German',
|
23 |
+
),
|
24 |
+
array(
|
25 |
+
'value' => 'pt',
|
26 |
+
'label' => 'Portuguese',
|
27 |
+
),
|
28 |
+
array(
|
29 |
+
'value' => 'ru',
|
30 |
+
'label' => 'Russian',
|
31 |
+
),
|
32 |
+
array(
|
33 |
+
'value' => 'es',
|
34 |
+
'label' => 'Spanish',
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'value' => 'tr',
|
38 |
+
'label' => 'Turkish',
|
39 |
+
),
|
40 |
+
);
|
41 |
+
}
|
42 |
+
}
|
app/code/community/OlegKoval/ContactsFormCaptcha/Model/System/Config/Source/Dropdown/Theme.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom options for "reCaptcha Theme" dropdown of "Contacts Form Captcha" customization
|
4 |
+
*/
|
5 |
+
class OlegKoval_ContactsFormCaptcha_Model_System_Config_Source_Dropdown_Theme {
|
6 |
+
public function toOptionArray() {
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => 'red',
|
10 |
+
'label' => 'Red (default)',
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
'value' => 'white',
|
14 |
+
'label' => 'White',
|
15 |
+
),
|
16 |
+
array(
|
17 |
+
'value' => 'blackglass',
|
18 |
+
'label' => 'Blackglass',
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'value' => 'clean',
|
22 |
+
'label' => 'Clean',
|
23 |
+
),
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
app/code/community/OlegKoval/ContactsFormCaptcha/controllers/IndexController.php
CHANGED
@@ -14,6 +14,8 @@ class OlegKoval_ContactsFormCaptcha_IndexController extends Mage_Contacts_IndexC
|
|
14 |
const XML_PATH_CFC_ENABLED = 'contacts/olegkoval_contactsformcaptcha/enabled';
|
15 |
const XML_PATH_CFC_PUBLIC_KEY = 'contacts/olegkoval_contactsformcaptcha/public_key';
|
16 |
const XML_PATH_CFC_PRIVATE_KEY = 'contacts/olegkoval_contactsformcaptcha/private_key';
|
|
|
|
|
17 |
|
18 |
/**
|
19 |
* Check if "Contacts Form Captcha" is enabled
|
@@ -36,7 +38,25 @@ class OlegKoval_ContactsFormCaptcha_IndexController extends Mage_Contacts_IndexC
|
|
36 |
$publickey = Mage::getStoreConfig(self::XML_PATH_CFC_PUBLIC_KEY);
|
37 |
$captcha_code = recaptcha_get_html($publickey);
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
else {
|
42 |
$this->getLayout()->getBlock('contactForm')->setFormAction(Mage::getUrl('*/*/post'));
|
14 |
const XML_PATH_CFC_ENABLED = 'contacts/olegkoval_contactsformcaptcha/enabled';
|
15 |
const XML_PATH_CFC_PUBLIC_KEY = 'contacts/olegkoval_contactsformcaptcha/public_key';
|
16 |
const XML_PATH_CFC_PRIVATE_KEY = 'contacts/olegkoval_contactsformcaptcha/private_key';
|
17 |
+
const XML_PATH_CFC_THEME = 'contacts/olegkoval_contactsformcaptcha/theme';
|
18 |
+
const XML_PATH_CFC_LANG = 'contacts/olegkoval_contactsformcaptcha/lang';
|
19 |
|
20 |
/**
|
21 |
* Check if "Contacts Form Captcha" is enabled
|
38 |
$publickey = Mage::getStoreConfig(self::XML_PATH_CFC_PUBLIC_KEY);
|
39 |
$captcha_code = recaptcha_get_html($publickey);
|
40 |
|
41 |
+
//get reCaptcha theme name
|
42 |
+
$theme = Mage::getStoreConfig(self::XML_PATH_CFC_THEME);
|
43 |
+
if (strlen($theme) == 0 || !in_array($theme, array('red', 'white', 'blackglass', 'clean'))) {
|
44 |
+
$theme = 'red';
|
45 |
+
}
|
46 |
+
|
47 |
+
//get reCaptcha lang name
|
48 |
+
$lang = Mage::getStoreConfig(self::XML_PATH_CFC_LANG);
|
49 |
+
if (strlen($lang) == 0 || !in_array($lang, array('en', 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr'))) {
|
50 |
+
$lang = 'en';
|
51 |
+
}
|
52 |
+
//small hack for language feature
|
53 |
+
$captcha_code = str_replace('?k=', '?hl='. $lang .'&k=', $captcha_code);
|
54 |
+
|
55 |
+
$this->getLayout()->getBlock('contactForm')->setTemplate('contactsformcaptcha/form.phtml')
|
56 |
+
->setFormAction(Mage::getUrl('*/*/post'))
|
57 |
+
->setCaptchaCode($captcha_code)
|
58 |
+
->setCaptchaTheme($theme)
|
59 |
+
->setCaptchaLang($lang);
|
60 |
}
|
61 |
else {
|
62 |
$this->getLayout()->getBlock('contactForm')->setFormAction(Mage::getUrl('*/*/post'));
|
app/code/community/OlegKoval/ContactsFormCaptcha/etc/config.xml
CHANGED
@@ -25,6 +25,12 @@
|
|
25 |
<class>OlegKoval_ContactsFormCaptcha_Block</class>
|
26 |
</contactsformcaptcha>
|
27 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</global>
|
29 |
|
30 |
<frontend>
|
25 |
<class>OlegKoval_ContactsFormCaptcha_Block</class>
|
26 |
</contactsformcaptcha>
|
27 |
</blocks>
|
28 |
+
|
29 |
+
<models>
|
30 |
+
<contactsformcaptcha>
|
31 |
+
<class>OlegKoval_ContactsFormCaptcha_Model</class>
|
32 |
+
</contactsformcaptcha>
|
33 |
+
</models>
|
34 |
</global>
|
35 |
|
36 |
<frontend>
|
app/code/community/OlegKoval/ContactsFormCaptcha/etc/system.xml
CHANGED
@@ -49,6 +49,26 @@
|
|
49 |
<show_in_website>1</show_in_website>
|
50 |
<show_in_store>1</show_in_store>
|
51 |
</private_key>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</fields>
|
53 |
</olegkoval_contactsformcaptcha>
|
54 |
</groups>
|
49 |
<show_in_website>1</show_in_website>
|
50 |
<show_in_store>1</show_in_store>
|
51 |
</private_key>
|
52 |
+
<theme translate="label">
|
53 |
+
<label>reCaptcha Theme</label>
|
54 |
+
<comment>Customizing the Look of reCAPTCHA</comment>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>contactsformcaptcha/system_config_source_dropdown_theme</source_model>
|
57 |
+
<sort_order>40</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</theme>
|
62 |
+
<lang translate="label">
|
63 |
+
<label>reCaptcha Language</label>
|
64 |
+
<comment>Which language is used in the reCaptcha interface</comment>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>contactsformcaptcha/system_config_source_dropdown_lang</source_model>
|
67 |
+
<sort_order>50</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</lang>
|
72 |
</fields>
|
73 |
</olegkoval_contactsformcaptcha>
|
74 |
</groups>
|
app/design/frontend/base/default/template/contactsformcaptcha/form.phtml
CHANGED
@@ -28,6 +28,14 @@
|
|
28 |
<div class="page-title">
|
29 |
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
|
30 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
|
32 |
<div class="fieldset">
|
33 |
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
|
@@ -67,7 +75,7 @@
|
|
67 |
</div>
|
68 |
<div class="buttons-set">
|
69 |
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
|
70 |
-
<input type="text" name="hideit" id="hideit" value="
|
71 |
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
|
72 |
</div>
|
73 |
</form>
|
28 |
<div class="page-title">
|
29 |
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
|
30 |
</div>
|
31 |
+
<script type="text/javascript">
|
32 |
+
//<![CDATA[
|
33 |
+
var RecaptchaOptions = {
|
34 |
+
theme : '<?php echo $this->getCaptchaTheme(); ?>',
|
35 |
+
lang : '<?php echo $this->getCaptchaLang(); ?>'
|
36 |
+
};
|
37 |
+
//]]>
|
38 |
+
</script>
|
39 |
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
|
40 |
<div class="fieldset">
|
41 |
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
|
75 |
</div>
|
76 |
<div class="buttons-set">
|
77 |
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
|
78 |
+
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
|
79 |
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
|
80 |
</div>
|
81 |
</form>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>contactsformcaptcha</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -12,9 +12,9 @@
|
|
12 |
This extension uses reCaptcha library (http://www.google.com/recaptcha).</description>
|
13 |
<notes>"Contacts Form Captcha" extension add in easy way the captcha to "Contact Us" form.</notes>
|
14 |
<authors><author><name>Oleg Koval</name><user>auto-converted</user><email>oleh.koval@gmail.com</email></author></authors>
|
15 |
-
<date>2012-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magecommunity"><dir name="OlegKoval"><dir name="ContactsFormCaptcha"><dir name="
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>contactsformcaptcha</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
12 |
This extension uses reCaptcha library (http://www.google.com/recaptcha).</description>
|
13 |
<notes>"Contacts Form Captcha" extension add in easy way the captcha to "Contact Us" form.</notes>
|
14 |
<authors><author><name>Oleg Koval</name><user>auto-converted</user><email>oleh.koval@gmail.com</email></author></authors>
|
15 |
+
<date>2012-11-26</date>
|
16 |
+
<time>11:36:33</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="OlegKoval"><dir name="ContactsFormCaptcha"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Lang.php" hash="ae1c2d598a57c0891cceb2b48299db01"/><file name="Theme.php" hash="b1c88e827e2bbf4ddd9b532a0f76212f"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="27fbbd9fd3d843fa16e09189a237cff5"/></dir><dir name="etc"><file name="config.xml" hash="675b557f1408e3a069e73b66122ba4e9"/><file name="system.xml" hash="53181e763cde62e4d58e21f600abff1a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="OlegKoval_ContactsFormCaptcha.xml" hash="9b7cbc1587fc43d6a0cd1106bc19a4fc"/></dir></target><target name="magelib"><dir name="reCaptcha"><file name="recaptchalib.php" hash="f80a9f01727de68aba8e98f1e37345a9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="contactsformcaptcha.xml" hash="797d1d456b4f7e6d4bdbb4308065b5fa"/></dir><dir name="template"><dir name="contactsformcaptcha"><file name="form.phtml" hash="5ba848935abf9b97a8a8ecac66dcc829"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="OlegKoval_ContactsFormCaptcha.csv" hash="a13e19dd1a4af77cf79394ca43f6bc0f"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|