• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WPCF7_Shortcode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WPCF7_Shortcode的典型用法代码示例。如果您正苦于以下问题:PHP WPCF7_Shortcode类的具体用法?PHP WPCF7_Shortcode怎么用?PHP WPCF7_Shortcode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WPCF7_Shortcode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wpcf7_mathcaptcha_shortcode_handler

function wpcf7_mathcaptcha_shortcode_handler($tag)
{
    if (!is_user_logged_in() || is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users']) {
        $tag = new WPCF7_Shortcode($tag);
        if (empty($tag->name)) {
            return '';
        }
        $validation_error = wpcf7_get_validation_error($tag->name);
        $class = wpcf7_form_controls_class($tag->type);
        if ($validation_error) {
            $class .= ' wpcf7-not-valid';
        }
        $atts = array();
        $atts['size'] = 2;
        $atts['maxlength'] = 2;
        $atts['class'] = $tag->get_class_option($class);
        $atts['id'] = $tag->get_option('id', 'id', true);
        $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
        $atts['aria-required'] = 'true';
        $atts['type'] = 'text';
        $atts['name'] = $tag->name;
        $atts['value'] = '';
        $atts = wpcf7_format_atts($atts);
        $mc_form = Math_Captcha()->core->generate_captcha_phrase('cf7');
        $mc_form[$mc_form['input']] = '<input %2$s />';
        $math_captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
        return sprintf((empty($math_captcha_title) ? '' : $math_captcha_title) . '<span class="wpcf7-form-control-wrap %1$s">' . $mc_form[1] . $mc_form[2] . $mc_form[3] . '%3$s</span><input type="hidden" value="' . (Math_Captcha()->core->session_number - 1) . '" name="' . $tag->name . '-sn" />', $tag->name, $atts, $validation_error);
    }
}
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:29,代码来源:contact-form-7.php


示例2: wpcf7_date_validation_filter

function wpcf7_date_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $min = $tag->get_date_option('min');
    $max = $tag->get_date_option('max');
    $value = isset($_POST[$name]) ? trim(strtr((string) $_POST[$name], "\n", " ")) : '';
    if ($tag->is_required() && '' == $value) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('invalid_required');
    } elseif ('' != $value && !wpcf7_is_date($value)) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('invalid_date');
    } elseif ('' != $value && !empty($min) && $value < $min) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('date_too_early');
    } elseif ('' != $value && !empty($max) && $max < $value) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('date_too_late');
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:25,代码来源:date.php


示例3: wpcf7_number_validation_filter

function wpcf7_number_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $value = isset($_POST[$name]) ? trim(strtr((string) $_POST[$name], "\n", " ")) : '';
    $min = $tag->get_option('min', 'signed_int', true);
    $max = $tag->get_option('max', 'signed_int', true);
    if ($tag->is_required() && '' == $value) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('invalid_required');
    } elseif ('' != $value && !wpcf7_is_number($value)) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('invalid_number');
    } elseif ('' != $value && '' != $min && (double) $value < (double) $min) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('number_too_small');
    } elseif ('' != $value && '' != $max && (double) $max < (double) $value) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('number_too_large');
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:25,代码来源:number.php


示例4: wpcf7_textarea_validation_filter

function wpcf7_textarea_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $type = $tag->type;
    $name = $tag->name;
    $value = isset($_POST[$name]) ? (string) $_POST[$name] : '';
    if ($tag->is_required() && '' == $value) {
        $result->invalidate($tag, wpcf7_get_message('invalid_required'));
    }
    if (!empty($value)) {
        $maxlength = $tag->get_maxlength_option();
        $minlength = $tag->get_minlength_option();
        if ($maxlength && $minlength && $maxlength < $minlength) {
            $maxlength = $minlength = null;
        }
        $code_units = wpcf7_count_code_units($value);
        if (false !== $code_units) {
            if ($maxlength && $maxlength < $code_units) {
                $result->invalidate($tag, wpcf7_get_message('invalid_too_long'));
            } elseif ($minlength && $code_units < $minlength) {
                $result->invalidate($tag, wpcf7_get_message('invalid_too_short'));
            }
        }
    }
    return $result;
}
开发者ID:Lumbe,项目名称:dev_servus,代码行数:26,代码来源:textarea.php


