| 1 |
<?php |
| 2 |
/* |
| 3 |
* Followig class handling file input control and their |
| 4 |
* dependencies. Do not make changes in code |
| 5 |
* Create on: 9 November, 2013 |
| 6 |
*/ |
| 7 |
|
| 8 |
class NM_File_WPC extends WPComment_Inputs{ |
| 9 |
|
| 10 |
/* |
| 11 |
* input control settings |
| 12 |
*/ |
| 13 |
var $title, $desc, $settings; |
| 14 |
|
| 15 |
|
| 16 |
/* |
| 17 |
* this var is pouplated with current plugin meta |
| 18 |
*/ |
| 19 |
var $plugin_meta; |
| 20 |
|
| 21 |
function __construct(){ |
| 22 |
|
| 23 |
[]; |
| 24 |
|
| 25 |
$this -> title = __ ( 'File Input', "wpcomment" ); |
| 26 |
$this -> desc = __ ( 'regular file input', "wpcomment" ); |
| 27 |
$this -> icon = __ ( '<i class="fa fa-file" aria-hidden="true"></i>', 'wp-comment-fields' ); |
| 28 |
$this -> settings = self::get_settings(); |
| 29 |
|
| 30 |
} |
| 31 |
|
| 32 |
private function get_settings(){ |
| 33 |
|
| 34 |
$input_meta = array ( |
| 35 |
'title' => array ( |
| 36 |
'type' => 'text', |
| 37 |
'title' => __ ( 'Title', "wpcomment" ), |
| 38 |
'desc' => __ ( 'It will be shown as field label', "wpcomment" ) |
| 39 |
), |
| 40 |
'data_name' => array ( |
| 41 |
'type' => 'text', |
| 42 |
'title' => __ ( 'Data name', "wpcomment" ), |
| 43 |
'desc' => __ ( 'REQUIRED: The identification name of this field, that you can insert into body email configuration. Note:Use only lowercase characters and underscores.', "wpcomment" ) |
| 44 |
), |
| 45 |
'description' => array ( |
| 46 |
'type' => 'textarea', |
| 47 |
'title' => __ ( 'Description', "wpcomment" ), |
| 48 |
'desc' => __ ( 'Small description, it will be display near name title.', "wpcomment" ) |
| 49 |
), |
| 50 |
'error_message' => array ( |
| 51 |
'type' => 'text', |
| 52 |
'title' => __ ( 'Error message', "wpcomment" ), |
| 53 |
'desc' => __ ( 'Insert the error message for validation.', "wpcomment" ) |
| 54 |
), |
| 55 |
'file_cost' => array ( |
| 56 |
'type' => 'text', |
| 57 |
'title' => __ ( 'File cost/price', "wpcomment" ), |
| 58 |
'desc' => __ ( 'This will be added into cart', "wpcomment" ), |
| 59 |
'col_classes' => array('col-md-3','col-sm-12') |
| 60 |
), |
| 61 |
'class' => array ( |
| 62 |
'type' => 'text', |
| 63 |
'title' => __ ( 'Class', "wpcomment" ), |
| 64 |
'desc' => __ ( 'Insert an additional class(es) (separateb by comma) for more personalization.', "wpcomment" ), |
| 65 |
'col_classes' => array('col-md-3','col-sm-12') |
| 66 |
), |
| 67 |
'width' => array ( |
| 68 |
'type' => 'select', |
| 69 |
'title' => __ ( 'Width', 'wp-comment-fields' ), |
| 70 |
'desc' => __ ( 'Select width column.', "wpcomment"), |
| 71 |
'options' => wpcomment_get_input_cols(), |
| 72 |
'default' => 12, |
| 73 |
'col_classes' => array('col-md-3','col-sm-12') |
| 74 |
), |
| 75 |
'button_label_select' => array ( |
| 76 |
'type' => 'text', |
| 77 |
'title' => __ ( 'Button label (select files)', "wpcomment" ), |
| 78 |
'desc' => __ ( 'Type button label e.g: Select Photos', "wpcomment" ), |
| 79 |
'col_classes' => array('col-md-3','col-sm-12') |
| 80 |
), |
| 81 |
'button_class' => array ( |
| 82 |
'type' => 'text', |
| 83 |
'title' => __ ( 'Button class', "wpcomment" ), |
| 84 |
'desc' => __ ( 'Type class for both (select, upload) buttons', "wpcomment" ), |
| 85 |
'col_classes' => array('col-md-3','col-sm-12') |
| 86 |
), |
| 87 |
'files_allowed' => array ( |
| 88 |
'type' => 'text', |
| 89 |
'title' => __ ( 'Files allowed', "wpcomment" ), |
| 90 |
'desc' => __ ( 'Type number of files allowed per upload by user, e.g: 3', "wpcomment" ), |
| 91 |
'col_classes' => array('col-md-3','col-sm-12') |
| 92 |
), |
| 93 |
'file_types' => array ( |
| 94 |
'type' => 'text', |
| 95 |
'title' => __ ( 'File types', "wpcomment" ), |
| 96 |
'desc' => __ ( 'File types allowed seperated by comma, e.g: jpg,pdf,zip', "wpcomment" ), |
| 97 |
'default' => 'jpg,pdf,zip', |
| 98 |
'col_classes' => array('col-md-3','col-sm-12') |
| 99 |
), |
| 100 |
'file_size' => array ( |
| 101 |
'type' => 'text', |
| 102 |
'title' => __ ( 'File size', "wpcomment" ), |
| 103 |
'desc' => __ ( 'Type size with units in kb|mb per file uploaded by user, e.g: 3mb', "wpcomment" ), |
| 104 |
'default' => '1mb', |
| 105 |
'col_classes' => array('col-md-3','col-sm-12') |
| 106 |
), |
| 107 |
'min_img_h' => array ( |
| 108 |
'type' => 'text', |
| 109 |
'title' => __ ( 'Min Height', "wpcomment" ), |
| 110 |
'desc' => __ ( 'Provide minimum image height.', "wpcomment" ), |
| 111 |
'col_classes' => array('col-md-3','col-sm-12') |
| 112 |
), |
| 113 |
'max_img_h' => array ( |
| 114 |
'type' => 'text', |
| 115 |
'title' => __ ( 'Max Height', "wpcomment" ), |
| 116 |
'desc' => __ ( 'Provide maximum image height.', "wpcomment" ), |
| 117 |
'col_classes' => array('col-md-3','col-sm-12') |
| 118 |
), |
| 119 |
'min_img_w' => array ( |
| 120 |
'type' => 'text', |
| 121 |
'title' => __ ( 'Min Width', "wpcomment" ), |
| 122 |
'desc' => __ ( 'Provide minimum image width.', "wpcomment" ), |
| 123 |
'col_classes' => array('col-md-3','col-sm-12') |
| 124 |
), |
| 125 |
'max_img_w' => array ( |
| 126 |
'type' => 'text', |
| 127 |
'title' => __ ( 'Max Width', "wpcomment" ), |
| 128 |
'desc' => __ ( 'Provide maximum image width.', "wpcomment" ), |
| 129 |
'col_classes' => array('col-md-3','col-sm-12') |
| 130 |
), |
| 131 |
'img_dimension_error' => array ( |
| 132 |
'type' => 'text', |
| 133 |
'title' => __ ( 'Error Message', "wpcomment" ), |
| 134 |
'desc' => __ ( 'Provide image dimension error message. It will display on frontend while uploading the image.', "wpcomment" ), |
| 135 |
'col_classes' => array('col-md-3','col-sm-12') |
| 136 |
), |
| 137 |
'visibility' => array ( |
| 138 |
'type' => 'select', |
| 139 |
'title' => __ ( 'Visibility', 'wp-comment-fields' ), |
| 140 |
'desc' => __ ( 'Set field visibility based on user.', "wpcomment"), |
| 141 |
'options' => wpcomment_field_visibility_options(), |
| 142 |
'default' => 'everyone', |
| 143 |
), |
| 144 |
'visibility_role' => array ( |
| 145 |
'type' => 'text', |
| 146 |
'title' => __ ( 'User Roles', 'wp-comment-fields' ), |
| 147 |
'desc' => __ ( 'Role separated by comma.', "wpcomment"), |
| 148 |
'hidden' => true, |
| 149 |
), |
| 150 |
'desc_tooltip' => array ( |
| 151 |
'type' => 'checkbox', |
| 152 |
'title' => __ ( 'Show tooltip (PRO)', 'wp-comment-fields' ), |
| 153 |
'desc' => __ ( 'Show Description in Tooltip with Help Icon', 'wp-comment-fields' ), |
| 154 |
'col_classes' => array('col-md-3','col-sm-12') |
| 155 |
), |
| 156 |
'required' => array ( |
| 157 |
'type' => 'checkbox', |
| 158 |
'title' => __ ( 'Required', "wpcomment" ), |
| 159 |
'desc' => __ ( 'Select this if it must be required.', "wpcomment" ), |
| 160 |
'col_classes' => array('col-md-3','col-sm-12') |
| 161 |
), |
| 162 |
'onetime' => array ( |
| 163 |
'type' => 'checkbox', |
| 164 |
'title' => __ ( 'Fixed Fee', "wpcomment" ), |
| 165 |
'desc' => __ ( 'Add one time fee to cart total.', "wpcomment" ), |
| 166 |
'col_classes' => array('col-md-3','col-sm-12') |
| 167 |
), |
| 168 |
'logic' => array ( |
| 169 |
'type' => 'checkbox', |
| 170 |
'title' => __ ( 'Enable Conditions', "wpcomment" ), |
| 171 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', "wpcomment" ) |
| 172 |
), |
| 173 |
'conditions' => array ( |
| 174 |
'type' => 'html-conditions', |
| 175 |
'title' => __ ( 'Conditions', "wpcomment" ), |
| 176 |
'desc' => __ ( 'Tick it to turn conditional logic to work below', "wpcomment" ) |
| 177 |
), |
| 178 |
); |
| 179 |
|
| 180 |
$type = 'file'; |
| 181 |
return apply_filters("poom_{$type}_input_setting", $input_meta, $this); |
| 182 |
} |
| 183 |
} |