PluginProbe
Comments Extra Fields For Post,Pages and CPT / trunk
Comments Extra Fields For Post,Pages and CPT vtrunk
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.2 2.3 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 5.0 5.1 5.2
wp-comment-fields / classes / inputs / input.text.php

input.text.php in Comments Extra Fields For Post,Pages and CPT trunk, at classes/inputs/input.text.php

147 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Followig class handling text input control and their
4 * dependencies. Do not make changes in code
5 * Create on: 9 November, 2013
6 */
7
8 class NM_Text_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 $this -> title = __ ( 'Text Input', 'wp-comment-fields' );
23 $this -> desc = __ ( 'regular text input', 'wp-comment-fields' );
24 $this -> icon = __ ( '<i class="fa fa-pencil-square-o" aria-hidden="true"></i>', 'wp-comment-fields' );
25 $this -> settings = self::get_settings();
26
27 }
28
29 private function get_settings(){
30
31 $regex_help_url = 'https://github.com/RobinHerbots/Inputmask#any-option-can-also-be-passed-through-the-use-of-a-data-attribute-use-data-inputmask-the-name-of-the-optionvalue';
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' => __ ( 'Optionally placeholder.', '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 'maxlength' => array (
60 'type' => 'text',
61 'title' => __ ( 'Max. Length', 'wp-comment-fields' ),
62 'desc' => __ ( 'Max. characters allowed, leave blank for default', 'wp-comment-fields' ),
63 'col_classes' => array('col-md-3','col-sm-12')
64 ),
65
66 'minlength' => array (
67 'type' => 'text',
68 'title' => __ ( 'Min. Length', 'wp-comment-fields' ),
69 'desc' => __ ( 'Min. characters allowed, leave blank for default', 'wp-comment-fields' ),
70 'col_classes' => array('col-md-3','col-sm-12')
71 ),
72 'default_value' => array (
73 'type' => 'text',
74 'title' => __ ( 'Set default value', 'wp-comment-fields' ),
75 'desc' => __ ( 'Pre-defined value for text input', 'wp-comment-fields' ),
76 'col_classes' => array('col-md-3','col-sm-12')
77 ),
78 'class' => array (
79 'type' => 'text',
80 'title' => __ ( 'Class', 'wp-comment-fields' ),
81 'desc' => __ ( 'Insert an additional class(es) (separateb by comma) for more personalization.', 'wp-comment-fields' ),
82 'col_classes' => array('col-md-3','col-sm-12')
83 ),
84 // 'input_mask' => array (
85 // 'type' => 'text',
86 // 'title' => __ ( 'Input Masking', 'wp-comment-fields' ),
87 // 'desc' => __ ( 'Click options to see all Masking Options', 'wp-comment-fields' ),
88 // 'link' => __ ( '<a href="https://github.com/RobinHerbots/Inputmask" target="_blank">Options</a>', 'wp-comment-fields' ),
89 // 'col_classes' => array('col-md-3','col-sm-12')
90 // ),
91 'width' => array (
92 'type' => 'select',
93 'title' => __ ( 'Width', 'wp-comment-fields' ),
94 'desc' => __ ( 'Type field width in % e.g: 50%', "wpcomment"),
95 'options' => wpcomment_get_input_cols(),
96 'default' => 12,
97 'col_classes' => array('col-md-3','col-sm-12')
98 ),
99 'visibility' => array (
100 'type' => 'select',
101 'title' => __ ( 'Visibility', 'wp-comment-fields' ),
102 'desc' => __ ( 'Set field visibility based on user.', "wpcomment"),
103 'options' => wpcomment_field_visibility_options(),
104 'default' => 'everyone',
105 'col_classes' => array('col-md-3','col-sm-12')
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 // 'use_regex' => array (
114 // 'type' => 'checkbox',
115 // 'title' => __ ( 'Use Regex Expresession', 'wp-comment-fields' ),
116 // 'link' => __ ( '<a target="_blank" href="'.esc_url($regex_help_url).'">See More</a>', 'wp-comment-fields' ),
117 // 'col_classes' => array('col-md-3','col-sm-12')
118 // ),
119 'desc_tooltip' => array (
120 'type' => 'checkbox',
121 'title' => __ ( 'Show tooltip (PRO)', 'wp-comment-fields' ),
122 'desc' => __ ( 'Show Description in Tooltip with Help Icon', 'wp-comment-fields' ),
123 'col_classes' => array('col-md-3','col-sm-12')
124 ),
125 'required' => array (
126 'type' => 'checkbox',
127 'title' => __ ( 'Required', 'wp-comment-fields' ),
128 'desc' => __ ( 'Select this if it must be required.', 'wp-comment-fields' ),
129 'col_classes' => array('col-md-3','col-sm-12')
130 ),
131 'logic' => array (
132 'type' => 'checkbox',
133 'title' => __ ( 'Enable Conditions', 'wp-comment-fields' ),
134 'desc' => __ ( 'Tick it to turn conditional logic to work below', 'wp-comment-fields' ),
135 ),
136 'conditions' => array (
137 'type' => 'html-conditions',
138 'title' => __ ( 'Conditions', 'wp-comment-fields' ),
139 'desc' => __ ( 'Tick it to turn conditional logic to work below', 'wp-comment-fields' )
140 ),
141
142 );
143
144 $type = 'text';
145 return apply_filters("poom_{$type}_input_setting", $input_meta, $this);
146 }
147 }