ta($bookingFormId,'form_element_agreement',$formElementAgreement); } /**************************************************************************/ function getPanel($meta) { $panel=array ( array ( 'id' => 1, 'label' => __('[Contact details]','chauffeur-booking-system') ), array ( 'id' => 2, 'label' => __('[Billing address]','chauffeur-booking-system') ) ); if(isset($meta['form_element_panel'])) { foreach($meta['form_element_panel'] as $value) $panel[]=$value; } return($panel); } /**************************************************************************/ function isPanel($panelId,$panelDictionary) { foreach($panelDictionary as $value) { if($value['id']==$panelId) return(true); } return(false); } /**************************************************************************/ function createField($panelId,$meta) { $html=array(null,null); if(!array_key_exists('form_element_field',$meta)) return(null); foreach($meta['form_element_field'] as $value) { if($value['panel_id']==$panelId) { $html[1].= '
'; } } if(array_key_exists('form_element_panel',$meta)) { if(!in_array($panelId,array(1,2))) { foreach($meta['form_element_panel'] as $value) { if($value['id']==$panelId) { $html[0].= '
'; } } } } return($html[0].$html[1]); } /**************************************************************************/ function createAgreement($meta) { $html=null; $Validation=new CHBSValidation(); if(!array_key_exists('form_element_agreement',$meta)) return($html); foreach($meta['form_element_agreement'] as $value) { $html.= '
'.$value['text'].'
'; } if($Validation->isNotEmpty($html)) { $html= '

'.esc_html__('Agreements','chauffeur-booking-system').'

'.$html.'
'; } return($html); } /**************************************************************************/ function validateField($meta,$data) { $error=array(); $Validation=new CHBSValidation(); if(!array_key_exists('form_element_field',$meta)) return($error); foreach($meta['form_element_field'] as $value) { $name='form_element_field_'.$value['id']; if((int)$value['mandatory']===1) { if(array_key_exists($name,$data)) { if($value['panel_id']==2) { if((int)$data['client_billing_detail_enable']===1) { if($Validation->isEmpty($data[$name])) $error[]=array('name'=>CHBSHelper::getFormName($name,false),'message_error'=>$value['message_error']); } } else { if($Validation->isEmpty($data[$name])) $error[]=array('name'=>CHBSHelper::getFormName($name,false),'message_error'=>$value['message_error']); } } } } return($error); } /**************************************************************************/ function validateAgreement($meta,$data) { if(!array_key_exists('form_element_agreement',$meta)) return(false); foreach($meta['form_element_agreement'] as $value) { $name='form_element_agreement_'.$value['id']; if((!array_key_exists($name,$data)) || ((int)$data[$name]!==1)) return(true); } return(false); } /**************************************************************************/ function sendBookingField($bookingId,$meta,$data) { if(!array_key_exists('form_element_field',$meta)) return; foreach($meta['form_element_field'] as $index=>$value) { $name='form_element_field_'.$value['id']; $meta['form_element_field'][$index]['value']=$data[$name]; } CHBSPostMeta::updatePostMeta($bookingId,'form_element_panel',$meta['form_element_panel']); CHBSPostMeta::updatePostMeta($bookingId,'form_element_field',$meta['form_element_field']); } /**************************************************************************/ function displayField($panelId,$meta,$type=1,$argument=array()) { $html=null; if(!array_key_exists('form_element_field',$meta)) return($html); foreach($meta['form_element_field'] as $value) { if($value['panel_id']==$panelId) { if($type==1) { $html.= '
'.esc_html($value['label']).'
'.esc_html($value['value']).'
'; } elseif($type==2) { $html.= ' '.esc_html($value['label']).' '.esc_html($value['value']).' '; } } } return($html); } /**************************************************************************/ } /******************************************************************************/ /******************************************************************************/unction validateField($meta,$data) { $error=array(); $Validation=new CHBSValidation(); if(!array_key_exists('form_element_field',$meta)) return($error); foreach($meta['form_element_field'] as $value) { $name='form_element_field_'.$value['id']; if((int)$value['mandatory']===1) { if(array_key_exists($name,$data)) { if($value['panel_id']==2) { if((int)$data['client_billing_detail_enable']===1) { if($Validation->isEmpty($data[$name])) $error[]=array('name'=>CHBSHelper::getFormName($name,false),'message_error'=>$value['message_error']); } } else { if($Validation->isEmpty($data[$name])) $error[]=array('name'=>CHBSHelper::getFormName($name,false),'message_error'=>$value['message_error']); } } } } return($error); } /**************************************************************************/ function validateAgreement($meta,$data) { if(!array_key_exists('form_element_agreement',$meta)) return(false); foreach($meta['form_element_agreement'] as $value) { $name='form_element_agreement_'.$value['id']; if((!array_key_exists($name,$data)) || ((int)$data[$name]!==1)) return(true); } return(false); } /**************************************************************************/ function sendBookingField($bookingId,$meta,$data) { if(!array_key_exists('form_element_field',$meta)) return; foreach($meta['form_element_field'] as $index=>$value) { $name='form_element_field_'.$value['id']; $meta['form_element_field'][$index]['value']=$data[$name]; } CHBSPostMeta::updatePostMeta($bookingId,'form_element_panel',$meta['form_element_panel']); CHBSPostMeta::updatePostMeta($bookingId,'form_element_field',$meta['form_element_field']); } /**************************************************************************/ function displayField($panelId,$meta,$type=1,$argument=array()) { $html=null; if(!array_key_exists('form_element_field',$meta)) return($html); foreach($meta['form_element_field'] as $value) { if($value['panel_id']==$panelId) { if($type==1) { $html.= '
'.esc_html($value['label']).'
'.esc_html($value['value']).'
'; } elseif($type==2) { $html.= ' '.esc_html($value['label']).' '.esc_html($value['value']).' '; } } } return($html); } /**************************************************************************/ } /******************************************************************************/ /******************************************************************************/
Parse error: syntax error, unexpected '')),' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /home/citycarb/public_html/wp-content/plugins/chauffeur-booking-system/class/CHBS.Country.class.php on line 223