| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPPIZZA_MODULE_ORDERFORM_ORDERPAGE Class |
| 4 |
* |
| 5 |
* @package WPPIZZA |
| 6 |
* @subpackage WPPIZZA_MODULE_ORDERFORM_ORDERPAGE |
| 7 |
* @copyright Copyright (c) 2015, Oliver Bach |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 3.0 |
| 10 |
* |
| 11 |
*/ |
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/ |
| 13 |
|
| 14 |
|
| 15 |
/************************************************************************************************************************ |
| 16 |
* |
| 17 |
* |
| 18 |
* |
| 19 |
* |
| 20 |
* |
| 21 |
* |
| 22 |
************************************************************************************************************************/ |
| 23 |
class WPPIZZA_MODULE_ORDERFORM_ORDERPAGE{ |
| 24 |
|
| 25 |
private $settings_page = 'order_form';/* which admin subpage (identified there by this->class_key) are we adding this to */ |
| 26 |
private $section_key = 'order_form';/* must be unique */ |
| 27 |
|
| 28 |
|
| 29 |
function __construct() { |
| 30 |
/********************************************************** |
| 31 |
[add settings to admin] |
| 32 |
***********************************************************/ |
| 33 |
if(is_admin()){ |
| 34 |
/* add admin options settings page*/ |
| 35 |
add_filter('wppizza_filter_settings_sections_'.$this->settings_page.'', array($this, 'admin_options_settings'), 10, 5); |
| 36 |
/* add admin options settings page fields */ |
| 37 |
add_action('wppizza_admin_settings_section_fields_'.$this->settings_page.'', array($this, 'admin_options_fields_settings'), 10, 5); |
| 38 |
/**add default options **/ |
| 39 |
add_filter('wppizza_filter_setup_default_options', array( $this, 'options_default')); |
| 40 |
/**validate options**/ |
| 41 |
add_filter('wppizza_filter_options_validate', array( $this, 'options_validate'), 10, 2 ); |
| 42 |
} |
| 43 |
/********************************************************** |
| 44 |
[filter/actions depending on settings] |
| 45 |
***********************************************************/ |
| 46 |
} |
| 47 |
|
| 48 |
/******************************************************************************************************************************************************* |
| 49 |
* |
| 50 |
* |
| 51 |
* |
| 52 |
* [frontend filters] |
| 53 |
* |
| 54 |
* |
| 55 |
* |
| 56 |
********************************************************************************************************************************************************/ |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
/******************************************************************************************************************************************************* |
| 62 |
* |
| 63 |
* |
| 64 |
* |
| 65 |
* [add admin page options] |
| 66 |
* |
| 67 |
* |
| 68 |
* |
| 69 |
********************************************************************************************************************************************************/ |
| 70 |
|
| 71 |
/*------------------------------------------------------------------------------ |
| 72 |
# |
| 73 |
# |
| 74 |
# [settings page] |
| 75 |
# |
| 76 |
# |
| 77 |
------------------------------------------------------------------------------*/ |
| 78 |
|
| 79 |
/*------------------------------------------------------------------------------ |
| 80 |
# [settings section - setting page] |
| 81 |
# @since 3.0 |
| 82 |
# @return array() |
| 83 |
------------------------------------------------------------------------------*/ |
| 84 |
function admin_options_settings($settings, $sections, $fields, $inputs, $help){ |
| 85 |
|
| 86 |
/*sections*/ |
| 87 |
if($sections){ |
| 88 |
$settings['sections'][$this->section_key] = __('Order Page', 'wppizza-admin'); |
| 89 |
} |
| 90 |
/*fields*/ |
| 91 |
if($fields){ |
| 92 |
$field = 'order_form'; |
| 93 |
$settings['fields'][$this->section_key][$field] = array('' , array( |
| 94 |
'value_key'=>$field, |
| 95 |
'option_key'=>$this->settings_page, |
| 96 |
'label'=>'', |
| 97 |
'description'=>array() |
| 98 |
)); |
| 99 |
} |
| 100 |
/*help*/ |
| 101 |
if($help){ |
| 102 |
$settings['help'][$this->section_key][] = array( |
| 103 |
'label'=>__('Order Page - Formfields', 'wppizza-admin'), |
| 104 |
'description'=>array( |
| 105 |
__('Set the form fields you would like to show when a customer places an order', 'wppizza-admin'), |
| 106 |
__('You can add html to the label if using type "checkbox".', 'wppizza-admin'), |
| 107 |
__('For "selects", the "placeholder" field can be used to replace the default "please select" .This will also be used as error message if a selection is required.', 'wppizza-admin'), |
| 108 |
__('"Checkboxes" and "radio" inputs will furthermore use the "placeholder" as title attribute for the surrounding html element.', 'wppizza-admin'), |
| 109 |
__('If you want to omit a field from the order form when it is not required, enable "Omit if optional".', 'wppizza-admin'), |
| 110 |
__('Note: only the email can and should be used to send email notifications of the order to the customer (if enabled).', 'wppizza-admin'), |
| 111 |
__('Additionally, if you want to offer customers to be able to register a new account on the order page - provided they are not logged in already - the email field must be set to be "enabled" and "required". Additionally "Anyone can register" in "Settings->General" has to be enabled too.', 'wppizza-admin') |
| 112 |
) |
| 113 |
); |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
return $settings; |
| 118 |
} |
| 119 |
/*------------------------------------------------------------------------------ |
| 120 |
# [output option fields - setting page] |
| 121 |
# @since 3.0 |
| 122 |
# @return array() |
| 123 |
------------------------------------------------------------------------------*/ |
| 124 |
function admin_options_fields_settings($wppizza_options, $options_key, $field, $label, $description){ |
| 125 |
|
| 126 |
if($field=='order_form'){ |
| 127 |
|
| 128 |
$rules_available = $this->get_validation_rules(); |
| 129 |
|
| 130 |
$input_fields = apply_filters('wppizza_filter_register_orderform_formfields',$wppizza_options[$options_key]); |
| 131 |
|
| 132 |
/**sort by sort**/ |
| 133 |
asort($input_fields); |
| 134 |
|
| 135 |
echo"<table id='wppizza_admin_table_".$options_key."' class='wppizza_admin_table'>"; |
| 136 |
/*header*/ |
| 137 |
echo"<thead>"; |
| 138 |
echo"<tr>"; |
| 139 |
echo"<th>".__('Enabled', 'wppizza-admin')."</th>"; |
| 140 |
echo"<th>".__('Sort', 'wppizza-admin')."</th>"; |
| 141 |
echo"<th>".__('Label', 'wppizza-admin')." /<br />".__('Placeholder', 'wppizza-admin')."</th>"; |
| 142 |
echo"<th>".__('Required:', 'wppizza-admin')."</th>"; |
| 143 |
echo"<th>".__('Prefill<br />[if known]', 'wppizza-admin')."</th>"; |
| 144 |
echo"<th>".__('Use when<br />Registering ?', 'wppizza-admin')."</th>"; |
| 145 |
echo"<th>".__('add to email<br />subject line ?', 'wppizza-admin')."</th>"; |
| 146 |
echo"<th>".__('Type', 'wppizza-admin')." /<br />".__('Validation', 'wppizza-admin')."</th>"; |
| 147 |
echo"</tr>"; |
| 148 |
echo"</thead>"; |
| 149 |
|
| 150 |
/*each field*/ |
| 151 |
echo"<tbody>"; |
| 152 |
foreach($input_fields as $k=>$v){ |
| 153 |
/** |
| 154 |
set some conditionals according to input |
| 155 |
**/ |
| 156 |
|
| 157 |
$attr = array(); |
| 158 |
$attr['enabled'] = true; |
| 159 |
$attr['sort'] = true; |
| 160 |
$attr['label'] = true; |
| 161 |
$attr['placeholder'] = true; |
| 162 |
$attr['required'] = true; |
| 163 |
$attr['required_on_pickup'] = true; |
| 164 |
$attr['omit_if_optional'] = true; |
| 165 |
$attr['prefill'] = true; |
| 166 |
$attr['onregister'] = true; |
| 167 |
$attr['add_to_subject_line'] = true; |
| 168 |
$attr['validation_rules'] = true; |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
/* |
| 173 |
allow filtering of attributed by key/type |
| 174 |
*/ |
| 175 |
$attr = apply_filters('wppizza_filter_register_orderform_formfields_column_disabled_'.$k.'',$attr, $v['type']); |
| 176 |
|
| 177 |
|
| 178 |
if($v['key']=='cemail'){ |
| 179 |
$attr['onregister'] = false; |
| 180 |
$attr['fixedType'] = 'email'; |
| 181 |
$attr['validation_rules'] = false; |
| 182 |
} |
| 183 |
if($v['key']=='ctips'){ |
| 184 |
$attr['onregister'] = false; |
| 185 |
$attr['prefill'] = false; |
| 186 |
$attr['fixedType'] = 'tips'; |
| 187 |
$attr['validation_rules'] = false; |
| 188 |
$attr['add_to_subject_line'] = false; |
| 189 |
$attr['omit_if_optional'] = false;//for the time being lets not use it for tips |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
/**each option in field**/ |
| 194 |
echo"<tr class='wppizza_".$v['key']."'>"; |
| 195 |
|
| 196 |
/*enabled - label for mobile*/ |
| 197 |
echo"<td class='".WPPIZZA_SLUG."_tr_label_mobile'>"; |
| 198 |
echo"".$v['lbl'].""; |
| 199 |
echo"</td>"; |
| 200 |
|
| 201 |
/*enabled*/ |
| 202 |
echo"<td>"; |
| 203 |
if(isset($attr['fixedEnabled'])){ |
| 204 |
echo "".$attr['fixedEnabled'].""; |
| 205 |
}else{ |
| 206 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Enabled', 'wppizza-admin')."</span>"; |
| 207 |
echo"<button class='button ".WPPIZZA_SLUG."-button' title='ID : ".$v['key']."'><input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][enabled]' type='checkbox' ". checked($v['enabled'],true,false)." value='1' /></button>"; |
| 208 |
} |
| 209 |
echo"</td>"; |
| 210 |
|
| 211 |
|
| 212 |
/*sort*/ |
| 213 |
echo"<td>"; |
| 214 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Sort', 'wppizza-admin')."</span>"; |
| 215 |
if($attr['sort']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][sort]' size='1' type='text' value='".esc_html($v['sort'])."' />";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 216 |
echo"</td>"; |
| 217 |
|
| 218 |
|
| 219 |
/*label / placeholder*/ |
| 220 |
echo"<td>"; |
| 221 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Label / Placeholder', 'wppizza-admin')."</span>"; |
| 222 |
if($attr['label']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][lbl]' size='15' type='text' value='".esc_html($v['lbl'])."' placeholder='".esc_html(__('Label', 'wppizza-admin'))."' />";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 223 |
if($attr['placeholder']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][placeholder]' size='15' type='text' value='".esc_html($v['placeholder'])."' placeholder='".esc_html(__('Placeholder', 'wppizza-admin'))."' />";} |
| 224 |
echo"</td>"; |
| 225 |
|
| 226 |
|
| 227 |
/*required - delivery / pickup */ |
| 228 |
echo"<td>"; |
| 229 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Required', 'wppizza-admin')."</span>"; |
| 230 |
|
| 231 |
/* required delivery */ |
| 232 |
if($attr['required']){echo"<label><input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][required]' type='checkbox' ". checked($v['required'],true,false)." value='1' />".__('On Delivery', 'wppizza-admin')."</label>";}else{echo"".__('N/A', 'wppizza-admin')."<br />";} |
| 233 |
|
| 234 |
/* required pickup */ |
| 235 |
if($attr['required_on_pickup']){echo"<label><input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][required_on_pickup]' type='checkbox' ". checked($v['required_on_pickup'],true,false)." value='1' />".__('On Pickup', 'wppizza-admin')."</label>";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 236 |
|
| 237 |
/* omit if optional */ |
| 238 |
if(!empty($attr['omit_if_optional'])){echo"<label><input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][omit_if_optional]' type='checkbox' ". checked(!empty($v['omit_if_optional']),true,false)." value='1' />".__('Omit if optional', 'wppizza-admin')."</label>";}else{echo"";} |
| 239 |
echo"</td>"; |
| 240 |
|
| 241 |
|
| 242 |
/*prefill*/ |
| 243 |
echo"<td>"; |
| 244 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Prefill', 'wppizza-admin')."</span>"; |
| 245 |
if($attr['prefill']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][prefill]' type='checkbox' ". checked($v['prefill'],true,false)." value='1' />";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 246 |
echo"</td>"; |
| 247 |
|
| 248 |
|
| 249 |
/*add to registration*/ |
| 250 |
echo"<td>"; |
| 251 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('On register', 'wppizza-admin')."</span>"; |
| 252 |
if($attr['onregister']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][onregister]' type='checkbox' ". checked($v['onregister'],true,false)." value='1' />";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 253 |
echo"</td>"; |
| 254 |
|
| 255 |
|
| 256 |
/*add to email subject line*/ |
| 257 |
echo"<td>"; |
| 258 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('in subject line', 'wppizza-admin')."</span>"; |
| 259 |
if($attr['add_to_subject_line']){echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][add_to_subject_line]' type='checkbox' ". checked($v['add_to_subject_line'],true,false)." value='1' />";}else{echo"".__('N/A', 'wppizza-admin')."";} |
| 260 |
echo"</td>"; |
| 261 |
|
| 262 |
|
| 263 |
/*formfield type*/ |
| 264 |
echo"<td>"; |
| 265 |
echo"<span class='".WPPIZZA_SLUG."_td_label_mobile'>".__('Type / Validation', 'wppizza-admin')."</span>"; |
| 266 |
/**non editable just show label and use hidden input**/ |
| 267 |
if(isset($attr['fixedType'])){ |
| 268 |
echo "".$attr['fixedType'].""; |
| 269 |
echo "<input type='hidden' name='".WPPIZZA_SLUG."[".$options_key."][".$k."][type]' value='".esc_html($v['type'])."'/>"; |
| 270 |
}else{ |
| 271 |
echo "<select id='".WPPIZZA_SLUG."_".$options_key."_type_".$k."' class='".WPPIZZA_SLUG."_".$options_key."_type' name='".WPPIZZA_SLUG."[".$options_key."][".$k."][type]' />"; |
| 272 |
echo'<option value="text" '.selected($v['type'],"text",false).'>text</option>'; |
| 273 |
echo'<option value="email" '.selected($v['type'],"email",false).'>email</option>'; |
| 274 |
echo'<option value="textarea" '.selected($v['type'],"textarea",false).'>textarea</option>'; |
| 275 |
echo'<option value="select" '.selected($v['type'],"select",false).'>select</option>'; |
| 276 |
echo'<option value="radio" '.selected($v['type'],"radio",false).'>radio</option>'; |
| 277 |
echo'<option value="checkbox" '.selected($v['type'],"checkbox",false).'>checkbox</option>'; |
| 278 |
echo'<option value="multicheckbox" '.selected($v['type'],"multicheckbox",false).'>multicheckbox</option>'; |
| 279 |
echo "</select>"; |
| 280 |
} |
| 281 |
|
| 282 |
/**if select, add input field**/ |
| 283 |
/*conditional defaults*/ |
| 284 |
$display=' style="display:none"'; |
| 285 |
$val=''; |
| 286 |
/**select*/ |
| 287 |
if($v['type']=='select' || $v['type']=='radio' || $v['type']=='multicheckbox' ){ |
| 288 |
$display=''; |
| 289 |
$val=''.implode(",",$v['value']).''; |
| 290 |
} |
| 291 |
|
| 292 |
echo "<span class='".WPPIZZA_SLUG."_".$options_key."_select' ".$display.">"; |
| 293 |
echo "<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][value]' type='text' value='".esc_html($val)."' />"; |
| 294 |
echo "</span>"; |
| 295 |
echo "<span class='".WPPIZZA_SLUG."_".$options_key."_select' ".$display.">"; |
| 296 |
echo "<span class='description'>".__('separate options with comma', 'wppizza-admin')."</span>"; |
| 297 |
echo "</span>"; |
| 298 |
|
| 299 |
|
| 300 |
/* validation type / pattern */ |
| 301 |
if($attr['validation_rules']){ |
| 302 |
|
| 303 |
/*allow for multiple validation rules if WPPIZZA_ADMIN_FORMFIELDS_VALIDATION_MULTISELECT == true*/ |
| 304 |
$constant_wppizza_validation_multiselect = WPPIZZA_ADMIN_FORMFIELDS_VALIDATION_MULTISELECT;/* cast to var for php 5.3 */ |
| 305 |
$multiple_rules = !empty($constant_wppizza_validation_multiselect) ? ' multiple="multiple"' : ''; |
| 306 |
|
| 307 |
echo"<label><select id='".WPPIZZA_SLUG."-".$options_key."-validation_rules-".$k."' class='".WPPIZZA_SLUG."-".$options_key."-validation_rules' name='".WPPIZZA_SLUG."[".$options_key."][".$k."][validation][rule][]' ".$multiple_rules.">"; |
| 308 |
foreach($this->get_validation_rules() as $validation_key=>$rule){ |
| 309 |
$option_has_parameters = (!empty($rule['parameters'])) ? '-hasparameters' : ''; |
| 310 |
echo'<option value="'. $validation_key . $option_has_parameters .'" '.selected(isset($v['validation'][$validation_key]),true,false).'>'.esc_html($rule['lbl']).'</option>'; |
| 311 |
} |
| 312 |
echo"</select></label>"; |
| 313 |
|
| 314 |
/* rules parameters for rules that require them */ |
| 315 |
echo "<span id='".WPPIZZA_SLUG."_validation_parameters-".$k."' class='".WPPIZZA_SLUG."_validation_parameters' >"; |
| 316 |
foreach($v['validation'] as $rule_key=>$rule_value){ |
| 317 |
/* only for rules that have / need parameters set */ |
| 318 |
if($rules_available[$rule_key]['parameters']){ |
| 319 |
//echo"<span>".$rules_available[$rule_key]['lbl'].":</span>"; |
| 320 |
echo"<input name='".WPPIZZA_SLUG."[".$options_key."][".$k."][validation][parameters][".$rule_key."]' type='text' value='".esc_html($rule_value)."' placeholder='".esc_html(__('Parameters', 'wppizza-admin'))."' />"; |
| 321 |
} |
| 322 |
} |
| 323 |
echo "</span>"; |
| 324 |
|
| 325 |
} |
| 326 |
echo"</td>"; |
| 327 |
|
| 328 |
echo"</tr>"; |
| 329 |
|
| 330 |
/**for tips, add description tr - kind of superflous and messes up odd/even css**/ |
| 331 |
//if($v['key']=='ctips'){ |
| 332 |
// echo"<tr class='wppizza_".$v['key']."_info'>"; |
| 333 |
// echo"<td colspan='9'>"; |
| 334 |
// echo"<span class='description'>"; |
| 335 |
// echo"".__('<b>Tips/Gratuities:</b> allow the customer can enter a <b>numerical</b> amount to be used as tips/gratuities.<br />This field will not be added to the users profile and can therefore not be pre-filled or used in the registration form.', 'wppizza-admin').""; |
| 336 |
// echo"</span>"; |
| 337 |
// echo"</td>"; |
| 338 |
// echo"</tr>"; |
| 339 |
//} |
| 340 |
|
| 341 |
} |
| 342 |
echo"</tbody>"; |
| 343 |
echo"</table>"; |
| 344 |
} |
| 345 |
|
| 346 |
} |
| 347 |
/*------------------------------------------------------------------------------ |
| 348 |
# [insert default option on install] |
| 349 |
# $parameter $options array() | filter passing on filtered options |
| 350 |
# @since 3.0 |
| 351 |
# @return array() |
| 352 |
------------------------------------------------------------------------------*/ |
| 353 |
function options_default($options){ |
| 354 |
|
| 355 |
$options[$this->settings_page]=array( |
| 356 |
'cname'=>array( |
| 357 |
'sort'=>0,'key'=>'cname','lbl'=>wppizza_textdomain('Name', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>true,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>true,'onregister'=>false,'add_to_subject_line'=>true, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 358 |
), |
| 359 |
'cemail'=>array( |
| 360 |
'sort'=>1,'key'=>'cemail','lbl'=>wppizza_textdomain('Email', 'wppizza').' :','value'=>array(),'type'=>'email','enabled'=>true,'required'=>true,'required_on_pickup'=>true,'omit_if_optional'=>false,'prefill'=>true,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('email'=>true) |
| 361 |
), |
| 362 |
'caddress'=>array( |
| 363 |
'sort'=>2,'key'=>'caddress','lbl'=>wppizza_textdomain('Address', 'wppizza').' :','value'=>array(),'type'=>'textarea','enabled'=>true,'required'=>true,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>true,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 364 |
), |
| 365 |
'ctel'=>array( |
| 366 |
'sort'=>3,'key'=>'ctel','lbl'=>wppizza_textdomain('Telephone', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>true,'required'=>true,'required_on_pickup'=>true,'omit_if_optional'=>false,'prefill'=>true,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('number'=>true) |
| 367 |
), |
| 368 |
'ccomments'=>array( |
| 369 |
'sort'=>4,'key'=>'ccomments','lbl'=>wppizza_textdomain('Comments', 'wppizza').' :','value'=>array(),'type'=>'textarea','enabled'=>true,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 370 |
), |
| 371 |
'ccustom1'=>array( |
| 372 |
'sort'=>5,'key'=>'ccustom1','lbl'=>wppizza_textdomain('Custom Field 1', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 373 |
), |
| 374 |
'ccustom2'=>array( |
| 375 |
'sort'=>6,'key'=>'ccustom2','lbl'=>wppizza_textdomain('Custom Field 2', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 376 |
), |
| 377 |
'ccustom3'=>array( |
| 378 |
'sort'=>7,'key'=>'ccustom3','lbl'=>wppizza_textdomain('Custom Field 3', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 379 |
), |
| 380 |
'ccustom4'=>array( |
| 381 |
'sort'=>8,'key'=>'ccustom4','lbl'=>wppizza_textdomain('Custom Field 4', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 382 |
), |
| 383 |
'ccustom5'=>array( |
| 384 |
'sort'=>9,'key'=>'ccustom5','lbl'=>wppizza_textdomain('Custom Field 5', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 385 |
), |
| 386 |
'ccustom6'=>array( |
| 387 |
'sort'=>10,'key'=>'ccustom6','lbl'=>wppizza_textdomain('Custom Field 6', 'wppizza').' :','value'=>array(),'type'=>'text','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('default'=>true) |
| 388 |
), |
| 389 |
'ctips'=>array( |
| 390 |
'sort'=>11,'key'=>'ctips','lbl'=>wppizza_textdomain('Tips / Gratuities', 'wppizza').' :','value'=>array(),'type'=>'tips','enabled'=>false,'required'=>false,'required_on_pickup'=>false,'omit_if_optional'=>false,'prefill'=>false,'onregister'=>false,'add_to_subject_line'=>false, 'placeholder'=>false, 'validation'=>array('decimal'=>true) |
| 391 |
) |
| 392 |
); |
| 393 |
|
| 394 |
return $options; |
| 395 |
} |
| 396 |
|
| 397 |
/*------------------------------------------------------------------------------ |
| 398 |
# [validate options on save/update] |
| 399 |
# |
| 400 |
# @since 3.0 |
| 401 |
# @return array() |
| 402 |
------------------------------------------------------------------------------*/ |
| 403 |
function options_validate($options, $input){ |
| 404 |
|
| 405 |
/**make sure we get the full array on install/update**/ |
| 406 |
if ( empty( $_POST['_wp_http_referer'] ) ) { |
| 407 |
return $input; |
| 408 |
} |
| 409 |
/******************************** |
| 410 |
* [validate] |
| 411 |
********************************/ |
| 412 |
if(isset($_POST[''.WPPIZZA_SLUG.'_'.$this->settings_page.''])){ |
| 413 |
|
| 414 |
/***************************************** |
| 415 |
[main order form] |
| 416 |
*****************************************/ |
| 417 |
$rules_available = $this->get_validation_rules(); |
| 418 |
|
| 419 |
foreach($input[$this->settings_page] as $key=>$b){ |
| 420 |
|
| 421 |
|
| 422 |
/* |
| 423 |
sanitise key |
| 424 |
*/ |
| 425 |
$key = wppizza_validate_alpha_only($key); |
| 426 |
|
| 427 |
/* |
| 428 |
force some types for certain keys |
| 429 |
*/ |
| 430 |
if($key == 'cemail'){ |
| 431 |
$type = 'email'; |
| 432 |
} |
| 433 |
elseif($key == 'ctips'){ |
| 434 |
$type = 'tips'; |
| 435 |
} |
| 436 |
else{ |
| 437 |
$type = wppizza_validate_letters_only($input[$this->settings_page][$key]['type']); |
| 438 |
} |
| 439 |
|
| 440 |
/* |
| 441 |
force some validation rules for certain keys |
| 442 |
|
| 443 |
*/ |
| 444 |
$validation = array(); |
| 445 |
/* |
| 446 |
loop through rules and validate parameters (if callback != false) |
| 447 |
*/ |
| 448 |
$selected_rules = !empty($input[$this->settings_page][$key]['validation']['rule']) ? $input[$this->settings_page][$key]['validation']['rule'] : '' ; |
| 449 |
$selected_rule_parameters = !empty($input[$this->settings_page][$key]['validation']['parameters']) ? $input[$this->settings_page][$key]['validation']['parameters'] : ''; |
| 450 |
|
| 451 |
/** |
| 452 |
if we do not overwrite by rules below, make sure we select at least default |
| 453 |
(in case no rule was selected at all in multiselect) |
| 454 |
also add fixed rules for cemail, ctips |
| 455 |
**/ |
| 456 |
$validation['default'] = true; |
| 457 |
if($key == 'cemail'){ $validation['email'] = true; } |
| 458 |
if($key == 'ctips'){ $validation['decimal'] = true; } |
| 459 |
|
| 460 |
/** loop through rules selected **/ |
| 461 |
if(is_array($selected_rules)){ |
| 462 |
$validation = array(); |
| 463 |
foreach($selected_rules as $rule){ |
| 464 |
/* make sure we loose the -hasparameters */ |
| 465 |
$rule = str_replace('-hasparameters','',$rule); |
| 466 |
|
| 467 |
/** validate that such a rule exists **/ |
| 468 |
if(isset($rules_available[$rule])){ |
| 469 |
$validation[$rule]=true;/////////* set trua as string to use in lozalized js |
| 470 |
/** validate parameters submitted using callback function */ |
| 471 |
if(!empty($rules_available[$rule]['parameters'])){ |
| 472 |
/*get callback function if not false*/ |
| 473 |
$callback_function = !empty($rules_available[$rule]['callback']) ? $rules_available[$rule]['callback'] : 'esc_html' ; |
| 474 |
/* validate each rule parameters */ |
| 475 |
$validation[$rule]=$callback_function($selected_rule_parameters[$rule]); |
| 476 |
} |
| 477 |
} |
| 478 |
}} |
| 479 |
|
| 480 |
/** force default rule for checkbox, radio, hidden **/ |
| 481 |
if(in_array($type, array('checkbox', 'radio', 'multicheckbox', 'hidden'))){ |
| 482 |
$validation = array(); |
| 483 |
$validation['default'] = true; |
| 484 |
} |
| 485 |
/* |
| 486 |
set array values for this key |
| 487 |
*/ |
| 488 |
$options[$this->settings_page][$key]['sort'] = (int)($input[$this->settings_page][$key]['sort']); |
| 489 |
$options[$this->settings_page][$key]['key'] = $key; |
| 490 |
$options[$this->settings_page][$key]['lbl'] = ($type == 'checkbox' ) ? wppizza_validate_string($input[$this->settings_page][$key]['lbl'], true) : wppizza_validate_string($input[$this->settings_page][$key]['lbl']);// allow for html when using checkboxes |
| 491 |
$options[$this->settings_page][$key]['type'] = $type; |
| 492 |
$options[$this->settings_page][$key]['enabled'] = !empty($input[$this->settings_page][$key]['enabled']) ? true : false; |
| 493 |
$options[$this->settings_page][$key]['required'] = !empty($input[$this->settings_page][$key]['required']) ? true : false; |
| 494 |
$options[$this->settings_page][$key]['required_on_pickup'] = !empty($input[$this->settings_page][$key]['required_on_pickup']) ? true : false; |
| 495 |
$options[$this->settings_page][$key]['omit_if_optional'] = !empty($input[$this->settings_page][$key]['omit_if_optional']) ? true : false; |
| 496 |
$options[$this->settings_page][$key]['prefill'] = !empty($input[$this->settings_page][$key]['prefill']) ? true : false; |
| 497 |
$options[$this->settings_page][$key]['onregister'] = !empty($input[$this->settings_page][$key]['onregister']) ? true : false; |
| 498 |
$options[$this->settings_page][$key]['add_to_subject_line'] = !empty($input[$this->settings_page][$key]['add_to_subject_line']) ? true : false; |
| 499 |
$options[$this->settings_page][$key]['value'] = isset($input[$this->settings_page][$key]['value']) ? wppizza_sanitize_post_vars(wppizza_strtoarray($input[$this->settings_page][$key]['value'])) : '' ;/* sanitize these the same as user input vars so we can check for matches in multicheckboxes etc */ |
| 500 |
$options[$this->settings_page][$key]['placeholder'] = isset($input[$this->settings_page][$key]['placeholder']) ? wppizza_validate_string($input[$this->settings_page][$key]['placeholder']) : '' ; |
| 501 |
$options[$this->settings_page][$key]['validation'] = $validation; |
| 502 |
|
| 503 |
} |
| 504 |
|
| 505 |
/* save sorted */ |
| 506 |
asort($options[$this->settings_page]); |
| 507 |
|
| 508 |
} |
| 509 |
|
| 510 |
|
| 511 |
return $options; |
| 512 |
} |
| 513 |
|
| 514 |
/*************************************************************** |
| 515 |
* |
| 516 |
* |
| 517 |
* [HELPERS] |
| 518 |
* |
| 519 |
* |
| 520 |
***************************************************************/ |
| 521 |
function get_validation_rules(){ |
| 522 |
/**validation patterns - available in validation methods and additional validation methods **/ |
| 523 |
$validation_rules = array(); |
| 524 |
|
| 525 |
/* default - required set by required attribute on formfield depending on pickup/delivey */ |
| 526 |
$validation_rules['default'] = array( 'lbl'=> __('default', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 527 |
|
| 528 |
/*standard jquery validator methods*/ |
| 529 |
$validation_rules['email'] = array( 'lbl'=> __('email', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 530 |
$validation_rules['url'] = array( 'lbl'=> __('url', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 531 |
$validation_rules['date'] = array( 'lbl'=> __('date', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 532 |
$validation_rules['dateISO'] = array( 'lbl'=> __('date ISO', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 533 |
$validation_rules['number'] = array( 'lbl'=> __('number', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 534 |
$validation_rules['digits'] = array( 'lbl'=> __('digits', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 535 |
$validation_rules['minlength'] = array( 'lbl'=> __('min length', 'wppizza-admin'), 'parameters'=>true, 'callback'=>'wppizza_validate_int_only', 'enabled'=>true); |
| 536 |
$validation_rules['maxlength'] = array( 'lbl'=> __('max length', 'wppizza-admin'), 'parameters'=>true, 'callback'=>'wppizza_validate_int_only', 'enabled'=>true); |
| 537 |
$validation_rules['rangelength'] = array( 'lbl'=> __('rangelength', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 538 |
$validation_rules['min'] = array( 'lbl'=> __('min', 'wppizza-admin'), 'parameters'=>false, 'callback'=>'wppizza_validate_int_only', 'enabled'=>false); |
| 539 |
$validation_rules['max'] = array( 'lbl'=> __('max', 'wppizza-admin'), 'parameters'=>false, 'callback'=>'wppizza_validate_int_only', 'enabled'=>false); |
| 540 |
$validation_rules['range'] = array( 'lbl'=> __('range', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 541 |
$validation_rules['step'] = array( 'lbl'=> __('step', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 542 |
$validation_rules['equalTo'] = array( 'lbl'=> __('equal to', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 543 |
$validation_rules['remote'] = array( 'lbl'=> __('remote', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 544 |
/* additional jquery validator methods */ |
| 545 |
$validation_rules['alphanumeric'] = array( 'lbl'=> __('alphanumeric', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 546 |
$validation_rules['maxWords'] = array( 'lbl'=> __('max words', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 547 |
$validation_rules['minWords'] = array( 'lbl'=> __('min words', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 548 |
$validation_rules['rangeWords'] = array( 'lbl'=> __('range words', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 549 |
$validation_rules['accept'] = array( 'lbl'=> __('accept', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 550 |
$validation_rules['bankaccountNL'] = array( 'lbl'=> __('bankaccount NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 551 |
$validation_rules['bankorgiroaccountNL'] = array( 'lbl'=> __('bankorgiroaccount NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 552 |
$validation_rules['bic'] = array( 'lbl'=> __('bic', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 553 |
$validation_rules['cifES'] = array( 'lbl'=> __('cif ES', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 554 |
$validation_rules['cpfBR'] = array( 'lbl'=> __('cpf BR', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 555 |
$validation_rules['creditcard'] = array( 'lbl'=> __('creditcard', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 556 |
$validation_rules['creditcardtypes'] = array( 'lbl'=> __('creditcard types', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 557 |
$validation_rules['currency'] = array( 'lbl'=> __('currency', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 558 |
$validation_rules['dateFA'] = array( 'lbl'=> __('date FA', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 559 |
$validation_rules['dateITA'] = array( 'lbl'=> __('date ITA', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 560 |
$validation_rules['dateNL'] = array( 'lbl'=> __('date NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 561 |
$validation_rules['extension'] = array( 'lbl'=> __('extension', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 562 |
$validation_rules['giroaccountNL'] = array( 'lbl'=> __('giroaccount NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 563 |
$validation_rules['iban'] = array( 'lbl'=> __('iban', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 564 |
$validation_rules['integer'] = array( 'lbl'=> __('integer', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 565 |
$validation_rules['ipv4'] = array( 'lbl'=> __('ipv4', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 566 |
$validation_rules['ipv6'] = array( 'lbl'=> __('ipv6', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 567 |
$validation_rules['lettersonly'] = array( 'lbl'=> __('lettersonly', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 568 |
$validation_rules['letterswithbasicpunc'] = array( 'lbl'=> __('letters w. basic punc', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 569 |
$validation_rules['mobileNL'] = array( 'lbl'=> __('mobile NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 570 |
$validation_rules['mobileUK'] = array( 'lbl'=> __('mobile UK', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 571 |
$validation_rules['nieES'] = array( 'lbl'=> __('nieES', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 572 |
$validation_rules['nifES'] = array( 'lbl'=> __('nifES', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 573 |
$validation_rules['notEqualTo'] = array( 'lbl'=> __('not equal to', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 574 |
$validation_rules['nowhitespace'] = array( 'lbl'=> __('no whitespace', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 575 |
$validation_rules['parameters'] = array( 'lbl'=> __('parameters', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 576 |
$validation_rules['phoneNL'] = array( 'lbl'=> __('phone NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 577 |
$validation_rules['phoneUK'] = array( 'lbl'=> __('phone UK', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 578 |
$validation_rules['phoneUS'] = array( 'lbl'=> __('phone US', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 579 |
$validation_rules['phonesUK'] = array( 'lbl'=> __('phones UK', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 580 |
$validation_rules['postalCodeCA'] = array( 'lbl'=> __('postalcode CA', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 581 |
$validation_rules['postalcodeBR'] = array( 'lbl'=> __('postalcode BR', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 582 |
$validation_rules['postalcodeIT'] = array( 'lbl'=> __('postalcode IT', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 583 |
$validation_rules['postalcodeNL'] = array( 'lbl'=> __('postalcode NL', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 584 |
$validation_rules['postcodeUK'] = array( 'lbl'=> __('postcode UK', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 585 |
$validation_rules['require_from_group'] = array( 'lbl'=> __('require_from_group', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 586 |
$validation_rules['skip_or_fill_minimum'] = array( 'lbl'=> __('skip_or_fill_minimum', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 587 |
$validation_rules['stateUS'] = array( 'lbl'=> __('state US', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 588 |
$validation_rules['time'] = array( 'lbl'=> __('time', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 589 |
$validation_rules['time12h'] = array( 'lbl'=> __('time12h', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 590 |
$validation_rules['url2'] = array( 'lbl'=> __('url2', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 591 |
$validation_rules['vinUS'] = array( 'lbl'=> __('vinUS', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 592 |
$validation_rules['zipcodeUS'] = array( 'lbl'=> __('zipcodeUS', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 593 |
$validation_rules['ziprange'] = array( 'lbl'=> __('ziprange', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 594 |
/* this plugin custom added methods */ |
| 595 |
$validation_rules['decimal'] = array( 'lbl'=> __('decimal', 'wppizza-admin'), 'parameters'=>false, 'callback'=>false, 'enabled'=>false); |
| 596 |
|
| 597 |
/* |
| 598 |
// customise rules |
| 599 |
// see jqueryvalidation.org what each rule/method does |
| 600 |
|
| 601 |
// add filter |
| 602 |
add_filter('wppizza_filter_validation_rules','my_function'); |
| 603 |
//to enable an exiting rule above - let's say 'phoneUS' |
| 604 |
function my_function($validation_rules){ |
| 605 |
$validation_rules['phoneUS']['enabled'] = true; |
| 606 |
return $validation_rules; |
| 607 |
} |
| 608 |
|
| 609 |
//to add your onw rule - let's say 'my_rule' |
| 610 |
function my_function($validation_rules){ |
| 611 |
$validation_rules['my_rule']= array( 'lbl'=> 'My Rule', 'parameters'=>false, 'callback'=>false, 'enabled'=>true); |
| 612 |
return $validation_rules; |
| 613 |
} |
| 614 |
// then add the rule like so via wp_footer action hook (or add it to an already existing js file) |
| 615 |
// adjust the validation pattern as appropriate for your validation rule |
| 616 |
$.validator.methods.my_rule = function (value, element) { |
| 617 |
return this.optional(element) || /^(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:[\.,]\d+)?$/.test(value); |
| 618 |
} |
| 619 |
|
| 620 |
*/ |
| 621 |
$validation_rules = apply_filters('wppizza_filter_validation_rules', $validation_rules); |
| 622 |
|
| 623 |
/* only return enabled*/ |
| 624 |
$rules = array(); |
| 625 |
foreach($validation_rules as $key=>$rule){ |
| 626 |
if(!empty($rule['enabled'])){ |
| 627 |
$rules[$key] = $rule; |
| 628 |
} |
| 629 |
} |
| 630 |
|
| 631 |
return $rules; |
| 632 |
} |
| 633 |
|
| 634 |
|
| 635 |
} |
| 636 |
/*************************************************************** |
| 637 |
* |
| 638 |
* [ini] |
| 639 |
* |
| 640 |
***************************************************************/ |
| 641 |
$WPPIZZA_MODULE_ORDERFORM_ORDERPAGE = new WPPIZZA_MODULE_ORDERFORM_ORDERPAGE(); |
| 642 |
?> |