예제 #1
0
function hocwp_enqueue_recaptcha()
{
    $lang = hocwp_get_recaptcha_language();
    $url = 'https://www.google.com/recaptcha/api.js';
    $url = add_query_arg(array('hl' => $lang), $url);
    $multiple = apply_filters('hocwp_multiple_recaptcha', false);
    if ($multiple) {
        $url = add_query_arg(array('onload' => 'CaptchaCallback', 'render' => 'explicit'), $url);
    }
    wp_enqueue_script('recaptcha', $url, array(), false, true);
}
예제 #2
0
function hocwp_field_recaptcha($args = array())
{
    $site_key = isset($args['site_key']) ? $args['site_key'] : '';
    if (empty($site_key)) {
        return;
    }
    $div = new HOCWP_HTML('div');
    $div->set_class('g-recaptcha');
    $div->set_attribute('data-sitekey', $site_key);
    if (isset($args['id'])) {
        $div->set_attribute('id', $args['id']);
    }
    $div->output();
    ?>
	<noscript>
		<div style="width: 302px; height: 425px;">
			<div style="width: 302px; height: 425px; position: relative;">
				<div style="width: 302px; height: 425px; position: absolute;">
					<iframe
						src="https://www.google.com/recaptcha/api/fallback?k=<?php 
    echo $site_key;
    ?>
&hl=<?php 
    echo hocwp_get_recaptcha_language();
    ?>
"
						frameborder="0" scrolling="no" style="width: 302px; height:425px; border-style: none;"></iframe>
				</div>
				<div
					style="width: 300px; height: 60px; bottom: 12px; left: 25px; margin: 0; padding: 0; right: 25px; background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">
					<label for="g-recaptcha-response" style="display: none"></label>
					<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response"
					          style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0; resize: none;"></textarea>
				</div>
			</div>
		</div>
	</noscript>
	<?php 
}