示例5: wpcf7_honeypot_shortcode_handler

function wpcf7_honeypot_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class('text');
    $atts = array();
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_option('id', 'id', true);
    $atts['message'] = __('Please leave this field empty.', 'wpcf7_honeypot');
    $atts['name'] = $tag->name;
    $atts['type'] = $tag->type;
    $atts['nomessage'] = $tag->get_option('nomessage');
    $atts['validation_error'] = $validation_error;
    $inputid = !empty($atts['id']) ? 'id="' . $atts['id'] . '" ' : '';
    $html = '<span class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" style="display:none !important;visibility:hidden !important;">';
    $html .= '<input ' . $inputid . 'class="' . $atts['class'] . '"  type="text" name="' . $atts['name'] . '" value="" size="40" tabindex="-1" />';
    if (!$atts['nomessage']) {
        $html .= '<span class="hp-message">' . $atts['message'] . '</span>';
    }
    $html .= $validation_error . '</span>';
    // Hook for filtering finished Honeypot form element.
    return apply_filters('wpcf7_honeypot_html_output', $html, $atts);
}
开发者ID:BennyHudson,项目名称:quoin,代码行数:26,代码来源:honeypot.php


示例6: wpcf7_birthday_validation_filter

function wpcf7_birthday_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $value = isset($_POST[$name]) ? trim(wp_unslash(strtr((string) $_POST[$name], "\n", " "))) : '';
    if ('birthday' == $tag->type && $value != '') {
        if (preg_match('@^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[0-2])$@', $value) != 1) {
            $result['valid'] = false;
            $result['reason'][$name] = wpcf7_get_message('invalid_birthday');
        }
    }
    if ('birthday*' == $tag->type) {
        if ($value == '') {
            $result['valid'] = false;
            $result['reason'][$name] = wpcf7_get_message('invalid_required');
        } else {
            if (preg_match('@^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[0-2])$@', $value) != 1) {
                $result['valid'] = false;
                $result['reason'][$name] = wpcf7_get_message('invalid_birthday');
            }
        }
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:eulo,项目名称:contact-form-7-birthday,代码行数:27,代码来源:birthday.php


示例7: wpcf7_icon_btn_shortcode_handler

 function wpcf7_icon_btn_shortcode_handler($tag)
 {
     $tag = new WPCF7_Shortcode($tag);
     $class = wpcf7_form_controls_class($tag->type);
     $atts = array();
     $atts['class'] = $tag->get_class_option($class);
     $atts['class'] = $atts['class'] . ' wpcf7-submit';
     //add the default submit class
     $atts['id'] = $tag->get_id_option();
     $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
     $atts['type'] = 'submit';
     $atts = wpcf7_format_atts($atts);
     //get icon class
     $icon_class = $tag->get_option('icon', '', true);
     $icon_class = empty($icon_class) ? 'fa-send' : $icon_class;
     //add default class if empty
     $icon_class = 'fa ' . esc_attr($icon_class);
     //add fa // did u notice space after fa
     //get button label
     $value = isset($tag->values[0]) ? $tag->values[0] : '';
     if (empty($value)) {
         $value = __('Send', 'contact-form-7');
     }
     //complete string
     $html = sprintf('<button %1$s /><i class="%2$s"></i> %3$s</button>', $atts, $icon_class, esc_html($value));
     return $html;
 }
开发者ID:brettex,项目名称:pspark,代码行数:27,代码来源:cf7-icon.php


示例8: 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


示例9: wpcf7_acceptance_validation_filter

function wpcf7_acceptance_validation_filter($result, $tag)
{
    if (!wpcf7_acceptance_as_validation()) {
        return $result;
    }
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $value = !empty($_POST[$name]) ? 1 : 0;
    $invert = $tag->has_option('invert');
    if ($invert && $value || !$invert && !$value) {
        $result->invalidate($tag, wpcf7_get_message('accept_terms'));
    }
    return $result;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:14,代码来源:acceptance.php


示例10: cf7bs_captcha_shortcode_handler

function cf7bs_captcha_shortcode_handler($tag)
{
    $tag_obj = new WPCF7_Shortcode($tag);
    if ('captchac' == $tag_obj->type && !class_exists('ReallySimpleCaptcha')) {
        return '<em>' . __('To use CAPTCHA, you need <a href="http://wordpress.org/extend/plugins/really-simple-captcha/">Really Simple CAPTCHA</a> plugin installed.', 'bootstrap-for-contact-form-7') . '</em>';
    }
    if (empty($tag_obj->name)) {
        return '';
    }
    $validation_error = wpcf7_get_validation_error($tag_obj->name);
    if ('captchac' == $tag_obj->type) {
        if ($image_sizes_array = preg_grep('%^size:[smlSML]$%', $tag['options'])) {
            $tag['options'] = array_values(array_diff_key($tag['options'], $image_sizes_array));
        }
        $size = cf7bs_get_form_property('size');
        $image_size = 'large' == $size ? 'l' : ('small' == $size ? 's' : 'm');
        $tag['options'][] = 'size:' . $image_size;
        $field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => wpcf7_captcha_shortcode_handler($tag), 'type' => 'custom', 'label' => $tag_obj->content, 'help_text' => $validation_error, 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'tabindex' => false, 'wrapper_class' => ''), $tag_obj->basetype, $tag_obj->name));
        $html = $field->display(false);
        return $html;
    } elseif ('captchar' == $tag_obj->type) {
        $mode = $status = 'default';
        $class = wpcf7_form_controls_class($tag_obj->type, 'wpcf7-text');
        if ($validation_error) {
            $class .= ' wpcf7-not-valid';
            $status = 'error';
        }
        // size is not used since Bootstrap input fields always scale 100%
        //$atts['size'] = $tag->get_size_option( '40' );
        $value = (string) reset($tag_obj->values);
        $placeholder = '';
        if (wpcf7_is_posted()) {
            $value = '';
        }
        if ($tag_obj->has_option('placeholder') || $tag_obj->has_option('watermark')) {
            $placeholder = $value;
            $value = '';
        }
        $input_before = $input_after = '';
        if ($tag_obj->has_option('include_captchac') && class_exists('ReallySimpleCaptcha')) {
            $captchac_mode = $tag_obj->get_option('include_captchac', '[A-Za-z]+', true);
            if ($captchac_mode && 'after' == strtolower($captchac_mode)) {
                $captchac_mode = 'input_after';
            } else {
                $captchac_mode = 'input_before';
            }
            $tag = cf7bs_captchar_to_captchac($tag);
            ${$captchac_mode} = wpcf7_captcha_shortcode_handler($tag);
        }
        $field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag_obj->name, 'id' => $tag_obj->get_option('id', 'id', true), 'class' => $tag_obj->get_class_option($class), 'type' => 'text', 'value' => $value, 'placeholder' => $placeholder, 'label' => $tag_obj->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'maxlength' => $tag_obj->get_maxlength_option(), 'tabindex' => $tag_obj->get_option('tabindex', 'int', true), 'wrapper_class' => $tag_obj->name, 'input_before' => $input_before, 'input_after' => $input_after, 'input_before_class' => 'input-group-addon input-group-has-image', 'input_after_class' => 'input-group-addon input-group-has-image'), $tag_obj->basetype, $tag_obj->name));
        $html = $field->display(false);
        return $html;
    }
    return '';
}
开发者ID:joostthehost,项目名称:bootstrap-for-contact-form-7,代码行数:55,代码来源:captcha.php


