function wpcf7_captcha_url($filename)
{
    $url = trailingslashit(wpcf7_captcha_tmp_url()) . $filename;
    if (is_ssl() && 'http:' == substr($url, 0, 5)) {
        $url = 'https:' . substr($url, 5);
    }
    return apply_filters('wpcf7_captcha_url', esc_url_raw($url));
}
Пример #2
0
function wpcf7_captcha_ajax_refill($items)
{
    if (!is_array($items)) {
        return $items;
    }
    $fes = wpcf7_scan_shortcode(array('type' => 'captchac'));
    if (empty($fes)) {
        return $items;
    }
    $refill = array();
    foreach ($fes as $fe) {
        $name = $fe['name'];
        $options = $fe['options'];
        if (empty($name)) {
            continue;
        }
        $op = wpcf7_captchac_options($options);
        if ($filename = wpcf7_generate_captcha($op)) {
            $captcha_url = trailingslashit(wpcf7_captcha_tmp_url()) . $filename;
            $refill[$name] = $captcha_url;
        }
    }
    if (!empty($refill)) {
        $items['captcha'] = $refill;
    }
    return $items;
}