本文整理汇总了PHP中wpcf7_scan_shortcode函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_scan_shortcode函数的具体用法?PHP wpcf7_scan_shortcode怎么用?PHP wpcf7_scan_shortcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_scan_shortcode函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wpcf7_quiz_ajax_refill
function wpcf7_quiz_ajax_refill($items)
{
if (!is_array($items)) {
return $items;
}
$fes = wpcf7_scan_shortcode(array('type' => 'quiz'));
if (empty($fes)) {
return $items;
}
$refill = array();
foreach ($fes as $fe) {
$name = $fe['name'];
$pipes = $fe['pipes'];
if (empty($name)) {
continue;
}
if (is_a($pipes, 'WPCF7_Pipes') && !$pipes->zero()) {
$pipe = $pipes->random_pipe();
$question = $pipe->before;
$answer = $pipe->after;
} else {
// default quiz
$question = '1+1=?';
$answer = '2';
}
$answer = wpcf7_canonicalize($answer);
$refill[$name] = array($question, wp_hash($answer, 'wpcf7_quiz'));
}
if (!empty($refill)) {
$items['quiz'] = $refill;
}
return $items;
}
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:33,代码来源:quiz.php
示例2: wpcf7_akismet_submitted_params
function wpcf7_akismet_submitted_params()
{
$params = array('author' => '', 'author_email' => '', 'author_url' => '');
$content = '';
$fes = wpcf7_scan_shortcode();
foreach ($fes as $fe) {
if (!isset($fe['name']) || !isset($_POST[$fe['name']])) {
continue;
}
$value = $_POST[$fe['name']];
if (is_array($value)) {
$value = implode(', ', wpcf7_array_flatten($value));
}
$value = trim($value);
$options = (array) $fe['options'];
if (preg_grep('%^akismet:author$%', $options)) {
$params['author'] = trim($params['author'] . ' ' . $value);
} elseif (preg_grep('%^akismet:author_email$%', $options)) {
if ('' == $params['author_email']) {
$params['author_email'] = $value;
}
} elseif (preg_grep('%^akismet:author_url$%', $options)) {
if ('' == $params['author_url']) {
$params['author_url'] = $value;
}
}
$content = trim($content . "\n\n" . $value);
}
$params = array_filter($params);
if (!$params) {
return false;
}
$params['content'] = $content;
return $params;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:35,代码来源:akismet.php
示例3: wpcf7_count_shortcode_handler
function wpcf7_count_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$target = wpcf7_scan_shortcode(array('name' => $tag->name));
$maxlength = $minlength = null;
if ($target) {
$target = new WPCF7_Shortcode($target[0]);
$maxlength = $target->get_maxlength_option();
$minlength = $target->get_minlength_option();
if ($maxlength && $minlength && $maxlength < $minlength) {
$maxlength = $minlength = null;
}
}
if ($tag->has_option('down')) {
$value = (int) $maxlength;
$class = 'wpcf7-character-count down';
} else {
$value = '0';
$class = 'wpcf7-character-count up';
}
$atts = array();
$atts['id'] = $tag->get_id_option();
$atts['class'] = $tag->get_class_option($class);
$atts['data-target-name'] = $tag->name;
$atts['data-starting-value'] = $value;
$atts['data-current-value'] = $value;
$atts['data-maximum-value'] = $maxlength;
$atts['data-minimum-value'] = $minlength;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span %1$s>%2$s</span>', $atts, $value);
return $html;
}
开发者ID:zoran180,项目名称:natashazindrou,代码行数:35,代码来源:count.php
示例4: wpcf7_file_form_enctype_filter
function wpcf7_file_form_enctype_filter($enctype)
{
$multipart = (bool) wpcf7_scan_shortcode(array('type' => array('file', 'file*')));
if ($multipart) {
$enctype = ' enctype="multipart/form-data"';
}
return $enctype;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:8,代码来源:file.php
示例5: wpcf7_acceptance_filter
function wpcf7_acceptance_filter($accepted)
{
$fes = wpcf7_scan_shortcode(array('type' => 'acceptance'));
foreach ($fes as $fe) {
$name = $fe['name'];
$options = (array) $fe['options'];
if (empty($name)) {
continue;
}
$value = $_POST[$name] ? 1 : 0;
$invert = (bool) preg_grep('%^invert$%', $options);
if ($invert && $value || !$invert && !$value) {
$accepted = false;
}
}
return $accepted;
}
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:17,代码来源:acceptance.php
示例6: invalidate
public function invalidate($context, $message)
{
if ($context instanceof WPCF7_Shortcode) {
$tag = $context;
} elseif (is_array($context)) {
$tag = new WPCF7_Shortcode($context);
} elseif (is_string($context)) {
$tags = wpcf7_scan_shortcode(array('name' => trim($context)));
$tag = $tags ? new WPCF7_Shortcode($tags[0]) : null;
}
$name = !empty($tag) ? $tag->name : null;
if (empty($name) || !wpcf7_is_name($name)) {
return;
}
if ($this->is_valid($name)) {
$id = $tag->get_id_option();
if (empty($id) || !wpcf7_is_name($id)) {
$id = null;
}
$this->invalid_fields[$name] = array('reason' => (string) $message, 'idref' => $id);
}
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:22,代码来源:validation.php
示例7: wpcf7_akismet_submitted_params
function wpcf7_akismet_submitted_params()
{
$params = array('author' => '', 'author_email' => '', 'author_url' => '', 'content' => '');
$has_akismet_option = false;
foreach ((array) $_POST as $key => $val) {
if ('_wpcf7' == substr($key, 0, 6) || '_wpnonce' == $key) {
continue;
}
if (is_array($val)) {
$val = implode(', ', wpcf7_array_flatten($val));
}
$val = trim($val);
if (0 == strlen($val)) {
continue;
}
if ($tags = wpcf7_scan_shortcode(array('name' => $key))) {
$tag = $tags[0];
$tag = new WPCF7_Shortcode($tag);
$akismet = $tag->get_option('akismet', '(author|author_email|author_url)', true);
if ($akismet) {
$has_akismet_option = true;
if ('author' == $akismet) {
$params[$akismet] = trim($params[$akismet] . ' ' . $val);
} elseif ('' == $params[$akismet]) {
$params[$akismet] = $val;
}
}
}
$params['content'] .= "\n\n" . $val;
}
if (!$has_akismet_option) {
return false;
}
$params['content'] = trim($params['content']);
return $params;
}
开发者ID:zoran180,项目名称:natashazindrou,代码行数:36,代码来源:akismet.php
示例8: wpcf7_akismet
function wpcf7_akismet($spam)
{
global $akismet_api_host, $akismet_api_port;
if (!function_exists('akismet_get_key') || !akismet_get_key()) {
return false;
}
$akismet_ready = false;
$author = $author_email = $author_url = $content = '';
$fes = wpcf7_scan_shortcode();
foreach ($fes as $fe) {
if (!isset($fe['name']) || !is_array($fe['options'])) {
continue;
}
if (preg_grep('%^akismet:author$%', $fe['options'])) {
$author .= ' ' . $_POST[$fe['name']];
$author = trim($author);
$akismet_ready = true;
}
if (preg_grep('%^akismet:author_email$%', $fe['options']) && '' == $author_email) {
$author_email = trim($_POST[$fe['name']]);
$akismet_ready = true;
}
if (preg_grep('%^akismet:author_url$%', $fe['options']) && '' == $author_url) {
$author_url = trim($_POST[$fe['name']]);
$akismet_ready = true;
}
if ('' != $content) {
$content .= "\n\n";
}
$content .= $_POST[$fe['name']];
}
if (!$akismet_ready) {
return false;
}
$c['blog'] = get_option('home');
$c['blog_lang'] = get_locale();
$c['blog_charset'] = get_option('blog_charset');
$c['user_ip'] = preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']);
$c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$c['referrer'] = $_SERVER['HTTP_REFERER'];
$c['comment_type'] = 'contactform7';
if ($permalink = get_permalink()) {
$c['permalink'] = $permalink;
}
if ('' != $author) {
$c['comment_author'] = $author;
}
if ('' != $author_email) {
$c['comment_author_email'] = $author_email;
}
if ('' != $author_url) {
$c['comment_author_url'] = $author_url;
}
if ('' != $content) {
$c['comment_content'] = $content;
}
$ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, (array) $ignore)) {
$c["{$key}"] = $value;
}
}
$query_string = '';
foreach ($c as $key => $data) {
$query_string .= $key . '=' . urlencode(stripslashes((string) $data)) . '&';
}
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
if ('true' == $response[1]) {
$spam = true;
}
return $spam;
}
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:72,代码来源:akismet.php
示例9: wpcf7_captcha_ajax_refill
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;
}
开发者ID:dracudakid,项目名称:WP_TrungTamTinHoc,代码行数:27,代码来源:really-simple-captcha.php
示例10: wpcf7_checkbox_posted_data
function wpcf7_checkbox_posted_data($posted_data)
{
$tags = wpcf7_scan_shortcode(array('type' => array('checkbox', 'checkbox*', 'radio')));
if (empty($tags)) {
return $posted_data;
}
foreach ($tags as $tag) {
$tag = new WPCF7_Shortcode($tag);
if (!isset($posted_data[$tag->name])) {
continue;
}
$posted_items = (array) $posted_data[$tag->name];
if ($tag->has_option('free_text')) {
if (WPCF7_USE_PIPE) {
$values = $tag->pipes->collect_afters();
} else {
$values = $tag->values;
}
$last = array_pop($values);
$last = html_entity_decode($last, ENT_QUOTES, 'UTF-8');
if (in_array($last, $posted_items)) {
$posted_items = array_diff($posted_items, array($last));
$free_text_name = sprintf('_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name);
$free_text = $posted_data[$free_text_name];
if (!empty($free_text)) {
$posted_items[] = trim($last . ' ' . $free_text);
} else {
$posted_items[] = $last;
}
}
}
$posted_data[$tag->name] = $posted_items;
}
return $posted_data;
}
开发者ID:Lumbe,项目名称:dev_servus,代码行数:35,代码来源:checkbox.php
示例11: cf7bs_captcha_ajax_refill
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;
}
开发者ID:joostthehost,项目名称:bootstrap-for-contact-form-7,代码行数:34,代码来源:captcha.php
注:本文中的wpcf7_scan_shortcode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论