示例11: cf7bs_file_shortcode_handler

function cf7bs_file_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $mode = $status = 'default';
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
        $status = 'error';
    }
    // size is not used since Bootstrap input fields always scale 100%
    //$atts['size'] = $tag->get_size_option( '40' );
    if ($tag->is_required()) {
        $mode = 'required';
    }
    $value = (string) reset($tag->values);
    $placeholder = '';
    if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
        $placeholder = $value;
        $value = '';
    } elseif (empty($value)) {
        $value = $tag->get_default_option();
    }
    if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
        $value = stripslashes_deep($_POST[$tag->name]);
    }
    $field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => 'file', 'value' => '1', 'label' => $tag->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
    $html = $field->display(false);
    return $html;
}
开发者ID:joostthehost,项目名称:bootstrap-for-contact-form-7,代码行数:33,代码来源:file.php


示例12: wpcf7_text_validation_filter

function wpcf7_text_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $value = isset($_POST[$name]) ? trim(wp_unslash(strtr((string) $_POST[$name], "\n", " "))) : '';
    if ('text' == $tag->basetype) {
        if ($tag->is_required() && '' == $value) {
            $result->invalidate($tag, wpcf7_get_message('invalid_required'));
        }
    }
    if ('email' == $tag->basetype) {
        if ($tag->is_required() && '' == $value) {
            $result->invalidate($tag, wpcf7_get_message('invalid_required'));
        } elseif ('' != $value && !wpcf7_is_email($value)) {
            $result->invalidate($tag, wpcf7_get_message('invalid_email'));
        }
    }
    if ('url' == $tag->basetype) {
        if ($tag->is_required() && '' == $value) {
            $result->invalidate($tag, wpcf7_get_message('invalid_required'));
        } elseif ('' != $value && !wpcf7_is_url($value)) {
            $result->invalidate($tag, wpcf7_get_message('invalid_url'));
        }
    }
    if ('tel' == $tag->basetype) {
        if ($tag->is_required() && '' == $value) {
            $result->invalidate($tag, wpcf7_get_message('invalid_required'));
        } elseif ('' != $value && !wpcf7_is_tel($value)) {
            $result->invalidate($tag, wpcf7_get_message('invalid_tel'));
        }
    }
    if (!empty($value)) {
        $maxlength = $tag->get_maxlength_option();
        $minlength = $tag->get_minlength_option();
        if ($maxlength && $minlength && $maxlength < $minlength) {
            $maxlength = $minlength = null;
        }
        $code_units = wpcf7_count_code_units($value);
        if (false !== $code_units) {
            if ($maxlength && $maxlength < $code_units) {
                $result->invalidate($tag, wpcf7_get_message('invalid_too_long'));
            } elseif ($minlength && $code_units < $minlength) {
                $result->invalidate($tag, wpcf7_get_message('invalid_too_short'));
            }
        }
    }
    return $result;
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:48,代码来源:text.php


