wpcf7_captchac_form_tag_handler()
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wpcf7_captchac_form_tag_handler( $tag );
- $tag(обязательный)
- .
Код wpcf7_captchac_form_tag_handler() wpcf7 captchac form tag handler CF7 6.1.5
function wpcf7_captchac_form_tag_handler( $tag ) {
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
return wp_kses_data( sprintf(
/* translators: %s: URL to the Really Simple CAPTCHA plugin page */
__( '<strong>Warning:</strong> The <a href="%s">Really Simple CAPTCHA</a> plugin is not active.', 'contact-form-7' ),
'https://wordpress.org/plugins/really-simple-captcha/'
) );
}
if ( empty( $tag->name ) ) {
return '';
}
$class = wpcf7_form_controls_class( $tag->type );
$class .= ' wpcf7-captcha-' . str_replace( ':', '', $tag->name );
$atts = array();
$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_id_option();
$op = array( // Default
'img_size' => array( 72, 24 ),
'base' => array( 6, 18 ),
'font_size' => 14,
'font_char_width' => 15,
);
$op = array_merge( $op, wpcf7_captchac_options( $tag->options ) );
if ( ! $filename = wpcf7_generate_captcha( $op ) ) {
return '';
}
if ( ! empty( $op['img_size'] ) ) {
if ( isset( $op['img_size'][0] ) ) {
$atts['width'] = $op['img_size'][0];
}
if ( isset( $op['img_size'][1] ) ) {
$atts['height'] = $op['img_size'][1];
}
}
$atts['alt'] = 'captcha';
$atts['src'] = wpcf7_captcha_url( $filename );
$atts = wpcf7_format_atts( $atts );
$prefix = substr( $filename, 0, strrpos( $filename, '.' ) );
$html = sprintf(
'<input type="hidden" name="%1$s" value="%2$s" /><img %3$s />',
esc_attr( sprintf( '_wpcf7_captcha_challenge_%s', $tag->name ) ),
esc_attr( $prefix ),
$atts
);
return $html;
}