| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
|
| 5 |
if(!class_exists('vxcf_mailchimp_api')){ |
| 6 |
|
| 7 |
class vxcf_mailchimp_api extends vxcf_mailchimp{ |
| 8 |
|
| 9 |
public $info='' ; // info |
| 10 |
public $url=''; |
| 11 |
public $api_key=''; |
| 12 |
public $error= ""; |
| 13 |
public $timeout= "15"; |
| 14 |
|
| 15 |
function __construct($info) { |
| 16 |
|
| 17 |
if(isset($info['data'])){ |
| 18 |
$this->info= $info; |
| 19 |
if(!empty($info['data']['api_key'])){ |
| 20 |
$this->api_key=$info['data']['api_key']; |
| 21 |
$temp_arr=explode('-',$this->api_key); |
| 22 |
if(!empty($temp_arr[1])){ |
| 23 |
$this->url='https://'.$temp_arr[1].'.api.mailchimp.com/3.0/'; |
| 24 |
} |
| 25 |
} |
| 26 |
} |
| 27 |
} |
| 28 |
public function get_token(){ |
| 29 |
$users=$this->get_crm_objects(); |
| 30 |
|
| 31 |
$info=$this->info; |
| 32 |
$info=isset($info['data']) ? $info['data'] : array(); |
| 33 |
if(is_array($users) ){ |
| 34 |
$info['valid_token']='true'; |
| 35 |
}else { |
| 36 |
unset($info['valid_token']); |
| 37 |
if(!empty($users)){ |
| 38 |
if(is_string($users)){ |
| 39 |
$info['error']=$users; |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
return $info; |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
public function get_crm_objects(){ |
| 49 |
|
| 50 |
$objects=$this->post_crm('lists?count=200','get'); |
| 51 |
//var_dump($objects); |
| 52 |
$res=''; |
| 53 |
if(!empty($objects['detail'])){ //title,detail |
| 54 |
$res=$objects['detail']; |
| 55 |
}else if(isset($objects['lists']) ){ |
| 56 |
$res=array(); |
| 57 |
foreach($objects['lists'] as $k=>$v){ |
| 58 |
$res[$v['id']]=$v['name']; |
| 59 |
} |
| 60 |
}else{ |
| 61 |
$res=json_encode($objects); |
| 62 |
} |
| 63 |
return $res; |
| 64 |
} |
| 65 |
public function get_crm_fields($module,$fields_type=false){ |
| 66 |
|
| 67 |
$fields=$this->post_crm('lists/'.$module.'/merge-fields?count=200','get'); |
| 68 |
//$field=$this->post_crm('lists/'.$module.'/members?count=200','get'); |
| 69 |
//var_dump($fields,$module); |
| 70 |
|
| 71 |
if($fields_type){ |
| 72 |
|
| 73 |
$field_options=array(); |
| 74 |
if(isset($fields['merge_fields']) && is_array($fields['merge_fields'])){ |
| 75 |
foreach($fields['merge_fields'] as $k=>$f){ |
| 76 |
$field_options[$k]=array('name'=>$f['key'],'label'=>$f['name']); |
| 77 |
if(isset($f['type'])){ |
| 78 |
|
| 79 |
if(in_array($f['type'],array('dropdown','radio'))){ |
| 80 |
if(!empty($f['options']['choices'])){ |
| 81 |
foreach($f['options']['choices'] as $kk=>$v){ |
| 82 |
$field_options[$k]['options'][]=array('name'=>$kk,'value'=>$v); |
| 83 |
} |
| 84 |
} } |
| 85 |
} } |
| 86 |
} |
| 87 |
return $field_options; |
| 88 |
} |
| 89 |
$res=array(); |
| 90 |
$address=array('addr1'=>'Street Line 1','addr2'=>'Street Line 2','city'=>'City','state'=>'State','zip'=>'Zip','country'=>'Country'); |
| 91 |
|
| 92 |
if(!empty($fields['merge_fields'])){ |
| 93 |
$res['email_address']=array('name'=>'email_address','label'=>'Email','type'=>'email','req'=>'true'); |
| 94 |
$res['PHONE']=array('name'=>'PHONE','label'=>'Phone Number','type'=>'phone'); |
| 95 |
foreach($fields['merge_fields'] as $k=>$v){ |
| 96 |
$merge_id=intval($v['merge_id']); |
| 97 |
if($v['type'] == 'address'){ |
| 98 |
foreach($address as $i=>$r){ |
| 99 |
$field=array('label'=>$v['name'].'-'.$r,'name'=>$v['tag'].'-'.$i,'type'=>'address'); |
| 100 |
if($v['required'] == true){ |
| 101 |
$field['req']='true'; |
| 102 |
} |
| 103 |
if($merge_id > 4){ |
| 104 |
$field['is_custom']='1'; |
| 105 |
} |
| 106 |
$res[$v['tag'].'-'.$i]=$field; |
| 107 |
} |
| 108 |
}else{ |
| 109 |
$field=array('label'=>$v['name'],'name'=>$v['tag'],'type'=>$v['type']); |
| 110 |
if(in_array($v['type'],array('dropdown','radio'))){ |
| 111 |
if(!empty($v['options']['choices'])){ |
| 112 |
$field['eg']=implode(',',$v['options']['choices']); |
| 113 |
$field['options']=$v['options']['choices']; |
| 114 |
} |
| 115 |
}else if($v['type'] == 'date'){ |
| 116 |
if(!empty($v['options']['date_format'])){ $field['eg']=$v['options']['date_format']; } |
| 117 |
}else if($v['type'] == 'birthday'){ |
| 118 |
$field['eg']='MM/DD'; |
| 119 |
} |
| 120 |
if($v['required'] == true){ $field['req']='true'; } |
| 121 |
if($merge_id > 4){ |
| 122 |
$field['is_custom']='1'; |
| 123 |
} |
| 124 |
|
| 125 |
$res[$v['tag']]=$field; |
| 126 |
} } |
| 127 |
|
| 128 |
$camps=$this->get_groups($module); |
| 129 |
|
| 130 |
$groups=$eg=array(); |
| 131 |
$group_field=array('name'=>'interests','label'=>'Interests','type'=>'dropdown','is_custom'=>'1'); |
| 132 |
if(!empty($camps) && is_array($camps)){ |
| 133 |
foreach($camps as $id=>$group){ |
| 134 |
if(!empty($group['items'])){ |
| 135 |
foreach($group['items'] as $g_id=>$g){ |
| 136 |
$groups[$g_id]=$g; |
| 137 |
$eg[]=$g_id.'='.$g; |
| 138 |
} |
| 139 |
} |
| 140 |
} |
| 141 |
$group_field['options']=$groups; |
| 142 |
$group_field['eg']=implode(', ',$eg); |
| 143 |
} |
| 144 |
$res['interests']= $group_field; |
| 145 |
$members=$this->post_crm('lists/'.$module.'/members?count=1','get'); |
| 146 |
if(isset($members['members'][0]['marketing_permissions'])){ |
| 147 |
foreach($members['members'][0]['marketing_permissions'] as $v){ |
| 148 |
$res[$v['marketing_permission_id']]=array('name'=>$v['marketing_permission_id'],'label'=>'GDPR - '.$v['text'],'type'=>'gdpr','is_custom'=>'1'); |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
$res['ip_signup']=array('name'=>'ip_signup','label'=>'User IP','type'=>'text'); |
| 153 |
$res['tags']=array('name'=>'tags','label'=>'Tags','type'=>'text or comma separated'); |
| 154 |
}else if(!empty($fields['detail'])){ |
| 155 |
$res=$fields['detail']; |
| 156 |
} |
| 157 |
|
| 158 |
return $res; |
| 159 |
} |
| 160 |
/** |
| 161 |
* Get users from mailchimp |
| 162 |
* @return array users |
| 163 |
*/ |
| 164 |
public function get_groups($object){ |
| 165 |
$arr=$this->post_crm('lists/'.$object.'/interest-categories?count=200','get'); |
| 166 |
$users=array(); |
| 167 |
$msg='No Stage Found'; |
| 168 |
if(!empty($arr['categories']) && is_array($arr['categories']) ){ |
| 169 |
foreach($arr['categories'] as $v){ |
| 170 |
if(!empty($v['title'])){ |
| 171 |
$arr_i=$this->post_crm('lists/'.$object.'/interest-categories/'.$v['id'].'/interests?count=200','get'); |
| 172 |
$items=array(); |
| 173 |
if(!empty($arr_i['interests'])){ |
| 174 |
foreach($arr_i['interests'] as $val){ |
| 175 |
$items[$val['id']]=$val['name']; |
| 176 |
} |
| 177 |
} |
| 178 |
$users[$v['id']]=array('title'=>$v['title'],'type'=>$v['type'],'items'=>$items); |
| 179 |
} |
| 180 |
} |
| 181 |
}else if(!empty($arr['error'])){ |
| 182 |
$msg=$arr['error']; |
| 183 |
} |
| 184 |
|
| 185 |
return empty($users) ? $msg : $users; |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
public function push_object($module,$fields,$meta){ |
| 190 |
//check primary key |
| 191 |
$extra=array(); |
| 192 |
|
| 193 |
$debug = isset($_GET['vx_debug']) && current_user_can('manage_options'); |
| 194 |
$event= isset($meta['event']) ? $meta['event'] : ''; |
| 195 |
$id= isset($meta['crm_id']) ? $meta['crm_id'] : ''; |
| 196 |
if($debug){ ob_start();} |
| 197 |
if(isset($meta['primary_key']) && $meta['primary_key']!="" && isset($fields[$meta['primary_key']]['value']) && $fields[$meta['primary_key']]['value']!=""){ |
| 198 |
$search=$fields[$meta['primary_key']]['value']; |
| 199 |
$field=$meta['primary_key']; |
| 200 |
|
| 201 |
$search_response=$this->post_crm('search-members?list_id='.$module.'&query='.urlencode($search),'get'); |
| 202 |
|
| 203 |
if(!empty($search_response['exact_matches']['members']) && is_array($search_response['exact_matches']['members']) && count($search_response['exact_matches']['members']) > 0){ |
| 204 |
$items=$search_response['exact_matches']['members']; |
| 205 |
//$item=end($items); |
| 206 |
if(!empty($items[0]['id'])){ |
| 207 |
$id=$items[0]['id']; |
| 208 |
$search_response =$items[0]; |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
if($debug){ |
| 213 |
?> |
| 214 |
<h3>Search field</h3> |
| 215 |
<p><?php print_r($field) ?></p> |
| 216 |
<h3>Search term</h3> |
| 217 |
<p><?php print_r($search) ?></p> |
| 218 |
<h3>POST Body</h3> |
| 219 |
<p><?php print_r($body) ?></p> |
| 220 |
<h3>Search response</h3> |
| 221 |
<p><?php print_r($res) ?></p> |
| 222 |
<?php |
| 223 |
} |
| 224 |
|
| 225 |
$extra["body"]=$search; |
| 226 |
$extra["response"]=$search_response; |
| 227 |
} |
| 228 |
if(!empty($meta['vx_unsub'])){ |
| 229 |
if(empty($id)){ |
| 230 |
return ''; |
| 231 |
}else{ |
| 232 |
$event='delete'; |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
if(in_array($event,array('delete_note','add_note'))){ |
| 237 |
if(isset($meta['related_object'])){ |
| 238 |
$extra['Note Object']= $meta['related_object']; |
| 239 |
} |
| 240 |
if(isset($meta['note_object_link'])){ |
| 241 |
$extra['note_object_link']=$meta['note_object_link']; |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
$status=$action=$method=""; $send_body=true; |
| 246 |
$entry_exists=false; |
| 247 |
|
| 248 |
$object_url=''; |
| 249 |
$is_main=false; |
| 250 |
$post=array(); |
| 251 |
if($id == ""){ |
| 252 |
//insert new object |
| 253 |
$action="Added"; $status="1"; $method='post'; |
| 254 |
$object_url='lists/'.$module.'/members'; |
| 255 |
$is_main=true; |
| 256 |
}else{ |
| 257 |
$entry_exists=true; |
| 258 |
if($event == 'add_note'){ |
| 259 |
if(!empty($fields['body']['value'])){ |
| 260 |
$post['note']=$fields['body']['value']; |
| 261 |
} |
| 262 |
|
| 263 |
$action="Note Added"; $status="1"; |
| 264 |
$object_url='lists/'.$meta['related_object'].'/members/'.$id.'/notes'; |
| 265 |
$method='post'; |
| 266 |
}else if(in_array($event,array('delete','delete_note'))){ |
| 267 |
$send_body=false; |
| 268 |
$method='delete'; |
| 269 |
$object_url=''; |
| 270 |
if($event == 'delete_note' && !empty($meta['note_object_link'])){ |
| 271 |
$object_url='lists/'.$meta['related_object'].'/members/'.$meta['note_object_link'].'/notes/'.$id; |
| 272 |
}else{ |
| 273 |
$object_url='lists/'.$meta['object'].'/members/'.$id; |
| 274 |
} |
| 275 |
$action="Deleted"; |
| 276 |
$status="5"; |
| 277 |
|
| 278 |
}else{ |
| 279 |
$action="Updated"; $status="2"; |
| 280 |
if(empty($meta['update'])){ |
| 281 |
$is_main=true; |
| 282 |
$object_url='lists/'.$module.'/members/'.$id; |
| 283 |
$method='patch'; |
| 284 |
} } |
| 285 |
} |
| 286 |
|
| 287 |
if($is_main){ |
| 288 |
|
| 289 |
$crm_fields=array(); |
| 290 |
if(!empty($meta['fields'])){ |
| 291 |
$crm_fields=$meta['fields']; |
| 292 |
} |
| 293 |
|
| 294 |
if(is_array($fields) && count($fields)>0){ |
| 295 |
$merge_fields=array(); |
| 296 |
foreach($fields as $k=>$v){ |
| 297 |
if(!empty($crm_fields[$k]['type'])){ |
| 298 |
$type=$crm_fields[$k]['type']; |
| 299 |
$val=$v['value']; |
| 300 |
|
| 301 |
if($type == 'gdpr'){ |
| 302 |
$post['marketing_permissions'][]=array('marketing_permission_id'=>$k,'enabled'=>!empty($v) ? true : false); |
| 303 |
}elseif($type == 'address'){ |
| 304 |
if(strpos($k,'-') !== false){ |
| 305 |
$key_arr=explode('-',$k); |
| 306 |
$merge_fields[$key_arr[0]][$key_arr[1]]=$val; |
| 307 |
} |
| 308 |
}else if($k == 'email_address'){ |
| 309 |
$post[$k]=$val; |
| 310 |
}else if(in_array($k,array('ip_signup','ip_opt'))){ |
| 311 |
$post[$k]=$val; |
| 312 |
}else if(in_array($k,array('tags','interests'))){ |
| 313 |
if(!empty($val)){ |
| 314 |
if(is_string($val)){ |
| 315 |
$val=array_map('trim',explode(',',$val)); |
| 316 |
} |
| 317 |
if(is_array($val)){ |
| 318 |
if($k == 'interests'){ |
| 319 |
foreach($val as $g){ |
| 320 |
$post[$k][$g]=true; |
| 321 |
} |
| 322 |
}else{ |
| 323 |
$post[$k]=$val; |
| 324 |
} } |
| 325 |
} |
| 326 |
}else{ |
| 327 |
if($type == 'birthday'){ $temp_val=strtotime($val); if(!empty($temp_val)){ $val=date('m/d',$temp_val); } } |
| 328 |
$merge_fields[$k]=$val; |
| 329 |
} } |
| 330 |
} |
| 331 |
if(!empty($merge_fields)){ |
| 332 |
$post['merge_fields']=$merge_fields; |
| 333 |
} |
| 334 |
$post['status']=!empty($meta['status']) ? $meta['status'] : 'subscribed'; |
| 335 |
$post['email_type']=!empty($meta['email_type']) ? $meta['email_type'] : 'html'; |
| 336 |
$post['language']=!empty($meta['language']) ? $meta['language'] : 'en'; |
| 337 |
if(!empty($meta['vip'])){ |
| 338 |
$post['vip']=true; |
| 339 |
} |
| 340 |
if(!empty($meta['assign_group']) && !empty($meta['groups'])){ |
| 341 |
if(!isset($post['interests'])){ $post['interests']=array(); } |
| 342 |
foreach($meta['groups'] as $k=>$g){ |
| 343 |
$post['interests'][$k]=true; |
| 344 |
} |
| 345 |
} |
| 346 |
|
| 347 |
} } |
| 348 |
//var_dump($post,$meta['groups']); die(); |
| 349 |
$link=""; $error=""; |
| 350 |
if(!empty($method) && !empty($object_url) ){ |
| 351 |
$arr= $this->post_crm($object_url, $method,$post); |
| 352 |
} |
| 353 |
//var_dump($object_url,$arr,$post,$method); die(); |
| 354 |
|
| 355 |
if(!empty($arr['detail'])){ |
| 356 |
$status=''; $error=$arr['detail']; |
| 357 |
}else if(!empty($arr['id'])){ |
| 358 |
$id=$arr['id']; |
| 359 |
//apply tags , when updating a member |
| 360 |
if($status == '2' && !empty($post['tags'])){ |
| 361 |
$tags=array(); |
| 362 |
foreach($post['tags'] as $v){ |
| 363 |
$tags[]=array('name'=>$v,'status'=>'active'); |
| 364 |
} |
| 365 |
|
| 366 |
$extra['Tags Response']=$this->post_crm($object_url.'/tags','post',array('tags'=>$tags)); |
| 367 |
} |
| 368 |
} |
| 369 |
if($debug){ |
| 370 |
?> |
| 371 |
<h3>Account Information</h3> |
| 372 |
<p><?php //print_r($this->info) ?></p> |
| 373 |
<h3>Data Sent</h3> |
| 374 |
<p><?php print_r($post) ?></p> |
| 375 |
<h3>Fields</h3> |
| 376 |
<p><?php echo json_encode($fields) ?></p> |
| 377 |
<h3>Response</h3> |
| 378 |
<p><?php print_r($response) ?></p> |
| 379 |
<h3>Object</h3> |
| 380 |
<p><?php print_r($module."--------".$action) ?></p> |
| 381 |
<?php |
| 382 |
echo $contents=trim(ob_get_clean()); |
| 383 |
if($contents!=""){ |
| 384 |
update_option($this->id."_debug",$contents); |
| 385 |
} |
| 386 |
} |
| 387 |
//add entry note |
| 388 |
if(!empty($meta['__vx_entry_note']) && !empty($id)){ |
| 389 |
$disable_note=$this->post('disable_entry_note',$meta); |
| 390 |
if(!($entry_exists && !empty($disable_note))){ |
| 391 |
$entry_note=$meta['__vx_entry_note']; |
| 392 |
if(!empty($entry_note['body'])){ |
| 393 |
$note_post=array('note'=>$entry_note['body']); |
| 394 |
$object_url='lists/'.$module.'/members/'.$id.'/notes'; |
| 395 |
$note_response= $this->post_crm( $object_url,'post',$note_post); |
| 396 |
$extra['Note Body']=$entry_note['body']; |
| 397 |
$extra['Note Response']=$note_response; |
| 398 |
} |
| 399 |
} |
| 400 |
} |
| 401 |
|
| 402 |
return array("error"=>$error,"id"=>$id,"link"=>$link,"action"=>$action,"status"=>$status,"data"=>$fields,"response"=>$arr,"extra"=>$extra); |
| 403 |
} |
| 404 |
public function create_fields_section($fields){ |
| 405 |
$arr=array(); |
| 406 |
if(!isset($fields['object'])){ |
| 407 |
$objects=array(''=>'Select Object'); |
| 408 |
$objs=$this->get_crm_objects(); |
| 409 |
if(is_array($objs) && count($objs)>0){ |
| 410 |
$objects=array_merge($objects,$objs); |
| 411 |
} |
| 412 |
$arr['gen_sel']['object']=array('label'=>'Select Object','options'=>$objects,'is_ajax'=>true,'req'=>true); |
| 413 |
}else if(isset($fields['fields']) && !empty($fields['object'])){ |
| 414 |
// filter fields |
| 415 |
$crm_fields=$this->get_crm_fields($fields['object']); |
| 416 |
if(!is_array($crm_fields)){ |
| 417 |
$crm_fields=array(); |
| 418 |
} |
| 419 |
$add_fields=array(); |
| 420 |
if(is_array($fields['fields']) && count($fields['fields'])>0){ |
| 421 |
foreach($fields['fields'] as $k=>$v){ |
| 422 |
$found=false; |
| 423 |
foreach($crm_fields as $crm_key=>$val){ |
| 424 |
if(strpos($crm_key,$k)!== false){ |
| 425 |
$found=true; break; |
| 426 |
} |
| 427 |
} |
| 428 |
// echo $found.'---------'.$k.'============'.$crm_key.'<hr>'; |
| 429 |
if(!$found){ |
| 430 |
$add_fields[$k]=$v; |
| 431 |
} |
| 432 |
} |
| 433 |
} |
| 434 |
$arr['fields']=$add_fields; |
| 435 |
} |
| 436 |
|
| 437 |
return $arr; |
| 438 |
} |
| 439 |
public function field_types($data){ |
| 440 |
return array('text'=>'Text','email'=>'Email',"number"=>'Number', "phone"=>'Phone',"date"=>'Date', "url"=>'Url', "imageurl"=>'Image URL', "birthday"=>'BirthDay'); |
| 441 |
} |
| 442 |
public function create_field($field){ |
| 443 |
// return 'ok'; |
| 444 |
|
| 445 |
$name=isset($field['name']) ? $field['name'] : ''; |
| 446 |
$label=isset($field['label']) ? $field['label'] : ''; |
| 447 |
$type=isset($field['type']) ? $field['type'] : ''; |
| 448 |
$object=isset($field['object']) ? $field['object'] : ''; |
| 449 |
|
| 450 |
$error='Unknow error'; |
| 451 |
if(!empty($label) && !empty($type) && !empty($object)){ |
| 452 |
$body=array('name'=>$label,'type'=>$type); |
| 453 |
$url='lists/'.$object.'/merge-fields'; |
| 454 |
$arr=$this->post_crm($url,'post',$body); |
| 455 |
$error='ok'; |
| 456 |
if(!empty($arr['error']) ){ |
| 457 |
|
| 458 |
$error=$arr['error']; |
| 459 |
} |
| 460 |
} |
| 461 |
return $error; |
| 462 |
} |
| 463 |
|
| 464 |
public function post_crm($path,$method,$body=''){ |
| 465 |
$url=$this->url.$path; |
| 466 |
if(is_array($body)&& count($body)>0) |
| 467 |
{ |
| 468 |
$body=json_encode($body); |
| 469 |
} |
| 470 |
|
| 471 |
$head=array('Authorization'=> ' apikey ' .$this->api_key); |
| 472 |
if($method == 'post'){ |
| 473 |
$head['Content-Type']='application/json'; |
| 474 |
} |
| 475 |
|
| 476 |
$args = array( |
| 477 |
'body' => $body, |
| 478 |
'headers'=> $head, |
| 479 |
'method' => strtoupper($method), // GET, POST, PUT, DELETE, etc. |
| 480 |
'sslverify' => false, |
| 481 |
'timeout' => 30, |
| 482 |
); |
| 483 |
|
| 484 |
$response = wp_remote_request($url, $args); |
| 485 |
if(is_wp_error($response)) { |
| 486 |
$error = $response->get_error_message(); |
| 487 |
return array('detail'=>$error); |
| 488 |
} |
| 489 |
$body=json_decode($response['body'],true); |
| 490 |
|
| 491 |
return $body; |
| 492 |
} |
| 493 |
public function get_entry($module,$id){ |
| 494 |
|
| 495 |
|
| 496 |
$arr=$this->post_crm('lists/'.$module.'/members/'.$id,'get'); |
| 497 |
if(!empty($arr['merge_fields']) && is_array($arr['merge_fields'])){ |
| 498 |
foreach($arr['merge_fields'] as $k=>$v){ |
| 499 |
if(is_array($v)){ |
| 500 |
foreach($v as $key=>$val){ |
| 501 |
$arr[$k.'-'.$key]=$val; |
| 502 |
} }else{ |
| 503 |
$arr[$k]=$v; |
| 504 |
} |
| 505 |
} |
| 506 |
} |
| 507 |
|
| 508 |
return $arr; |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
?> |