示例13: wpcf7_custom_textarea_validation_message

function wpcf7_custom_textarea_validation_message($result, $tag)
{
    $cmtatag = new WPCF7_Shortcode($tag);
    $type = $cmtatag->type;
    $name = $cmtatag->name;
    $post_id = sanitize_text_field($_POST['_wpcf7']);
    $value = isset($_POST[$name]) ? (string) $_POST[$name] : '';
    $key = "_cf7cm_" . $name;
    $val = get_post_meta($post_id, $key, true);
    $enable = get_post_meta($post_id, '_cf7cm_enable_errors');
    if ($enable[0] != 0) {
        if ($cmtatag->is_required() && '' == $value) {
            $result->invalidate($cmtatag, $val);
        }
        if (!empty($value)) {
            $maxlength = $cmtatag->get_maxlength_option();
            $minlength = $cmtatag->get_minlength_option();
            if ($maxlength && $minlength && $maxlength < $minlength) {
                $maxlength = $minlength = null;
            }
            $code_units = wpcf7_count_code_units($value);
            if (false !== $code_units) {
                if ($maxlength && $maxlength < $code_units) {
                    $result->invalidate($cmtatag, $val);
                } elseif ($minlength && $code_units < $minlength) {
                    $result->invalidate($cmtatag, $val);
                }
            }
        }
    }
    return $result;
}
开发者ID:QuantumCPH,项目名称:crowdeyesweb,代码行数:32,代码来源:cf7-tag-custom-error-message.php


示例14: cf7bs_submit_shortcode_handler

