| 1 |
<?php |
| 2 |
/* |
| 3 |
* Followig class handling date input control and their |
| 4 |
* dependencies. Do not make changes in code |
| 5 |
* Create on: 9 November, 2013 |
| 6 |
*/ |
| 7 |
|
| 8 |
class NM_Date_WPC extends WPComment_Inputs{ |
| 9 |
|
| 10 |
/* |
| 11 |
* input control settings |
| 12 |
*/ |
| 13 |
var $title, $desc, $settings; |
| 14 |
|
| 15 |
/* |
| 16 |
* this var is pouplated with current plugin meta |
| 17 |
*/ |
| 18 |
var $plugin_meta; |
| 19 |
|
| 20 |
function __construct(){ |
| 21 |
|
| 22 |
[]; |
| 23 |
|
| 24 |
$this -> title = __ ( 'Date Input', 'wp-comment-fields' ); |
| 25 |
$this -> desc = __ ( 'regular date input', 'wp-comment-fields' ); |
| 26 |
$this -> icon = __ ( '<i class="fa fa-calendar" aria-hidden="true"></i>', 'wp-comment-fields' ); |
| 27 |
$this -> settings = self::get_settings(); |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
private function get_settings(){ |
| 32 |
|
| 33 |
$input_meta = array ( |
| 34 |
'title' => array ( |
| 35 |
'type' => 'text', |
| 36 |
'title' => __ ( 'Title', 'wp-comment-fields' ), |
| 37 |
'desc' => __ ( 'It will be shown as field label', 'wp-comment-fields' ) |
| 38 |
), |
| 39 |
'data_name' => array ( |
| 40 |
'type' => 'text', |
| 41 |
'title' => __ ( 'Data name', 'wp-comment-fields' ), |
| 42 |
'desc' => __ ( 'REQUIRED: The identification name of this field, that you can insert into body email configuration. Note:Use only lowercase characters and underscores.', 'wp-comment-fields' ) |
| 43 |
), |
| 44 |
'description' => array ( |
| 45 |
'type' => 'textarea', |
| 46 |
'title' => __ ( 'Description', 'wp-comment-fields' ), |
| 47 |
'desc' => __ ( 'Small description, it will be display near name title.', 'wp-comment-fields' ) |
| 48 |
), |
| 49 |
'placeholder' => array ( |
| 50 |
'type' => 'text', |
| 51 |
'title' => __ ( 'Placeholder', 'wp-comment-fields' ), |
| 52 |
'desc' => __ ( 'Optional.', 'wp-comment-fields' ) |
| 53 |
), |
| 54 |
'error_message' => array ( |
| 55 |
'type' => 'text', |
| 56 |
'title' => __ ( 'Error message', 'wp-comment-fields' ), |
| 57 |
'desc' => __ ( 'Insert the error message for validation.', 'wp-comment-fields' ) |
| 58 |
), |
| 59 |
'class' => array ( |
| 60 |
'type' => 'text', |
| 61 |
'title' => __ ( 'Class', 'wp-comment-fields' ), |
| 62 |
'desc' => __ ( 'Insert an additional class(es) (separateb by comma) for more personalization.', 'wp-comment-fields' ), |
| 63 |
'col_classes' => array('col-md-3','col-sm-12') |
| 64 |
), |
| 65 |
'default_value' => array ( |
| 66 |
'type' => 'text', |
| 67 |
'title' => __ ( 'Default Date', 'wp-comment-fields' ), |
| 68 |
'desc' => __ ( 'User format YYYY-MM-DD e.g: 2017-05-25.', 'wp-comment-fields' ), |
| 69 |
'col_classes' => array('col-md-3','col-sm-12') |
| 70 |
), |
| 71 |
'date_formats' => array ( |
| 72 |
'type' => 'select', |
| 73 |
'title' => __ ( 'Date formats', 'wp-comment-fields' ), |
| 74 |
'desc' => __ ( 'Select date format. (if jQuery enabled below)', 'wp-comment-fields' ), |
| 75 |
'options' => wpcomment_get_date_formats(), |
| 76 |
'col_classes' => array('col-md-3','col-sm-12') |
| 77 |
), |
| 78 |
'width' => array ( |
| 79 |
'type' => 'select', |
| 80 |
'title' => __ ( 'Width', 'wp-comment-fields' ), |
| 81 |
'desc' => __ ( 'Select width column.', "wpcomment"), |
| 82 |
'options' => wpcomment_get_input_cols(), |
| 83 |
'default' => 12, |
| 84 |
'col_classes' => array('col-md-3','col-sm-12') |
| 85 |
), |
| 86 |
'max_date' => array ( |
| 87 |
'type' => 'text', |
| 88 |
'title' => __ ( 'Max Date', 'wp-comment-fields' ), |
| 89 |
'desc' => __ ( 'Max. date, enter a date or use shortcode (example: +10d)', 'wp-comment-fields' ), |
| 90 |
'link' => __ ( '<a target="_blank" href="http://api.jqueryui.com/datepicker/#option-yearRange">Example</a>', 'wp-comment-fields' ), |
| 91 |
'col_classes' => array('col-md-3','col-sm-12') |
| 92 |
), |
| 93 |
'year_range' => array ( |
| 94 |
'type' => 'text', |
| 95 |
'title' => __ ( 'Year Range', 'wp-comment-fields' ), |
| 96 |
'desc' => __ ( 'e.g: 1950:2016. (if jQuery enabled below) Set start/end year like used example.', 'wp-comment-fields' ), |
| 97 |
'link' => __ ( '<a target="_blank" href="http://api.jqueryui.com/datepicker/#option-yearRange">Example</a>', 'wp-comment-fields' ), |
| 98 |
'col_classes' => array('col-md-3','col-sm-12') |
| 99 |
), |
| 100 |
'visibility' => array ( |
| 101 |
'type' => 'select', |
| 102 |
'title' => __ ( 'Visibility', 'wp-comment-fields' ), |
| 103 |
'desc' => __ ( 'Set field visibility based on user.', "wpcomment"), |
| 104 |
'options' => wpcomment_field_visibility_options(), |
| 105 |
'default' => 'everyone', |
| 106 |
), |
| 107 |
'visibility_role' => array ( |
| 108 |
'type' => 'text', |
| 109 |
'title' => __ ( 'User Roles', 'wp-comment-fields' ), |
| 110 |
'desc' => __ ( 'Role separated by comma.', "wpcomment"), |
| 111 |
'hidden' => true, |
| 112 |
), |
| 113 |
'jquery_dp' => array ( |
| 114 |
'type' => 'checkbox', |
| 115 |
'title' => __ ( 'jQuery Datepicker', 'wp-comment-fields' ), |
| 116 |
'desc' => __ ( 'It will load jQuery fancy datepicker.', 'wp-comment-fields' ), |
| 117 |
'col_classes' => array('col-md-3','col-sm-12') |
| 118 |
), |
| 119 |
'no_weekends' => array ( |
| 120 |
'type' => 'checkbox', |
| 121 |
'title' => __ ( 'Disable Weekends', 'wp-comment-fields' ), |
| 122 |
'desc' => __ ( 'It will disable Weekends.', 'wp-comment-fields' ), |
| 123 |
'col_classes' => array('col-md-3','col-sm-12') |
| 124 |
), |
| 125 |
'past_dates' => array ( |
| 126 |
'type' => 'checkbox', |
| 127 |
'title' => __ ( 'Disable Past Dates', 'wp-comment-fields' ), |
| 128 |
'desc' => __ ( 'Disable dates.', 'wp-comment-fields' ), |
| 129 |
'col_classes' => array('col-md-3','col-sm-12') |
| 130 |
), |
| 131 |
'desc_tooltip' => array ( |
| 132 |
'type' => 'checkbox', |
| 133 |
'title' => __ ( 'Show tooltip (PRO)', 'wp-comment-fields' ), |
| 134 |
'desc' => __ ( 'Show Description in Tooltip with Help Icon', 'wp-comment-fields' ), |
| 135 |
'col_classes' => array('col-md-3','col-sm-12') |
| 136 |
), |
| 137 |
'required' => array ( |
| 138 |
'type' => 'checkbox', |
| 139 |
'title' => __ ( 'Required', 'wp-comment-fields' ), |
| 140 |
'desc' => __ ( 'Select this if it must be required.', 'wp-comment-fields' ), |
| 141 |
'col_classes' => array('col-md-3','col-sm-12') |
| 142 |
), |
| 143 |
'logic' => array ( |
| 144 |
'type' => 'checkbox', |
| 145 |
'title' => __ ( 'Enable Conditions', 'wp-comment-fields' ), |
| 146 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', 'wp-comment-fields' ) |
| 147 |
), |
| 148 |
'conditions' => array ( |
| 149 |
'type' => 'html-conditions', |
| 150 |
'title' => __ ( 'Conditions', 'wp-comment-fields' ), |
| 151 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', 'wp-comment-fields' ) |
| 152 |
), |
| 153 |
); |
| 154 |
|
| 155 |
$type = 'date'; |
| 156 |
return apply_filters("poom_{$type}_input_setting", $input_meta, $this); |
| 157 |
} |
| 158 |
} |