Dotclear

Changeset 3283


Ignore:
Timestamp:
12/21/13 00:11:59 (9 years ago)
Author:
kwon
Message:

add for use reCAPTCHA with ContactMe?

Location:
plugins/dcReCaptcha
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/dcReCaptcha/_define.php

    r3282 r3283  
    2424          "Benoit de Marne", 
    2525          /* Version */ 
    26           '0.0.1', 
     26          '0.0.2', 
    2727          /* Properties */ 
    2828          array( 
  • plugins/dcReCaptcha/_public.php

    r3282 r3283  
    2929); 
    3030 
    31 if(empty($dcRecaptcha_settings['private_key'])  
    32      || empty($dcRecaptcha_settings['public_key']) 
    33      || !$dcRecaptcha_settings['comments_form_enable']) { 
     31# reCAPTCHA is not correctly configured 
     32if(empty($dcRecaptcha_settings['private_key']) 
     33|| empty($dcRecaptcha_settings['public_key'])) { 
    3434     return; 
    35 }  
     35} 
    3636 
    3737# adding behaviors 
    3838$core->addBehavior('publicBeforeDocument', array('dcReCaptchaBehaviorsPublic','publicBeforeDocument')); 
    39 $core->addBehavior('publicCommentFormAfterContent', array('dcReCaptchaBehaviorsPublic','publicCommentFormAfterContent')); 
    4039$core->addBehavior('publicHeadContent', array('dcReCaptchaBehaviorsPublic','publicHeadContent')); 
     40 
     41if($dcRecaptcha_settings['comments_form_enable']) { 
     42     $core->addBehavior('publicCommentFormAfterContent', array('dcReCaptchaBehaviorsPublic','publicCommentFormAfterContent')); 
     43} 
     44 
     45$core->tpl->addValue('dcReCaptchaForm', array('tplDcReCaptcha', 'dcReCaptchaForm')); 
    4146 
    4247class dcReCaptchaBehaviorsPublic 
     
    8691} 
    8792 
     93class tplDcReCaptcha 
     94{ 
     95     public static function dcReCaptchaForm($attr, $content) 
     96     { 
     97          global $core; 
     98          $res = ''; 
     99           
     100          if (!isset($_SESSION['recaptcha_ok'])) { 
     101                
     102               $dcReCaptcha = new dcReCaptcha($core); 
     103               $res = '<p id="dcrecaptcha-form">'. 
     104                    $dcReCaptcha->getReCaptchaHtml(). 
     105                    '</p>'; 
     106          } 
     107          return $res; 
     108           
     109     } 
     110} 
  • plugins/dcReCaptcha/changelog.txt

    r3282 r3283  
     1dcReCaptcha 0.0.2 - 2013-12-20 
     2=========================================================== 
     3* ajout le template {{tpl:dcReCaptchaForm}} pour utiliser reCAPTCHA dans le page ContactMe 
     4 
    15dcReCaptcha 0.0.1 - 2013-12-19 
    26=========================================================== 
  • plugins/dcReCaptcha/inc/class.dc.filter.recaptcha.php

    r3282 r3283  
    141141               '<form action="'.html::escapeURL($url).'" method="post" id="reCaptcha">'. 
    142142                
    143                '</p>'. 
    144143               '<p><a href="'.$this->dcReCaptcha->getApiUrl().'">'.__('Get your owns API key').'</a></p>'. 
    145144 
     
    162161               '</p>'. 
    163162 
     163               '<p>If you want add reCAPTCHA form with the plugin ContactMe:'. 
     164                    '<ul>'. 
     165                         '<li>insert template {{tpl:dcReCaptchaForm}} to form in file contact_me.html</li>'. 
     166                         '<li>activate the spam filter option in ContactMe</li>'. 
     167                    '</ul>'. 
     168               '</p>'.              
     169                
    164170               '<p>'.__('reCAPTCHA is a free CAPTCHA service that protects your site against spam.').'</p>'. 
    165171                
Note: See TracChangeset for help on using the changeset viewer.

Sites map