function cf7bs_submit_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $class = wpcf7_form_controls_class($tag->type);
    $value = isset($tag->values[0]) ? $tag->values[0] : '';
    if (empty($value)) {
        $value = __('Send', 'contact-form-7');
    }
    $size = cf7bs_get_form_property('submit_size');
    if (!$size) {
        $size = cf7bs_get_form_property('size');
    }
    $button = new CF7BS_Button(array('mode' => 'submit', 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'title' => $value, 'type' => cf7bs_get_form_property('submit_type'), 'size' => $size, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'align' => $tag->get_option('align', '[A-Za-z]+', true), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint')));
    $html = $button->display(false);
    return $html;
}
开发者ID:joostthehost,项目名称:bootstrap-for-contact-form-7,代码行数:16,代码来源:submit.php


示例15: wpcf7_quiz_validation_filter

function wpcf7_quiz_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $answer = isset($_POST[$name]) ? wpcf7_canonicalize($_POST[$name]) : '';
    $answer = wp_unslash($answer);
    $answer_hash = wp_hash($answer, 'wpcf7_quiz');
    $expected_hash = isset($_POST['_wpcf7_quiz_answer_' . $name]) ? (string) $_POST['_wpcf7_quiz_answer_' . $name] : '';
    if ($answer_hash != $expected_hash) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('quiz_answer_not_correct');
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:17,代码来源:quiz.php


示例16: wpcf7_button_shortcode_handler

function wpcf7_button_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $class = wpcf7_form_controls_class($tag->type);
    $atts = array();
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_id_option();
    $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
    $value = isset($tag->values[0]) ? $tag->values[0] : '';
    if (empty($value)) {
        $value = __('Send', 'contact-form-7');
    }
    $atts['type'] = 'submit';
    $atts = wpcf7_format_atts($atts);
    $html = sprintf('<button %1$s>%2$s</button>', $atts, $value);
    return $html;
}
开发者ID:Thielo,项目名称:contact-form-7,代码行数:17,代码来源:button.php


示例17: wpcf7_textarea_validation_filter

function wpcf7_textarea_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $type = $tag->type;
    $name = $tag->name;
    $value = isset($_POST[$name]) ? (string) $_POST[$name] : '';
    if ('textarea*' == $type) {
        if ('' == $value) {
            $result['valid'] = false;
            $result['reason'][$name] = wpcf7_get_message('invalid_required');
        }
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:17,代码来源:textarea.php


示例18: recaptcha_shortcode_handler

 function recaptcha_shortcode_handler($tag)
 {
     if (!WP_reCaptcha::instance()->is_required()) {
         return apply_filters('wp_recaptcha_disabled_html', '');
     }
     $tag = new WPCF7_Shortcode($tag);
     if (empty($tag->name)) {
         return '';
     }
     $atts = null;
     if ($theme = $tag->get_option('theme', '', true)) {
         $atts = array('data-theme' => $theme);
     }
     $recaptcha_html = WP_reCaptcha::instance()->recaptcha_html($atts);
     $validation_error = wpcf7_get_validation_error($tag->name);
     $html = sprintf(apply_filters('wp_recaptcha_cf7_shortcode_wrap', '<span class="wpcf7-form-control-wrap %1$s">%2$s %3$s</span>'), $tag->name, $recaptcha_html, $validation_error);
     return $html;
 }
开发者ID:wiratama,项目名称:gardenbal,代码行数:18,代码来源:class-wp_recaptcha_contactform7.php


示例19: wpcf7_submit_shortcode_handler

function wpcf7_submit_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $class = wpcf7_form_controls_class($tag->type);
    $atts = array();
    $atts['class'] = $tag->get_class_option($class);
    $atts['id'] = $tag->get_option('id', 'id', true);
    $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
    $value = isset($tag->values[0]) ? $tag->values[0] : '';
    if (empty($value)) {
        $value = __('Send', 'wpcf7');
    }
    $atts['type'] = 'submit';
    $atts['value'] = $value;
    $atts = wpcf7_format_atts($atts);
    $html = sprintf('<input %1$s />', $atts);
    return $html;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:18,代码来源:submit.php


示例20: wpcf7_acceptance_validation_filter

function wpcf7_acceptance_validation_filter($result, $tag)
{
    if (!wpcf7_acceptance_as_validation()) {
        return $result;
    }
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $value = !empty($_POST[$name]) ? 1 : 0;
    $invert = $tag->has_option('invert');
    if ($invert && $value || !$invert && !$value) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('accept_terms');
    }
    if (isset($result['reason'][$name]) && ($id = $tag->get_id_option())) {
        $result['idref'][$name] = $id;
    }
    return $result;
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:18,代码来源:acceptance.php



注:本文中的WPCF7_Shortcode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WPCF7_Submission类代码示例发布时间:2022-05-23
下一篇:
PHP WPCF7_ContactForm类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap