コード例 #1
0
ファイル: date.php プロジェクト: ntngiri/Wordpress-dhaba
 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;
 }
コード例 #2
0
ファイル: admin.php プロジェクト: ntngiri/Wordpress-dhaba
    public static function theme_panel()
    {
        ?>
        <h3><?php 
        _e('Datepicker Theme');
        ?>
</h3>

        <div id="preview" style="float: left; margin: 0 10px 0 0">
            <?php 
        echo "<style id=\"cf7dp-jquery-ui-theme\" scoped>@import url('" . ContactForm7Datepicker::get_theme_uri() . "')</style>";
        ?>
        </div>
			<form action="">
				<label for="jquery-ui-theme"><?php 
        _e('Theme');
        ?>
</label><br />
				<?php 
        self::themes_dropdown();
        ?>
				<input type="submit" id="save-ui-theme" value="<?php 
        _e('Save');
        ?>
" class="button" />
			</form>
		<div class="clear"></div>

		<?php 
        $dp = new CF7_DateTimePicker('datetime', '#preview');
        echo '<script>jQuery(function($){ ' . $dp->generate_code(true) . ' });</script>';
    }
コード例 #3
0
ファイル: admin.php プロジェクト: aim-web-projects/kobe-chuoh
    public static function theme_metabox()
    {
        ?>

		<div id="preview" style="float: left; margin: 0 10px 0 0"></div>
			<form action="">
				<label for="jquery-ui-theme"><?php 
        _e('Theme');
        ?>
</label><br />
				<?php 
        self::themes_dropdown();
        ?>
				<input type="submit" id="save-ui-theme" value="<?php 
        _e('Save');
        ?>
" class="button" />
			</form>
		<div class="clear"></div>

		<?php 
        $dp = new CF7_DateTimePicker('datetime', '#preview');
        echo '<script>jQuery(function($){ ' . $dp->generate_code(true) . ' });</script>';
    }
コード例 #4
0
 public static function enqueue_js()
 {
     $regional = CF7_DateTimePicker::get_regional_match();
     $proto = is_ssl() ? 'https' : 'http';
     if (!empty($regional)) {
         wp_enqueue_script('jquery-ui-' . $regional, $proto . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::JQUERYUI_VERSION . '/i18n/jquery.ui.datepicker-' . $regional . '.min.js', array('jquery-ui-datepicker'), self::JQUERYUI_VERSION, true);
         wp_enqueue_script('jquery-ui-timepicker-' . $regional, plugins_url('js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-' . $regional . '.js', __FILE__), array('jquery-ui-timepicker'), '', true);
     }
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_script('jquery-ui-timepicker', plugins_url('js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js', __FILE__), array('jquery-ui-datepicker'), '', true);
     wp_enqueue_script('jquery-ui-slider');
     wp_enqueue_script('jquery-ui-slider-access', plugins_url('js/jquery-ui-sliderAccess.js', __FILE__), array('jquery-ui-slider', 'jquery-ui-button'), '', true);
     wp_register_script('jquery-ui-effect-core', plugins_url('js/jquery.ui.effect.min.js', __FILE__), array('jquery-ui-datepicker'), self::JQUERYUI_VERSION, true);
     foreach (CF7_DateTimePicker::$effects as $effect) {
         wp_register_script('jquery-ui-effect-' . $effect, plugins_url('js/jquery.ui.effect-' . $effect . '.min.js', __FILE__), array('jquery-ui-effect-core'), self::JQUERYUI_VERSION, true);
     }
 }