本文整理汇总了PHP中wpcf7_format_atts函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_format_atts函数的具体用法?PHP wpcf7_format_atts怎么用?PHP wpcf7_format_atts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpcf7_format_atts函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: wpcf7_file_shortcode_handler
function wpcf7_file_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($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_option('id', 'id', true);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['type'] = 'file';
$atts['name'] = $tag->name;
$atts['value'] = '1';
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', $tag->name, $atts, $validation_error);
return $html;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:26,代码来源:file.php
示例3: shortcode_handler
public static function 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($tag->type, 'wpcf7-date');
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_option('id', 'id', true);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['type'] = 'text';
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = stripslashes_deep($_POST[$tag->name]);
}
$atts['value'] = $value;
$dpOptions = array();
$dpOptions['dateFormat'] = str_replace('_', ' ', $tag->get_option('date-format', '', true));
$dpOptions['minDate'] = $tag->get_option('min-date', '', true);
$dpOptions['maxDate'] = $tag->get_option('max-date', '', true);
$dpOptions['firstDay'] = (int) $tag->get_option('first-day', 'int', true);
$dpOptions['showAnim'] = $tag->get_option('animate', '', true);
$dpOptions['yearRange'] = str_replace('-', ':', $tag->get_option('year-range', '', true));
$dpOptions['numberOfMonths'] = (int) $tag->get_option('months', 'int', true);
$dpOptions['showButtonPanel'] = $tag->has_option('buttons');
$dpOptions['changeMonth'] = $tag->has_option('change-month');
$dpOptions['changeYear'] = $tag->has_option('change-year');
$dpOptions['noWeekends'] = $tag->has_option('no-weekends');
$inline = $tag->has_option('inline');
if ($inline) {
$dpOptions['altField'] = "#{$tag->name}_alt";
$atts['id'] = "{$tag->name}_alt";
}
$atts['type'] = $inline ? 'hidden' : 'text';
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s %4$s</span>', $tag->name, $atts, $validation_error, $inline ? "<div id=\"{$tag->name}_datepicker\"></div>" : '');
$html = apply_filters('cf7dp_date_input', $html);
$dp_selector = $inline ? '#' . $tag->name . '_datepicker' : $tag->name;
$dp = new CF7_DateTimePicker('date', $dp_selector, $dpOptions);
self::$inline_js[] = $dp->generate_code($inline);
return $html;
}
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:60,代码来源:date.php
示例4: 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
示例5: wpcf7_acceptance_shortcode_handler
function wpcf7_acceptance_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($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
if ($tag->has_option('invert')) {
$class .= ' wpcf7-invert';
}
$atts = array();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
if ($tag->has_option('default:on')) {
$atts['checked'] = 'checked';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$atts['type'] = 'checkbox';
$atts['name'] = $tag->name;
$atts['value'] = '1';
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
return $html;
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:29,代码来源:acceptance.php
示例6: wpcf7_quiz_shortcode_handler
function wpcf7_quiz_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($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$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';
$pipes = $tag->pipes;
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);
$atts['type'] = 'text';
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><span class="wpcf7-quiz-label">%2$s</span> <input %3$s /><input type="hidden" name="_wpcf7_quiz_answer_%1$s" value="%4$s" />%5$s</span>', $tag->name, esc_html($question), $atts, wp_hash($answer, 'wpcf7_quiz'), $validation_error);
return $html;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:35,代码来源:quiz.php
示例7: 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
示例8: wpcf7_text_shortcode_handler
function wpcf7_text_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($tag->type, 'wpcf7-text');
if (in_array($tag->basetype, array('email', 'url', 'tel'))) {
$class .= ' wpcf7-validates-as-' . $tag->basetype;
}
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_option('id', 'id', true);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
} elseif (empty($value) && is_user_logged_in()) {
$user = wp_get_current_user();
$user_options = array('default:user_login' => 'user_login', 'default:user_email' => 'user_email', 'default:user_url' => 'user_url', 'default:user_first_name' => 'first_name', 'default:user_last_name' => 'last_name', 'default:user_nickname' => 'nickname', 'default:user_display_name' => 'display_name');
foreach ($user_options as $option => $prop) {
if ($tag->has_option($option)) {
$value = $user->{$prop};
break;
}
}
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = stripslashes_deep($_POST[$tag->name]);
}
$atts['value'] = $value;
if (wpcf7_support_html5()) {
$atts['type'] = $tag->basetype;
} else {
$atts['type'] = 'text';
}
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', $tag->name, $atts, $validation_error);
return $html;
}
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:55,代码来源:text.php
示例9: wpcf7_text_shortcode_handler
function wpcf7_text_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($tag->type, 'wpcf7-text');
if (in_array($tag->basetype, array('email', 'url', 'tel'))) {
$class .= ' wpcf7-validates-as-' . $tag->basetype;
}
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['minlength'] = $tag->get_minlength_option();
if ($atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength']) {
unset($atts['maxlength'], $atts['minlength']);
}
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['autocomplete'] = $tag->get_option('autocomplete', '[-0-9a-zA-Z]+', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
}
$value = $tag->get_default_option($value);
$value = wpcf7_get_hangover($tag->name, $value);
$atts['value'] = $value;
if (wpcf7_support_html5()) {
$atts['type'] = $tag->basetype;
} else {
$atts['type'] = 'text';
}
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
return $html;
}
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:50,代码来源:text.php
示例10: wpcf7_text_shortcode_handler
function wpcf7_text_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($tag->type, 'wpcf7-text');
if (in_array($tag->basetype, array('email', 'url', 'tel'))) {
$class .= ' wpcf7-validates-as-' . $tag->basetype;
}
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_option('id', 'id', true);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['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]);
}
$atts['value'] = $value;
if (wpcf7_support_html5()) {
$atts['type'] = $tag->basetype;
} else {
$atts['type'] = 'text';
}
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<input %2$s />', $tag->name, $atts, $validation_error);
return $html;
}
开发者ID:roycocup,项目名称:enclothed,代码行数:48,代码来源:text.php
示例11: 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
示例12: wpcf7_number_shortcode_handler
function wpcf7_number_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($tag->type);
$class .= ' wpcf7-validates-as-number';
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['min'] = $tag->get_option('min', 'signed_int', true);
$atts['max'] = $tag->get_option('max', 'signed_int', true);
$atts['step'] = $tag->get_option('step', 'int', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = wp_unslash($_POST[$tag->name]);
}
$atts['value'] = $value;
if (wpcf7_support_html5()) {
$atts['type'] = $tag->basetype;
} else {
$atts['type'] = 'text';
}
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
return $html;
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:45,代码来源:number.php
示例13: wpcf7_submit_form_tag_handler
function wpcf7_submit_form_tag_handler($tag)
{
$tag = new WPCF7_FormTag($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['value'] = $value;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<input %1$s />', $atts);
return $html;
}
开发者ID:netmagik,项目名称:netmagik,代码行数:18,代码来源:submit.php
示例14: wpcf7c_back_shortcode_handler
function wpcf7c_back_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
$class = wpcf7_form_controls_class($tag->type);
$atts = array();
$atts['class'] = $tag->get_class_option($class) . " wpcf7c-elm-step2 wpcf7c-btn-back wpcf7c-force-hide";
$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 = __('Backedit', 'contact-form-7-add-confirm');
}
$atts['type'] = 'button';
$atts['value'] = $value;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<input %1$s />', $atts);
return $html;
}
开发者ID:vanlong200880,项目名称:uni,代码行数:18,代码来源:back.php
示例15: wpcf7_hidden_form_tag_handler
function wpcf7_hidden_form_tag_handler($tag)
{
$tag = new WPCF7_FormTag($tag);
if (empty($tag->name)) {
return '';
}
$atts = array();
$class = wpcf7_form_controls_class($tag->type);
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$value = (string) reset($tag->values);
$value = $tag->get_default_option($value);
$atts['value'] = $value;
$atts['type'] = 'hidden';
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<input %s />', $atts);
return $html;
}
开发者ID:netmagik,项目名称:netmagik,代码行数:19,代码来源:hidden.php
示例16: wpcf7_textarea_shortcode_handler
function wpcf7_textarea_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($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['cols'] = $tag->get_cols_option('40');
$atts['rows'] = $tag->get_rows_option('10');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['minlength'] = $tag->get_minlength_option();
if ($atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength']) {
unset($atts['maxlength'], $atts['minlength']);
}
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['autocomplete'] = $tag->get_option('autocomplete', '[-0-9a-zA-Z]+', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = empty($tag->content) ? (string) reset($tag->values) : $tag->content;
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
}
$value = $tag->get_default_option($value);
$value = wpcf7_get_hangover($tag->name, $value);
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><textarea %2$s>%3$s</textarea>%4$s</span>', sanitize_html_class($tag->name), $atts, esc_textarea($value), $validation_error);
return $html;
}
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:42,代码来源:textarea.php
示例17: wpcf7_textarea_shortcode_handler
function wpcf7_textarea_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($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['cols'] = $tag->get_cols_option('');
$atts['rows'] = $tag->get_rows_option('');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_option('id', 'id', true);
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
if ($tag->has_option('readonly')) {
$atts['readonly'] = 'readonly';
}
if ($tag->is_required()) {
$atts['aria-required'] = 'true';
}
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$value = (string) reset($tag->values);
if ('' !== $tag->content) {
$value = $tag->content;
}
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = stripslashes_deep($_POST[$tag->name]);
}
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<textarea %2$s></textarea>', $tag->name, $atts, esc_textarea($value), $validation_error);
return $html;
}
开发者ID:roycocup,项目名称:enclothed,代码行数:41,代码来源:textarea.php
示例18: wpcf7_quiz_form_tag_handler
function wpcf7_quiz_form_tag_handler($tag)
{
$tag = new WPCF7_FormTag($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'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['minlength'] = $tag->get_minlength_option();
if ($atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength']) {
unset($atts['maxlength'], $atts['minlength']);
}
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
$atts['autocomplete'] = 'off';
$atts['aria-required'] = 'true';
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
$pipes = $tag->pipes;
if ($pipes instanceof 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);
$atts['type'] = 'text';
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %1$s"><label><span class="wpcf7-quiz-label">%2$s</span> <input %3$s /></label><input type="hidden" name="_wpcf7_quiz_answer_%4$s" value="%5$s" />%6$s</span>', sanitize_html_class($tag->name), esc_html($question), $atts, $tag->name, wp_hash($answer, 'wpcf7_quiz'), $validation_error);
return $html;
}
开发者ID:netmagik,项目名称:netmagik,代码行数:41,代码来源:quiz.php
示例19: wpcf7_robottrap_shortcode_handler
function wpcf7_robottrap_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
// default field name
if (empty($tag->name)) {
$tag->name = 'email-verify';
}
// per field errors
$validation_error = wpcf7_get_validation_error($tag->name);
// add wpcf7 specific classes
$class = wpcf7_form_controls_class('text');
if ($validation_error) {
$class .= ' wpcf7-not-valid';
}
$atts = array();
$atts['size'] = $tag->get_size_option('40');
$atts['maxlength'] = $tag->get_maxlength_option();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
/**
* Robots may look for the word "hidden".
*
* @ignore Commented out.
*/
//$atts['aria-hidden'] = 'true';
$value = (string) reset($tag->values);
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$atts['placeholder'] = $value;
$value = '';
} elseif ('' === $value) {
$value = $tag->get_default_option();
}
$value = wpcf7_get_hangover($tag->name, $value);
$atts['value'] = $value;
$atts['type'] = 'text';
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<span class="wpcf7-form-control-wrap %s"><input %s />%s</span>', sanitize_html_class($tag->name), $atts, $validation_error);
return $html;
}
开发者ID:vrkansagara,项目名称:wordpress-plugin-construction,代码行数:41,代码来源:cf7-robot_trap.php
示例20: wpcf7_authoremail_shortcode_handler
/**
* Renders the itens id input control (html code)
*
* @param string $tagName defined by the user at form's edit form (inside
* shortcode brackets)
*
* @return void
*/
function wpcf7_authoremail_shortcode_handler($tagName)
{
global $post;
$tag = new WPCF7_Shortcode($tagName);
if (empty($tag->name)) {
return '';
}
$class = wpcf7_form_controls_class($tag->type);
$class .= ' wpcf7-authoremail';
$author = get_the_author();
$author_email = get_the_author_meta('user_email');
$atts = array();
$atts['class'] = $tag->get_class_option($class);
$atts['id'] = $tag->get_id_option();
$atts['type'] = 'hidden';
$atts['value'] = $author_email;
$atts['name'] = $tag->name;
$atts = wpcf7_format_atts($atts);
$html = sprintf('<input %1$s />', $atts);
return $html;
}
开发者ID:jamalwsilva,项目名称:wpcf7_itememail,代码行数:29,代码来源:authoremail.php
注:本文中的wpcf7_format_atts函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论