当前位置: 首页>>代码示例>>PHP>>正文


PHP WPCF7_Shortcode::get_date_option方法代码示例

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


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

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

示例2: cf7bs_date_shortcode_handler

function cf7bs_date_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);
    $class .= ' wpcf7-validates-as-date';
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
        $status = 'error';
    }
    if ($tag->is_required()) {
        $mode = 'required';
    }
    $value = (string) reset($tag->values);
    $placeholder = '';
    if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
        $placeholder = $value;
        $value = '';
    }
    $value = $tag->get_default_option($value);
    if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
        $value = stripslashes_deep($_POST[$tag->name]);
    } elseif (isset($_GET) && array_key_exists($tag->name, $_GET)) {
        $value = stripslashes_deep(rawurldecode($_GET[$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' => wpcf7_support_html5() ? $tag->basetype : 'text', 'value' => $value, 'placeholder' => $placeholder, 'label' => $tag->content, 'options' => array('min' => $tag->get_date_option('min'), 'max' => $tag->get_date_option('max'), 'step' => $tag->get_option('step', 'int', true)), '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, 'readonly' => $tag->has_option('readonly') ? true : false, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
    $html = $field->display(false);
    return $html;
}
开发者ID:zepich,项目名称:bootstrap-for-contact-form-7,代码行数:33,代码来源:date.php


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