PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / trunk
Disable Admin Notices – Hide Dashboard Notifications vtrunk
1.4.5 trunk 1.0.0 1.0.2 1.0.3 1.0.5 1.0.6 1.1.1 1.1.3 1.1.4 1.2.0 1.2.2 1.2.3 1.2.4 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4
disable-admin-notices / libs / factory / forms / controls / datepicker-range.php
disable-admin-notices / libs / factory / forms / controls Last commit date
customs 1 year ago holders 1 year ago checkbox.php 1 year ago color-and-opacity.php 1 year ago color.php 1 year ago datepicker-range.php 1 year ago dropdown-and-colors.php 1 year ago dropdown.php 1 year ago font.php 1 year ago google-font.php 1 year ago gradient.php 1 year ago hidden.php 1 year ago index.php 3 years ago integer.php 1 year ago list.php 1 year ago multiple-textbox.php 1 year ago paddings-editor.php 1 year ago pattern.php 1 year ago radio-colors.php 1 year ago radio.php 1 year ago textarea.php 1 year ago textbox.php 1 year ago url.php 1 year ago wp-editor.php 1 year ago
datepicker-range.php
106 lines
1 <?php
2
3 /**
4 * Datepicker range control
5 *
6 * @author Alex Kovalev <alex.kovalevv@gmail.com>
7 * @copyright (c) 2018, Webcraftic Ltd
8 *
9 * Example:
10 * 'type' => 'datetimepicker-range',
11 * 'name' => 'facebook_start_date_filter',
12 * 'range_1' => array(
13 * 'format' => 'YYYY/MM/DD HH:mm',
14 * 'default' => date('Y/m/d H:i', strtotime('-1 week'))
15 * ),
16 * 'range_2' => array(
17 * 'format' => 'YYYY/MM/DD HH:mm',
18 * 'default' => date('Y/m/d H:i')
19 * ),
20 * 'title' => __('Выберите период', 'wpcr-scrapes'),
21 * 'hint' => __('Если Вкл., вы сможете установить настройки выбора записей за установленный период времени.', 'wpcr-scrapes')
22 *
23 * @package factory-forms
24 * @since 1.0.0
25 */
26
27 // Exit if accessed directly
28 if( !defined('ABSPATH') ) {
29 exit;
30 }
31
32 if( !class_exists('Wbcr_FactoryForms480_DatepickerRangeControl') ) {
33
34 class Wbcr_FactoryForms480_DatepickerRangeControl extends Wbcr_FactoryForms480_ComplexControl {
35
36 public $type = 'datetimepicker-range';
37
38 public function __construct($options, $form, $provider = null)
39 {
40 parent::__construct($options, $form, $provider);
41
42 if( !isset($options['range_1']) ) {
43 $options['range_1'] = array();
44 }
45
46 $options['range_1'] = array_merge(array(
47 'scope' => isset($options['scope'])
48 ? $options['scope']
49 : 'factory',
50 'name' => $this->options['name'] . '__range_1',
51 'format' => 'YYYY/MM/DD HH:mm',
52 'default' => date('Y/m/d H:i')
53 ), $options['range_1']);
54
55 if( !isset($options['range_2']) ) {
56 $options['range_2'] = array();
57 }
58
59 $options['range_2'] = array_merge(array(
60 'scope' => isset($options['scope'])
61 ? $options['scope']
62 : 'factory',
63 'name' => $this->options['name'] . '__range_2',
64 'format' => 'YYYY/MM/DD HH:mm',
65 'default' => date('Y/m/d H:i', strtotime("+1 month"))
66 ), $options['range_2']);
67
68 $this->range_1 = new Wbcr_FactoryForms480_TextboxControl($options['range_1'], $form, $provider);
69 $this->range_2 = new Wbcr_FactoryForms480_TextboxControl($options['range_2'], $form, $provider);
70 $this->inner_controls = array($this->range_1, $this->range_2);
71
72 foreach($this->inner_controls as $key => $control) {
73 $control->addCssClass('factory-datetimepicker-range-' . $key);
74 $control->addHtmlAttr('data-date-show-today-button', 'true');
75 $control->addHtmlAttr('data-date-show-clear', 'true');
76
77 $format = $control->getOption('format');
78
79 if( !empty($format) ) {
80 //'YYYY/MM/DD HH:mm'
81 $control->addHtmlAttr('data-date-format', $format);
82 }
83
84 $locale_parts = explode('_', get_locale());
85
86 $locale = isset($locale_parts[0])
87 ? $locale_parts[0]
88 : 'en';
89
90 $control->addHtmlAttr('data-date-locale', $locale);
91 }
92 }
93
94 public function render()
95 {
96 ?>
97 <div class='input-group date factory-datetimepicker-input-group' style="display:inline-block; width: 200px">
98 <?php $this->range_1->render(); ?>
99 </div>
100 <div class='input-group date factory-datetimepicker-input-group' style="display:inline-block; width: 200px">
101 <?php $this->range_2->render(); ?>
102 </div>
103 <?php
104 }
105 }
106 }