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 = wpcf7_captcha_url($filename); $refill[$name] = $captcha_url; } } if (!empty($refill)) { $items['captcha'] = $refill; } return $items; }
function cf7bs_captcha_ajax_refill($items) { if (!is_array($items)) { return $items; } $fes = wpcf7_scan_shortcode(array('type' => 'captchar')); if (empty($fes)) { return $items; } $refill = array(); foreach ($fes as $fe) { if (cf7bs_captchar_has_captchac($fe)) { $fe = cf7bs_captchar_to_captchac($fe); $name = $fe['name']; $options = $fe['options']; if (empty($name)) { continue; } $op = wpcf7_captchac_options($options); if ($filename = wpcf7_generate_captcha($op)) { $captcha_url = wpcf7_captcha_url($filename); $refill[$name] = $captcha_url; } } } if (count($refill) > 0) { if (!isset($items['captcha'])) { $items['captcha'] = $refill; } else { $items['captcha'] = array_merge($items['captcha'], $refill); } } return $items; }