Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param array $config
  */
 public function __construct($config = null)
 {
     if (is_array($config)) {
         $recaptchaValidator = new iPhorm_Validator_Recaptcha(array('secretKey' => get_option('iphorm_recaptcha_secret_key')));
         if (array_key_exists('recaptcha_theme', $config)) {
             $this->setRecaptchaTheme($config['recaptcha_theme']);
             unset($config['recaptcha_theme']);
         }
         if (array_key_exists('recaptcha_type', $config)) {
             $this->setRecaptchaType($config['recaptcha_type']);
             unset($config['recaptcha_type']);
         }
         if (array_key_exists('recaptcha_lang', $config)) {
             $this->setRecaptchaLang($config['recaptcha_lang']);
             unset($config['recaptcha_lang']);
         }
         if (array_key_exists('messages', $config) && is_array($config['messages'])) {
             $recaptchaValidator->setMessageTemplates($config['messages']);
             unset($config['messages']);
         }
         $config['name'] = 'g-recaptcha-response';
         parent::__construct($config);
         $this->addValidator($recaptchaValidator);
     }
 }
Exemplo n.º 2
0
esc_html_e('Translate error messages', 'iphorm');
?>
</h3>
                    <table class="ifb-form-table translate-error-messages-table">
                        <?php 
if (!isset($element['messages'])) {
    $element['messages'] = array();
}
// key => tooltip
$customisableMessages = array('missing-input-secret' => '', 'invalid-input-secret' => '', 'missing-input-response' => '', 'invalid-input-response' => '', 'error' => '');
foreach ($customisableMessages as $key => $tooltip) {
    if (!isset($element['messages'][$key])) {
        $element['messages'][$key] = '';
    }
}
$recaptchaValidator = new iPhorm_Validator_Recaptcha();
?>
                        <tr valign="top">
                            <th><?php 
esc_html_e('Default', 'iphorm');
?>
</th>
                            <th><?php 
esc_html_e('Translation', 'iphorm');
?>
</th>
                        </tr>
                        <?php 
foreach ($customisableMessages as $key => $tooltip) {
    ?>
                            <tr valign="top">