2bd5e87f by Jeff Balicki

cf7-mailchimp

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 5e5f6fe5
Showing 70 changed files with 8744 additions and 0 deletions
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'=>'Groups','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
145 $res['interests']= $group_field;
146 $res['tags']=array('name'=>'tags','label'=>'Tags','type'=>'text or comma separated');
147 }else if(!empty($fields['detail'])){
148 $res=$fields['detail'];
149 }
150
151 return $res;
152 }
153 /**
154 * Get users from mailchimp
155 * @return array users
156 */
157 public function get_groups($object){
158 $arr=$this->post_crm('lists/'.$object.'/interest-categories?count=200','get');
159 $users=array();
160 $msg='No Stage Found';
161 if(!empty($arr['categories']) && is_array($arr['categories']) ){
162 foreach($arr['categories'] as $v){
163 if(!empty($v['title'])){
164 $arr_i=$this->post_crm('lists/'.$object.'/interest-categories/'.$v['id'].'/interests?count=200','get');
165 $items=array();
166 if(!empty($arr_i['interests'])){
167 foreach($arr_i['interests'] as $val){
168 $items[$val['id']]=$val['name'];
169 }
170 }
171 $users[$v['id']]=array('title'=>$v['title'],'type'=>$v['type'],'items'=>$items);
172 }
173 }
174 }else if(!empty($arr['error'])){
175 $msg=$arr['error'];
176 }
177
178 return empty($users) ? $msg : $users;
179 }
180
181
182 public function push_object($module,$fields,$meta){
183 //check primary key
184 $extra=array();
185
186 $debug = isset($_GET['vx_debug']) && current_user_can('manage_options');
187 $event= isset($meta['event']) ? $meta['event'] : '';
188 $id= isset($meta['crm_id']) ? $meta['crm_id'] : '';
189 if($debug){ ob_start();}
190 if(isset($meta['primary_key']) && $meta['primary_key']!="" && isset($fields[$meta['primary_key']]['value']) && $fields[$meta['primary_key']]['value']!=""){
191 $search=$fields[$meta['primary_key']]['value'];
192 $field=$meta['primary_key'];
193
194 $search_response=$this->post_crm('search-members?list_id='.$module.'&query='.urlencode($search),'get');
195
196 if(!empty($search_response['exact_matches']['members']) && is_array($search_response['exact_matches']['members']) && count($search_response['exact_matches']['members']) > 0){
197 $items=$search_response['exact_matches']['members'];
198 //$item=end($items);
199 if(!empty($items[0]['id'])){
200 $id=$items[0]['id'];
201 $search_response =$items[0];
202 }
203 }
204
205 if($debug){
206 ?>
207 <h3>Search field</h3>
208 <p><?php print_r($field) ?></p>
209 <h3>Search term</h3>
210 <p><?php print_r($search) ?></p>
211 <h3>POST Body</h3>
212 <p><?php print_r($body) ?></p>
213 <h3>Search response</h3>
214 <p><?php print_r($res) ?></p>
215 <?php
216 }
217
218 $extra["body"]=$search;
219 $extra["response"]=$search_response;
220 }
221 if(!empty($meta['vx_unsub'])){
222 if(empty($id)){
223 return '';
224 }else{
225 $event='delete';
226 }
227 }
228
229 if(in_array($event,array('delete_note','add_note'))){
230 if(isset($meta['related_object'])){
231 $extra['Note Object']= $meta['related_object'];
232 }
233 if(isset($meta['note_object_link'])){
234 $extra['note_object_link']=$meta['note_object_link'];
235 }
236 }
237
238 $status=$action=$method=""; $send_body=true;
239 $entry_exists=false;
240
241 $object_url='';
242 $is_main=false;
243 $post=array();
244 if($id == ""){
245 //insert new object
246 $action="Added"; $status="1"; $method='post';
247 $object_url='lists/'.$module.'/members';
248 $is_main=true;
249 }else{
250 $entry_exists=true;
251 if($event == 'add_note'){
252 if(!empty($fields['body']['value'])){
253 $post['note']=$fields['body']['value'];
254 }
255
256 $action="Note Added"; $status="1";
257 $object_url='lists/'.$meta['related_object'].'/members/'.$id.'/notes';
258 $method='post';
259 }else if(in_array($event,array('delete','delete_note'))){
260 $send_body=false;
261 $method='delete';
262 $object_url='';
263 if($event == 'delete_note' && !empty($meta['note_object_link'])){
264 $object_url='lists/'.$meta['related_object'].'/members/'.$meta['note_object_link'].'/notes/'.$id;
265 }else{
266 $object_url='lists/'.$meta['object'].'/members/'.$id;
267 }
268 $action="Deleted";
269 $status="5";
270
271 }else{
272 $action="Updated"; $status="2";
273 if(empty($meta['update'])){
274 $is_main=true;
275 $object_url='lists/'.$module.'/members/'.$id;
276 $method='patch';
277 } }
278 }
279
280 if($is_main){
281
282 $crm_fields=array();
283 if(!empty($meta['fields'])){
284 $crm_fields=$meta['fields'];
285 }
286
287 if(is_array($fields) && count($fields)>0){
288 $merge_fields=array();
289 foreach($fields as $k=>$v){
290 if(!empty($crm_fields[$k]['type'])){
291 $type=$crm_fields[$k]['type'];
292 $val=$v['value'];
293
294 if($type == 'birthday'){ $temp_val=strtotime($val); if(!empty($temp_val)){ $val=date('m/d',$temp_val); } }
295 if($type == 'address'){
296 if(strpos($k,'-') !== false){
297 $key_arr=explode('-',$k);
298 $merge_fields[$key_arr[0]][$key_arr[1]]=$val;
299 }
300 }else if($k == 'email_address'){
301 $post[$k]=$val;
302 }else if(in_array($k,array('tags','interests'))){
303 if(!empty($val)){
304 if(is_string($val)){
305 $val=array_map('trim',explode(',',$val));
306 }
307 if(is_array($val)){
308 if($k == 'interests'){
309 foreach($val as $g){
310 $post[$k][$g]=true;
311 }
312 }else{
313 $post[$k]=$val;
314 } }
315 }
316 }else{
317 $merge_fields[$k]=$val;
318 } }
319 }
320 if(!empty($merge_fields)){
321 $post['merge_fields']=$merge_fields;
322 }
323 $post['status']=!empty($meta['status']) ? $meta['status'] : 'subscribed';
324 $post['email_type']=!empty($meta['email_type']) ? $meta['email_type'] : 'html';
325 $post['language']=!empty($meta['language']) ? $meta['language'] : 'en';
326 if(!empty($meta['vip'])){
327 $post['vip']=true;
328 }
329 if(!empty($meta['assign_group']) && !empty($meta['groups'])){
330 if(!isset($post['interests'])){ $post['interests']=array(); }
331 foreach($meta['groups'] as $k=>$g){
332 $post['interests'][$k]=true;
333 }
334 }
335
336 } }
337 ///var_dump($post,$meta['groups']); die();
338 $link=""; $error="";
339 if(!empty($method) && !empty($object_url) ){
340 $arr= $this->post_crm($object_url, $method,$post);
341 }
342 //var_dump($object_url,$arr,$post,$method); die();
343
344 if(!empty($arr['detail'])){
345 $status=''; $error=$arr['detail'];
346 }else if(!empty($arr['id'])){
347 $id=$arr['id'];
348 //apply tags , when updating a member
349 if($status == '2' && !empty($post['tags'])){
350 $tags=array();
351 foreach($post['tags'] as $v){
352 $tags[]=array('name'=>$v,'status'=>'active');
353 }
354
355 $extra['Tags Response']=$this->post_crm($object_url.'/tags','post',array('tags'=>$tags));
356 }
357 }
358 if($debug){
359 ?>
360 <h3>Account Information</h3>
361 <p><?php //print_r($this->info) ?></p>
362 <h3>Data Sent</h3>
363 <p><?php print_r($post) ?></p>
364 <h3>Fields</h3>
365 <p><?php echo json_encode($fields) ?></p>
366 <h3>Response</h3>
367 <p><?php print_r($response) ?></p>
368 <h3>Object</h3>
369 <p><?php print_r($module."--------".$action) ?></p>
370 <?php
371 echo $contents=trim(ob_get_clean());
372 if($contents!=""){
373 update_option($this->id."_debug",$contents);
374 }
375 }
376 //add entry note
377 if(!empty($meta['__vx_entry_note']) && !empty($id)){
378 $disable_note=$this->post('disable_entry_note',$meta);
379 if(!($entry_exists && !empty($disable_note))){
380 $entry_note=$meta['__vx_entry_note'];
381 if(!empty($entry_note['body'])){
382 $note_post=array('note'=>$entry_note['body']);
383 $object_url='lists/'.$module.'/members/'.$id.'/notes';
384 $note_response= $this->post_crm( $object_url,'post',$note_post);
385 $extra['Note Body']=$entry_note['body'];
386 $extra['Note Response']=$note_response;
387 }
388 }
389 }
390
391 return array("error"=>$error,"id"=>$id,"link"=>$link,"action"=>$action,"status"=>$status,"data"=>$fields,"response"=>$arr,"extra"=>$extra);
392 }
393 public function create_fields_section($fields){
394 $arr=array();
395 if(!isset($fields['object'])){
396 $objects=array(''=>'Select Object');
397 $objs=$this->get_crm_objects();
398 if(is_array($objs) && count($objs)>0){
399 $objects=array_merge($objects,$objs);
400 }
401 $arr['gen_sel']['object']=array('label'=>'Select Object','options'=>$objects,'is_ajax'=>true,'req'=>true);
402 }else if(isset($fields['fields']) && !empty($fields['object'])){
403 // filter fields
404 $crm_fields=$this->get_crm_fields($fields['object']);
405 if(!is_array($crm_fields)){
406 $crm_fields=array();
407 }
408 $add_fields=array();
409 if(is_array($fields['fields']) && count($fields['fields'])>0){
410 foreach($fields['fields'] as $k=>$v){
411 $found=false;
412 foreach($crm_fields as $crm_key=>$val){
413 if(strpos($crm_key,$k)!== false){
414 $found=true; break;
415 }
416 }
417 // echo $found.'---------'.$k.'============'.$crm_key.'<hr>';
418 if(!$found){
419 $add_fields[$k]=$v;
420 }
421 }
422 }
423 $arr['fields']=$add_fields;
424 }
425
426 return $arr;
427 }
428 public function field_types($data){
429 return array('text'=>'Text','email'=>'Email',"number"=>'Number', "phone"=>'Phone',"date"=>'Date', "url"=>'Url', "imageurl"=>'Image URL', "birthday"=>'BirthDay');
430 }
431 public function create_field($field){
432 // return 'ok';
433
434 $name=isset($field['name']) ? $field['name'] : '';
435 $label=isset($field['label']) ? $field['label'] : '';
436 $type=isset($field['type']) ? $field['type'] : '';
437 $object=isset($field['object']) ? $field['object'] : '';
438
439 $error='Unknow error';
440 if(!empty($label) && !empty($type) && !empty($object)){
441 $body=array('name'=>$label,'type'=>$type);
442 $url='lists/'.$object.'/merge-fields';
443 $arr=$this->post_crm($url,'post',$body);
444 $error='ok';
445 if(!empty($arr['error']) ){
446
447 $error=$arr['error'];
448 }
449 }
450 return $error;
451 }
452
453 public function post_crm($path,$method,$body=''){
454
455 $url=$this->url.$path;
456 if(is_array($body)&& count($body)>0)
457 {
458 $body=json_encode($body);
459 }
460
461
462
463 $head=array('Authorization'=> ' apikey ' .$this->api_key);
464 if($method == 'post'){
465 $head['Content-Type']='application/json';
466 }
467
468 $args = array(
469 'body' => $body,
470 'headers'=> $head,
471 'method' => strtoupper($method), // GET, POST, PUT, DELETE, etc.
472 'sslverify' => false,
473 'timeout' => 30,
474 );
475
476 $response = wp_remote_request($url, $args);
477 if(is_wp_error($response)) {
478 $error = $response->get_error_message();
479 return array('detail'=>$error);
480 }
481 $body=json_decode($response['body'],true);
482
483 return $body;
484 }
485 public function get_entry($module,$id){
486
487
488 $arr=$this->post_crm('lists/'.$module.'/members/'.$id,'get');
489 if(!empty($arr['merge_fields']) && is_array($arr['merge_fields'])){
490 foreach($arr['merge_fields'] as $k=>$v){
491 if(is_array($v)){
492 foreach($v as $key=>$val){
493 $arr[$k.'-'.$key]=$val;
494 } }else{
495 $arr[$k]=$v;
496 }
497 }
498 }
499
500 return $arr;
501 }
502 }
503 }
504 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * Plugin Name: Integration for Contact Form 7 and Mailchimp
4 * Description: Integrates Contact Form 7 and <a href="https://wordpress.org/plugins/contact-form-entries/">Contact Form Entries Plugin</a> with Mailchimp allowing form submissions to be automatically sent to your Mailchimp account
5 * Version: 1.1.2
6 * Requires at least: 3.8
7 * Tested up to: 6.1
8 * Author URI: https://www.crmperks.com
9 * Plugin URI: https://www.crmperks.com/plugins/contact-form-plugins/contact-form-mailchimp-plugin/
10 * Author: CRM Perks.
11 * Text Domain: contact-form-mailchimp
12 * Domain Path: /languages/
13 */
14 // Exit if accessed directly
15 if( !defined( 'ABSPATH' ) ) exit;
16
17
18 if( !class_exists( 'vxcf_mailchimp' ) ):
19
20
21 class vxcf_mailchimp {
22
23
24 public $url = "https://www.crmperks.com";
25
26 public $crm_name = "mailchimp";
27 public $id = "vxcf_mailchimp";
28 public $domain = "vxcf-mailchimp";
29 public $version = "1.1.2";
30 public $update_id = "6000001";
31 public $min_cf_version = "1.0";
32 public $type = "vxcf_mailchimp";
33 public $fields = null;
34 public $data = null;
35
36 private $filter_condition;
37 private $plugin_dir= "";
38 private $temp;
39 private $crm_arr= false;
40 public $notice_js= false;
41 public static $title='Contact Form Mailchimp Plugin';
42 public static $path = '';
43 public static $slug = "";
44 public static $debug_html = '';
45 public static $save_key='';
46 public static $lic_msg = "";
47 public static $db_version='';
48 public static $vx_plugins;
49 public static $note;
50 public static $feeds_res;
51 public static $cf_status='';
52 public static $cf_status_msg='';
53 public static $tooltips;
54 public static $entry_created=false;
55 public static $plugin;
56 public static $api_timeout;
57 public static $is_pr;
58
59 public function instance(){
60 add_action( 'plugins_loaded', array( $this, 'setup_main' ) );
61 register_deactivation_hook(__FILE__,array($this,'deactivate'));
62 register_activation_hook(__FILE__,(array($this,'activate')));
63
64
65
66 }
67 /**
68 * Plugin starting point. Will load appropriate files
69 *
70 */
71 public function init(){
72
73 /* self::$cf_status= $this->cf_status();
74 if(self::$cf_status !== 1){
75 add_action( 'admin_notices', array( $this, 'install_cf_notice' ) );
76 add_action( 'after_plugin_row_'.self::$slug, array( $this, 'install_cf_notice_plugin_row' ) );
77 return;
78 } */
79
80 $pro_file=self::$path . 'wp/crmperks-notices.php';
81 if(file_exists($pro_file)){
82 include_once($pro_file);
83 }else{
84 //plugin api
85 $this->plugin_api(true);
86 self::$is_pr=true;
87 $pro_file=self::$path . 'pro/add-ons.php';
88 if(file_exists($pro_file)){
89 include_once($pro_file);
90 } }
91
92 require_once(self::$path . "includes/crmperks-cf.php");
93 require_once(self::$path . "includes/plugin-pages.php");
94
95
96 }
97
98 /**
99 * create tables and roles
100 *
101 */
102 public function setup_main(){
103
104 add_filter('wpcf7_before_send_mail', array($this, 'form_submitted'),99);
105 add_action('cfx_form_submitted', array($this, 'entry_created_crmperks'),10,3);
106 add_action('vxcf_entry_created', array($this, 'entry_created'),10,3);
107 add_action('vx_contact_created', array($this, 'entry_created_contacts'),10,3);
108 add_action('vx_callcenter_entry_created', array($this, 'entry_created_callcenter'),10,3);
109
110 if(is_admin()){
111 self::$path=$this->get_base_path();
112 add_action('init', array($this,'init'));
113 //loading translations
114 load_plugin_textdomain('contact-form-mailchimp-crm', FALSE, $this->plugin_dir_name(). '/languages/' );
115
116 self::$db_version=get_option($this->type."_version");
117 if(self::$db_version != $this->version && current_user_can( 'manage_options' )){
118 $data=$this->get_data_object();
119 $data->update_table();
120 update_option($this->type."_version", $this->version);
121 //add post permissions
122 require_once(self::$path . "includes/install.php");
123 $install=new vxcf_mailchimp_install();
124 $install->create_roles();
125
126 }
127 }
128
129 }
130 public function form_submitted($form){
131
132 //entries plugin exists , do not use this hook
133 if(class_exists('vxcf_form')){ return; }
134 $form_id=$form->id();
135 $submission = WPCF7_Submission::get_instance();
136
137 $lead = $submission->uploaded_files();
138 if(!is_array($lead)){ $lead=array(); }
139 $form_title=$form->title();
140 $tags=array();
141
142 if(method_exists('WPCF7_ShortcodeManager','get_instance') || method_exists('WPCF7_FormTagsManager','get_instance')){
143
144 $form_text=get_post_meta($form_id ,'_form',true);
145
146 if(method_exists('WPCF7_FormTagsManager','get_instance')){
147 $manager=WPCF7_FormTagsManager::get_instance();
148 $contents=$manager->scan($form_text);
149 $tags=$manager->get_scanned_tags();
150
151 }else if(method_exists('WPCF7_ShortcodeManager','get_instance')){ //
152 $manager = WPCF7_ShortcodeManager::get_instance();
153 $contents=$manager->do_shortcode($form_text);
154 $tags=$manager->get_scanned_tags();
155 } }
156
157
158 if(is_array($tags)){
159 foreach($tags as $k=>$v){
160 if(!empty($v['name'])){
161 $name=$v['name'];
162 $val=$submission->get_posted_data($name);
163 if(!isset($lead[$name])){ $lead[$name]=$val; }
164
165 } }
166 }
167 //var_dump($lead);
168 $form_arr=array('id'=>'cf_'.$form_id,'name'=>$form_title,'fields'=>$tags);
169 $this->entry_created($lead,'0',$form_arr);
170
171 }
172 public function plugin_api($start_instance=false){
173 if(empty(self::$path)){ self::$path=$this->get_base_path(); }
174 $api_file=self::$path . "pro/plugin-api.php";
175 if(!class_exists('vxcf_plugin_api') && file_exists( $api_file)){
176 require_once( $api_file );
177 }
178 if(class_exists('vxcf_plugin_api')){
179 $slug=$this->get_slug();
180 $settings_link=$this->link_to_settings();
181 $is_plugin_page=$this->is_crm_page();
182 self::$plugin=new vxcf_plugin_api($this->id,$this->version,$this->type,$this->domain,$this->update_id,self::$title,$slug,self::$path,$settings_link,$is_plugin_page);
183 if($start_instance){
184 self::$plugin->instance();
185 }
186 } }
187 /**
188 * contact form entry created
189 *
190 * @param mixed $entry
191 * @param mixed $form
192 */
193 public function entry_created($entry,$entry_id,$form){
194
195 self::$entry_created=true;
196
197 if($this->do_actions()){
198 do_action('vx_addons_save_entry',$entry_id,$entry,'cf',$form);
199 }
200
201 $entry['__vx_id']=$entry_id;
202 $this->push($entry,$form,'',false);
203 }
204 public function entry_created_crmperks($entry_id,$entry,$form){
205 self::$entry_created=true;
206 if($this->do_actions()){
207 do_action('vx_addons_save_entry',$entry_id,$entry,'vf',$form);
208 }
209
210 $form['id']='vf_'.$form['id'];
211 $form['cfx_type']='vf';
212 $entry['__vx_id']=$entry_id;
213 $this->push($entry,$form,'',false);
214 }
215 public function entry_created_contacts($entry,$entry_id,$form){
216
217 if($this->do_actions()){
218 do_action('vx_addons_save_entry',$entry_id,$entry,'cc',$form);
219 }
220
221 $entry['__vx_id']=$entry_id;
222 $this->push($entry,$form,'',false);
223 }
224 public function entry_created_callcenter($entry,$entry_id,$form){
225 $this->push($entry,$form,'',false);
226 }
227
228 /**
229 * Install Contact Form Notice
230 *
231 */
232 public function install_cf_notice(){
233 $message=self::$cf_status_msg;
234 if(!empty($message)){
235 $this->display_msg('admin',$message,'gravity');
236 $this->notice_js=true;
237
238 }
239 }
240 public function submit(){
241 $entry='{"your-name":"Your Name (required)","your-email":"admin@localhost.com","your-subject":"subject test","your-message":"sdfsdfsdfsdf","your-country":["India"],"your-sports":["Tennis"],"your-fruit":["Banana"],"your-browser":"Safari","your-file":""}';
242 $form='{"id":69,"name":"Contact form 1"}';
243 $entry=json_decode($entry,true);
244 $form=json_decode($form,true);
245 apply_filters('vx_addons_save_entry',false,$entry_id,$entry,'cf',$form);
246 $entry['__vx_id']="1";
247 $p=$this->push($entry,$form);
248 var_dump($p); die();
249 }
250
251 /**
252 * Install Contact Form Notice (plugin row)
253 *
254 */
255 public function install_cf_notice_plugin_row(){
256 $message=self::$cf_status_msg;
257 if(!empty($message)){
258 $this->display_msg('',$message,'gravity');
259 }
260 }
261 /**
262 * display admin notice
263 *
264 * @param mixed $type
265 * @param mixed $message
266 * @param mixed $id
267 */
268 public function display_msg($type,$message,$id=""){
269 //exp
270 global $wp_version;
271 $ver=floatval($wp_version);
272 if($type == "admin"){
273 if($ver<4.2){
274 ?>
275 <div class="error vx_notice notice" data-id="<?php echo esc_attr($id) ?>"><p style="display: table"><span style="display: table-cell; width: 98%"><span class="dashicons dashicons-megaphone"></span> <b><?php esc_html_e('Contact Form Mailchimp Plugin','contact-form-mailchimp-crm') ?>. </b><?php echo wp_kses_post($message);?> </span>
276 <span style="display: table-cell; padding-left: 10px; vertical-align: middle;"><a href="#" class="notice-dismiss" title="<?php esc_html_e('Dismiss Notice','contact-form-mailchimp-crm') ?>">dismiss</a></span> </p></div>
277 <?php
278 }else{
279 ?>
280 <div class="error vx_notice notice below-h2 is-dismissible" data-id="<?php echo esc_attr($id) ?>"><p><span class="dashicons dashicons-megaphone"></span> <b><?php esc_html_e('Contact Form Mailchimp Plugin','contact-form-mailchimp-crm') ?>. </b> <?php echo wp_kses_post($message);?> </p>
281 </div>
282 <?php
283 }
284 }else{
285 ?>
286 <tr class="plugin-update-tr"><td colspan="5" class="plugin-update">
287 <style type="text/css"> .vx_msg a{color: #fff; text-decoration: underline;} .vx_msg a:hover{color: #eee} </style>
288 <div style="background-color: rgba(224, 224, 224, 0.5); padding: 9px; margin: 0px 10px 10px 28px "><div style="background-color: #d54d21; padding: 5px 10px; color: #fff" class="vx_msg"> <span class="dashicons dashicons-info"></span> <?php echo wp_kses_post($message) ?>
289 </div></div></td></tr>
290 <?php
291 }
292 }
293 /**
294 * admin_screen_message function.
295 *
296 * @param mixed $message
297 * @param mixed $level
298 */
299 public function screen_msg( $message, $level = 'updated') {
300 echo '<div class="'. esc_attr( $level ) .' fade notice below-h2 is-dismissible"><p>';
301 echo wp_kses_post($message) ;
302 echo '</p></div>';
303 }
304
305
306 /**
307 * create tables and roles
308 *
309 */
310 public function install(){
311
312 if(current_user_can( 'manage_options' )){
313 self::$db_version=get_option($this->type."_version");
314 if(self::$db_version != $this->version){
315 $data=$this->get_data_object();
316 $data->update_table();
317 update_option($this->type."_version", $this->version);
318 //add post permissions
319 require_once(self::$path . "includes/install.php");
320 $install=new vxcf_mailchimp_install();
321 $install->create_roles();
322
323 }
324
325 }
326 }
327 /**
328 * Contact Form status
329 *
330 */
331 public function cf_status() {
332
333 $installed = 0;
334 if(!class_exists('vxcf_form')) {
335 if(file_exists(WP_PLUGIN_DIR.'/contact-form-entries-pro/contact-form-entries-pro.php')) {
336 $installed=2;
337 }
338 }else{
339 $installed=1;
340 if(!$this->is_cf_supported()){
341 $installed=3;
342 }
343 }
344 if($installed !=1){
345 if($installed === 0){ // not found
346 $message = sprintf(__("%sContact Form Entries%s is required. %s it today!%s", 'contact-form-mailchimp-crm'), "<a href='https://www.crmperks.com/'>", "</a>", "<a href='https://www.crmperks.com/'>", "</a>");
347 }else if($installed === 2){ // not active
348 $message = sprintf(__('Contact Form Entries is installed but not active. %sActivate Contact Form Entries%s to use the Contact Form Mailchimp Plugin','contact-form-mailchimp-crm'), '<strong><a href="'.wp_nonce_url(admin_url('plugins.php?action=activate&plugin=contact-form-entries-pro/contact-form-entries-pro.php'), 'activate-plugin_contact-form-entries-pro/contact-form-entries-pro.php').'">', '</a></strong>');
349 } else if($installed === 3){ // not supported
350 $message = sprintf(__("A higher version of %sContact Form Entries%s is required. %sPurchase it today!%s", 'contact-form-mailchimp-crm'), "<a href='https://www.crmperks.com/'>", "</a>", "<a href='https://www.crmperks.com/'>", "</a>");
351 }
352 self::$cf_status_msg=$message;
353 }
354 return $installed;
355 }
356
357
358 /**
359 * Returns true if the current page is an Feed pages. Returns false if not
360 *
361 * @param mixed $page
362 */
363 public function is_crm_page($page=""){
364 if(empty($page)) {
365 $page = $this->post("page");
366 }
367 return $page == $this->id;
368 }
369
370
371 /**
372 * form fields
373 *
374 * @param mixed $form_id
375 */
376 public function get_form_fields($form_id){
377 $fields=array();
378
379 $fields=apply_filters('vx_add_crm_form_fields',$fields,$form_id);
380 if(empty($fields)){
381 global $vxcf_form;
382
383 if(is_object($vxcf_form) && method_exists($vxcf_form,'get_form_fields')){
384 $fields=$vxcf_form->get_form_fields($form_id);
385 }else if(strpos($form_id,'cf_') === 0 ){
386 if(method_exists('WPCF7_ShortcodeManager','get_instance') || method_exists('WPCF7_FormTagsManager','get_instance')){
387 $id=substr($form_id,3);
388 $form_text=get_post_meta($id,'_form',true);
389
390 if(method_exists('WPCF7_FormTagsManager','get_instance')){
391 $manager=WPCF7_FormTagsManager::get_instance();
392 $contents=$manager->scan($form_text);
393 $tags=$manager->get_scanned_tags();
394
395 }else if(method_exists('WPCF7_ShortcodeManager','get_instance')){ //
396 $manager = WPCF7_ShortcodeManager::get_instance();
397 $contents=$manager->do_shortcode($form_text);
398 $tags=$manager->get_scanned_tags();
399 }
400
401 if(is_array($tags)){
402 foreach($tags as $tag){
403 if(is_object($tag)){ $tag=(array)$tag; }
404 if(!empty($tag['name'])){
405 $id=str_replace(' ','',$tag['name']);
406 $tag['label']=ucwords(str_replace(array('-','_')," ",$tag['name']));
407 $tag['type_']=$tag['type'];
408 $tag['type']=$tag['basetype'];
409 $tag['req']=strpos($tag['type'],'*') !==false ? 'true' : '';
410 if($tag['type'] == 'select' && !empty($tag['options']) && array_search('multiple',$tag['options'])!== false){
411 $tag['type']='multiselect';
412 }
413 $fields[$id]=$tag;
414 }
415 }
416 }
417 }
418 }
419 }
420 return $fields;
421 }
422
423 public function get_form($form_id){
424
425 $title='Contacts Addon';
426 if($form_id !='vx_contacts'){
427 global $vxcf_form;
428 if(method_exists($vxcf_form,'get_forms')){
429 $forms=$vxcf_form->get_forms();
430 if(is_array($forms) && count($forms)>0){
431 foreach($forms as $key=>$vals){
432 $found=false;
433 if(!empty($vals['forms']) && is_array($vals['forms'])){
434 foreach($vals['forms'] as $k=>$v){
435 $f_id=$key.'_'.$k;
436 if($f_id == $form_id){
437 $found=true;
438 if(!empty($v)){
439 $title=$v;
440 }
441 break;
442 }
443 }
444 }
445 if($found){
446 break;
447 }
448 }
449 }
450 }
451 }
452 $form=array('id'=>$form_id,'title'=>$title,'name'=>$title);
453
454 return $form;
455 }
456
457
458 /**
459 * settings link
460 *
461 * @param mixed $escaped
462 */
463 public function link_to_settings( $tab='' ) {
464 $q=array('page'=>$this->id);
465 if(!empty($tab)){
466 $q['tab']=$tab;
467 }
468 $url = admin_url('admin.php?'.http_build_query($q));
469
470 return $url;
471 }
472
473
474 /**
475 * Get CRM info
476 *
477 */
478 public function get_info($id){
479 $data=$this->get_data_object();
480 $info=$data->get_account($id);
481 $data=array(); $meta=$info_arr=array();
482 if(is_array($info)){
483 if(!empty($info['data'])){
484 $info['data']=trim($info['data']);
485 if(strpos($info['data'],'{') !== 0){
486 $info['data']=$this->de_crypt($info['data']);
487 }
488 $info_arr=json_decode($info['data'],true);
489 if(!is_array($info_arr)){
490 $info_arr=array();
491 }
492 }
493
494 $info_arr['time']=$info['time'];
495 $info_arr['id']=$info['id'];
496 $info['data']=$info_arr;
497 if(!empty($info['meta'])){
498 $meta=json_decode($info['meta'],true);
499 }
500 $info['meta']=is_array($meta) ? $meta : array();
501
502 }
503 return $info;
504 }
505 /**
506 * update account
507 *
508 * @param mixed $data
509 * @param mixed $id
510 */
511 public function update_info($data,$id) {
512
513 if(empty($id)){
514 return;
515 }
516
517 $time = current_time( 'mysql' ,1);
518
519 $sql=array('updated'=>$time);
520 if(is_array($data)){
521
522
523 if(isset($data['meta'])){
524 $sql['meta']= json_encode($data['meta']);
525 }
526 if( isset($data['data']) && is_array($data['data'])){
527 $_data=$this->get_data_object();
528 $acount=$_data->get_account($id);
529 if(array_key_exists('time' , $data['data']) && empty($data['data']['time'])){
530 $sql['time']= $time;
531 $sql['status']= '2';
532 }
533 if(isset($data['data']['class'])){
534 $sql['status']= $data['data']['class'] == 'updated' ? '1' : '2';
535 }
536 if(isset($data['data']['meta'])){
537 unset($data['data']['meta']);
538 }
539 if(isset($data['data']['status'])){
540 unset($data['data']['status']);
541 }
542 if(isset($data['data']['name'])){
543 $sql['name']=$data['data']['name'];
544 // unset($data['data']['name']);
545 }else if(isset($_GET['id'])){
546 $sql['name']="Account #".$this->post('id');
547 }
548
549 $enc_str=json_encode($data['data']);
550 //$enc_str=$this->en_crypt($enc_str);
551 $sql['data']=$enc_str;
552 }
553 }
554
555 $data=$this->get_data_object();
556 $result = $data->update_info_data($sql,$id);
557
558
559 return $result;
560 }
561
562 /**
563 * contact form field values, modify check boxes etc
564 *
565 * @param mixed $entry
566 * @param mixed $form
567 * @param mixed $gf_field_id
568 * @param mixed $crm_field_id
569 * @param mixed $custom
570 */
571 public function verify_field_val($entry,$field_id,$sf_id=''){
572 $value=false;
573
574 if(isset($entry[$field_id])){
575 $value=$entry[$field_id];
576 if(is_array($value) && isset($value['value'])){
577 $value=$value['value'];
578 }
579 if(!is_array($value)){
580 $value=maybe_unserialize($value);
581 }
582
583 }
584 $fields=$this->form_fields;
585 $type=isset($fields[$field_id]['type']) ? $fields[$field_id]['type'] : '';
586 if( $type == 'file' && !empty($value)){
587 if(class_exists('vxcf_form')){
588 $upload=vxcf_form::get_upload_dir();
589 $temp_files=array();
590 if(!is_array($value)){ $value=array($value); }
591 foreach($value as $f){
592 if(filter_var($f,FILTER_VALIDATE_URL) === false){
593 if(strpos($sf_id,'vx_list_files') !== false){
594 $f=$upload['dir'].$f;
595 }else{
596 $f=$upload['url'].$f; //url , dir
597 } }
598 $temp_files[]=$f;
599 } $value=$temp_files;
600 }
601 $value=trim(implode(' ',$value));
602 }else if( is_array($value) && count($value) == 1 ){
603 $value=trim(implode(' ',$value));
604 }
605 return $value;
606 }
607 /**
608 * filter enteries
609 *
610 * @param mixed $feed
611 * @param mixed $entry
612 * @param mixed $form
613 */
614 public function check_filter($feed,$entry){
615 $filters=$this->post('filters',$feed);
616 $final=$this->filter_condition=null;
617 if(is_array($filters)){
618 $time=current_time('timestamp');
619 foreach($filters as $filter_s){
620 $check=null; $and=null;
621 if(is_array($filter_s)){
622 foreach($filter_s as $filter){
623 $field=$filter['field'];
624 $fval=$filter['value'];
625 $val=$this->verify_field_val($entry,$field);
626 if(is_array($val)){ $val=trim(implode(' ',$val)); }
627 switch($filter['op']){
628 case"is": $check=$fval == $val; break;
629 case"is_not": $check=$fval != $val; break;
630 case"contains": $check=strpos($val,$fval) !==false; break;
631 case"not_contains": $check=strpos($val,$fval) ===false; break;
632 case"is_in": $check=strpos($fval,$val) !==false; break;
633 case"not_in": $check=strpos($fval,$val) ===false; break;
634 case"starts": $check=strpos($val,$fval) === 0; break;
635 case"not_starts": $check=strpos($val,$fval) !== 0; break;
636 case"ends": $check=(strpos($val,$fval)+strlen($fval)) == strlen($val); break;
637 case"not_ends": $check=(strpos($val,$fval)+strlen($fval)) != strlen($val); break;
638 case"less": $check=(float)$val<(float)$fval; break;
639 case"greater": $check=(float)$val>(float)$fval; break;
640 case"less_date": $check=strtotime($val,$time) < strtotime($fval,$time); break;
641 case"greater_date": $check=strtotime($val,$time) > strtotime($fval,$time); break;
642 case"equal_date": $check=strtotime($val,$time) == strtotime($fval,$time); break;
643 case"empty": $check=$val == ""; break;
644 case"not_empty": $check=$val != ""; break;
645 }
646 $and_c[]=array("check"=>$check,"field_val"=>$fval,"input"=>$val,"field"=>$field,"op"=>$filter['op']);
647 if($check !== null){
648 if($and !== null){
649 $and=$and && $check;
650 }else{
651 $and=$check;
652 }
653 }
654 } //end and loop filter
655 }
656 if($and !== null){
657 if($final !== null){
658 $final=$final || $and;
659 }else{
660 $final=$and;
661 }
662 }
663 $this->filter_condition[]=$and_c;
664 } // end or loop
665 }
666 return $final === null ? true : $final;
667 }
668
669 public function get_all_objects(){
670 $option=get_option($this->id.'_meta',array());
671 $objects=array();
672 if(!empty($option['objects'])){
673 $objects=$option['objects'];
674 }
675 return $objects;
676 }
677 /**
678 * Logs page row
679 *
680 * @param mixed $feed
681 */
682 public function verify_log($feed,$objects=''){
683 $link="N/A"; $desc=__("Added to ",'contact-form-mailchimp-crm');
684 $status_imgs=array("1"=>"created","2"=>"updated","4"=>"filtered",'5'=>'deleted');
685 $feed['status_img']=isset($status_imgs[$feed["status"]]) ? $status_imgs[$feed["status"]] : 'failed';
686
687 if(isset($objects[$feed['object']])){
688 $feed['object']=$objects[$feed['object']];
689 }
690
691 if(!empty($feed['crm_id'])&& !empty($feed['object']) && !empty($feed['status'])){
692
693 $link=$feed['crm_id'];
694
695 if($feed['status'] == 1 && $feed['event'] == 'add_note'){
696 // $desc="Note Added to ";
697 }
698 if($feed['status'] == 2){
699 $desc="Updated to ";
700 }
701 $desc.=$feed['object'];
702 if($feed['status'] == 5){
703 $desc=sprintf(__("Deleted from %s",'contact-form-mailchimp-crm'),$feed['object']);
704 }
705 }else if($feed['status'] == 4){
706 $desc=sprintf(__("Filtered from %s",'contact-form-mailchimp-crm'),$feed['object']);
707 }else{
708 $desc= !empty($feed['error']) ? $feed['error'] : esc_html__("Unknown Error",'contact-form-mailchimp-crm');
709 }
710 $title=__("Failed",'contact-form-mailchimp-crm');
711 if($feed['status'] == 1){
712 $title=__("Created",'contact-form-mailchimp-crm');
713 }else if($feed['status'] == 2){
714 $title=__("Updated",'contact-form-mailchimp-crm');
715 }else if($feed['status'] == 4){
716 $title=__("Filtered",'contact-form-mailchimp-crm');
717 }else if($feed['status'] == 5){
718 $title=__("Deleted",'contact-form-mailchimp-crm');
719 }
720 $feed['_crm_id']= !empty($feed['crm_id']) ? $feed['crm_id'] : "N/A";
721 $feed['a_link']=$link;
722 $feed['desc']=$desc;
723 $feed['title']=$title;
724 return $feed;
725 }
726 /**
727 * get address components
728 *
729 * @param mixed $entry
730 * @param mixed $field_id
731 * @param mixed $type
732 */
733 private function get_address($entry, $field_id,$type=""){
734 $street_value = str_replace(" ", " ", trim($entry[$field_id . ".1"]));
735 $street2_value = str_replace(" ", " ", trim($entry[$field_id . ".2"]));
736 $city_value = str_replace(" ", " ", trim($entry[$field_id . ".3"]));
737 $state_value = str_replace(" ", " ", trim($entry[$field_id . ".4"]));
738 $zip_value = trim($entry[$field_id . ".5"]);
739 if(method_exists('GF_Field_Address','get_country_code')){
740 $field_c=new GF_Field_Address();
741 $country_value=$field_c->get_country_code(trim($entry[$field_id . ".6"]));
742 }else{
743 $country_value = GFCommon::get_country_code(trim($entry[$field_id . ".6"]));
744 }
745 $country =trim($entry[$field_id . ".6"]);
746 $address = $street_value;
747 $address .= !empty($address) && !empty($street2_value) ? " $street2_value" : $street2_value;
748 if($type =="json"){
749 $arr=array("street"=>$address,"city"=>$city_value,"state"=>$state_value,"zip"=>$zip_value,"country"=>$country);
750 return json_encode($arr);
751 }
752 $address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? " $city_value" : $city_value;
753 $address .= !empty($address) && !empty($city_value) && !empty($state_value) ? " $state_value" : $state_value;
754 $address .= !empty($address) && !empty($zip_value) ? " $zip_value" : $zip_value;
755 $address .= !empty($address) && !empty($country_value) ? " $country_value" : $country_value;
756
757 return $address;
758 }
759
760 /**
761 * Add checkbox to entry info - option to send entry to crm
762 *
763 * @param mixed $form_id
764 * @param mixed $lead
765 */
766 public function entry_info_send_checkbox( $form_id, $lead ) {
767
768 // If this entry's form isn't connected to crm, don't show the checkbox
769 if(!$this->show_send_to_crm_button() ) { return; }
770
771 // If this is not the Edit screen, get outta here.
772 if(empty($_POST["screen_mode"]) || $_POST["screen_mode"] === 'view') { return; }
773
774 if(!current_user_can($this->id."_send_to_crm")){return; }
775
776 if( apply_filters( $this->id.'_show_manual_export_button', true ) ) {
777 printf('<input type="checkbox" name="'.esc_attr($this->id).'_update" id="'.esc_attr($this->id).'_update" value="1" /><label for="'.esc_attr($this->id).'_update" title="%s">%s</label><br /><br />', esc_html__('Create or update this entry in Mailchimp. The fields will be mapped according to the form feed settings.', 'contact-form-mailchimp-crm'), esc_html__('Send to Mailchimp', 'contact-form-mailchimp-crm'));
778 } else {
779 echo '<input type="hidden" name="'.esc_attr($this->id).'_update" id="'.esc_attr($this->id).'_update" value="1" />';
780 }
781 }
782 /**
783 * Add button to entry info - option to send entry to crm
784 *
785 * @param mixed $button
786 */
787 public function entry_info_send_button( $button = '' ) {
788 // If this entry's form isn't connected to crm, don't show the button
789 if(!$this->show_send_to_crm_button()) { return $button; }
790 if(!current_user_can($this->id."_send_to_crm")){return; }
791 // Is this the view or the edit screen?
792 $mode = empty($_POST["screen_mode"]) ? "view" : $this->post("screen_mode");
793 if($mode === 'view') {
794 $margin="";
795 if(defined("vx_btn")){
796 $margin="margin-top: 5px;";
797 }else{define('vx_btn','true');}
798 $button.= '<input type="submit" class="button button-large button-secondary alignright" name="'.esc_attr($this->id).'_send" style="margin-left:5px; '.$margin.'" title="'.__('Create or update this entry in Mailchimp. The fields will be mapped according to the form feed settings.','contact-form-mailchimp-crm').'" value="'.__('Send to Mailchimp', 'contact-form-mailchimp-crm').'" onclick="jQuery(\'#action\').val(\'send_to_crm\')" />';
799 //logs button
800
801 $entry_id=$this->post('lid');
802 $form_id = rgget('id');
803 if(empty($entry_id)){
804 $entry_id=$this->get_entry_id($form_id);
805 }
806 $log_url=admin_url( 'admin.php?page=gf_edit_forms&view=settings&subview='.$this->id.'&tab=log&id='.$this->post('id').'&entry_id='.$entry_id);
807 $button.= '<a class="button button-large button-secondary alignright" style="margin-left:5px; margin-top:5px; " title="'.__('Go to Mailchimp Logs','contact-form-mailchimp-crm').'" href="'.esc_url($log_url).'">'.__('Mailchimp Logs','contact-form-mailchimp-crm').'</a>';
808
809 }
810 return $button;
811 }
812 /**
813 * Whether to show the Entry "Send to CRM" button or not
814 *
815 * If the entry's form has been mapped to CRM feed, show the Send to CRM button. Otherwise, don't.
816 *
817 * @return boolean True: Show the button; False: don't show the button.
818 */
819 private function show_send_to_crm_button() {
820
821 $form_id = rgget('id');
822
823 return $this->has_feed($form_id);
824 }
825 /**
826 * Does the current form have a feed assigned to it?
827 * @param INT $form_id Form ID
828 * @return boolean
829 */
830 function has_feed($form_id) {
831 $data=$this->get_data_object();
832 $feeds = $data->get_feed_by_form( $form_id , true);
833
834 return !empty($feeds);
835 }
836
837
838
839 /**
840 * if contact form installed and supported
841 *
842 */
843 private function is_cf_supported(){
844 if(class_exists("vxcf_form")){
845 global $vxcf_form;
846 $version='1.0';
847 if($vxcf_form->version){
848 $version=$vxcf_form->version;
849 }
850 $is_correct_version = version_compare($version, $this->min_cf_version, ">=");
851 return $is_correct_version;
852 }
853 else{
854 return false;
855 }
856 }
857 /**
858 * uninstall plugin
859 *
860 */
861 public function uninstall(){
862 //droping all tables
863 require_once(self::$path . "includes/install.php");
864 $install=new vxcf_mailchimp_install();
865 do_action('uninstall_vx_plugin_'.$install->id);
866 $install->remove_data();
867 $install->remove_roles();
868 }
869 /**
870 * email validation
871 *
872 * @param mixed $email
873 */
874 public function is_valid_email($email){
875 if(function_exists('filter_var')){
876 if(filter_var($email, FILTER_VALIDATE_EMAIL)){
877 return true;
878 }
879 }else{
880 if(strpos($email,"@")>1){
881 return true;
882 }
883 }
884 return false;
885 }
886 /**
887 * deactivate
888 *
889 * @param mixed $action
890 */
891 public function deactivate($action="deactivate"){
892 do_action('plugin_status_'.$this->type,$action);
893 }
894 /**
895 * activate plugin
896 *
897 */
898 public function activate(){
899 $this->plugin_api(true);
900 do_action('plugin_status_'.$this->type,'activate');
901 }
902 /**
903 * Send CURL Request
904 *
905 * @param mixed $body
906 * @param mixed $path
907 * @param mixed $method
908 */
909 public function request($path="",$method='POST',$body="",$head=array()) {
910
911 $args = array(
912 'body' => $body,
913 'headers'=> $head,
914 'method' => strtoupper($method), // GET, POST, PUT, DELETE, etc.
915 'sslverify' => false,
916 'timeout' => 20,
917 );
918
919 $response = wp_remote_request($path, $args);
920
921 if(is_wp_error($response)) {
922 $this->error_msg= $response->get_error_message();
923 return false;
924 } else if(isset($response['response']['code']) && $response['response']['code'] != 200 && $response['response']['code'] != 404) {
925 $this->error_msg = strip_tags($response['body']);
926 return false;
927 } else if(!$response) {
928 return false;
929 }
930 $result=wp_remote_retrieve_body($response);
931 return $result;
932 }
933
934 /**
935 * Formates User Informations and submitted form to string
936 * This string is sent to email and mailchimp
937 * @param array $info User informations
938 * @param bool $is_html If HTML needed or not
939 * @return string formated string
940 */
941 public function format_user_info($info,$is_html=false){
942 $str=""; $file="";
943 if($is_html){
944 self::$path=$this->get_base_path();
945 if(file_exists(self::$path."templates/email.php")){
946 ob_start();
947 include_once(self::$path."templates/email.php");
948 $file= ob_get_contents(); // data is now in here
949 ob_end_clean();
950 }
951 if(trim($file) == "")
952 $is_html=false;
953 }
954 if(isset($info['info']) && is_array($info['info'])){
955 if($is_html){
956 if(isset($info['info_title'])){
957 $str.='<tr><td style="font-family: Helvetica, Arial, sans-serif;background-color: #C35050; height: 36px; color: #fff; font-size: 24px; padding: 0px 10px">'.$info['info_title'].'</td></tr>'."\n";
958 }
959 if(is_array($info['info']) && count($info['info'])>0){
960 $str.='<tr><td style="padding: 10px;"><table border="0" cellpadding="0" cellspacing="0" width="100%;"><tbody>';
961 foreach($info['info'] as $f_k=>$f_val){
962 $str.='<tr><td style="padding-top: 10px;color: #303030;font-family: Helvetica;font-size: 13px;line-height: 150%;text-align: right; font-weight: bold; width: 28%; padding-right: 10px;">'.$f_k.'</td><td style="padding-top: 10px;color: #303030;font-family: Helvetica;font-size: 13px;line-height: 150%;text-align: left; word-break:break-all;">'.$f_val.'</td></tr>'."\n";
963 }
964 $str.="</table></td></tr>";
965 }
966 }else{
967 if(isset($info['title']))
968 $str.="\n".$info['title']."\n";
969 foreach($info['info'] as $f_k=>$f_val){
970 $str.=$f_k." : ".$f_val."\n";
971 }
972 }
973 }
974 if($is_html){
975 $str=str_replace(array("{title}","{msg}","{sf_contents}"),array($info['title'],$info['msg'],$str),$file);
976 }
977 return $str;
978 }
979
980
981 /**
982 * if plugin user is valid
983 *
984 * @param mixed $update
985 */
986
987 public function is_valid_user($update){
988 return is_array($update) && isset($update['user']['user']) && $update['user']['user']!=""&& isset($update['user']['expires']);
989 }
990 public function post($key, $arr="") {
991 if($arr!=""){
992 return isset($arr[$key]) ? self::clean($arr[$key]) : "";
993 }
994 return isset($_REQUEST[$key]) ? self::clean($_REQUEST[$key]) : "";
995 }
996 public static function clean($var){
997 if ( is_array( $var ) ) {
998 return array_map( array('self','clean'), $var );
999 } else {
1000 return sanitize_text_field(wp_unslash($var));
1001 }
1002 }
1003 public static function get_key(){
1004 $k='Wezj%+l-x.4fNzx%hJ]FORKT5Ay1w,iczS=DZrp~H+ve2@1YnS;;g?_VTTWX~-|t';
1005 if(defined('AUTH_KEY')){
1006 $k=AUTH_KEY;
1007 }
1008 return substr($k,0,30);
1009 }
1010 /**
1011 * check if other version of this plugin exists
1012 *
1013 */
1014 public function other_plugin_version(){
1015 $status=0;
1016 if(class_exists('vxcf_mailchimp_wp')){
1017 $status=1;
1018 }else if( file_exists(WP_PLUGIN_DIR.'/contact-form-mailchimp-crm/contact-form-mailchimp-crm.php')) {
1019 $status=2;
1020 }
1021 return $status;
1022 }
1023 /**
1024 * Get time Offset
1025 *
1026 */
1027 public function time_offset(){
1028 $offset = (int) get_option('gmt_offset');
1029 return $offset*3600;
1030 }
1031 /**
1032 * Decrypts Values
1033 * @param array $info Mailchimp encrypted API info
1034 * @return array API settings
1035 */
1036 public static function de_crypt($info){
1037 $info=trim($info);
1038 if($info == "")
1039 return '';
1040 $str=base64_decode($info);
1041 $key=self::get_key();
1042 $decrypted_string='';
1043 if(function_exists("openssl_encrypt") && strpos($str,':')!==false ) {
1044 $method='AES-256-CBC';
1045 $arr = explode(':', $str);
1046 if(isset($arr[1]) && $arr[1]!=""){
1047 $decrypted_string=openssl_decrypt($arr[0],$method,$key,false, base64_decode($arr[1]));
1048 }
1049 }else{
1050 $decrypted_string=$str;
1051 }
1052 return $decrypted_string;
1053 }
1054 /**
1055 * Encrypts Values
1056 * @param string $str
1057 * @return string Encrypted Value
1058 */
1059 public static function en_crypt($str){
1060 $str=trim($str);
1061 if($str == "")
1062 return '';
1063 $key=self::get_key();
1064 if(function_exists("openssl_encrypt")) {
1065 $method='AES-256-CBC';
1066 $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
1067 $enc_str=openssl_encrypt($str,$method, $key,false,$iv);
1068 $enc_str.=":".base64_encode($iv);
1069 }else{
1070 $enc_str=$str;
1071 }
1072 $enc_str=base64_encode($enc_str);
1073 return $enc_str;
1074 }
1075
1076 /**
1077 * Get variable from array
1078 *
1079 * @param mixed $key
1080 * @param mixed $key2
1081 * @param mixed $arr
1082 */
1083 public function post2($key,$key2, $arr="") {
1084 if(is_array($arr)){
1085 return isset($arr[$key][$key2]) ? self::clean($arr[$key][$key2]) : "";
1086 }
1087 return isset($_REQUEST[$key][$key2]) ? self::clean($_REQUEST[$key][$key2]) : "";
1088 }
1089 /**
1090 * Get variable from array
1091 *
1092 * @param mixed $key
1093 * @param mixed $key2
1094 * @param mixed $arr
1095 */
1096 public function post3($key,$key2,$key3, $arr="") {
1097 if(is_array($arr)){
1098 return isset($arr[$key][$key2][$key3]) ? self::clean($arr[$key][$key2][$key3]) : "";
1099 }
1100 return isset($_REQUEST[$key][$key2][$key3]) ? self::clean($_REQUEST[$key][$key2][$key3]) : "";
1101 }
1102 /**
1103 * get base url
1104 *
1105 */
1106 public function get_base_url(){
1107 return plugin_dir_url(__FILE__);
1108 }
1109 /**
1110 * get plugin direcotry name
1111 *
1112 */
1113 public function plugin_dir_name(){
1114 if(!empty($this->plugin_dir)){
1115 return $this->plugin_dir;
1116 }
1117 if(empty(self::$path)){
1118 self::$path=$this->get_base_path();
1119 }
1120 $this->plugin_dir=basename(self::$path);
1121 return $this->plugin_dir;
1122 }
1123 /**
1124 * get plugin slug
1125 *
1126 */
1127 public function get_slug(){
1128 return plugin_basename(__FILE__);
1129 }
1130 public function do_actions(){
1131 if(!is_object(self::$plugin) ){ $this->plugin_api(); }
1132 if(is_object(self::$plugin) && method_exists(self::$plugin,'valid_addons')){
1133 return self::$plugin->valid_addons();
1134 }
1135
1136 return false;
1137 }
1138 /**
1139 * Returns the physical path of the plugin's root folder
1140 *
1141 */
1142 public function get_base_path(){
1143 return plugin_dir_path(__FILE__);
1144 }
1145
1146 /**
1147 * get api object
1148 *
1149 * @param mixed $settings
1150 * @return vxg_api_mailchimp
1151 */
1152 public function get_api($crm=""){
1153 $api = false;
1154 $api_class=$this->id."_api";
1155 if(!class_exists($api_class))
1156 require_once(self::$path."api/api.php");
1157
1158 $api = new $api_class($crm);
1159 return $api;
1160 }
1161 /**
1162 * get contact form entry
1163 *
1164 */
1165 public function get_cf_entry($entry_id,$type=''){
1166 $entry=array();
1167
1168 if($type == 'addon'){
1169
1170 if( class_exists( 'vxcf_crm' ) && !empty( $entry_id ) ) {
1171 $entry = vxcf_crm::get_entry( $entry_id );
1172 $entry['__vx_id']=$entry_id;
1173 $entry['form_id']='vx_contacts';
1174 }
1175 }
1176 else{
1177 if( class_exists( 'vxcf_form' ) && !empty( $entry_id ) ) {
1178 $entry = vxcf_form::get_entry( $entry_id );
1179 $entry['__vx_id']=$entry_id;
1180 }
1181 }
1182 return $entry;
1183 }
1184 /**
1185 * get contact form entry
1186 *
1187 */
1188 public function get_cf_entry_detail($entry_id){
1189 $entry=array();
1190 // Fetch entry (use new GF API from version 1.8)
1191 if( class_exists( 'vxcf_form' ) && !empty( $entry_id ) ) {
1192 $entry = vxcf_form::get_entry_detail( $entry_id );
1193 }
1194 return $entry;
1195 }
1196 /**
1197 * get data object
1198 *
1199 */
1200 public function get_data_object(){
1201 require_once(self::$path . "includes/data.php");
1202 if(!is_object($this->data))
1203 $this->data=new vxcf_mailchimp_data();
1204 return $this->data;
1205 }
1206
1207
1208 /**
1209 * push form data to crm
1210 *
1211 * @param mixed $entry
1212 * @param mixed $form
1213 * @param mixed $is_admin
1214 */
1215 public function push($entry, $form,$event="",$is_admin=true,$log=""){
1216
1217 $data_db=$this->get_data_object();
1218 $log_id=''; $feeds_meta=array();
1219 if(!empty($log)){
1220 if(isset($log['id'])){
1221 $log_id=$log['id'];
1222 }
1223 $log_feed=$data_db->get_feed($log['feed_id']);
1224
1225 if(!empty($log_feed)){
1226 $feeds_meta=array($log_feed);
1227 }
1228 }else{
1229 //get feeds of a form
1230 $feeds=$data_db->get_feed_by_form($form['id'],true);
1231
1232 if(is_array($feeds) && count($feeds)>0){
1233 $e=1000; $k=1;
1234 foreach($feeds as $feed){
1235 $data=isset($feed['data']) ? json_decode($feed['data'],true) : array();
1236 $meta=isset($feed['meta']) ? json_decode($feed['meta'],true) : array();
1237 $feed['meta']=$meta;
1238 $feed['data']=$data;
1239 if(!empty($data['organisation_check']) || !empty($data['opportunity_check']) || !empty($data['contact_check'])){
1240 $feeds_meta[$e++]=$feed;
1241 }else{
1242 $feeds_meta[$k++]=$feed;
1243 }
1244 }
1245 ksort($feeds_meta);
1246 }
1247
1248 }
1249
1250 $entry_id=$this->post('__vx_id',$entry);
1251
1252 $type='cf';
1253 if($form['id'] == 'vx_contacts'){
1254 $type='cc';
1255 }
1256
1257 if(empty($form['__vx_addons']) && ($event == '' || $event == 'update' || $event == 'submit')){
1258 $entry=apply_filters('vx_crm_post_fields',$entry,$entry_id,$type,$form);
1259 }
1260 if(isset($form['id'])){
1261 $entry['_vx_form_id']=$form['id'];
1262 }
1263 if( isset($form['name'])){
1264 $entry['_vx_form_name']=$form['name'];
1265 }else if( isset($form['title'])){
1266 $entry['_vx_form_name']=$form['title'];
1267 }
1268
1269 $local_time=current_time( 'mysql');
1270 $entry['_vx_created']=isset($entry['__vx_entry']['created']) ? $entry['__vx_entry']['created'] : $local_time;
1271 $entry['_vx_updated']=isset($entry['__vx_entry']['updated']) ? $entry['__vx_entry']['updated'] : $local_time;
1272
1273 if(!empty($entry['_vx_created'])){
1274 $entry['_vx_created']=date('m/d/Y h:i A',strtotime($entry['_vx_created']));
1275 }
1276 if(!empty($entry['_vx_updated'])){
1277 $entry['_vx_updated']=date('m/d/Y h:i A',strtotime($entry['_vx_updated']));
1278 }
1279 if(!empty($entry['__vx_entry'])){
1280 $entry['_vx_url']=$entry['__vx_entry']['url'];
1281 }
1282
1283 $screen_msg_class="updated"; $notice=""; $log_link='';
1284 if(is_array($feeds_meta) && count($feeds_meta)>0){
1285 foreach($feeds_meta as $feed){
1286 $temp=array();
1287 $force_send=false;
1288 $post_comment=true;
1289 $screen_msg="";
1290 $parent_id=0;
1291 if(isset($entry['__vx_parent_id'])){
1292 $parent_id=$entry['__vx_parent_id'];
1293 }
1294 $object=$this->post('object',$feed);
1295 if(empty($object)){
1296 continue;
1297 }
1298 //
1299 $data=$meta=array();
1300
1301 if(is_array($feed)){
1302 if(isset($feed['data']) && is_array($feed['data'])){
1303 $data=$feed['data'];
1304 $feed=array_merge($feed,$data);
1305 }
1306 //
1307 if(isset($feed['meta']) && is_array($feed['meta'])){
1308 $meta=$feed['meta'];
1309 $feed=array_merge($feed,$meta);
1310 }
1311 }
1312 //
1313
1314
1315 if( in_array($event,array('restore','update','delete','add_note','delete_note'))){
1316 $is_admin=true;
1317 $search_object=$object;
1318 if(in_array($event,array('add_note','delete_note')) && !empty($log)){
1319
1320 if($event == 'add_note'){
1321 $note=json_decode($log['data'],true);
1322 if(!empty($note['title']['value'])){
1323 self::$note=array('id'=>$log['parent_id']);
1324 self::$note['title']=$note['title']['value'];
1325 self::$note['body']=$note['body']['value'];
1326 }
1327 }
1328 }
1329 if($event == 'delete_note' && !empty(self::$note)){
1330 $parent_id=self::$note['id'];
1331 }
1332
1333 if(in_array($event,array('delete_note','add_note'))){
1334 $order_notes=$this->post('entry_notes',$feed); //if notes sync not enabled in feed return
1335 if( empty($order_notes)){
1336 continue;
1337 }
1338 //change main object to Note
1339 $feed['related_object']=$object;
1340 $object=$feed['object']='Note';
1341 }
1342 if($event == 'delete_note'){
1343 //when deleting note search note object
1344 $search_object='Note';
1345 }
1346 $_data=$this->get_data_object();
1347 $feed_log=$_data->get_feed_log($feed['id'],$entry_id,$search_object,$parent_id);
1348 //var_dump($feed_log); die();
1349 if($event == 'restore' && $feed_log['status'] != 5) { // only allow successfully deleted records
1350 continue;
1351 }
1352 if( in_array($event,array('update','delete') ) && !in_array($feed_log['status'],array(1,2) ) ){ // only allow successfully sent records
1353 continue;
1354 }
1355 if(empty($feed_log['crm_id']) || empty($feed_log['object']) || $feed_log['object'] != $search_object){
1356
1357 continue;
1358 }
1359 if($event !='restore'){
1360 $feed['crm_id']=$feed_log['crm_id'];
1361 unset($feed['primary_key']);
1362 }
1363 $feed['event']=$event;
1364 // add note and save related extra info
1365 if( $event == 'add_note' && !empty(self::$note)){
1366 $temp=array('title'=>array('value'=>self::$note['title']),'body'=>array('value'=>self::$note['body']),'parent_id'=>array('value'=> $feed['crm_id']),'object'=>array('value'=> $search_object));
1367 $parent_id=self::$note['id'];
1368 $feed['note_object_link']=$feed_log['crm_id'];
1369 }
1370 // delete not and save extra info
1371 if( $event == 'delete_note'){
1372 $feed_log_arr= json_decode($feed_log['extra'],true);
1373 if(isset($feed_log_arr['note_object_link'])){
1374 $feed['note_object_link']=$feed_log_arr['note_object_link'];
1375 }
1376 $temp=array('ParentId'=>array('value'=> $feed['crm_id']));
1377 }
1378 //delete object
1379 if( $event == 'delete'){
1380 $temp=array('Id'=>array('value'=> $feed['crm_id']));
1381 }
1382 //
1383 if(!in_array($event , array('update','restore') )){
1384 //do not apply filters when adding note , deleting note , entry etc
1385 $force_send=true;
1386 }
1387 //do not post comment in al other cases
1388 $post_comment=false;
1389
1390 }
1391 // var_dump(self::$note,$object,$feed['note_object'],$feed['object'],$feed['crm_id'],$feed['event'],$temp,$force_send);
1392 //continue;
1393 // die();
1394 if(isset($entry['__vx_data'])){
1395 $force_send=true;
1396 $temp=$entry['__vx_data'];
1397 }
1398
1399 if(!$force_send && isset($data['map']) && is_array($data['map']) && count($data['map'])>0){
1400
1401 $custom= isset($meta['fields']) && is_array($meta['fields']) ? $meta['fields'] : array();
1402 if(empty($this->form_fields)){
1403 $this->form_fields=$this->get_form_fields($form['id']);
1404 }
1405 foreach($data['map'] as $k=>$v){
1406 ///
1407 $value='';
1408 if(!empty($v)){ //if value not empty
1409 if($this->post('type',$v) == "value"){ //custom value
1410 $value=trim($this->post('value',$v));
1411 //starts with { and ends } , any char in brackets except {
1412 preg_match_all('/\{[^\{]+\}/',$value,$matches);
1413 if(!empty($matches[0])){
1414 $vals=array();
1415 foreach($matches[0] as $m){
1416 $m=trim($m,'{}');
1417 $vals['{'.$m.'}']=$this->verify_field_val($entry,$m);
1418 }
1419 $value=str_replace(array_keys($vals),array_values($vals),$value);
1420 }
1421
1422 }else{ //general field
1423 $field=$this->post('field',$v);
1424
1425 if($field !=""){
1426 $value=$this->verify_field_val($entry,$field);
1427 if($field == '_vx_form_id' && isset($form['id'])){
1428 $value=$form['id'];
1429 }else if($field == '_vx_form_name' && isset($form['title'])){
1430 $value=$form['title'];
1431 }
1432 }}
1433 if(!empty($value)){
1434 if(isset($custom[$k])){
1435
1436 $temp[$k]=array("value"=>$value,"label"=>$custom[$k]['label']);
1437 }
1438 }
1439 }
1440 }
1441
1442 //add note
1443 if(!empty($data['note_check']) && !empty($data['note_fields']) && is_array($data['note_fields'])){
1444 $entry_note=''; $entry_note_title='';
1445 foreach($data['note_fields'] as $e_note){
1446 $value=$this->verify_field_val($entry,$e_note);
1447 if(!empty($value)){
1448 if(!empty($entry_note)){
1449 $entry_note.="\n";
1450 }
1451 $entry_note.=$value;
1452 }
1453 if(empty($entry_note_title)){
1454 $entry_note_title=substr($entry_note,0,100);
1455 }
1456 }
1457 if(!empty($entry_note)){
1458 $feed['__vx_entry_note']=array('title'=>$entry_note_title,'body'=>$entry_note);
1459 }
1460
1461 }
1462
1463 }
1464
1465 $no_filter=true;
1466 //not submitted by admin
1467 if( !$is_admin && $this->post('manual_export',$data) == "1"){ //if manual export is yes
1468 continue;
1469 }
1470 if(isset($_REQUEST['bulk_action']) && $_REQUEST['bulk_action'] =="send_to_crm_bulk_force" && !empty($log_id)){
1471 $force_send=true;
1472 }
1473 if(!$force_send && $this->post('optin_enabled',$data) == "1"){ //apply filters if not sending by force and optin is enabled
1474 $no_filter=$this->check_filter($data,$entry);
1475 $res=array("status"=>"4","extra"=>array("filter"=>$this->filter_condition),"data"=>$temp);
1476 }
1477 $account=$this->post('account',$feed);
1478
1479 $info=$this->get_info($account);
1480
1481 if(!$no_filter && !empty($data['un_sub'])){
1482 $no_filter=true;
1483 if(empty($feed['primary_key'])){ $feed['primary_key']='email_address'; }
1484 $feed['vx_unsub']='1';
1485 }
1486
1487 if($no_filter){ //get $res if no filter , other wise use filtered $res
1488 $api=$this->get_api($info);
1489 $res_temp=$api->push_object($feed['object'],$temp,$feed);
1490 if(!empty($res_temp)){ $res=$res_temp; }
1491 }
1492
1493 $feed_id=$this->post('id',$feed);
1494 self::$feeds_res[$feed_id]=$res;
1495 $status=$res['status']; $error=""; $id="";
1496 if($this->post('id',$res)!=""){
1497 $id=$res['id'];
1498 $action=$this->post('action',$res);
1499 if($action == "Added"){
1500 if(empty($res['link'])){
1501 $msg=sprintf(__('Successfully Added to Mailchimp (%s) with ID # %s .', 'contact-form-mailchimp-crm'),$feed['object'],$res['id']);
1502 }else{
1503 $msg=sprintf(__('Successfully Added to Mailchimp (%s) with ID # %s . View entry at %s', 'contact-form-mailchimp-crm'),$feed['object'],$res['id'],$res['link']);
1504 }
1505 $screen_msg=__( 'Entry added in Mailchimp', 'contact-form-mailchimp-crm');
1506 }else{
1507 if(empty($res['link'])){
1508 $msg=sprintf(__('Successfully Updated to Mailchimp (%s) with ID # %s . View entry at %s', 'contact-form-mailchimp-crm'),$feed['object'],$res['id'],$res['link']);
1509 }else{
1510 $msg=sprintf(__('Successfully Updated to Mailchimp (%s) with ID # %s .', 'contact-form-mailchimp-crm'),$feed['object'],$res['id']);
1511 }
1512 if($event == 'delete'){
1513 $screen_msg=__( 'Entry deleted from Mailchimp', 'contact-form-mailchimp-crm');
1514 }else{
1515 $screen_msg=__( 'Entry updated in Mailchimp', 'contact-form-mailchimp-crm');
1516 }
1517 }
1518
1519
1520 }else if($this->post('status',$res) == 4){
1521 $screen_msg=$msg=__( 'Entry filtered', 'contact-form-mailchimp-crm');
1522 }else{
1523 $status=0; $screen_msg_class="error";
1524 $screen_msg=__('Errors when adding to Mailchimp. Entry not sent! Check the Entry Notes below for more details.' , 'contact-form-mailchimp-crm' );
1525 if($log_id!=""){
1526 //message for bulk actions in logs
1527 $screen_msg=__('Errors when adding to Mailchimp. Entry not sent' , 'contact-form-mailchimp-crm' );
1528 }
1529 $msg=sprintf(__('Error while creating %s', 'contact-form-mailchimp-crm'),$feed['object']);
1530 if($this->post('error',$res)!=""){
1531 $error= is_array($res['error']) ? json_encode($res['error']) : $res['error'];
1532 $msg.=" ($error)";
1533
1534 $_REQUEST['VXGMailchimpError']=$msg; //front end form error for admin only
1535 }
1536 if(!$is_admin){
1537 $info['msg']=$msg;
1538 $this->send_error_email($info,$entry,$form);
1539 }
1540
1541 }
1542
1543 //insert log
1544 $arr=array("object"=>$feed["object"],"form_id"=>$form['id'],"status"=>$status,"entry_id"=>$entry_id,"crm_id"=>$id,"meta"=>$error,"time"=>date('Y-m-d H:i:s'),"data"=>$temp,"response"=>$this->post('response',$res),"extra"=>$this->post('extra',$res),"feed_id"=>$this->post('id',$feed),'parent_id'=>$parent_id,'event'=>$event,"link"=>$this->post('link',$res));
1545 $settings=get_option($this->type.'_settings',array());
1546 // if($this->post('disable_log',$settings) !="yes"){
1547 $insert_id=$data_db->insert_log($arr,$log_id);
1548 // }
1549 $log_link='';
1550 if(!empty($insert_id)){ //
1551 $log_url=admin_url( 'admin.php?page='.$this->id.'&tab=logs&log_id='.$insert_id);
1552 $log_link=' <a href="'.esc_url($log_url).'" class="vx_log_link" data-id="'.$insert_id.'">'.__('View Detail','contact-form-mailchimp-crm')."</a>";
1553 $screen_msg.=$log_link;
1554 }
1555 if($post_comment){
1556 //insert entry comment
1557 //$this->add_note($entry["id"], $msg);
1558 }
1559 if($notice!=""){
1560 $notice.='<br/>';
1561 }
1562 if(isset($info['objects'][$object])){
1563 $notice.='<b>'.$info['objects'][$object].': </b>';
1564 }
1565 $notice.=$screen_msg;
1566
1567 }
1568 }
1569 return array("msg"=>$notice,"class"=>$screen_msg_class);
1570 }
1571
1572 /**
1573 * Send error email
1574 *
1575 * @param mixed $info
1576 * @param mixed $entry
1577 * @param mixed $form
1578 */
1579 public function send_error_email($info,$entry,$form){
1580 if(!empty($info['data']['error_email'])){
1581 $subject="Error While Posting to Mailchimp";
1582 $entry_link=add_query_arg(array('page' => 'vxcf_leads','tab'=>'entries', 'id' => $entry['__vx_id']), admin_url('admin.php'));
1583 $page_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
1584
1585 $detail=array(
1586 "Time"=>date('d/M/y H:i:s',current_time('timestamp')),
1587 "Page URL"=>'<a href="'.$page_url.'" style="word-break:break-all;">'.$page_url.'</a>',
1588 "Entry ID"=>'<a href="'.$entry_link.'" target="_blank" style="word-break:break-all;">'.$entry_link.'</a>'
1589 );
1590 if(isset($form['title'])){
1591 $detail["Form Name"]=$form['title'];
1592 $detail["Form Id"]=$form['id'];
1593 }
1594 $email_info=array("msg"=>$info['msg'],"title"=>__('Mailchimp','contact-form-mailchimp-crm')." Error","info_title"=>"More Detail","info"=>$detail);
1595 $email_body=$this->format_user_info($email_info,true);
1596
1597 $error_emails=explode(",",$info['data']['error_email']);
1598 $headers = array('Content-Type: text/html; charset=UTF-8');
1599 foreach($error_emails as $email)
1600 wp_mail(trim($email),$subject, $email_body,$headers);
1601
1602 }
1603
1604 }
1605
1606
1607 /**
1608 * Get Objects from local options or from mailchimp
1609 *
1610 * @param mixed $check_option
1611 * @return array
1612 */
1613 public function get_objects($info="",$refresh=false){
1614
1615
1616
1617 $objects=array();
1618 if(!empty($info)){
1619 $meta=$this->post('meta',$info);
1620
1621 }else{
1622 $meta=get_option($this->id.'_meta',array());
1623 }
1624 if(empty($meta['objects'])){
1625 $refresh=true;
1626 }else{
1627 $objects=$meta['objects'];
1628 }
1629
1630 //get objects from mailchimp
1631 if($refresh && !empty($info)){
1632 $api=$this->get_api($info);
1633 $objects=$api->get_crm_objects();
1634
1635 if(is_array($objects)){
1636 $option=get_option($this->id.'_meta',array());
1637 $meta_objects=$objects;
1638 if(!empty($option['objects']) && is_array($option['objects'])){
1639 $meta_objects=array_merge($option['objects'],$objects);
1640 }
1641
1642 $option['objects']=$meta_objects;
1643
1644 update_option($this->id.'_meta',$option); //save objects for logs search option
1645 $meta["objects"]=$objects;
1646 $this->update_info(array("meta"=>$meta),$info['id']);
1647 }
1648 }
1649
1650 return $objects;
1651 }
1652 /**
1653 * check if user conected to crm
1654 *
1655 * @param mixed $settings
1656 */
1657 public function api_is_valid($info="") {
1658
1659 if(isset($info['data']['class']) && is_array($info['data']) && $info['data']['class'] =='updated'){
1660 return true;
1661 }else{
1662 return false;}
1663 }
1664 }
1665
1666 $vxcf_mailchimp=new vxcf_mailchimp();
1667 $vxcf_mailchimp->instance();
1668 $vx_cf['vxcf_mailchimp']='vxcf_mailchimp';
1669 endif;
1670
1 /*!
2 * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome
3 * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 */@font-face{font-family:'FontAwesome';src:url('fonts/fontawesome-webfont.eot?v=4.4.0');src:url('fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'),url('fonts/fontawesome-webfont.woff2?v=4.4.0') format('woff2'),url('fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'),url('fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'),url('fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}
1 @charset "UTF-8";
2
3 @font-face {
4 font-family: "vx-fonts";
5 src:url("fonts/vx-fonts.eot");
6 src:url("fonts/vx-fonts.eot?#iefix") format("embedded-opentype"),
7 url("fonts/vx-fonts.woff") format("woff"),
8 url("fonts/vx-fonts.ttf") format("truetype"),
9 url("fonts/vx-fonts.svg#vx-fonts") format("svg");
10 font-weight: normal;
11 font-style: normal;
12
13 }
14
15 [data-icon]:before {
16 font-family: "vx-fonts" !important;
17 content: attr(data-icon);
18 font-style: normal !important;
19 font-weight: normal !important;
20 font-variant: normal !important;
21 text-transform: none !important;
22 speak: none;
23 line-height: 1;
24 -webkit-font-smoothing: antialiased;
25 -moz-osx-font-smoothing: grayscale;
26 }
27
28 [class^="vx-"]:before,
29 [class*=" vx-"]:before {
30 font-family: "vx-fonts" !important;
31 font-style: normal !important;
32 font-weight: normal !important;
33 font-variant: normal !important;
34 text-transform: none !important;
35 speak: none;
36 line-height: 1;
37 -webkit-font-smoothing: antialiased;
38 -moz-osx-font-smoothing: grayscale;
39 }
40
41 .vx-bin-2:before {
42 content: "a";
43 }
44 .vx-minus-3:before {
45 content: "b";
46 }
47 .vx-add-4:before {
48 content: "c";
49 }
50 .vx-add-3:before {
51 content: "d";
52 }
53 .vx-add-2:before {
54 content: "e";
55 }
56 .vx-loop-1:before {
57 content: "f";
58 }
59 .vx-refresh:before {
60 content: "g";
61 }
62 .vx-check-4:before {
63 content: "h";
64 }
65 .vx-cross-1:before {
66 content: "i";
67 }
68 .vx-check-1:before {
69 content: "j";
70 }
71 .vx-check-2:before {
72 content: "k";
73 }
74 .vx-chat-2:before {
75 content: "l";
76 }
77 .vx-chat-1:before {
78 content: "m";
79 }
80 .vx-check-3:before {
81 content: "n";
82 }
83 .vx-check-bubble:before {
84 content: "o";
85 }
86 .vx-check-shield:before {
87 content: "p";
88 }
89 .vx-cross-shield:before {
90 content: "q";
91 }
92 .vx-check-list:before {
93 content: "r";
94 }
95 .vx-cross-bubble:before {
96 content: "s";
97 }
98 .vx-setting-gear:before {
99 content: "t";
100 }
101 .vx-scale:before {
102 content: "u";
103 }
104 .vx-clock-3:before {
105 content: "v";
106 }
107 .vx-dollar-bag:before {
108 content: "w";
109 }
110 .vx-dollar-currency-1:before {
111 content: "x";
112 }
113 .vx-lock-unlock-2:before {
114 content: "y";
115 }
116 .vx-lock-2:before {
117 content: "z";
118 }
119 .vx-lock-1:before {
120 content: "A";
121 }
122 .vx-lock-unlock-1:before {
123 content: "B";
124 }
125 .vx-wrench:before {
126 content: "C";
127 }
128 .vx-bubble-ask-2:before {
129 content: "D";
130 }
131 .vx-bubble-ask-1:before {
132 content: "E";
133 }
134 .vx-baloon:before {
135 content: "F";
136 }
137 .vx-bubble-attention-4:before {
138 content: "G";
139 }
140 .vx-bubble-attention-6:before {
141 content: "H";
142 }
143 .vx-user-2:before {
144 content: "I";
145 }
146 .vx-arrow-46:before {
147 content: "J";
148 }
149 .vx-arrow-50:before {
150 content: "K";
151 }
152 .vx-arrow-49:before {
153 content: "L";
154 }
155 .vx-arrow-53:before {
156 content: "M";
157 }
158 .vx-arrow-54:before {
159 content: "N";
160 }
161 .vx-arrow-42:before {
162 content: "O";
163 }
164 .vx-arrow-58:before {
165 content: "P";
166 }
167 .vx-arrow-59:before {
168 content: "Q";
169 }
170 .vx-arrow-60:before {
171 content: "R";
172 }
173 .vx-arrow-62:before {
174 content: "S";
175 }
176 .vx-arrow-70:before {
177 content: "T";
178 }
179 .vx-arrow-circle-28:before {
180 content: "U";
181 }
This diff could not be displayed because it is too large.
1 /*! jQuery UI - v1.11.4 - 2015-04-27
2 * http://jqueryui.com
3 * Includes: core.css, draggable.css, resizable.css, selectable.css, sortable.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, menu.css, progressbar.css, selectmenu.css, slider.css, spinner.css, tabs.css, tooltip.css, theme.css
4 * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Gill%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.2em&cornerRadius=4px&bgColorHeader=35414f&bgTextureHeader=dots_small&bgImgOpacityHeader=35&borderColorHeader=2c4359&fcHeader=e1e463&iconColorHeader=e1e463&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=2c4359&iconColorContent=c02669&bgColorDefault=93c3cd&bgTextureDefault=diagonals_small&bgImgOpacityDefault=50&borderColorDefault=93c3cd&fcDefault=333333&iconColorDefault=ffffff&bgColorHover=ccd232&bgTextureHover=diagonals_small&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=db4865&bgTextureActive=diagonals_small&bgImgOpacityActive=40&borderColorActive=ff6b7f&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffff38&bgTextureHighlight=dots_medium&bgImgOpacityHighlight=80&borderColorHighlight=b4d100&fcHighlight=363636&iconColorHighlight=88a206&bgColorError=ff3853&bgTextureError=diagonals_small&bgImgOpacityError=50&borderColorError=ff6b7f&fcError=ffffff&iconColorError=ffeb33&bgColorOverlay=f7f7ba&bgTextureOverlay=white_lines&bgImgOpacityOverlay=85&opacityOverlay=80&bgColorShadow=ba9217&bgTextureShadow=flat&bgImgOpacityShadow=75&opacityShadow=20&thicknessShadow=10px&offsetTopShadow=8px&offsetLeftShadow=8px&cornerRadiusShadow=5px
5 * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
6
7 .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Gill Sans,Arial,sans-serif;font-size:1.2em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Gill Sans,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#2c4359}.ui-widget-content a{color:#2c4359}.ui-widget-header{border:1px solid #2c4359;background:#35414f url("images/ui-bg_dots-small_35_35414f_2x2.png") 50% 50% repeat;color:#e1e463;font-weight:bold}.ui-widget-header a{color:#e1e463}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #93c3cd;background:#93c3cd url("images/ui-bg_diagonals-small_50_93c3cd_40x40.png") 50% 50% repeat;font-weight:bold;color:#333}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#333;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#ccd232 url("images/ui-bg_diagonals-small_75_ccd232_40x40.png") 50% 50% repeat;font-weight:bold;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ff6b7f;background:#db4865 url("images/ui-bg_diagonals-small_40_db4865_40x40.png") 50% 50% repeat;font-weight:bold;color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #b4d100;background:#ffff38 url("images/ui-bg_dots-medium_80_ffff38_4x4.png") 50% 50% repeat;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ff6b7f;background:#ff3853 url("images/ui-bg_diagonals-small_50_ff3853_40x40.png") 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_c02669_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_e1e463_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_88a206_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffeb33_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#f7f7ba url("images/ui-bg_white-lines_85_f7f7ba_40x100.png") 50% 50% repeat;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:8px 0 0 8px;padding:10px;background:#ba9217 url("images/ui-bg_flat_75_ba9217_40x100.png") 50% 50% repeat-x;opacity:.2;filter:Alpha(Opacity=20);border-radius:5px}
...\ No newline at end of file ...\ No newline at end of file
1 .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:26px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
1 /* TipTip CSS - Version 1.2 */
2
3 #tiptip_holder {
4 display: none;
5 position: absolute;
6 top: 0;
7 left: 0;
8 z-index: 99999;
9 }
10
11 #tiptip_holder.tip_top {
12 padding-bottom: 5px;
13 }
14
15 #tiptip_holder.tip_bottom {
16 padding-top: 5px;
17 }
18
19 #tiptip_holder.tip_right {
20 padding-left: 5px;
21 }
22
23 #tiptip_holder.tip_left {
24 padding-right: 5px;
25 }
26
27 #tiptip_content {
28 font-size: 11px;
29 color: #fff;
30 text-shadow: 0 0 2px #000;
31 padding: 4px 8px;
32 border: 0px solid rgba(255,255,255,1);
33 background-color: rgb(25,25,25);
34 background-color: rgba(25,25,25,1);
35 border-radius: 0px;
36 -webkit-border-radius: 0px;
37 -moz-border-radius: 0px;
38 text-align: left;
39
40 }
41
42 #tiptip_arrow, #tiptip_arrow_inner {
43 position: absolute;
44 border-color: transparent;
45 border-style: solid;
46 border-width: 6px;
47 height: 0;
48 width: 0;
49 }
50
51 #tiptip_holder.tip_top #tiptip_arrow {
52 border-top-color: #fff;
53 border-top-color: rgba(255,255,255,0.35);
54 }
55
56 #tiptip_holder.tip_bottom #tiptip_arrow {
57 border-bottom-color: #fff;
58 border-bottom-color: rgba(255,255,255,0.35);
59 }
60
61 #tiptip_holder.tip_right #tiptip_arrow {
62 border-right-color: #fff;
63 border-right-color: rgba(255,255,255,0.35);
64 }
65
66 #tiptip_holder.tip_left #tiptip_arrow {
67 border-left-color: #fff;
68 border-left-color: rgba(255,255,255,0.35);
69 }
70
71 #tiptip_holder.tip_top #tiptip_arrow_inner {
72 margin-top: -7px;
73 margin-left: -6px;
74 border-top-color: rgb(25,25,25);
75 border-top-color: rgba(25,25,25,1);
76 }
77
78 #tiptip_holder.tip_bottom #tiptip_arrow_inner {
79 margin-top: -5px;
80 margin-left: -6px;
81 border-bottom-color: rgb(25,25,25);
82 border-bottom-color: rgba(25,25,25,1);
83 }
84
85 #tiptip_holder.tip_right #tiptip_arrow_inner {
86 margin-top: -6px;
87 margin-left: -5px;
88 border-right-color: rgb(25,25,25);
89 border-right-color: rgba(25,25,25,1);
90 }
91
92 #tiptip_holder.tip_left #tiptip_arrow_inner {
93 margin-top: -6px;
94 margin-left: -7px;
95 border-left-color: rgb(25,25,25);
96 border-left-color: rgba(25,25,25,1);
97 }
98
99 /* Webkit Hacks */
100 @media screen and (-webkit-min-device-pixel-ratio:0) {
101 #tiptip_content {
102 padding: 4px 8px 5px 8px;
103 background-color: rgba(45,45,45,1);
104 }
105 #tiptip_holder.tip_bottom #tiptip_arrow_inner {
106 border-bottom-color: rgba(45,45,45,1);
107 }
108 #tiptip_holder.tip_top #tiptip_arrow_inner {
109 border-top-color: rgba(20,20,20,1);
110 }
111 }
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5 if( !class_exists( 'vx_crmperks_cf' )):
6 class vx_crmperks_cf{
7 public $plugin_url="https://www.crmperks.com/";
8 public function __construct(){
9 //Add meta boxes
10 add_action( 'vx_cf_add_meta_box', array($this,'add_meta_box'),10,2 );
11 }
12 public function addons_key(){
13 $key='';
14 if(class_exists('vxcf_addons')){
15 $key=vxcf_addons::addons_key();
16 }
17 return $key;
18 }
19 public function get_pro_domain(){
20 global $vx_wc,$vx_cf,$vx_gf,$vx_all;
21 $domain=''; $class='';
22 if(!empty($vx_cf) && is_array($vx_cf)){
23 $class=key($vx_cf);
24 }else if(!empty($vx_gf) && is_array($vx_gf)){
25 $class=key($vx_gf);
26 }else if(!empty($vx_wc) && is_array($vx_wc)){
27 $class=key($vx_wc);
28 }else if(!empty($vx_all) && is_array($vx_all)){
29 $class=key($vx_all);
30 }
31 global ${$class};
32 return ${$class}->domain;
33 }
34
35 /**
36 * Add Customer information box
37 *
38 */
39 public function add_meta_box($lead,$detail){
40 $lead_id=isset($lead['id']) ? $lead['id'] : "";
41 ?>
42 <div class="vx_div">
43 <div class="vx_head">
44 <div class="crm_head_div"><i class="fa fa-bullhorn"></i> <?php esc_html_e('Marketing Data', 'contact-form-mailchimp-crm'); ?></div>
45 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
46 <div class="crm_clear"></div>
47 </div>
48
49 <div class="vx_group">
50 <?php
51 $access=$this->addons_key();
52 if(empty($access) ){
53 $plugin_url=$this->plugin_url.'?vx_product='.$this->get_pro_domain();
54 ?>
55 <div class="vx_panel" style="text-align: center; font-size: 16px; color: #888; font-weight: bold;">
56 <p><?php esc_html_e('Need Marketing Insight? ,','contact-form-mailchimp-crm')?> <a href="<?php echo esc_url($plugin_url) ?>&section=vxc_premium"><?php esc_html_e('Go Pro!','contact-form-mailchimp-crm')?></a></p>
57 </div>
58 <?php
59 }else{
60 $html_added=apply_filters('vx_addons_meta_box',false,$lead_id,'cf');
61
62 if(!$html_added){
63 ?>
64 <h3 style="text-align: center;"><?php esc_html_e('No Information Available','contact-form-mailchimp-crm')?></h3>
65 <?php
66 }
67 }
68 ?>
69
70 </div>
71 </div>
72 <?php
73 }
74
75 }
76 $addons=new vx_crmperks_cf();
77 ///$addons->init_premium();
78 endif;
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5
6 if( !class_exists( 'vxcf_mailchimp_data' ) ) {
7
8 /**
9 * since 1.0
10 */
11 class vxcf_mailchimp_data extends vxcf_mailchimp{
12 /**
13 * creates or updates tables
14 *
15 */
16 public function update_table(){
17 global $wpdb;
18
19 $wpdb->hide_errors();
20 $table_name = $this->get_crm_table_name();
21
22 require_once(ABSPATH . '/wp-admin/includes/upgrade.php');
23
24 if ( ! empty($wpdb->charset) )
25 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
26 if ( ! empty($wpdb->collate) )
27 $charset_collate .= " COLLATE $wpdb->collate";
28
29 $sql = "CREATE TABLE $table_name (
30 id int(11) unsigned not null auto_increment,
31 form_id varchar(60) not null,
32 account mediumint(8) not null,
33 is_active tinyint(1) not null default 1,
34 sort mediumint(8) not null default 0,
35 name varchar(240) not null,
36 object varchar(200) not null,
37 meta longtext,
38 data longtext,
39 `time` datetime null,
40 PRIMARY KEY (id),
41 KEY form_id (form_id)
42 )$charset_collate; ";
43
44 dbDelta($sql);
45
46 $table_name = $this->get_crm_table_name('log');
47
48 $sql= "CREATE TABLE $table_name (
49 id int(11) unsigned not null auto_increment,
50 entry_id int(11) not null,
51 form_id varchar(60) not null,
52 feed_id int(11) not null,
53 parent_id int(11) not null,
54 crm_id varchar(200) not null,
55 object varchar(200) not null,
56 link varchar(200) not null,
57 meta varchar(250) not null,
58 event varchar(200) not null,
59 data text,
60 response text,
61 extra text,
62 `status` tinyint(1) not null default 1,
63 `time` datetime null,
64 PRIMARY KEY (id),
65 KEY entry_id (entry_id)
66 )$charset_collate;";
67
68 dbDelta($sql);
69
70 $table_name = $this->get_crm_table_name('accounts');
71
72 $sql= "CREATE TABLE $table_name (
73 id int(11) unsigned not null auto_increment,
74 name varchar(250) not null,
75 data text,
76 meta text,
77 `status` int(1) not null default 0,
78 `time` datetime null,
79 `updated` datetime null,
80 PRIMARY KEY (id)
81 )$charset_collate;";
82
83 dbDelta($sql);
84
85 }
86 /**
87 * Get tables names
88 *
89 * @param mixed $table
90 */
91 public function get_crm_table_name($table=""){
92 global $wpdb;
93 if(!empty($table))
94 return $wpdb->prefix . $this->id."_".$table;
95 else
96 return $wpdb->prefix . $this->id;
97 }
98
99 /**
100 * get crm feeds
101 *
102 */
103 public function get_feeds(){
104 global $wpdb;
105 $table_name = $this->get_crm_table_name();
106
107 $sql = "SELECT s.id, s.is_active,s.object,s.name,s.data,s.time, s.form_id, s.meta
108 FROM $table_name s where time is not NULL
109 ORDER BY s.sort";
110
111 $results = $wpdb->get_results($sql, ARRAY_A);
112
113 $count = sizeof($results);
114 /* for($i=0; $i<$count; $i++){
115 $results[$i]["meta"] = maybe_unserialize($results[$i]["meta"]);
116 }*/
117
118 return $results;
119 }
120 /**
121 * get log from database
122 *
123 */
124 public function get_log(){
125 global $wpdb;
126 $sql_end=$this->get_log_query();
127 $sql_t="select count(s.id) as total $sql_end";
128 $result= $wpdb->get_results($sql_t);
129 $items=$result[0]->total;
130 $per_page = 20;
131 $start = 0;
132 $pages = ceil($items/$per_page);
133 if(isset($_GET['page_id']))
134 {
135 $page=(int)$this->post('page_id');
136 $start = $page-1;
137 $start = $start*$per_page;
138 }
139 $start=max($start,0);
140 $sql = "SELECT s.id, s.status,s.parent_id,s.object,s.event,s.feed_id, s.form_id, s.meta as error,s.entry_id,s.crm_id,s.time
141 $sql_end
142 limit $start , $per_page";
143 $results = $wpdb->get_results($sql, ARRAY_A);
144
145 $page_id=isset($_REQUEST['page_id'])&& $_REQUEST['page_id'] !="" ? $this->post('page_id') : "1";
146 $range_min=(int)($per_page*($page_id-1))+1;
147 $range_max=(int)($per_page*($page_id-1))+count($results);
148 unset($_GET['page_id']);
149 $query_h=$this->clean($_GET);
150 $query_h=http_build_query($query_h);
151 $page_links = paginate_links( array(
152 'base' => admin_url("admin.php")."?".$query_h."&%_%" ,
153 'format' => 'page_id=%#%',
154 'prev_text' =>'&laquo;',
155 'next_text' =>'&raquo;',
156 'total' => $pages,
157 'current' => $page_id,
158 'show_all' => false
159 ));
160
161 return array("min"=>$range_min,"max"=>$range_max,"items"=>$items,"links"=>$page_links,"feeds"=>$results);
162 }
163 /**
164 * get logs query string
165 *
166 */
167 public function get_log_query(){
168 $search="";
169 $table_name = $this->get_crm_table_name('log');
170 $sql_end="FROM $table_name s";
171 // handle search
172 $time_key=$this->post('time');
173 $time=current_time('timestamp');
174
175 $offset = $this->time_offset();
176 $start_date=""; $end_date="";
177 switch($time_key){
178 case"today": $start_date=strtotime('today',$time); break;
179 case"this_week": $start_date=strtotime('last sunday',$time); break;
180 case"last_7": $start_date=strtotime('-7 days',$time); break;
181 case"last_30": $start_date=strtotime('-30 days',$time); break;
182 case"this_month": $start_date=strtotime('first day of 0 month',$time); break;
183 case"yesterday":
184 $start_date=strtotime('yesterday',$time);
185 $end_date=strtotime('today',$time);
186
187 break;
188 case"last_month":
189 $start_date=strtotime('first day of -1 month',$time);
190 $end_date=strtotime('last day of -1 month',$time);
191
192 break;
193 case"custom":
194
195 if(!empty($_GET['start_date'])){
196 $start_date=strtotime($this->post('start_date').' 00:00:00');
197 }
198 if(!empty($_GET['end_date'])){
199 $end_date=strtotime($this->post('end_date').' 23:59:59');
200 }
201 break;
202 }
203
204 if($start_date!=""){
205 $start_date-=$offset;
206 $search.=' and s.time >="'.date('Y-m-d H:i:s',$start_date).'"';
207 }
208 if($end_date!=""){
209 $end_date-=$offset;
210 if($time_key == "yesterday"){
211 $search.=' and s.time <"'.date('Y-m-d H:i:s',$end_date).'"';
212 }else{
213 $search.=' and s.time <="'.date('Y-m-d H:i:s',$end_date).'"';
214 }
215 }
216 if($this->post('object')!=""){
217 $search.=' and object ="'.esc_sql($this->post('object')).'"';
218 }
219 if($this->post('status')!=""){
220 $status=$this->post('status');
221 if($status == "all"){$status="0";}
222 $search.=' and status ="'.esc_sql($status).'"';
223 }
224 if($this->post('search')!=""){
225 $search_s=esc_sql($this->post('search'));
226 $search.=' and (object like "'.$search_s.'" or crm_id="'.$search_s.'" or entry_id="'.$search_s.'")';
227 }
228 if(isset($_GET['log_id']) && !empty($_GET['log_id'])){
229 $log_id=esc_sql($this->post('log_id'));
230 $search.=' and id="'.$log_id.'"';
231 }
232 if($this->post('id')!=""){
233 $form_id=esc_sql($this->post('id'));
234 $search.=' and form_id="'.$form_id.'"';
235 }
236 if($this->post('entry_id')!=""){
237 $entry_id=esc_sql($this->post('entry_id'));
238 $search.=' and entry_id="'.$entry_id.'"';
239 }
240 if($this->post('feed_id')!=''){
241 $feed_id=esc_sql($this->post('feed_id'));
242 $search.=' and feed_id="'.$feed_id.'"';
243 }
244 if($search!=""){
245 $sql_end.=" where ".substr($search,4);
246 }
247 if($this->post('orderby')!=""){
248 $sql_end.=' order by '.esc_sql($this->post('orderby'));
249 if($this->post('order')!="" && in_array($this->post('order'),array("asc","desc"))){
250 $sql_end.=' '.$this->post('order');
251 }
252 }else{
253 $sql_end.=" order by s.id desc";
254 }
255 return $sql_end;
256 }
257 /**
258 * insert log in database
259 *
260 * @param mixed $arr
261 */
262 public function insert_log($arr,$log_id=""){
263 global $wpdb;
264 if(!is_array($arr) || count($arr) == 0)
265 return;
266 //$wpdb->show_errors();
267 $table_name = $table_name = $this->get_crm_table_name('log');
268 $sql_arr=array();
269 foreach($arr as $k=>$v){
270 $sql_arr[$k]=is_array($v) ? json_encode($v) : $v;
271 }
272 $log_id=(int)$log_id;
273 $res=false;
274 if(!empty($log_id)){
275 // update
276 $res=$wpdb->update($table_name,$sql_arr,array("id"=>$log_id));
277 }else{
278 $res=$wpdb->insert($table_name,$sql_arr);
279 $log_id=$wpdb->insert_id;
280 }
281
282 return $log_id;
283 }
284 /**
285 * clear logs
286 *
287 */
288 public function clear_logs(){
289 global $wpdb;
290 $table_name = $this->get_crm_table_name('log');
291 // update
292 return $wpdb->query("truncate table `".$table_name."`");
293 }
294 /**
295 * delete feed
296 *
297 * @param mixed $id
298 */
299 public function delete_feed($id){
300 global $wpdb;
301 $table_name = $this->get_crm_table_name();
302 $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE id=%s", $id));
303 }
304 /**
305 * delete log entries
306 *
307 * @param mixed $id
308 */
309 public function delete_log($log_ids){
310 global $wpdb;
311 $table=$this->get_crm_table_name('log');
312 $count=0;
313 foreach($log_ids as $id){
314 $del=$wpdb->delete($table,array('id'=>$id),array( '%d' ));
315 if($del){$count++;}
316 }
317 return $count;
318 }
319 /**
320 * get form
321 *
322 * @param mixed $form_id
323 * @param mixed $only_active
324 */
325 public function get_feed_by_form($form_id, $only_active = false){
326 if(empty($form_id)){
327 return array();
328 }
329 global $wpdb;
330 $table_name = $this->get_crm_table_name();
331 $active_clause = $only_active ? " AND is_active=1" : "";
332 $sql = $wpdb->prepare("SELECT * FROM $table_name WHERE form_id=%s $active_clause ORDER BY sort", $form_id);
333 $results = $wpdb->get_results($sql, ARRAY_A);
334 if(empty($results))
335 return array();
336
337 return $results;
338 }
339 /**
340 * get object feeds
341 *
342 * @param mixed $form_id
343 * @param mixed $only_active
344 */
345 public function get_object_feeds($form_id, $account , $object,$skip=''){
346 global $wpdb;
347 $table_name = $this->get_crm_table_name();
348
349 $sql = $wpdb->prepare("SELECT * FROM $table_name WHERE id!=%d and form_id=%s and object = %s and account=%d and is_active=1 ORDER BY sort", $skip, $form_id,$object, $account);
350 $results = $wpdb->get_results($sql, ARRAY_A);
351 if(empty($results))
352 return array();
353
354 return $results;
355 }
356 /**
357 * Get log of order and feed
358 *
359 * @param mixed $feed_id
360 * @param mixed $order_id
361 */
362 public function get_feed_log($feed_id,$order_id,$object,$parent_id=""){
363 global $wpdb;
364 $table = $this->get_crm_table_name('log');
365 $sql= $wpdb->prepare('SELECT * FROM '.$table.' where entry_id = %d and feed_id = %d and crm_id!="" and object=%s and parent_id=%d order by id desc limit 1',$order_id,$feed_id,$object,$parent_id);
366 $results = $wpdb->get_row( $sql ,ARRAY_A );
367
368
369 return $results;
370 }
371 /**
372 * get single feed entry
373 *
374 * @param mixed $id
375 */
376 public function get_feed($id){
377 global $wpdb;
378 $table= $this->get_crm_table_name();
379 if((string)$id =='new_form'){
380 $sql='SELECT * FROM '.$table.' where `time` is NULL limit 1';
381 $results = $wpdb->get_results( $sql,ARRAY_A );
382
383 if(count($results) == 0){
384 $wpdb->insert($table,array("is_active"=>"1"));
385 return array("id"=>$wpdb->insert_id,"is_active"=>1);
386 }else{
387 return $results[0];
388 }
389 }
390 $results = $wpdb->get_results( 'SELECT * FROM '.$table.' where id='.$id.' limit 1',ARRAY_A );
391 if(count($results) == 0){
392 return array();
393 }
394 $feed=$results[0];
395 $fields=json_decode($feed['data'],true);
396 $meta=json_decode($feed['meta'],true);
397 $feed['meta']=is_array($meta) ? $meta : array();
398 $feed['data']=is_array($fields) ? $fields : array();
399 return $feed;
400 }
401 /**
402 * get log by id
403 *
404 * @param mixed $id
405 */
406 public function get_log_by_id($log_id){
407 global $wpdb;
408 $table= $this->get_crm_table_name('log');
409
410 $sql = $wpdb->prepare("SELECT * FROM $table WHERE id=%d limit 1", $log_id);
411 $log = $wpdb->get_row($sql, ARRAY_A);
412 return $log;
413 }
414 /**
415 * get log by id
416 *
417 * @param mixed $id
418 */
419 public function get_log_by_lead($lead_id,$form_id,$parent_logs=true,$limit=1){
420 global $wpdb;
421 $table= $this->get_crm_table_name('log');
422 $sql="SELECT * FROM $table WHERE ";
423 if($parent_logs){
424 $sql.='parent_id=0 and ';
425 }
426 $sql.='entry_id=%d and form_id=%s order by id DESC limit %d';
427 $sql = $wpdb->prepare($sql, $lead_id,$form_id,$limit);
428 $log = $wpdb->get_row($sql, ARRAY_A);
429 return $log;
430 }
431 /**
432 * update feed
433 *
434 * @param mixed $arr
435 * @param mixed $id
436 */
437 public function update_feed($arr,$id){
438 global $wpdb;
439 if(!is_array($arr) || count($arr) == 0)
440 return;
441 foreach($arr as $k=>$v){
442 if(is_array($v)){
443 $arr[$k]=json_encode($v);
444 }
445 }
446 $table_name = $this->get_crm_table_name();
447 // update
448 // $wpdb->show_errors();
449 return $wpdb->update($table_name,$arr, array('id' => $id));
450 }
451
452 /**
453 * fields sorting order
454 *
455 * @param mixed $data
456 */
457 public function update_feed_order($data){
458 global $wpdb;
459 $table_name = $this->get_crm_table_name();
460
461 if(!empty($data)) {
462 foreach($data as $order=>$id) {
463 $u=$wpdb->update($table_name,
464 array('sort' => $order),
465 array('id' => $id),
466 array('%d'),
467 array('%d')
468 );
469 /// var_dump($u);
470 }
471 }
472
473 return true;
474 }
475 /**
476 * Get New Settings Id
477 * @return int Settings id
478 */
479 public function get_new_account() {
480 global $wpdb;
481 $table= $this->get_crm_table_name('accounts');
482 $results = $wpdb->get_results( 'SELECT * FROM '.$table.' where status=9 limit 1',ARRAY_A );
483 $id=0;
484 if(count($results) == 0){
485 $wpdb->insert($table,array("status"=>"9"));
486 $id=$wpdb->insert_id;
487 }else{
488 $id=$results[0]['id'];
489 }
490 return $id;
491 }
492 /**
493 * delete account
494 *
495 * @param mixed $id
496 */
497 public function del_account($id) {
498 global $wpdb;
499 $table= $this->get_crm_table_name('accounts');
500 $res=$wpdb->delete( $table, array('id'=>$id) , array('%d'));
501 return $res;
502 }
503 /**
504 * get account by id
505 *
506 * @param mixed $id
507 */
508 public function get_account($id) {
509 global $wpdb; $id=(int)$id;
510 $table= $this->get_crm_table_name('accounts');
511 $res=$wpdb->get_row( 'SELECT * FROM '.$table.' where id='.$id.' limit 1',ARRAY_A );
512 return $res;
513 }
514 /**
515 * update account
516 *
517 * @param mixed $id
518 */
519 public function update_info_data($sql, $id) {
520 global $wpdb;
521 $table= $this->get_crm_table_name('accounts');
522 $res=$wpdb->update( $table, $sql,array('id'=>$id));
523 return $res;
524 }
525
526 /**
527 * Get all accounts
528 */
529 public function get_accounts($verified=false) {
530 global $wpdb;
531 $table= $this->get_crm_table_name('accounts');
532 $sql='SELECT * FROM '.$table.' where';
533 if($verified){
534 $sql.=' status =1';
535 }else{
536 $sql.=' status !=9';
537 }
538 $sql.=' limit 100';
539 $results = $wpdb->get_results( $sql ,ARRAY_A );
540 return $results;
541 }
542 /**
543 * drop tables
544 *
545 */
546 public function drop_tables(){
547 global $wpdb;
548 $wpdb->query("DROP TABLE IF EXISTS " . $this->get_crm_table_name());
549 $wpdb->query("DROP TABLE IF EXISTS " . $this->get_crm_table_name('accounts'));
550 $wpdb->query("DROP TABLE IF EXISTS " . $this->get_crm_table_name('log'));
551 delete_option($this->type."_version");
552 }
553 }
554 }
555 ?>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5
6 if( !class_exists( 'vxcf_mailchimp_install' ) ):
7
8 class vxcf_mailchimp_install extends vxcf_mailchimp{
9 public static $sending_req=false;
10 public function get_roles(){
11 $roles=array(
12 $this->id."_read_feeds",
13 $this->id."_edit_feeds",
14 $this->id."_read_logs" ,
15 $this->id."_read_settings" ,
16 $this->id."_edit_settings" ,
17 $this->id."_send_to_crm" ,
18 $this->id."_export_logs",
19 $this->id."_read_license",
20 $this->id."_uninstall"
21 );
22 return $roles;
23
24 }
25 public function create_roles(){
26 global $wp_roles;
27 if ( ! class_exists( 'WP_Roles' ) ) {
28 return;
29 }
30 $roles=$this->get_roles();
31 foreach($roles as $role){
32 $wp_roles->add_cap( 'administrator', $role );
33 }
34 $wp_roles->add_cap( 'administrator', 'vx_crmperks_view_addons' );
35 $wp_roles->add_cap( 'administrator', 'vx_crmperks_edit_addons' );
36 }
37
38 public function remove_roles(){
39 global $wp_roles;
40 if ( ! class_exists( 'WP_Roles' ) ) {
41 return;
42 }
43 $roles=$this->get_roles();
44 foreach($roles as $role){
45 $wp_roles->remove_cap( 'administrator', $role );
46 }
47 }
48 public function remove_data(){
49 global $wpdb;
50
51 //delete options
52 delete_option($this->type."_version");
53 delete_option($this->type."_updates");
54 delete_option($this->type."_settings");
55 $other_version=$this->other_plugin_version();
56 if(empty($other_version)){ //if other version not found
57 delete_option($this->id."_crm");
58 delete_option($this->id."_meta");
59 $this->deactivate('uninstall');
60 $data=$this->get_data_object();
61 $data->drop_tables();
62 $this->remove_roles();
63 }
64
65 $this->deactivate_plugin();
66 }
67 public function deactivate_plugin(){
68 $slug=$this->get_slug();
69 //deactivate
70 deactivate_plugins($slug);
71 update_option('recently_activated', array($slug => time()) + (array)get_option('recently_activated'));
72 }
73
74 }
75
76 endif;
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5
6 if( !class_exists( 'vxcf_mailchimp_pages' ) ) {
7
8 /**
9 * Main class
10 *
11 * @since 1.0.0
12 */
13 class vxcf_mailchimp_pages extends vxcf_mailchimp{
14 public $ajax=false;
15
16 /**
17 * initialize plugin hooks
18 *
19 */
20 public function __construct() {
21
22 $this->data=$this->get_data_object();
23 global $pagenow;
24 if(in_array($pagenow, array("admin-ajax.php"))){
25 add_action('wp_ajax_update_feed_'.$this->id, array($this, 'update_feed'));
26 add_action('wp_ajax_update_feed_sort_'.$this->id, array($this, 'update_feed_sort'));
27 add_action('wp_ajax_get_field_map_'.$this->id, array($this, 'get_field_map_ajax'));
28 add_action('wp_ajax_get_field_map_object_'.$this->id, array($this, 'get_field_map_object_ajax'));
29 add_action('wp_ajax_get_objects_'.$this->id, array($this, 'get_objects_ajax'));
30 add_action('wp_ajax_log_detail_'.$this->id, array($this, 'log_detail'));
31 add_action('wp_ajax_refresh_data_'.$this->id, array($this, 'refresh_data'));
32 add_action('wp_ajax_send_to_crm_'.$this->id, array($this, 'send_to_crm'));
33 }
34 //crmperks forms
35 add_action( 'cfx_add_meta_box', array($this,'add_meta_box_crmperks_form'),10,2 );
36 add_action('cfx_form_entry_updated', array($this, 'update_entry_crm_perks_forms'),10,3);
37 add_action('cfx_form_post_note_added', array($this, 'create_note_crm_perks_forms'),10,3);
38 add_action('cfx_form_pre_note_deleted', array($this, 'delete_note_crm_perks_forms'),10,2);
39 add_action('cfx_form_pre_trash_leads', array($this, 'trash_leads_crm_perks_forms'),10,2);
40 add_action('cfx_form_pre_restore_leads', array($this, 'restore_leads_crm_perks_forms'),10,2);
41 if($this->is_crm_page()){
42 $base_url=$this->get_base_url();
43 wp_register_script( 'vxc-tooltip',$base_url. 'js/jquery.tipTip.js', array( 'jquery' ), $this->version, true );
44 wp_register_style('vxc-tooltip', $base_url. 'css/tooltip.css');
45 wp_register_style('vx-fonts', $base_url. 'css/font-awesome.min.css');
46 wp_register_style('vx-datepicker', $base_url. 'css/jquery-ui.min.css');
47 wp_register_script( 'vxg-select2',$base_url. 'js/select2.min.js', array( 'jquery' ), $this->version, true );
48 wp_register_style('vxg-select2', $base_url. 'css/select2.min.css',array(),array('ver'=>'1.0'));
49 wp_register_script( 'vx-sorter',$base_url. 'js/jquery.tablesorter.min.js', array( 'jquery' ), $this->version, true );
50 }
51 //creates the subnav left menu
52 add_filter("admin_menu", array($this, 'create_menu'), 50);
53 add_filter( 'vx_cf_meta_boxes_right', array($this,'add_meta_box'),10,3 );
54 add_action( 'admin_notices', array( $this, 'admin_notices' ) );
55 add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
56 add_action('vxcf_entry_submit_btn', array($this, 'entry_checkbox'));
57
58 add_action('vx_cf7_post_note_added', array($this, 'create_note_e'),10,3);
59 add_action('vx_cf7_pre_note_deleted', array($this, 'delete_note_e'),10,2);
60 add_action('vx_cf7_pre_trash_leads', array($this, 'trash_leads_e'));
61 add_action('vx_cf7_pre_restore_leads', array($this, 'restore_leads_e'));
62 add_action('vx_cf7_entry_updated', array($this, 'update_entry_e'),10,3);
63 //
64 add_action('vx_contact_post_note_added', array($this, 'create_note_c'),10,3);
65 add_action('vx_contact_pre_note_deleted', array($this, 'delete_note_c'),10,2);
66 add_action('vx_contact_pre_trash_leads', array($this, 'trash_leads_c'));
67 add_action('vx_contact_pre_restore_leads', array($this, 'restore_leads_c'));
68 add_action('vx_contact_entry_updated', array($this, 'update_entry_c'),10,3);
69
70 add_filter('vx_callcenter_entries_action',array($this,'bulk_send_crm_callcenter'),10,4);
71 add_filter('vx_callcenter_bulk_actions',array($this,'add_bulk_send_crm_callcenter'));
72 $this->setup_plugin();
73 }
74
75 public function update_entry_crm_perks_forms($entry_id,$lead,$form){
76 $option=get_option($this->type.'_settings',array());
77
78 if( !empty($option['update']) ){
79 $event= 'update';
80 $lead['__vx_id']=$entry_id;
81 $form['id']='vf_'.$form['id'];
82 $form['cfx_type']='vf';
83 $push=$this->push($lead,$form,$event);
84 if(!empty($push['msg'])){
85 $this->screen_msg($push['msg'],$push['class']);
86 }
87 }
88 }
89 public function create_note_crm_perks_forms($id, $entry, $note){
90 $option=get_option($this->type.'_settings',array());
91 if(!empty($option['notes']) ){
92 if(!empty($entry['form_id'])){
93 $form=array('id'=>'vf_'.$entry['form_id']);
94 $entry['__vx_id']=$entry['id'];
95 $title=substr($note,0,100);
96 self::$note=array('id'=>$id,'body'=>$note,'title'=>$title);
97 $push=$this->push($entry,$form,'add_note');
98
99 }
100 }
101 }
102
103 public function delete_note_crm_perks_forms($note_id,$entry){
104 $option=get_option($this->type.'_settings',array());
105 if(!empty($option['notes'])){
106 if(!empty($entry['form_id'])){
107 $form=array('id'=>'vf_'.$entry['form_id']);
108 self::$note=array('id'=>$note_id);
109 $entry['__vx_id']=$entry['id'];
110 $push=$this->push($entry,$form,'delete_note');
111 }
112 }
113 }
114 public function trash_leads_crm_perks_forms($leads,$form_id){
115 $option=get_option($this->type.'_settings',array());
116
117 if(!empty($option['delete'])){
118 if(is_array($leads)){
119 $updated=$error='';
120 foreach($leads as $lead){
121 if(!empty($form_id)){
122 $entry=array('__vx_id'=>$lead);
123 $push=$this->push($entry,array('id'=>$form_id),'delete');
124 if(!empty($push['msg'])){
125 if($push['class'] == 'updated'){
126 $updated.=$push['msg'].'<br>';
127 }else{
128 $error.=$push['msg'].'<br>';
129 }
130 }
131 }
132 }
133 if(!empty($updated)){
134 $this->add_msg($updated,'updated');
135 }
136
137 if(!empty($error)){
138 $this->add_msg($error,'error');
139 }
140 }
141 }
142
143 }
144
145 public function restore_leads_crm_perks_forms($leads,$form_id){
146 $option=get_option($this->type.'_settings',array());
147
148 if(!empty($option['restore'])){
149
150 if(is_array($leads)){
151 $updated=$error='';
152 foreach($leads as $lead){
153 if( !empty($lead['id'])){
154 $lead['__vx_id']=$lead['id'];
155 $push=$this->push($lead,array('id'=>$form_id),'restore');
156
157 if(!empty($push['msg'])){
158 if($push['class'] == 'updated'){
159 $updated.=$push['msg'].'<br>';
160 }else{
161 $error.=$push['msg'].'<br>';
162 }
163 }
164 }
165 }
166 if(!empty($updated)){
167 $this->add_msg($updated,'updated');
168 }
169
170 if(!empty($error)){
171 $this->add_msg($error,'error');
172 }
173 }
174 }
175 // var_dump($leads); die();
176 }
177
178
179 public function add_bulk_send_crm_callcenter($list){
180 $list['send_mailchimp']=__('Send to Mailchimp','contact-form-mailchimp-crm');
181 return $list;
182 }
183 public function bulk_send_crm_callcenter($msg,$action,$ids,$type){
184 if($action == 'send_mailchimp'){
185 $entry=array(); $notice=''; $class='updated';
186
187 if(class_exists('vx_dialpad')){
188 $pad=new vx_dialpad();
189 $form=$pad->get_form($type);
190 if(is_array($ids)){
191 foreach($ids as $id){
192 $entry=$pad->get_entry($type,$id);
193 if(!empty($entry['id'])){
194 $entry['__vx_id']=$entry['id'];
195 $temp=$this->push($entry,$form,'',false);
196
197 if(!empty($temp['msg'])){
198 if(!empty($notice)){
199 $notice.='<br/>';
200 }
201 $notice.=$temp['msg'];
202 if($temp['class'] !='updated'){
203 $class=$temp['class'];
204 }
205 }
206 } }
207 }
208 }
209 if(empty($notice)){
210 $notice='Nothing Sent to Mailchimp';
211 }
212 $msg=array('msg'=>$notice,'class'=>$class);
213 }
214
215 return $msg;
216 }
217
218 public function update_entry_e($entry,$entry_id,$lead){
219 $this->update_entry($entry,$entry_id,$lead);
220 }
221 public function update_entry_c($entry,$entry_id,$lead){
222 $this->update_entry($entry,$entry_id,$lead,'addon');
223 }
224 /**
225 * Send entry to crm on update
226 *
227 * @param mixed $form
228 * @param mixed $lead_id
229 */
230 public function update_entry($entry,$entry_id,$lead,$type=''){
231 $option=get_option($this->type.'_settings',array());
232
233 if( !empty($_POST[$this->id.'_send']) || ( !empty($option['update']) ) ){
234 // only update , if already sent to crm
235 //will in case of auto update option or send to crm checkbox
236 $event= 'update';
237 $entry['__vx_id']=$entry_id;
238 $entry['__vx_type']=$type;
239
240 $form=$this->get_form($lead['form_id']);
241 $push=$this->push($entry,$form,$event);
242 if(!empty($push['msg'])){
243 $this->screen_msg($push['msg'],$push['class']);
244 }
245 }
246
247 }
248 public function trash_leads_e($leads){
249 $this->trash_leads($leads);
250 }
251 public function trash_leads_c($leads){
252 $this->trash_leads($leads,'addon');
253 }
254 /**
255 * Delete entry from crm on deletion
256 *
257 * @param mixed $lead_id
258 */
259 public function trash_leads($leads,$type=''){
260 $option=get_option($this->type.'_settings',array());
261
262 if(!empty($option['delete'])){
263 if(is_array($leads)){
264 $updated=$error='';
265 foreach($leads as $lead){
266 $entry=$this->get_cf_entry($lead,$type);
267 if(!empty($entry['form_id'])){
268 $form=$this->get_form($entry['form_id']);
269 $entry['__vx_id']=$lead;
270 $push=$this->push($entry,$form,'delete');
271 if(!empty($push['msg'])){
272 if($push['class'] == 'updated'){
273 $updated.=$push['msg'].'<br>';
274 }else{
275 $error.=$push['msg'].'<br>';
276 }
277 }
278 }
279 }
280 if(!empty($updated)){
281 $this->add_msg($updated,'updated');
282 }
283
284 if(!empty($error)){
285 $this->add_msg($error,'error');
286 }
287 }
288 }
289 // var_dump($leads); die();
290 }
291
292 public function restore_leads_e($leads){
293 $this->restore_leads($leads);
294 }
295 public function restore_leads_c($leads){
296 $this->restore_leads($leads,'addon');
297 }
298 /**
299 * Send entry to crm on restore
300 *
301 * @param mixed $lead_id
302 */
303 public function restore_leads($leads,$type=''){
304 $option=get_option($this->type.'_settings',array());
305
306 if(!empty($option['restore'])){
307
308 if(is_array($leads)){
309 $updated=$error='';
310 foreach($leads as $lead){
311 $entry=$this->get_cf_entry($lead,$type);
312
313 if(!empty($entry['form_id'])){
314 $form=$this->get_form($entry['form_id']);
315 if($type == 'addon'){
316 $detail=$entry;
317 }else{
318 $detail=$this->get_cf_entry_detail($lead);
319 }
320 $detail['__vx_id']=$lead;
321 $push=$this->push($detail,$form,'restore');
322 if(!empty($push['msg'])){
323 if($push['class'] == 'updated'){
324 $updated.=$push['msg'].'<br>';
325 }else{
326 $error.=$push['msg'].'<br>';
327 }
328 }
329 }
330 }
331 if(!empty($updated)){
332 $this->add_msg($updated,'updated');
333 }
334
335 if(!empty($error)){
336 $this->add_msg($error,'error');
337 }
338 }
339 }
340 // var_dump($leads); die();
341 }
342 public function delete_note_e($note_id,$lead_id){
343 $this->delete_note($note_id,$lead_id);
344 }
345 public function delete_note_c($note_id,$lead_id){
346 $this->delete_note($note_id,$lead_id,'addon');
347 }
348 /**
349 * delete note from crm when deleted from GF entry
350 *
351 * @param mixed $note_id
352 * @param mixed $lead_id
353 */
354 public function delete_note($note_id,$lead_id,$type=''){
355 $option=get_option($this->type.'_settings',array());
356
357 if(!empty($option['notes'])){
358
359 $entry=$this->get_cf_entry($lead_id,$type);
360 if(!empty($entry['form_id'])){
361 $form=$this->get_form($entry['form_id']);
362 self::$note=array('id'=>$note_id);
363 $entry['__vx_id']=$entry['id'];
364 $push=$this->push($entry,$form,'delete_note');
365
366 }
367 }
368 }
369 public function create_note_e($id, $lead_id, $note){
370 $this->create_note($id, $lead_id, $note);
371 }
372 public function create_note_c($id, $lead_id, $note){
373
374 $this->create_note($id, $lead_id, $note,'addon');
375 }
376 /**
377 * send entry note to crm
378 *
379 * @param mixed $id
380 * @param mixed $lead_id
381 * @param mixed $user_id
382 * @param mixed $user_name
383 * @param mixed $note
384 * @param mixed $note_type
385 */
386 public function create_note($id, $lead_id, $note,$type=''){
387
388 $option=get_option($this->type.'_settings',array());
389
390 if(!empty($option['notes'])){
391 $entry=$this->get_cf_entry($lead_id,$type);
392 if(!empty($entry['form_id'])){
393 $form=$this->get_form($entry['form_id']);
394 if($type == 'addon'){
395 $entry_detail=$entry;
396 }else{
397 $entry_detail=$this->get_cf_entry_detail($lead_id);
398 }
399 $entry_detail['__vx_id']=$lead_id;
400
401 $title=substr($note,0,100);
402 self::$note=array('id'=>$id,'body'=>$note,'title'=>$title);
403
404 $push=$this->push($entry_detail,$form,'add_note');
405
406 }
407 }
408
409 }
410 public function entry_checkbox($lead){
411 ?>
412 <div class="vx_row">
413 <label><input type="checkbox" name="<?php echo esc_attr($this->id) ?>_send" value="yes"> <?php esc_html_e('Send to Mailchimp','contact-form-mailchimp-crm') ?></label>
414 </div>
415 <?php
416 }
417 /**
418 * Display custom notices
419 * show mailchimp response
420 *
421 */
422 public function admin_notices(){
423
424 $debug = !empty(self::$debug_html) && current_user_can($this->id.'_edit_settings');
425 if($debug){
426 echo "<div class='error'><p>".self::$debug_html."</p></div>";
427 self::$debug_html='';
428 }
429 if(!empty($_POST[$this->id.'_send_btn']) && !empty($_REQUEST['id'])){
430 $tab=$this->post('tab');
431 $id=$this->post('id');
432 $form=array('title'=>'Contact Form');
433 $lead=array();
434 if($tab == 'contacts'){
435 global $vxcf_crm;
436 if(method_exists($vxcf_crm,'get_entry')){
437 $lead=$vxcf_crm->get_entry($id);
438 $form['id']='vx_contacts';
439 }
440 }else{
441 $info=$this->get_cf_entry($id);
442 $lead=$this->get_cf_entry_detail($id);
443 if(!empty($info['form_id'])){
444 $form['id']=$info['form_id'];
445 }
446 $lead['__vx_entry']=$info;
447 }
448 $lead['__vx_id']=$id;
449 $push=$this->push($lead,$form);
450 if(!empty($push['msg'])){
451 $this->screen_msg($push['msg'],$push['class']);
452 }
453 }
454 //send to crm in order page message
455 $msgs=get_option($this->id.'_msgs');
456
457 if(is_array($msgs)){
458 foreach($msgs as $msg){
459 $this->screen_msg($msg['msg'],$msg['class']);
460 }
461 update_option($this->id.'_msgs','');
462 }
463 }
464 /**
465 * Add settings and support link
466 *
467 * @param mixed $links
468 * @param mixed $file
469 */
470 public function plugin_action_links( $links, $file ) {
471 $slug=$this->get_slug();
472 if ( $file == $slug ) {
473 $settings_link=$this->link_to_settings();
474 array_unshift( $links, '<a href="' .$settings_link. '">' . esc_html__('Settings', 'contact-form-mailchimp-crm') . '</a>' );
475 }
476 return $links;
477 }
478 /**
479 * Creates left nav menu under Forms
480 *
481 * @param mixed $menus
482 */
483 public function create_menu(){
484 // Adding submenu if user has access
485 $page_title =__('Mailchimp for Contact Form 7','contact-form-mailchimp-crm');
486 $menu_title =__('Mailchimp','contact-form-mailchimp-crm');
487 $capability = $this->id."_read_feeds";
488 $menu_id='vxcf_leads';
489 if(empty($GLOBALS['admin_page_hooks'][$menu_id])){
490 add_menu_page($page_title,$menu_title,$capability,$this->id,array( $this,'mapping_page'));
491 }else{
492 add_submenu_page('vxcf_leads',$page_title,$menu_title,$capability,$this->id,array( $this,'mapping_page'));
493 }
494 }
495 /**
496 * plugin admin features
497 *
498 */
499 public function setup_plugin(){
500 global $wpdb;
501
502 if(isset($_REQUEST[$this->id.'_tab_action']) && $_REQUEST[$this->id.'_tab_action']=="del_account"){
503 check_admin_referer('vx_nonce','vx_nonce');
504 if( current_user_can($this->id."_edit_settings")){
505 $id=$this->post('id');
506 $data=$this->get_data_object();
507 $res=$data->del_account($id);
508 $class='';
509 if($res){
510 $msg=__('Account Deleted Successfully','contact-form-mailchimp-crm');
511 $class='updated';
512 }else{
513 $msg=__('Error While Removing Account','contact-form-mailchimp-crm');
514 $class='error';
515 }
516 $this->add_msg($msg,$class);
517 }
518 $redir=$this->link_to_settings('accounts');
519 wp_redirect($redir.'&'.$this->id.'_msg=1');
520 die();
521 }
522
523
524 if($this->post('vx_tab_action_'.$this->id)=="export_log"){
525 check_admin_referer('vx_nonce','vx_nonce');
526 if(!current_user_can($this->id."_export_logs")){
527 $msg=__('You do not have permissions to export logs','contact-form-mailchimp-crm');
528 $this->display_msg('admin',$msg);
529 return;
530 }
531 header('Content-disposition: attachment; filename='.date("Y-m-d",current_time('timestamp')).'.csv');
532 header('Content-Type: application/excel');
533 $data=$this->get_data_object();
534 $sql_end=$data->get_log_query();
535 $forms=array();
536 $sql="select * $sql_end limit 3000";
537 $results = $wpdb->get_results($sql , ARRAY_A );
538 $fields=array(); $field_titles=array("#",__('Status','contact-form-mailchimp-crm'),__('Mailchimp ID','contact-form-mailchimp-crm') ,__('Entry ID','contact-form-mailchimp-crm'),__('Description','contact-form-mailchimp-crm'),__('Time','contact-form-mailchimp-crm'));
539 $fp = fopen('php://output', 'w');
540 fputcsv($fp, $field_titles);
541 $sno=0;
542 foreach($results as $row){
543 $sno++;
544 $row=$this->verify_log($row);
545 fputcsv($fp, array($sno,$row['title'],$row['_crm_id'],$row['entry_id'],$row['desc'],$row['time']));
546 }
547 fclose($fp);
548 die();
549 }
550
551 if($this->post('vx_tab_action_'.$this->id)=="clear_logs" ){
552 check_admin_referer('vx_nonce','vx_nonce');
553 if(!current_user_can($this->id."_edit_settings")){
554 $msg=__('You do not have permissions to clear logs','contact-form-mailchimp-crm');
555 $this->display_msg('admin',$msg);
556 return;
557 }
558 $data=$this->get_data_object();
559 $clear=$data->clear_logs();
560
561
562 $msg=__('Error While Clearing Mailchimp Logs','contact-form-mailchimp-crm');
563 $level="error";
564 if(!empty($clear)){
565 $msg=__('Mailchimp Logs Cleared Successfully','contact-form-mailchimp-crm');
566 $level="updated";
567 }
568 $this->add_msg($msg,$level);
569 $link=$this->link_to_settings('logs').$this->id.'_msg=1';
570 wp_redirect($link);
571 die();
572 }
573 //
574 self::$tooltips = array(
575 'vx_feed_name' => esc_html__('Enter feed name of your choice.', 'contact-form-mailchimp-crm'),
576 'vx_sel_object' => esc_html__('Select the Object to Create when a Form is Submitted.', 'contact-form-mailchimp-crm'),
577 'vx_sel_account' =>__('Select the Mailchimp account you would like to export entries to.', 'contact-form-mailchimp-crm'),
578 'vx_sel_form' => esc_html__('Select the Contact Form you would like to integrate with Mailchimp. Contacts generated by this form will be automatically added to your Mailchimp account.', 'contact-form-mailchimp-crm'),
579
580 'vx_map_fields' => esc_html__('Associate your Mailchimp fields to the appropriate Contact Form fields.', 'contact-form-mailchimp-crm'),
581
582 'vx_optin_condition' =>__('When the opt-in condition is enabled, form submissions will only be exported to Mailchimp when the condition is met. When disabled all form submissions will be exported.', 'contact-form-mailchimp-crm'),
583
584 'vx_manual_export' => esc_html__('If you do not want all entries sent to Mailchimp, but only specific, approved entries, check this box. To manually send an entry to Mailchimp, go to Entries, choose the entry you would like to send to Mailchimp, and then click the "Send to Mailchimp" button.', 'contact-form-mailchimp-crm'),
585
586 'vx_entry_notes' => esc_html__('Enable this option if you want to synchronize Contact Form entry notes to Mailchimp Object notes. For example , when you add a note to a Contact Form entry, it will be added to the Mailchimp Object selected in the feed.', 'contact-form-mailchimp-crm'),
587
588 'vx_primary_key' => esc_html__('Which field should be used to update existing objects?', 'contact-form-mailchimp-crm'),
589
590
591 'vx_disable_logs'=>__('When an order is sent to Mailchimp we store that order information in the database and show it in the Mailchimp Log. Check this box if you do not want to save the exported order information in the logs.','contact-form-mailchimp-crm'),
592
593 'vx_sources'=>__('Get Lead Sources list from mailchimp.','contact-form-mailchimp-crm'),
594 'vx_statuses'=>__('Get Lead Status list from mailchimp.','contact-form-mailchimp-crm'),
595 'vx_cats'=>__('Get Categories list from mailchimp.','contact-form-mailchimp-crm'),
596
597 'vx_source'=>__('Which Lead Source should be assigned to this object.','contact-form-mailchimp-crm'),
598 'vx_status'=>__('Which Lead Status should be assigned to this object.','contact-form-mailchimp-crm'),
599 'vx_cat'=>__('Which Category should be assigned to this object.','contact-form-mailchimp-crm'),
600
601 'vx_source_check'=>__('If enabled, a Lead Source will be assigned to the Object','contact-form-mailchimp-crm'),
602 'vx_status_check'=>__('If enabled, a Lead Status will be assigned to the Object','contact-form-mailchimp-crm'),
603 'vx_cat_check'=>__('If enabled, a Category will be assigned to the Object','contact-form-mailchimp-crm'),
604
605 'vx_assign_opportunity'=>__('Enable this option if you want to assign an opportunity this object.','contact-form-mailchimp-crm'),
606 'vx_sel_opportunity'=>__('Select Opportunity feed. Opportunity created by this feed will be assigned to this object.','contact-form-mailchimp-crm'),
607
608 'vx_assign_contact'=>__('Enable this option , if you want to assign a Contact to this object','contact-form-mailchimp-crm'),
609 'vx_sel_contact'=>__('Select Contact feed. Contact created by this feed will be assigned to this object','contact-form-mailchimp-crm'),
610
611 'vx_assign_organization'=>__('Enable this option , if you want to assign a Organization to this object','contact-form-mailchimp-crm'),
612 'vx_sel_organization'=>__('Select Organization feed. Organization created by this feed will be assigned to this object','contact-form-mailchimp-crm'),
613
614 'vx_owner_check'=>__('Enable this option if you want to assign another object owner.','contact-form-mailchimp-crm'),
615 'vx_owners'=>__('Get Users list from Mailchimp','contact-form-mailchimp-crm'),
616 'vx_order_notes'=>__('Enable this option if you want to synchronize WooCommerce Order notes to Mailchimp Object notes. For example, when you add a note to a WooCommerce Order, it will be added to the Mailchimp Object selected in the feed.','contact-form-mailchimp-crm'),
617 'vx_sel_owner'=>__('Select a user as a owner of this object','contact-form-mailchimp-crm'),
618
619 'vx_entry_note'=>__('Check this option if you want to send more data as CRM entry note.', 'contact-form-mailchimp-crm'),
620 'vx_note_fields'=>__('Select fields which you want to send as a note', 'contact-form-mailchimp-crm'),
621 'vx_disable_note'=>__('Enable this option if you want to add note only for new CRM entry', 'contact-form-mailchimp-crm')
622
623 );
624
625 }
626 public function add_meta_box_crmperks_form($lead,$form){
627 $lead_id=isset($lead['id']) ? $lead['id'] : "";
628 $form_id=isset($lead['form_id']) ? 'vf_'.$lead['form_id'] : "";
629
630 if(! $this->has_feed($form_id)) { return ''; }
631 $data=$this->get_data_object();
632 $log_entry=$data->get_log_by_lead($lead['id'],$form_id);
633 $log_url=$this->link_to_settings('logs').'&entry_id='.$lead['id'];
634 ?>
635 <div class="vx_div" style="margin-top: 20px;">
636 <div class="table_head_i"><?php esc_html_e('Capsule', 'contact-form-mailchimp-crm'); ?></div>
637 <div class="vx_group">
638 <div class="vx_send_crm_msg">
639 <?php
640 $comments=false;
641 if( !empty($log_entry) ){
642 $comments=true;
643 $log=$this->verify_log($log_entry);
644 echo $this->format_log_msg($log);
645 }
646 ?></div>
647 <p style="margin-top: 12px;">
648 <button class="button vx_send_crm_btn" data-crm="<?php echo esc_attr($this->crm_name); ?>" type="button" data-action="send_to_crm_<?php echo esc_attr($this->id) ?>" value="yes">
649 <span class="reg_ok"><i class="fa fa-send"></i> Send to <?php echo esc_attr($this->crm_name); ?></span>
650 <span class="reg_proc" style="display: none;"><i class="fa fa-circle-o-notch fa-spin"></i> Sending ...</span>
651 </button>
652 <?php
653 if($comments ){
654 ?>
655 <a href="<?php echo esc_url($log_url) ?>" target="_blank" class="button"><i class="fa fa-external-link"></i> Go to Logs</a>
656 <?php
657 }
658 ?>
659 </p>
660 </div>
661 </div>
662 <?php
663
664 }
665 public function send_to_crm(){
666
667 check_ajax_referer('vx_nonce','vx_nonce');
668 if(current_user_can($this->id."_send_to_crm")){
669 $id=(int)$this->post('id');
670 $log=array('meta'=>'Unknow Error');
671 if(class_exists('cfx_form')){
672 $entry=cfx_form::get_entry($id);
673 if(!empty($entry)){
674 $form=cfx_form::get_form($entry['form_id']);
675 if(!empty($form['fields'])){
676 $detail=cfx_form::get_entries_detail($id,$form['fields']);
677 if(!empty($detail[0])){
678 $detail=$detail[0];
679 $lead=array();
680 foreach($detail as $k=>$v){
681 $field_id=substr($k,0,strpos($k,'_'));
682 if(is_numeric($field_id)){
683 $lead[$field_id]=$v;
684 }
685 }
686 $lead['__vx_id']=$entry['id'];
687 $form['id']='vf_'.$form['id'];
688 $form['cfx_type']='vf';
689 $push=$this->push($lead,$form);
690 $data=$this->get_data_object();
691 $log_entry=$data->get_log_by_lead($entry['id'],$form['id']);
692 $log=$this->verify_log($log_entry);
693 } } }
694 echo $this->format_log_msg($log);
695 } }else{
696 $msg=__('You do not have permissions for this action','contact-form-mailchimp-crm');
697 $this->screen_msg($msg,'error');
698 }
699 die();
700 }
701 public function format_log_msg($log){
702 $msg=!empty($log['meta']) ? $log['meta'] : $log['desc'];
703 if(!empty($log['status']) && !empty($log['a_link']) && !empty($log['crm_id'])){
704 $msg.=' '.$log['a_link'];
705 }
706 $st=empty($log['status']) ? '0' : $log['status'];
707 //$this->screen_msg($msg,$class);
708 $icons=array('0'=>array('color'=>'#DC513B','icon'=>'fa-warning'),'4'=>array('color'=>'#3897C3','icon'=>'fa-filter'),
709 '2'=>array('color'=>'#d5962c','icon'=>'fa-edit'),'5'=>array('color'=>'#DC513B','icon'=>'fa-times'));
710
711 $bg='#83B131'; $icon='fa-check';
712 if(isset($icons[$st])){
713 $bg=$icons[$st]['color'];
714 $icon=$icons[$st]['icon'];
715 }
716 return '<div style="background-color: '.$bg.';" class="vx_msg_div"><i class="fa '.$icon.'"></i> '.$msg.'</div>';
717 }
718 public function add_meta_box($boxes,$lead,$detail){
719 $form_id=isset($lead['form_id']) ? $lead['form_id'] : "";
720
721 if( $this->has_feed($form_id)) {
722 $boxes['mailchimp_crm']=array('title'=>'<i class="fa fa-plug"></i> '.__('MailChimp', 'contact-form-mailchimp-crm'),'callback'=>array($this,'meta_box_html'));
723 }
724 return $boxes;
725 }
726 public function meta_box_html($lead,$detail){
727 $lead_id=isset($lead['id']) ? $lead['id'] : "";
728 $form_id=isset($lead['form_id']) ? $lead['form_id'] : "";
729 $data=$this->get_data_object();
730 $data=$this->get_data_object();
731 $log_entry=$data->get_log_by_lead($lead['id'],$form_id);
732 $log_url=$this->link_to_settings('logs').'&entry_id='.$lead['id'];
733 include_once(self::$path."templates/crm-entry-box.php");
734
735 }
736 /**
737 * Whether to show the Entry "Send to CRM" button or not
738 *
739 * If the entry's form has been mapped to CRM feed, show the Send to CRM button. Otherwise, don't.
740 *
741 * @return boolean True: Show the button; False: don't show the button.
742 */
743 public function show_send_to_crm_button() {
744
745 $form_id = rgget('id');
746
747 return $this->has_feed($form_id);
748 }
749 public function has_feed($form_id) {
750 $data=$this->get_data_object();
751 $feeds = $data->get_feed_by_form( $form_id , true);
752
753 return !empty($feeds);
754 }
755 /**
756 * refresh data , ajax method
757 *
758 */
759 public function refresh_data(){
760 check_ajax_referer("vx_crm_ajax","vx_crm_ajax");
761 if(!current_user_can($this->id."_read_settings")){
762 die();
763 }
764 $res=array();
765 $action=$this->post('vx_action');
766
767
768 $camp_id_sel=$this->post('camp_id');
769
770 $account=$this->post('account');
771 $object=$this->post('object');
772 $status_sel=$this->post('status');
773 $owner_sel=$this->post('owner');
774
775 $info=array(); $meta=array();
776 if(!empty($account)){
777 $info=$this->get_info($account);
778 if(!empty($info['meta']) ){
779 $meta=$info['meta'];
780 }
781 }
782
783 $api=$this->get_api($info);
784 $data=array();
785 switch($action){
786 case"refresh_groups":
787 $camps=$api->get_groups($object);
788 if(is_array($camps)){
789 $res['status']="ok";
790
791 }else{
792 $res['error']=$camps;
793 }
794 $meta['groups']=$camps;
795 ob_start();
796 $this->groups(array(),$meta);
797 $data['vx_groups_data']=ob_get_clean();
798 $res['data']=$data;
799 break;
800 case"refresh_users":
801 $users=$api->get_users($object);
802
803 if(is_array($users)){
804 $res['status']="ok";
805
806
807 }else{
808 $res['error']=$users;
809 }
810 $data['crm_sel_user']=$this->gen_select($users,$owner_sel,__('Select User','contact-form-mailchimp-crm'));
811 $meta['users']=$users;
812 $res['data']=$data;
813 break;
814
815 }
816
817 if(isset($info['id'])){
818 $this->update_info( array("meta"=>$meta) , $info['id'] );
819 }
820 if(isset($res['error'])){
821 $res['status']='error';
822 if(empty($res['error'])){
823 $res['error']=__('Unknown Error','contact-form-mailchimp-crm');
824 }
825 }
826 die(json_encode($res));
827 }
828 /**
829 * CRM menu page
830 *
831 */
832 public function mapping_page(){
833 wp_enqueue_style('vx-fonts');
834 wp_enqueue_script('vxc-tooltip');
835 wp_enqueue_style('vxc-tooltip');
836 $tabs=array('feeds'=>__('Mailchimp Feeds','contact-form-mailchimp-crm') , 'logs'=>__('Mailchimp Log','contact-form-mailchimp-crm') , 'accounts'=>__('Mailchimp Accounts','contact-form-mailchimp-crm'), 'settings'=>__('Settings','contact-form-mailchimp-crm'));
837
838 $tabs=apply_filters('vx_plugin_tabs_'.$this->id,$tabs);
839
840 $view = isset($_GET["tab"]) ? $this->post("tab") : 'feeds';
841 $tab=$view;
842 if(!isset($tabs[$view])){
843 $tab='feeds';
844 }
845 ?>
846 <style type="text/css">
847 .vx_img_head{
848 line-height: 44px;
849 margin-bottom: 12px;
850 }
851 .vx_img_head img{
852 height: 44px;
853 margin-right: 10px;
854 vertical-align: middle;
855 }
856 </style>
857 <div class="wrap">
858 <h2 class="nav-tab-wrapper">
859 <?php
860 $link=$this->link_to_settings();
861 foreach($tabs as $k=>$v){
862 $v=is_array($v) && isset($v['label']) ? $v['label'] : $v;
863 ?>
864 <a href="<?php echo esc_url($link.'&tab='.$k); ?>" class="nav-tab <?php if($k == $tab){echo 'nav-tab-active';} ?>"><?php echo esc_html($v); ?></a>
865
866 <?php
867 }
868 ?>
869 </h2>
870
871 <div style="padding-top: 10px;">
872 <?php
873
874 if($view == 'edit') {
875 $this->edit_page($this->post('id'));
876 }else if($view == "logs") {
877 $this->log_page();
878 }else if($view == "accounts") {
879 $this->accounts_page();
880 } else if($view == "settings") {
881 $this->settings_page();
882 }else if(isset($tabs[$tab]) && is_array($tabs[$tab])) {
883 call_user_func($tabs[$tab]['function']);
884 } else {
885 $this->list_page();
886 }
887 ?>
888 </div>
889 </div>
890 <script type="text/javascript">
891 jQuery(document).ready(function($){
892
893 var unsaved=false;
894
895 $('#mainform :input').change(function(){
896 unsaved=true;
897 });
898 $('#mainform').submit(function(){
899 unsaved=false;
900 });
901
902 $(window).bind("beforeunload",function(event) {
903 if(unsaved) return 'Changes you made may not be saved';
904 });
905
906 $(document).on('click','.vx_toggle_key',function(e){
907 e.preventDefault();
908 var key=$(this).parents(".vx_tr").find(".crm_text");
909
910 if($(this).hasClass('vx_hidden')){
911 $(this).text('<?php esc_html_e('Show Key','contact-form-mailchimp-crm') ?>');
912 $(this).removeClass('vx_hidden');
913 key.attr('type','password');
914 }else{
915 $(this).text('<?php esc_html_e('Hide Key','contact-form-mailchimp-crm') ?>');
916 $(this).addClass('vx_hidden');
917 key.attr('type','text');
918 }
919 });
920 start_tooltip();
921 });
922 function start_tooltip(){
923 // Tooltips
924 var tiptip_args = {
925 'attribute' : 'data-tip',
926 'fadeIn' : 50,
927 'fadeOut' : 50,
928 'defaultPosition': 'top',
929 'delay' : 200
930 };
931 jQuery(".vxc_tips").tipTip( tiptip_args );
932
933 }
934
935 </script>
936 <?php
937 }
938
939
940 /**
941 * Displays the crm feeds list page
942 *
943 */
944 private function list_page(){
945 if(!current_user_can($this->id.'_read_feeds')){
946 esc_html_e('You do not have permissions to access this page','contact-form-mailchimp-crm');
947 return;
948 }
949 $is_section=apply_filters('add_page_html_'.$this->id,false);
950
951 if($is_section === true){
952 return;
953 }
954 $config = $this->data->get_feed('new_form');
955 $offset=$this->time_offset();
956 if(isset($_POST["action"]) && $_POST["action"] == "delete"){
957 check_admin_referer("vx_crm_ajax");
958
959 $id = absint($this->post("action_argument"));
960 $this->data->delete_feed($id);
961 ?>
962 <div class="updated fade" style="margin:10px 0;">
963 <p>
964 <?php esc_html_e("Feed deleted.", 'contact-form-mailchimp-crm') ?>
965 </p>
966 </div>
967 <?php
968 }
969 else if (!empty($_POST["bulk_action"])){
970 check_admin_referer("vx_crm_ajax");
971 $selected_feeds = $this->post("feed");
972 if(is_array($selected_feeds)){
973 foreach($selected_feeds as $feed_id)
974 $this->data->delete_feed($feed_id);
975 }
976 ?>
977 <div class="updated fade" style="margin:10px 0;">
978 <p>
979 <?php esc_html_e("Feeds deleted.", 'contact-form-mailchimp-crm') ?>
980 </p>
981 </div>
982 <?php
983 }
984 $feeds = $this->data->get_feeds();
985
986 wp_enqueue_script('jquery-ui-sortable');
987 $page_link=$this->link_to_settings('accounts');
988
989 $data=$this->get_data_object();
990 $accounts=$data->get_accounts(true);
991 //
992 $new_feed_link=$this->get_feed_link($config['id']);
993 $valid_accounts= is_array($accounts) && count($accounts) > 0 ? true : false;
994
995 include_once(self::$path . "templates/feeds.php");
996 }
997 /**
998 * Displays the crm feeds list page
999 *
1000 */
1001 public function log_page(){
1002
1003 if(!current_user_can($this->id.'_read_logs')){
1004 esc_html_e('You do not have permissions to access this page','contact-form-mailchimp-crm');
1005 return;
1006 }
1007 $is_section=apply_filters('add_page_html_'.$this->id,false);
1008
1009 if($is_section === true){
1010 return;
1011 }
1012 $log_ids=array();
1013 $bulk_action=$this->post('bulk_action');
1014 $offset=$this->time_offset();
1015 if($bulk_action!=""){
1016 $log_id=$this->post('log_id');
1017 if(is_array($log_id) && count($log_id)>0){
1018 foreach($log_id as $id){
1019 if(is_numeric($id)){
1020 $log_ids[]=(int)$id;
1021 }
1022 }
1023 if($bulk_action == "delete"){
1024 $count=$this->data->delete_log($log_ids);
1025 $this->screen_msg(sprintf(__('Successfully Deleted %d Item(s)','contact-form-mailchimp-crm'),$count));
1026 }
1027 else if(in_array($bulk_action,array("send_to_crm_bulk","send_to_crm_bulk_force"))){
1028 self::$api_timeout='1000';
1029
1030 foreach($log_ids as $id){
1031 $log = $this->data->get_log_by_id($id);
1032
1033 $form_id=$this->post('form_id',$log);
1034 $entry_id=$this->post('entry_id',$log);
1035 $log['__vx_id']=$entry_id;
1036 $form=$this->get_form($form_id);
1037 if(!empty($entry_id) && class_exists('vxcf_form')){
1038 $entry=$this->get_cf_entry($entry_id);
1039 }else{
1040 //
1041 $entry['__vx_data']=json_decode($log['data'],true);
1042 }
1043 if(!empty($entry) && is_array($entry)){
1044 $push=$this->push($entry,$form,$log['event'],true,$log);
1045 }else{
1046 $push=array('class'=>'error','msg'=>__('Entry Not Found','contact-form-mailchimp-crm'));
1047 }
1048 if(is_array($push) && isset($push['class'])){
1049 $this->screen_msg($push['msg'],$push['class']);
1050 }
1051 ///var_dump($log_ids,$log); die();
1052 }
1053
1054 }
1055 }
1056 unset($_GET['bulk_action']);
1057 unset($_GET['vx_nonce']);
1058 //$logs_link=admin_url('admin.php?'.http_build_query($_GET));
1059 //wp_redirect($logs_link);
1060 // die();
1061 }
1062 wp_enqueue_script('jquery-ui-datepicker' );
1063 wp_enqueue_style('vx-datepicker');
1064 $times=array("today"=>"Today","yesterday"=>"Yesterday","this_week"=>"This Week","last_7"=>"Last 7 Days","last_30"=>"Last 30 Days","this_month"=>"This Month","last_month"=>"Last Month","custom"=>"Select Range");
1065 $data= $this->data->get_log(); $items=count($data['feeds']);
1066 $crm_order=$entry_order=$desc_order=$time_order="up";
1067 $crm_class=$entry_class=$desc_class=$time_class="vx_hide_sort";
1068 $order=$this->post('order');
1069 $order_icon= $order == "desc" ? "down" : "up";
1070 if(isset($_REQUEST['orderby'])){
1071 switch($_REQUEST['orderby']){
1072 case"crm_id": $crm_order=$order_icon; $crm_class=""; break;
1073 case"entry_id": $entry_order=$order_icon; $entry_class=""; break;
1074 case"object": $desc_order=$order_icon; $desc_class=""; break;
1075 case"time": $time_order=$order_icon; $time_class=""; break;
1076 }
1077 }
1078 $bulk_actions=array(""=>__('Bulk Action','contact-form-mailchimp-crm'),"delete"=>__('Delete','contact-form-mailchimp-crm'),
1079 // 'send_to_crm_bulk'=>__('Send to Mailchimp','contact-form-mailchimp-crm'),'send_to_crm_bulk_force'=>__('Force Send to Mailchimp - Ignore filters','contact-form-mailchimp-crm')
1080 );
1081 $base_url=$this->get_base_url();
1082 $objects=$this->get_objects();
1083 $statuses=array("1"=>__("Created",'contact-form-mailchimp-crm'),"2"=>__("Updated",'contact-form-mailchimp-crm'),"error"=>__("Failed",'contact-form-mailchimp-crm'),"4"=>__("Filtered",'contact-form-mailchimp-crm'),"5"=>__("Deleted",'contact-form-mailchimp-crm'));
1084
1085 include_once(self::$path . "templates/logs.php");
1086 }
1087
1088
1089
1090 /**
1091 * feed link
1092 *
1093 * @param mixed $id
1094 */
1095 public function get_feed_link($id=""){
1096 $tab='feeds';
1097 if(!empty($id)){
1098 $tab='edit';
1099 }
1100 $str="admin.php?page={$this->id}&tab={$tab}&id={$id}" ;
1101 return admin_url( $str );
1102 }
1103
1104 /**
1105 * Field mapping HTML
1106 *
1107 * @param mixed $feed
1108 * @param mixed $settings
1109 * @param mixed $refresh
1110 * @return mixed
1111 */
1112 private function get_field_mapping($feed,$info="",$refresh=false){
1113 $fields=array();
1114 if($info == ""){
1115 $account=$this->post('account',$feed);
1116 $info=$this->get_info($account);
1117 }
1118
1119 if(empty($feed['form_id']) || empty($feed['object']))
1120 return '';
1121 $module=''; $form_id=0;
1122 if(isset($feed['object']))
1123 $module=$feed['object'];
1124 if(isset($feed['form_id']))
1125 $form_id=$feed['form_id'];
1126 //
1127 $api_type=isset($info['data']['api']) ? $info['data']['api'] : '';
1128 $info_meta= isset($info['meta']) && is_array($info['meta']) ? $info['meta'] : array();
1129 $feed_meta= isset($feed['meta']) && is_array($feed['meta']) ? $feed['meta'] : array();
1130 $info_data= isset($info['data']) && is_array($info['data']) ? $info['data'] : array();
1131 $id= isset($feed['id']) ? $feed['id'] : '';
1132 //
1133 $meta=isset($feed['data']) && is_array($feed['data']) ? $feed['data'] : array();
1134
1135
1136 $map=isset($meta['map']) && is_array($meta['map']) ? $meta['map'] : array();
1137
1138 $optin_field=isset($meta['optin_field']) ?$meta['optin_field'] : '';
1139 //
1140 $api_type=$this->post('api',$info_data);
1141
1142 if($this->ajax){
1143
1144 $api=$this->get_api($info);
1145 $fields=$api->get_crm_fields($module);
1146
1147 if(is_array($fields)){
1148
1149 if(!vxcf_mailchimp::$is_pr){
1150 $temp_fields=array();
1151 $phone=array('tags','interests');
1152 $n=0;
1153 foreach($fields as $k=>$v){
1154 $add=true;
1155 if(in_array($k,$phone)){ $add=false; } //remove tags
1156 if($v['type'] == 'phone'){ $add=false; } //remove phones
1157 if( !empty($v['is_custom']) ){ if( $n>10 ){ $add=false; } $n++; } //allow first 7 custom fields
1158 if($add){
1159 $temp_fields[$k]=$v;
1160 }
1161 }
1162 $fields=$temp_fields;
1163 }
1164
1165 $info_meta['fields']=$fields;
1166 $info_meta['object']=$module;
1167 $info_meta['feed_id']=$this->post('id');
1168 $this->update_info( array('meta'=>$info_meta),$info['id']);
1169 }
1170 }else{
1171 $fields=$this->post('fields',$feed_meta);
1172 }
1173
1174 if(!is_array($fields)){
1175 $fields= $fields == "" ? "Error while getting fields" : $fields;
1176 ?>
1177 <div class="error below-h2">
1178 <p><?php echo wp_kses_post($fields)?></p>
1179 </div>
1180 <?php
1181 return;
1182 }
1183 $meta=isset($feed['data']) && is_array($feed['data']) ? $feed['data'] : array();
1184
1185 $map=isset($meta['map']) && is_array($meta['map']) ? $meta['map'] : array();
1186
1187 $optin_field=isset($meta['optin_field']) ?$meta['optin_field'] : '';
1188
1189 $vx_op=$this->get_filter_ops();
1190 if(isset($meta['filters']) && is_array($meta['filters'])&& count($meta['filters'])>0){
1191 $filters=$meta['filters'];
1192 }else{
1193 $filters=array("1"=>array("1"=>array("field"=>"")));
1194 }
1195
1196 $map_fields=array();
1197 $skip_fields=array();
1198
1199 foreach($fields as $k=>$v){
1200
1201 $req=$this->post('req',$v);
1202 if($req == 'true'){
1203 $map_fields[$k]=$v;
1204 }
1205
1206 }
1207 //mapping fields
1208 foreach($map as $field_k=>$field_v){
1209 if(isset($fields[$field_k])){
1210 $map_fields[$field_k]=$fields[$field_k];
1211 }
1212 }
1213
1214
1215
1216
1217 $sel_fields=array(""=>__("Standard Field",'contact-form-mailchimp-crm'),"value"=>__("Custom Value",'contact-form-mailchimp-crm'));
1218 include_once(self::$path . "templates/fields-mapping.php");
1219 }
1220 public function groups($meta,$info){
1221
1222 if(!empty($info['groups']) && is_array($info['groups'])){
1223 foreach($info['groups'] as $id=>$v){
1224 ?>
1225 <div class="vx_row">
1226 <div class="vx_col1">
1227 <label for="crm_sel_camp"><?php echo $v['title'] ?></label>
1228 </div> <div class="vx_col2">
1229 <?php
1230 if(!empty($v['items'])){
1231 foreach($v['items'] as $k=>$l){
1232 $check= !empty($meta['groups'][$k]) ? 'checked="checked"' : '';
1233 ?><div class="vx_check_item">
1234 <input type="checkbox" <?php echo $check ?> id="meta_item_<?php echo esc_attr($k) ?>" name="meta[groups][<?php echo esc_attr($k) ?>]" value="1">
1235 <label for="meta_item_<?php echo esc_attr($k) ?>"><?php echo $l; ?></label>
1236 </div><?php
1237 }
1238 }
1239 ?>
1240 </div>
1241 <div class="clear"></div>
1242 </div> <?php }
1243 }
1244 }
1245
1246 /**
1247 * Updates feed
1248 *
1249 */
1250 public function update_feed(){
1251 check_ajax_referer('vx_crm_ajax','vx_crm_ajax');
1252 if(!current_user_can($this->id."_edit_feeds")){
1253 return;
1254 }
1255 $id = $this->post("feed_id");
1256 $feed = $this->data->get_feed($id);
1257 $this->data->update_feed(array("is_active"=>$this->post("is_active")),$id);
1258 }
1259
1260 /**
1261 * Update the feed sort order
1262 *
1263 * @since 3.1
1264 * @return void
1265 */
1266 public function update_feed_sort(){
1267 check_ajax_referer('vx_crm_ajax','vx_crm_ajax');
1268 if(!current_user_can($this->id."_edit_feeds")){
1269 return;
1270 }
1271 if( empty( $_POST['sort'] ))
1272 {
1273 exit(false);
1274 }
1275
1276 $this->data->update_feed_order($this->post('sort'));
1277 }
1278 public function set_logging_supported($plugins) {
1279 $slug=$this->plugin_dir_name();
1280 $plugins[$slug] = esc_html__('Mailchimp','contact-form-mailchimp-crm');
1281 return $plugins;
1282 }
1283 /**
1284 * Field map ajax method
1285 *
1286 */
1287 public function get_field_map_ajax(){
1288 check_ajax_referer('vx_crm_ajax','vx_crm_ajax');
1289 if(!current_user_can($this->id."_read_feeds")){
1290 return;
1291 }
1292 $this->ajax=true;
1293 $msg="";
1294 if(empty($_REQUEST['module'])){
1295 $msg=__("Please Choose Object",'contact-form-mailchimp-crm');
1296 }else if(empty($_REQUEST['form_id'])){
1297 $msg=__("Please Choose Form",'contact-form-mailchimp-crm');
1298 }
1299 if($msg !=""){
1300 ?>
1301 <div class="error below-h2" style="background: #f3f3f3">
1302 <p><?php echo esc_html($msg); ?></p>
1303 </div>
1304 <?php
1305 die();
1306 }
1307 $module=$this->post('module');
1308 $form_id=$this->post('form_id');
1309 $refresh=$_REQUEST['refresh'] == "true" ? true: false;
1310 $id=$this->post('id');
1311 $feed=$this->data->get_feed($id);
1312 $this->account=$account=$this->post('account');
1313
1314 $info=$this->get_info($account);
1315 /* $object=$this->post('object',$feed);
1316 if(!$refresh && $object != $module){
1317 $refresh=true;
1318 } */
1319 $feed['form_id']=$form_id;
1320 $feed['object']=$module;
1321 $this->get_field_mapping($feed,$info,true);
1322 die();
1323 }
1324 public function get_field_map_object_ajax(){
1325 check_ajax_referer('vx_crm_ajax','vx_crm_ajax');
1326 if(!current_user_can($this->id."_read_feeds")){
1327 return;
1328 }
1329 $this->ajax=true;
1330 $msg="";
1331 if(empty($_REQUEST['account'])){
1332 $msg=__("Please Choose Account",'contact-form-mailchimp-crm');
1333 }else if(empty($_REQUEST['form_id'])){
1334 $msg=__("Please Choose Form",'contact-form-mailchimp-crm');
1335 }
1336 if($msg !=""){
1337 ?>
1338 <div class="error below-h2" style="margin-top: 20px;">
1339 <p><?php echo esc_html($msg); ?></p>
1340 </div>
1341 <?php
1342 die();
1343 }
1344 $this->account=$account=$this->post('account');
1345 $form_id=$this->post('form_id');
1346 $id=$this->post('id');
1347 $feed= $this->data->get_feed($id);
1348 $feed['form_id']=$form_id;
1349 $info=$this->get_info($account);
1350 /* $object=$this->post('object',$feed);
1351 if(!$refresh && $object != $module){
1352 $refresh=true;
1353 } */
1354 $this->field_map_object($account,$form_id,$feed,$info);
1355 die();
1356 }
1357 /**
1358 * available operators for custom filters
1359 *
1360 */
1361 public function get_filter_ops(){
1362 return array("is"=>"Exactly Matches","is_not"=>"Does Not Exactly Match","contains"=>"(Text) Contains","not_contains"=>"(Text) Does Not Contain","is_in"=>"(Text) Is In","not_in"=>"(Text) Is Not In","starts"=>"(Text) Starts With","not_starts"=>"(Text) Does Not Start With","ends"=>"(Text) Ends With","not_ends"=>"(Text) Does Not End With","less"=>"(Number) Less Than","greater"=>"(Number) Greater Than","less_date"=>"(Date/Time) Less Than","greater_date"=>"(Date/Time) Greater Than","equal_date"=>"(Date/Time) Equals","empty"=>"Is Empty","not_empty"=>"Is Not Empty");
1363 }
1364 /**
1365 * crm fields select options
1366 *
1367 * @param mixed $fields
1368 * @param mixed $selected
1369 */
1370 public function crm_select($fields,$selected,$first_empty=true){
1371 $field_options="";
1372 if($first_empty){
1373 $field_options="<option value=''></option>";
1374 }
1375 if(is_array($fields)){
1376 foreach($fields as $k=>$v){
1377 if(isset($v['label'])){
1378 $sel=$selected == $k ? 'selected="selected"' : "";
1379 $field_options.="<option value='".esc_attr($k)."' ".$sel.">".esc_html($v['label'])."</option>";
1380 }
1381 }
1382 }
1383 return $field_options;
1384 }
1385 /**
1386 * general(key/val) select options
1387 *
1388 * @param mixed $fields
1389 * @param mixed $selected
1390 */
1391 public function gen_select($fields,$selected,$placeholder=""){
1392 $field_options="<option value=''>".esc_html($placeholder)."</option>";
1393 if(is_array($fields)){
1394 foreach($fields as $k=>$v){
1395 $sel=$selected == $k ? 'selected="selected"' : "";
1396 $field_options.="<option value='".esc_attr($k)."' ".$sel.">".esc_html($v)."</option>";
1397 }
1398 }
1399 return $field_options;
1400 }
1401 public function get_object_feeds($form_id,$account,$object,$skip=''){
1402
1403 $feeds=$this->data->get_object_feeds($form_id,$account,$object,$skip);
1404 $arr=array();
1405 if(is_array($feeds) && count($feeds)>0){
1406 foreach($feeds as $k=>$feed){
1407 if(isset($feed['id'])){
1408 $arr[$feed['id']]=$feed['name'];
1409 }
1410 }
1411 }
1412 return $arr;
1413 }
1414 /**
1415 * Log detail
1416 *
1417 */
1418 public function log_detail(){
1419 $log_id=$this->post('id');
1420 $log=$this->data->get_log_by_id($log_id);
1421 $data=json_decode($log['data'],true);
1422 $response=json_decode($log['response'],true);
1423 $triggers=array('manual'=>'Submitted Manually','submit'=>'Form Submission','update'=>'Entry Update'
1424 ,'delete'=>'Entry Deletion','add_note'=>'Entry Note Created','delete_note'=>'Entry Note Deleted');
1425 $event= empty($log['event']) ? 'manual' : $log['event'];
1426 $extra=array('Object'=>$log['object']);
1427 if(isset($triggers[$event])){
1428 $extra['Trigger']=$triggers[$event];
1429 }
1430 $extra_log=json_decode($log['extra'],true);
1431 if(is_array($extra_log)){
1432 $extra=array_merge($extra,$extra_log);
1433 }
1434 $error=true;
1435 $vx_ops=$this->get_filter_ops();
1436 $form_id=$this->post('form_id',$log);
1437 $labels=array("url"=>"URL","body"=>"Search Body","response"=>"Search Response","filter"=>"Filter",'note_object_link'=>'Note Object ID');
1438 $log_link=$this->link_to_settings('logs').'&log_id='.$log['id'];
1439 include_once(self::$path . "templates/log.php");
1440 die();
1441 }
1442
1443 /**
1444 * Get Objects , AJAX method
1445 * @return null
1446 */
1447 public function get_objects_ajax(){
1448 check_ajax_referer('vx_crm_ajax','vx_crm_ajax');
1449
1450
1451 $object=$this->post('object');
1452 $account=$this->post('account');
1453 $crm=$this->get_info($account);
1454
1455 $objects=$this->get_objects($crm,true);
1456
1457 $field_options="<option>".esc_html__("Select Object",'contact-form-mailchimp-crm')."</option>";
1458 if(is_array($objects)){
1459 foreach($objects as $k=>$v){
1460 $sel="";
1461 if($k == $object){
1462 $sel='selected="selected"';
1463 }
1464 $field_options.="<option value='".esc_attr($k)."' ".$sel.">".esc_attr($v)."</option>";
1465 }
1466 }
1467 echo $field_options;
1468
1469 die();
1470 }
1471 /**
1472 * Settings page
1473 *
1474 */
1475 public function settings_page(){
1476 if(!current_user_can($this->id.'_read_settings')){
1477 $msg_text=__('You do not have permissions to access this page','contact-form-mailchimp-crm');
1478 $this->display_msg('admin',$msg_text);
1479 return;
1480 }
1481
1482
1483 $is_section=apply_filters('add_page_html_'.$this->id,false);
1484
1485 if($is_section === true){
1486 return;
1487 }
1488 $msgs=array(); $lic_key=false;
1489 $message=$force_check= false;
1490 $id=$this->post('id');
1491 $tooltips=self::$tooltips;
1492
1493
1494 if(!empty($_POST[$this->id."_uninstall"])){
1495 check_admin_referer("vx_nonce");
1496 if(!current_user_can($this->id."_uninstall")){
1497 return;
1498 }
1499 $this->uninstall();
1500 $uninstall_msg=sprintf(__("Contact Form Mailchimp Plugin has been successfully uninstalled. It can be re-activated from the %s plugins page %s.", 'contact-form-mailchimp-crm'),"<a href='plugins.php'>","</a>");
1501 $this->screen_msg($uninstall_msg);
1502 return;
1503 }
1504
1505
1506
1507 $meta=get_option($this->type.'_settings',array());
1508
1509 if(!empty($_POST['save'])){
1510 if(current_user_can($this->id."_edit_settings")){
1511
1512 $meta=isset($_POST['meta']) ? $this->post('meta') : array();
1513
1514 $msgs['submit']=array('class'=>'updated','msg'=>__('Settings Changed Successfully','contact-form-mailchimp-crm'));
1515 update_option($this->type.'_settings',$meta);
1516 }
1517 }
1518 $this->show_msgs($msgs);
1519 $nonce=wp_create_nonce("vx_nonce");
1520 include_once(self::$path . "templates/settings.php");
1521 }
1522 /**
1523 * Accounts page
1524 *
1525 */
1526 public function accounts_page(){
1527 if(!current_user_can($this->id.'_read_settings')){
1528 $msg_text=__('You do not have permissions to access this page','contact-form-mailchimp-crm');
1529 $this->display_msg('admin',$msg_text);
1530 return;
1531 }
1532 $is_section=apply_filters('add_page_html_'.$this->id,false);
1533
1534 if($is_section === true){
1535 return;
1536 }
1537
1538 $msgs=array(); $lic_key=false;
1539 $message=$force_check= false;
1540 $id=$this->post('id');
1541 $tooltips=self::$tooltips;
1542 $offset=$this->time_offset();
1543 if(!empty($_POST["save"])){ //var_dump($_REQUEST); die();
1544 check_admin_referer("vx_nonce");
1545 if(!current_user_can($this->id."_edit_settings")){
1546 esc_html_e('You do not have permissions to save settings','contact-form-mailchimp-crm');
1547 return;
1548 }
1549 $msgs['submit']=array('class'=>'updated','msg'=>__('Settings Changed Successfully','contact-form-mailchimp-crm'));
1550 $valid_email=true; $crm=$this->post('crm');
1551 if($this->post('error_email',$crm) !=""){
1552 $emails=explode(",",$this->post('error_email',$crm));
1553 foreach($emails as $email){
1554 $email=trim($email);
1555 if($email !="" && !$this->is_valid_email($email)){
1556 $valid_email=false;
1557 }
1558 }
1559 }
1560 if(!$valid_email){
1561 $msgs['submit']=array("class"=>"error","msg"=>__('Invalid Email(s)','contact-form-mailchimp-crm'));
1562 }
1563 $info=$this->get_info($id);
1564
1565 if(isset($info['data']) && is_array($info['data']) && is_array($crm)){
1566 $crm= array_merge($info['data'],$crm);
1567 }
1568 /////////////
1569 $this->update_info(array('data'=> $crm),$id);
1570 $force_check=true;
1571 ////////////////////
1572 }
1573
1574 $data=$this->get_data_object();
1575 $new_account_id=$data->get_new_account();
1576 $page_link=$this->link_to_settings('accounts');
1577 $new_account=$page_link."&id=".$new_account_id;
1578 if(!empty($id)){
1579 $info=$this->get_info($id);
1580
1581 if(empty($info)){
1582 $id="";
1583 } }
1584 if(!empty($id)){
1585 $valid_user=false;
1586
1587
1588 $api=$this->get_api($info);
1589
1590 if(empty($_POST)){
1591 $api->timeout="5";
1592 }
1593
1594 $link=$page_link.'&id='.$id;
1595 if(!$force_check && isset($_POST['vx_test_connection'])){
1596 $force_check=true;
1597 }
1598 if(!empty($info['data'])){
1599 $info=$info['data'];
1600 }
1601 //
1602 // $force_check=true;
1603 $info=$this->validate_api($info,$force_check);
1604 //var_dump($info); die('----------');
1605 if($force_check){
1606 $this->update_info( array("data"=> $info),$id);
1607 }
1608 $con_class=$this->post('class',$info);
1609 if(!empty($con_class)){
1610
1611 $msgs['connection']=array('class'=>$con_class,'msg'=>$info['msg']);
1612 }
1613 if(isset($_POST['vx_test_connection'])){
1614 if($con_class != "updated" ){
1615 $msg=__('Connection to Mailchimp is NOT Working','contact-form-mailchimp-crm');
1616 }else{
1617 $msg=__('Connection to Mailchimp is Working','contact-form-mailchimp-crm');
1618 }
1619 $title=__('Test Connection: ','contact-form-mailchimp-crm');
1620 $msgs['test']=array('class'=>$con_class,'msg'=>'<b>'.$title.'</b>'.$msg);
1621 }
1622
1623 }else{
1624 $accounts=$data->get_accounts();
1625
1626 }
1627
1628 $nonce=wp_create_nonce("vx_nonce");
1629 include_once(self::$path . "templates/accounts.php");
1630 }
1631
1632 /**
1633 * Create or edit crm feed page
1634 *
1635 */
1636 private function edit_page($fid=""){
1637 if(!current_user_can($this->id.'_read_feeds')){
1638 esc_html_e('You do not have permissions to access this page','contact-form-mailchimp-crm');
1639 return;
1640 }
1641 wp_enqueue_style('vx-fonts');
1642 wp_enqueue_script('vxg-select2' );
1643 wp_enqueue_style('vxg-select2');
1644 wp_enqueue_script( 'jquery-ui-sortable');
1645 $is_section=apply_filters('add_page_html_'.$this->id,false);
1646
1647 if($is_section === true){
1648 return;
1649 }
1650 $msgs=array();
1651 $feed= $this->data->get_feed($fid);
1652 //updating meta information
1653 if(isset($_POST[$this->id."_submit"])){
1654 check_admin_referer("vx_nonce");
1655 if(!current_user_can($this->id.'_edit_feeds')){
1656 esc_html_e('You do not have permissions to edit/save feed','contact-form-mailchimp-crm');
1657 return;
1658 }
1659 //
1660 $time = current_time( 'mysql' ,1);
1661 $feed_update=array("data"=>$this->post("meta"),"name"=>$this->post('name'),"account"=>$this->post('account'),"object"=>$this->post('object'),"form_id"=>$this->post('form_id'),"time"=>$time);
1662 if(!empty($_POST['account'])){
1663 $info=$this->get_info($this->post('account'));
1664
1665 if(isset($info['meta']['feed_id']) && isset($info['meta']['fields']) && !empty($info['meta']['feed_id']) && $info['meta']['feed_id'] == $fid ){
1666 $meta=isset($feed['meta']) && is_array($feed['meta']) ? $feed['meta'] : array();
1667 $info_meta=$info['meta'];
1668 $meta['fields']=$info_meta['fields'];
1669 $feed_update['meta']=$meta;
1670 unset($info_meta['feed_id']);
1671
1672 $this->update_info(array('meta'=>$info_meta),$info['id']);
1673 } }
1674 if(is_array($feed_update) && is_array($feed)){
1675 $feed=array_merge($feed,$feed_update);
1676 }
1677 $is_valid=$this->data->update_feed($feed_update,$fid);
1678
1679 if($is_valid){
1680 $feed_link=$this->link_to_settings('feeds');
1681 $msgs['save']=array('class'=>'updated','msg'=>sprintf(__("Feed Updated. %sback to list%s", 'contact-form-mailchimp-crm'), '<a href="'.$feed_link.'">', "</a>"));
1682 }
1683 else{
1684 $msgs['save']=array('class'=>'error','msg'=>__("Feed could not be updated. Please enter all required information below.", 'contact-form-mailchimp-crm'));
1685
1686 }
1687 }
1688 //getting API
1689 $_data=$this->get_data_object();
1690 $accounts=$_data->get_accounts(true);
1691 $forms=$this->get_forms();
1692
1693
1694 $account=$this->post('account',$feed);
1695 $form_id=$this->post('form_id',$feed);
1696 $info=$this->get_info($account);
1697 $config = $this->data->get_feed('new_form');
1698 $feeds_link=$this->link_to_settings('feeds');
1699 $feed_link=$this->link_to_settings('edit');
1700 $new_feed_link=$feed_link.'&id='.$config['id'];
1701 // $form_id=$this->post('id');
1702
1703
1704 include_once(self::$path . "templates/feed-account.php");
1705
1706 }
1707 /**
1708 * all form fields + addon fields
1709 *
1710 * @param mixed $form_id
1711 */
1712 public function get_all_fields($form_id){
1713 if($this->fields ){
1714 return $this->fields;
1715 }
1716
1717 $tags=$this->get_form_fields($form_id);
1718
1719 if(is_array($tags)){
1720 foreach($tags as $id=>$tag){
1721 $fields[$id]=array('id'=>$id,'label'=>$tag['label']);
1722 }
1723
1724 }
1725 $fields['__vx_id']=array('id'=>'__vx_id','label'=>__('Entry ID','contact-form-mailchimp-crm'));
1726 $fields['_vx_form_id']=array('id'=>'_vx_form_id','label'=>__('Form ID','contact-form-mailchimp-crm'));
1727 $fields['_vx_form_name']=array('id'=>'_vx_form_title','label'=>__('Form Title','contact-form-mailchimp-crm'));
1728
1729 $fields['_vx_url']=array('id'=>'_vx_url','label'=>__('Page URL','contact-form-mailchimp-crm'));
1730 $fields['_vx_created']=array('id'=>'_vx_created','label'=>__('Entry Created','contact-form-mailchimp-crm'));
1731 $fields['_vx_updated']=array('id'=>'_vx_updated','label'=>__('Entry Updated','contact-form-mailchimp-crm'));
1732
1733 $this->fields=$fields=array('cf'=>array("title"=>__('Contact Form Fields','contact-form-mailchimp-crm'),"fields"=>$fields));
1734
1735 if($this->do_actions()){
1736
1737 $this->fields=$fields=apply_filters('vx_mapping_standard_fields',$this->fields);
1738 }
1739 return $fields;
1740 }
1741 /**
1742 * contact form fields label
1743 *
1744 * @param mixed $form_id
1745 * @param mixed $key
1746 */
1747 public function get_gf_field_label($form_id,$key){
1748 $fields=$this->get_all_fields($form_id);
1749 $label=$key;
1750 if(is_array($fields)){
1751 foreach($fields as $ke=>$field){
1752 if(isset($field['fields']) && is_array($field['fields']) ){
1753 foreach($field['fields'] as $k=>$v){
1754 if($ke == "gf"){
1755 $k=$v[0];
1756 }
1757 if($k == $key && isset($field['fields'][$k])){
1758 if($ke == "gf"){
1759 $label=$v[1];
1760 }else if(isset($field['fields'][$k]['label'])){
1761 $label= $field['fields'][$k]['label'];
1762 }
1763 if(!empty($label)){
1764 return $label;
1765 }
1766 }
1767
1768 }
1769 }
1770
1771 }}
1772 return $label;
1773 }
1774 /**
1775 * contact form field select options
1776 *
1777 * @param mixed $form_id
1778 * @param mixed $selected_val
1779 */
1780 public function form_fields_options($form_id,$sel_val=""){
1781 if($this->fields == null){
1782 $this->fields=$this->get_all_fields($form_id);
1783 }
1784
1785 if(!is_array($sel_val)){
1786 $sel_val=array($sel_val);
1787 }
1788 $sel="<option value=''></option>";
1789 $fields=$this->fields;
1790 if(is_array($fields)){
1791 foreach($fields as $key=>$fields_arr){
1792 if(is_array($fields_arr['fields'])){
1793 $sel.="<optgroup label='".$fields_arr['title']."'>";
1794 foreach($fields_arr['fields'] as $k=>$v){
1795 $option_k=$k;
1796 $option_name=$v;
1797
1798 $option_name=$v['label'];
1799
1800 $select="";
1801 if( in_array($option_k,$sel_val)){
1802
1803 $select='selected="selected"';
1804
1805 }
1806 $sel.='<option value="'.esc_attr($option_k).'" '.$select.'>'.esc_html($option_name).'</option>';
1807 } }
1808 }}
1809 return $sel;
1810 }
1811 /**
1812 * field mapping box's Contents
1813 *
1814 */
1815 public function field_map_object($account,$form_id,$feed,$info) {
1816
1817 //get objects from crm
1818 $objects=$this->get_objects($info);
1819
1820 if(empty($feed['object'])){
1821 $feed['object']="";
1822 }
1823 if(!empty($feed['object']) && is_array($objects) && !isset($objects[$feed['object']])){
1824 $feed['object']="";
1825 }
1826 $modules=array(""=>__("Select Object",'contact-form-mailchimp-crm'));
1827 if(isset($objects) && is_array($objects)){
1828 foreach($objects as $k=>$v){
1829 $modules[$k]=$v;
1830 }
1831 }
1832 $meta=$this->post('meta',$info);
1833 $object=$this->post('object',$feed);
1834 include_once(self::$path."templates/feed-object.php");
1835 }
1836 /**
1837 * validate API
1838 *
1839 * @param mixed $info
1840 * @param mixed $force_check
1841 */
1842 public function validate_api($info,$check=false){
1843 $time=current_time('timestamp');
1844
1845 if($check){
1846 $api=$this->get_api(array('data'=>$info));
1847 $info=$api->get_token();
1848 }
1849
1850 if(isset($info['valid_token']) && $info['valid_token']!="") {
1851 $msg=__( 'Successfully Connected to Mailchimp','contact-form-mailchimp-crm' );
1852 if(isset($info['_time'])){
1853 $msg.=" - ".date('F d, Y h:i:s A',$info['_time']);
1854 }
1855 $info['msg']=$msg;
1856 $info['class']="updated";
1857
1858 }else{
1859 $info['class']="";
1860 if(!empty($info['api_key'])){
1861 $info['msg']= !empty($info['error']) ? $info['error'] : 'API Token is Not Valid';
1862 $info['class']="error";
1863 }
1864 }
1865 if($check){
1866 $info['_time']=$time;
1867 }
1868 return $info;
1869 }
1870 public function get_forms(){
1871
1872 $forms=array();
1873 global $vxcf_form;
1874 if(is_object($vxcf_form) && method_exists($vxcf_form,'get_forms')){
1875 $forms=$vxcf_form->get_forms();
1876 }else{
1877 if(class_exists('WPCF7_ContactForm')){
1878 if( !function_exists('wpcf7_contact_forms') ) {
1879 $cf_forms = get_posts( array(
1880 'numberposts' => -1,
1881 'orderby' => 'ID',
1882 'order' => 'ASC',
1883 'post_type' => 'wpcf7_contact_form' ) );
1884 }
1885 else {
1886 $forms_cf = wpcf7_contact_forms();
1887 $cf_forms=array();
1888 if(count($forms_cf)>0){
1889 foreach($forms_cf as $k=>$f){
1890 $v=new stdClass();
1891 if( isset( $f->id ) ) {
1892 $v->ID = $f->id; // as serialized option data
1893 }
1894 if( isset( $f->title ) ) {
1895 $v->post_title = $f->title; // as serialized option data
1896 }
1897 $cf_forms[]=$v;
1898 }
1899 }
1900 }
1901
1902 if(is_array($cf_forms) && count($cf_forms)>0){
1903 foreach($cf_forms as $form){
1904 if(!empty($form->post_title)){
1905 $forms_arr[$form->ID]=$form->post_title;
1906 }
1907 }
1908 $forms['cf']=array('label'=>'Contact Form 7','forms'=>$forms_arr);
1909 }
1910 ///////
1911 }
1912 }
1913 $forms=apply_filters('vx_add_crm_form',$forms);
1914
1915 return $forms;
1916 }
1917 public function add_msg($msg,$level='updated'){
1918 $option=get_option($this->id.'_msgs',array());
1919 if(!is_array($option)){
1920 $option=array();
1921 }
1922 $option[]=array('msg'=>$msg,'class'=>$level);
1923 update_option($this->id.'_msgs',$option);
1924 }
1925 public function show_msgs($msgs=""){
1926 /* $option=get_option($this->id.'_msgs',array());
1927 if(is_array($option) && count($msgs)>0){
1928 // $msgs=array_merge($msgs,$option);
1929 } */
1930 if(is_array($msgs) && count($msgs)>0){
1931 foreach($msgs as $msg){
1932 $this->screen_msg($msg['msg'],$msg['class']);
1933 }
1934 /* if(empty($option)){
1935 // update_option($this->id.'_msgs',array());
1936 } */
1937 }
1938 }
1939 /**
1940 * Tooltip image
1941 *
1942 * @param mixed $str
1943 */
1944 public function tooltip($str){
1945
1946 if(!isset(self::$tooltips[$str])){return;}
1947 ?>
1948 <i class="vx_icons vxc_tips fa fa-question-circle" data-tip="<?php echo esc_attr(self::$tooltips[$str]) ?>"></i>
1949 <?php
1950 }
1951 }
1952 }
1953 new vxcf_mailchimp_pages();
1
2 (function($){$.extend({tablesorter:new
3 function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
4 var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if (c.dateFormat == "pt") {s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");} else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
1 /*
2 * TipTip
3 * Copyright 2010 Drew Wilson
4 * www.drewwilson.com
5 * code.drewwilson.com/entry/tiptip-jquery-plugin
6 *
7 * Version 1.3 - Updated: Mar. 23, 2010
8 *
9 * This Plug-In will create a custom tooltip to replace the default
10 * browser tooltip. It is extremely lightweight and very smart in
11 * that it detects the edges of the browser window and will make sure
12 * the tooltip stays within the current window size. As a result the
13 * tooltip will adjust itself to be displayed above, below, to the left
14 * or to the right depending on what is necessary to stay within the
15 * browser window. It is completely customizable as well via CSS.
16 *
17 * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
18 * http://www.opensource.org/licenses/mit-license.php
19 * http://www.gnu.org/licenses/gpl.html
20 */
21 (function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
...\ No newline at end of file ...\ No newline at end of file
1 /*! Select2 4.0.2-rc.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,
2 c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
...\ No newline at end of file ...\ No newline at end of file
1 === Integration for Contact Form 7 and Mailchimp ===
2 Contributors: crmperks, sbazzi, asif876
3 Tags: contact form 7, contact form 7 mailchimp, connecting contact form 7 and mailchimp, mailchimp, contact form 7 mailchimp extension
4 Requires at least: 3.8
5 Tested up to: 6.1
6 Stable tag: 1.1.2
7 Version: 1.1.2
8 Requires PHP: 5.3
9 License: GPLv3
10 License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
12 Send Contact Form 7, CRM Perks Forms and many other contact form submissions to Mailchimp.
13
14 == Description ==
15
16 Contact Form 7 Mailchimp extension sends form submissions from [Contact Form 7](https://wordpress.org/plugins/contact-form-7/), [Contact Form Entries](https://wordpress.org/plugins/contact-form-entries/) and many other popular contact form plugins to Mailchimp when anyone submits a form. Learn more at [crmperks.com](https://www.crmperks.com/plugins/contact-form-plugins/contact-form-mailchimp-plugin/?utm_source=wordpress&utm_medium=directory&utm_campaign=mailchimp_readme)
17
18
19 == Why we built this Contact Form 7 Mailchimp Extension ==
20
21 Many Mailchimp extensions are already available but we added many new features. This plugin shows all mailchimp merge fields list and you can easily map any field. This plugin displays complete log of data sent to mailchimp. You can easily resend any contact form entry to mailchimp.
22
23 == How to Setup ==
24
25 * Go to "Mailchimp Accounts" tab then add new account.
26 * Go to "Mailchimp Feeds" tab then create a new feed.
27 * Map required mailchimp fields to contact form fields.
28 * Send your test entry to mailchimp by clicking "send to mailchimp" button.
29 * Go to "Mailchimp Logs" tab and verify status of previously sent entry.
30
31
32 **Connect Mailchimp account**
33
34 Connect any contact form 7 to Mailchimp account by simply entering Mailchimp API key. Additionally, you can connect multiple Mailchimp accounts to Contact Form 7.
35
36 **Map Mailchimp fields**
37
38 Select any mailchimp list then Map mailchimp list fields to any contact form 7 fields. Plugin displays all mailchimp merge fields.
39
40 **Filter contact form 7 submissions**
41
42 Filter contact form 7 submissions sent to Mailchimp based on user input. For example , send those customers to Mailchimp who check "Subscribe to newsletter" checkbox.
43
44 **Manually send to Mailchimp**
45
46 Send contact form 7 submissions to Mailchimp when someone submits a contact form. You can manually send contact form 7 submissions to Mailchimp by clicking "Send to Mailchimp" button.
47
48 **Mailchimp logs**
49
50 View a detailed log of each contact form 7 submission Whether sent or not sent to Mailchimp and easily resend contact form 7 submission to Mailchimp.
51
52 **Send Data As Mailchimp Member Notes**
53
54 Send one to many contact form 7 form fields as Mailchimp Object notes when someone submits a contact form on your site.
55
56 **Create Or Update Contact in Mailchimp**
57
58 If a member already exists in Mailchimp , update it otherwise create a new member in Mailchimp.
59
60
61 <blockquote>
62 <p><strong>Premium Version Features.</strong></p>
63 <p>Following features are available only in premium version <a href="https://www.crmperks.com/plugins/contact-form-plugins/contact-form-mailchimp-plugin/?utm_source=wordpress&utm_medium=directory&utm_campaign=mailchimp_readme">Contact Form 7 Mailchimp Pro</a>.</p>
64 <ul>
65 <li>Mailchimp tags.</li>
66 <li>Phone number field and all custom fields of Mailchimp.</li>
67 <li>Mailchimp interest groups.</li>
68 <li>Google Analytics Parameters and Geolocation of a visitor who submitted the form.</li>
69 <li>Lookup lead's email and phone using email and phone lookup apis.</li>
70 <li>20+ premium addons</li>
71 </ul>
72 <p><a href="https://www.crmperks.com/plugins/contact-form-plugins/contact-form-mailchimp-plugin/?utm_source=wordpress&utm_medium=directory&utm_campaign=readme">Upgrade to Contact Form 7 Mailchimp Pro</a></p>
73 </blockquote>
74
75
76 == Want to send data to crm ==
77 We have Premium Extensions for 20+ CRMs.[View All CRM Extensions](https://www.crmperks.com/plugin-category/contact-form-plugins/?utm_source=wordpress&utm_medium=directory&utm_campaign=mailchimp_readme)
78
79
80
81 == Screenshots ==
82
83 1. Connect Mailchimp Account to contact form 7.
84 2. Map Mailchimp fields.
85 3. Mailchimp logs.
86 4. Manually Send Contact form 7 submission to Mailchimp.
87 5. Get email infomation of contact form 7 entry from Full Contact(Premium feature).
88 6. Get Customer geolocation, browser and OS (Premium feature).
89
90
91 == Frequently Asked Questions ==
92
93 = Where can I get support? =
94
95 Our team provides free support at <a href="https://www.crmperks.com/contact-us/">https://www.crmperks.com/contact-us/</a>.
96
97
98 = How to integrate contact form 7 with mailchimp =
99
100 You can easily integrate contact form 7 with mailchimp by following these steps.
101
102 * Go to Mailchimp Accounts then connect your account.
103 * Go to Mailchimp Feeds , select desired list then map form fields to mailchimp list fields.
104 * Submit a contact form , a new member will added in mailchimp.
105 * If you have installed Contact Form Entries plugin then open any entry and click "Send to MailChimp" button.
106 * Go to MailChimp logs and check if entry was successfully sent to MailChimp.
107
108 = Contact form 7 mailchimp subscribe =
109
110 * Create beautifull mailchimp subscribe forms and popups with free [CRM Perks Forms](https://wordpress.org/plugins/crm-perks-forms/).
111 * Go to MailChimp accounts tab and connect your mailchimp account.
112 * Creat a feed and select desired list then map form fields to mailchimp list fields.
113
114 = Connecting contact form 7 and mailchimp =
115
116 * Simply Connect your mailchimp account.
117 * Go to Feeds and create mailchimp feed, select list then map contact form 7 fields to mailchimp fields.
118 * Test by submitting a form or go to Contact Form Entries and open any entry then press "Send to Mailchimp" button.
119 * Go to MailChimp Logs and verify if entry was sent to mailchimp.
120
121 = contact form 7 mailchimp integration =
122
123 You can easily integrate contact form 7 with mailchimp. You can add a member as Subsribed or pending in mailchimp when someone submits a form on your site.
124
125 = Add mailchimp to contact form 7 =
126
127 You can add mailchimp to contact form 7 with this free Wordpress contact form 7 mailchimp plugin. Simply connect mailchimp then map mailchimp list fields to contact form 7 fields.
128
129 = Mailchimp integration with contact form 7 =
130
131 Integrating mailchimp with contact form 7 is very easy. You can send form entry to mailchimp when anyone submits a form or send it manually by clicking "Send to Mailchimp" button.
132
133 = how to use contact form 7 mailchimp extension =
134
135 It is simple, Go to Mailchimp accounts , add your account then go to Mailchimp feeds and add new feed here. Now submit a contact form 7 form, this new submission will be sent to mailchimp.
136
137 = Contact form 7 integration with mailchimp =
138
139 Easily integrate contact form 7 and mailchimp with this free wordpress mailchimp contact form 7 extension. This plugin displays all data whether sent or not sent to mailchimp as "Mailchimp Logs".
140
141
142 = Mailchimp and contact form 7 =
143
144 contact form 7 is always free forms builder and mailchimp is a free newsletter service which is good. You can easily connect mailchimp to contact form 7 with this free contact form 7 mailchimp extension.
145
146 = Contact form 7 mailchimp checkbox =
147
148 You do not need a separate checkbox for mailchimp optin. simply use "Optin Condition" feature of this plugin. Additionally you can add multiple conditions for mailchimp optin.
149
150 = Contact form 7 mailchimp custom fields =
151
152 This contact form 7 mailchimp extension displays list of all mailchimp custom fields. you can easily map mailchimp merge fields to contact form 7 fields.
153
154 = Contact form 7 mailchimp groups =
155
156 You can add a member to multiple groups in mailchimp. currently this feature is available in pro version of this plugin.
157
158 = Mailchimp for contact form 7 =
159
160 You can use contact form 7 forms for sending form submissions to mailchimp with mailchimp contact form 7 plugin. when anyone submits a form , you can subscribe him to mailchimp list.
161
162 = Contact form 7 newsletter signup mailchimp =
163
164 Mailchimp is a popular newletter service. You can create newsletter singup forms using any form builder then send it to mailchimp with this free contact form 7 mailchimp extension.
165
166
167 == Changelog ==
168
169 = 1.1.2 =
170 * fixed "escape variables" issue.
171
172 = 1.1.1 =
173 * fixed "add field" button not working issue.
174
175 = 1.1.0 =
176 * fixed "debug xss" issue.
177
178 = 1.0.9 =
179 * fixed mailchimp groups.
180
181 = 1.0.8 =
182 * fixed file field warning.
183 * fixed dropdown fields.
184
185 = 1.0.7 =
186 * fixed mailchimp interest field.
187
188 = 1.0.6 =
189 * fixed mailchimp groups issue.
190 * removed "send from logs" option.
191
192 = 1.0.5 =
193 * fixed form title field.
194 * fixed groups.
195
196 = 1.0.4 =
197 * added page_url field.
198
199 = 1.0.3 =
200 * increased fields limit to 200.
201 * fixed empty merge fields issue.
202
203 = 1.0.2 =
204 * increased lists limit to 200.
205 * add tags when updating old member.
206
207 = 1.0.1 =
208 * Fixed mailchimp Phone number field.
209
210 = 1.0.0 =
211 * Initial release.
212
213
214
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?> <style type="text/css">
5 .crm_fields_table{
6 width: 100%; margin-top: 30px;
7 }.crm_fields_table .crm_field_cell1 label{
8 font-weight: bold; font-size: 14px;
9 }
10 .crm_fields_table .clear{
11 clear: both;
12 }
13 .crm_fields_table .crm_field{
14 margin: 20px 0px;
15 }
16 .crm_fields_table .crm_text{
17 width: 100%;
18 }
19 .crm_fields_table .crm_field_cell1{
20 width: 20%; min-width: 100px; float: left; display: inline-block;
21 line-height: 26px;
22 }
23 .crm_fields_table .crm_field_cell2{
24 width: 80%; float: left; display: inline-block;
25 }
26 .vxc_alert{
27 padding: 10px 20px;
28 }
29 .vx_icons{
30 color: #888;
31 }
32 .vx_green{
33 color:rgb(0, 132, 0);
34 }
35 #tiptip_content{
36 max-width: 200px;
37 }
38 .vx_tr{
39 display: table; width: 100%;
40 }
41 .vx_td{
42 display: table-cell; width: 90%;
43 }
44 .vx_td2{
45 display: table-cell;
46 }
47 .crm_field .vx_td2 .vx_toggle_btn{
48 margin: 0 0 0 10px; vertical-align: baseline; width: 80px;
49 }
50 .submit{
51 display: none;
52 }
53 </style>
54 <script type="text/javascript">
55 jQuery(document).ready(function($){
56
57 $(".vx_tabs_radio").click(function(){
58 $(".vx_tabs").hide();
59 $("#tab_"+this.id).show();
60 });
61 $(".sf_login").click(function(e){
62 if($("#vx_custom_app_check").is(":checked")){
63 var client_id=$(this).data('id');
64 var new_id=$("#app_id").val();
65 if(client_id!=new_id){
66 e.preventDefault();
67 alert("<?php esc_html_e('Mailchimp Client ID Changed.Please save new changes first','contact-form-mailchimp-crm') ?>");
68 }
69 }
70 })
71 $("#vx_custom_app_check").click(function(){
72 if($(this).is(":checked")){
73 $("#vx_custom_app_div").show();
74 }else{
75 $("#vx_custom_app_div").hide();
76 }
77 });
78
79 $(document).on('click','#vx_revoke',function(e){
80
81 if(!confirm('<?php esc_html_e('Notification - Remove Connection?','contact-form-mailchimp-crm'); ?>')){
82 e.preventDefault();
83 }
84 });
85
86 });
87 </script>
88 <div class="vx_wrap">
89
90 <form method="post" id="mainform">
91 <?php wp_nonce_field("vx_nonce") ?>
92 <h2 class="vx_img_head"><img alt="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" title="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" src="<?php echo $this->get_base_url()?>images/mailchimp-crm-logo.png?ver=1" /> <?php
93 if(empty($id)){
94 esc_html_e("Mailchimp Accounts", 'contact-form-mailchimp-crm');
95 }else{
96 esc_html_e("Mailchimp Account #", 'contact-form-mailchimp-crm'); echo $id;
97 }
98 if(empty($id) || $new_account_id != $id){
99 ?> <a href="<?php echo $new_account ?>" class="add-new-h2" title="<?php esc_html_e('Add New Account','contact-form-mailchimp-crm'); ?>"><?php esc_html_e('Add New Account','contact-form-mailchimp-crm'); ?></a>
100 <?php
101 }if(!empty($id)){
102 ?>
103 <a href="<?php echo $page_link ?>" class="add-new-h2" title="<?php esc_html_e('Back to Accounts','contact-form-mailchimp-crm'); ?>"><?php esc_html_e('Back to Accounts','contact-form-mailchimp-crm'); ?></a>
104 <?php
105 }
106 ?>
107 </h2>
108 <p style="text-align: left;"> <?php echo sprintf(esc_html__("If you don't have a Mailchimp account, you can %ssign up for one here%s.", 'contact-form-mailchimp-crm'), "<a href='https://www.mailchimp.com/' target='_blank' title='".__('Sign Up for Mailchimp CRM','contact-form-mailchimp-crm')."'>" , "</a>") ?> </p>
109 <?php
110 $this->show_msgs($msgs);
111
112 if(!empty($id)){
113 $name=$this->post('name',$info);
114 include_once(self::$path . "templates/setting.php");
115 }else{
116 include_once(self::$path . "templates/settings-table.php");
117 }
118 do_action('vx_plugin_upgrade_notice_'.$this->type);
119 ?>
120 <div>
121
122
123 </div>
124 </form>
125
126 </div>
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?>
5
6 <?php
7 $comments=false;
8 if( is_array($log_entry) && count($log_entry)>0){
9 $objects=$this->get_all_objects();
10 $log=$this->verify_log($log_entry,$objects);
11 $comments=true;
12 echo $this->format_log_msg($log);
13 }
14 if(isset($_GET['vx_debug'])){
15 ?>
16 <input type="hidden" name="vx_debug" value="<?php echo esc_attr($_REQUEST['vx_debug']); ?>">
17 <?php
18 }
19 ?>
20 <div class="box_btns_div">
21 <button class="button" type="submit" name="<?php echo esc_attr($this->id) ?>_send_btn" value="yes"><?php echo esc_html__("Send to Mailchimp",'contact-form-mailchimp-crm')?></button>
22 <?php
23 if($comments ){
24 ?>
25 <a href="<?php echo esc_url($log_url); ?>" class="button"><?php echo esc_html__("Go to Logs",'contact-form-mailchimp-crm')?></a>
26 <?php
27 }
28 ?>
29 </div>
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html>
6 <head>
7 <meta http-equiv="Content-Type" content="text/html;" charset="UTF-8" />
8 </head>
9 <body style="margin: 0px; background-color: #FFFFFF; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#FFFFFF" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0"><table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable" style="margin: 0;padding: 0;background-color: #EBEBEB;height: 100% !important;width: 100% !important;">
10 <tbody><tr>
11 <td align="center" valign="top">
12 <!-- // End Template Preheader \\ -->
13 <table border="0" cellpadding="0" cellspacing="0" width="600" style="border-top: 5px solid #C35050;" id="templateContainer">
14 <tbody><tr>
15 <td align="center" valign="top" id="templateHeader" style="background-color: #FFFFFF;border-top: 0;border-bottom: 0px solid #D9D9D9;">
16 <!-- // Begin Template Header \\ -->
17 <table border="0" cellpadding="0" cellspacing="0" width="100%">
18 <tbody><tr>
19 <td class="headerContent" style="color: #C35050;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 100%;padding: 20px;text-align: left;vertical-align: middle; border-top:1px solid #B24747;">
20 <span style="color:#C35050;"><span style="font-size:24px">{title}</span></span>
21
22 </td>
23 </tr>
24 <tr><td> <p style="padding-left: 10px; padding-bottom: 20px;color: #303030;font-family: Helvetica;font-size: 15px;line-height: 150%;text-align: left;">{msg}</p>
25 </tbody></table>
26 <!-- // End Template Header \\ -->
27 </td>
28 </tr>
29 <tr>
30 <td align="center" valign="top">
31 <!-- // Begin Template Body \\ -->
32 <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody" style="background-color: #FFFFFF;border-top: 0;border-bottom: 1px solid #CACACA;">
33 <tbody>
34 {sf_contents}
35 <tr><td valign="top" style="padding: 40px"></td></tr>
36 </tbody></table>
37 <!-- // End Template Body \\ -->
38 </td>
39 </tr>
40 </tbody></table>
41 </td>
42 </tr>
43
44 </tbody></table>
45 </body>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?> <style type="text/css">
5 label span.howto { cursor: default; }
6
7 .vx_required{color:red; font-weight: normal;}
8 .vx_contents *{
9 -webkit-box-sizing: border-box;
10 -moz-box-sizing: border-box;
11 box-sizing: border-box;
12 }
13 .vx_div{
14 padding: 10px 0px 0px 0px;
15 }
16 .vx_head{
17 font-size: 14px;
18 background: #f4f4f4;
19 font-weight: bold;
20 border: 1px solid #e4e4e4;
21 -moz-user-select: none;
22 -webkit-user-select: none;
23 -ms-user-select: none;
24 }
25 .vx_head:hover , .crm_panel_head2:hover{
26
27 background: #f0f0f0;
28 }
29 .vx_group{
30 border: 1px dashed #ccc;
31 border-top-width: 0px ;
32 padding: 14px;
33 background: #fff;
34 }
35 .vx_row{
36 padding: 10px 0px;
37 }
38 .vx_col1{float:left; width: 25%; padding-right: 20px; font-weight: bold;}
39 .vx_col2{float:left; width: 75%; padding-right: 20px;}
40 @media screen and (max-width: 782px) {
41 .vx_col1{float:none; width: 100%;}
42 .vx_col2{float:none; width: 100%}
43 }
44
45 .alert_danger {
46 background: #ca5952;
47 padding: 5px;
48 font-size: 12px;
49 font-weight: bold;
50 color: #fff;
51 text-align: center;
52 margin-top: 10px;
53 }
54 .crm_sel{
55 min-width: 220px;
56 }
57
58 .vx_wrapper{
59 border: 0px solid #e5e5e5;
60 margin: 20px auto;
61 width: 100%;
62
63 }
64
65 .vx_contents{
66 padding-top: 8px;
67 }
68 .vx_heading{
69 font-size: 18px;
70 padding: 10px 20px;
71 border-bottom: 1px dashed #ccc;
72 }
73 /*********custom fields***************/
74 .vx_filter_div{
75 border: 1px solid #eee;
76 padding: 10px;
77 background: #f3f3f3;
78 border-radius: 4px;
79 }
80 .vx_filter_field{
81 float: left;
82 }
83 .vx_filter_field1{
84 width: 32%;
85 }
86 .vx_filter_field2{
87 width: 30%;
88 }
89 .vx_filter_field3{
90 width: 30%;
91 }
92 .vx_filter_field4{
93 width: 8%;
94 }
95 .vx_filter_field select{
96 width:90%; display: block;
97 }
98 .vx_btn_div{
99 padding: 10px 0px;
100 }
101 .vx_filter_label{
102 padding: 3px;
103 }
104 .vxc_filter_text{
105 max-width: 98%;
106 width: 96%;
107 }
108 .vx_trash_or{
109 color: #D20000;
110 margin-left: 10px;
111 }
112
113 .vx_trash_or:hover{
114 color: #C24B4B;
115 }
116 .vx_icons{
117 font-size: 16px;
118 vertical-align: middle;
119 cursor: pointer;
120 color: #999;
121 }
122 .vx_icons-s{
123 font-size: 12px;
124 vertical-align: middle;
125 }
126 .vx_icons-h{
127 font-size: 16px;
128 line-height: 28px;
129 vertical-align: middle;
130 cursor: pointer;
131 }
132 .vx_icons:hover , .vx_icons-h:hover{
133 color: #333;
134 }
135 .reg_proc{
136 display: none;
137 }
138 /*******fields boxes****************/
139 .crm_panel * {
140 -webkit-box-sizing: border-box; /* Safari 3.0 - 5.0, Chrome 1 - 9, Android 2.1 - 3.x */
141 -moz-box-sizing: border-box; /* Firefox 1 - 28 */
142 box-sizing: border-box;
143 }
144 .crm_panel_100{
145 margin: 10px 0;
146 }
147 .crm_panel_50{
148 width: 48%;
149 margin: 1%;
150 min-width: 300px;
151 float: left;
152 }
153 .crm_panel_head{
154 background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
155 border: 1px solid #ddd;
156 }
157 .crm_panel_head2{
158 background: #f6f6f6;
159 border: 1px solid #e8e8e8;
160 font-weight: bold;
161 -moz-user-select: none;
162 -webkit-user-select: none;
163 -ms-user-select: none;
164 }
165 .crm_panel_head {
166 font-size: 14px; color:#666; font-weight: bold;
167 }
168 .crm_head_div{
169 float: left;
170 width: 80%; padding: 8px 20px;
171 }
172 .crm_panel_content{
173 border: 1px solid #e8e8e8;
174 border-top: 0px;
175 display: block;
176 padding: 12px;
177 background: #fff;
178 overflow: auto;
179 }
180 .crm-block-content{
181 height: 200px;
182 overflow: auto;
183 }
184 .crm_btn_div{
185 float: right;
186 width:20%; padding: 8px 20px;
187 text-align: right;
188 }
189 .vx_action_btn:hover{
190 color: #333;
191 }
192 .crm_panel .vx_action_btn{
193 color: #777; cursor: pointer;
194 vertical-align: middle;
195 font-size: 16px;
196 }
197 .vx_remove_btn{
198 margin-right: 7px;
199 }
200 .vx_input_100{
201 width: 100%;
202 }
203 .crm_clear{
204 clear: both;
205 }
206 .entry_row {
207 margin: 7px auto;
208 }
209 .entry_col1 {
210 float: left;
211 width: 25%;
212 padding: 0px 7px;
213 text-align: left;
214 }
215 .entry_col2 {
216 float: left;
217 width: 75%;
218 padding-left: 7px;
219 }
220 .vx_margin{
221 margin-top: 10px;
222 }
223 .vx_red{
224 color: #E31230;
225 }
226 .vx_label{
227 font-weight: bold;
228 }
229 .vx_error{
230 background: #ca5952;
231 padding: 10px;
232 font-size: 14px;
233 margin: 1% 2%;
234 color: #fff;
235 }
236 .crm_panel .vx_error{
237 margin: 0;
238 }
239 .vxc_field_value{
240 margin-bottom: 7px;
241 }
242 .vxcf_options_row .howto{
243 display: none;
244 }
245 .vx_check_item{
246 padding-bottom: 6px;
247 }
248 .vx_check_item input{
249 margin-top: 0;
250 }
251 </style>
252
253 <?php
254 if(is_array($msgs) && count($msgs)>0){
255 foreach($msgs as $msg){
256 if(isset($msg['class']) && $msg['class'] !=""){
257 ?>
258 <div class="fade below-h2 <?php echo $msg['class'] ?> notice is-dismissible">
259 <p><?php echo wp_kses_post($msg['msg']); ?></p>
260 </div>
261 <?php
262 } }
263 }
264 ?>
265 <div class="vx_wrap">
266 <h2 class="vx_img_head"><img alt="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" title="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" src="<?php echo $this->get_base_url()?>images/mailchimp-crm-logo.png?ver=1" /> <?php
267 echo sprintf(esc_html__('Edit Mailchimp Feed # %d','contact-form-mailchimp-crm') ,$fid);
268 if(empty($id) || $new_account_id != $id){
269 ?> <a href="<?php echo esc_url($new_feed_link) ?>" class="add-new-h2"><?php esc_html_e("Add New Feed",'contact-form-mailchimp-crm'); ?></a>
270 <?php
271 }
272 ?>
273 <a href="<?php echo esc_url($feeds_link) ?>" class="add-new-h2"><?php esc_html_e("Back to Feeds",'contact-form-mailchimp-crm'); ?></a>
274
275 </h2>
276 <?php
277 //
278 $feed_name=$this->post('name',$feed);
279 if(empty($feed_name)){
280 $feed_name="Feed #".$fid;
281 }
282
283 //ensures valid credentials were entered in the settings page
284 if(!empty($info) && !$this->api_is_valid($info)) {
285 ?>
286 <div class="error" id="message" style="margin-top:20px;"><?php echo wpautop(sprintf(esc_html__("We are unable to login to Mailchimp with the provided API token. Please make sure they are valid in the %sSettings Page%s", 'contact-form-mailchimp-crm'), "<a href='".esc_url($this->link_to_settings())."'>", "</a>")); ?></div>
287 <?php
288 // return;
289 }
290 ?>
291 <div class="vx_contents">
292
293 <form method="post" action="">
294 <input type="hidden" name="id" id="vx_id" value="<?php echo esc_html($fid) ?>"/>
295 <?php wp_nonce_field("vx_nonce") ?>
296 <div class="vx_div">
297 <div class="vx_head">
298 <div class="crm_head_div"> <?php esc_html_e('1. Enter feed name', 'contact-form-mailchimp-crm' ); ?></div>
299 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
300 <div class="crm_clear"></div>
301 </div>
302 <div class="vx_group">
303 <div class="vx_row">
304 <div class="vx_col1">
305 <label for="vx_name" class="left_header"><?php esc_html_e("Feed Name", 'contact-form-mailchimp-crm'); ?>
306 <?php $this->tooltip("vx_feed_name") ?>
307 </label>
308 </div>
309 <div class="vx_col2">
310 <input type="text" id="vx_name" class="vx_input_100" name="name" autocomplete="off" value="<?php echo esc_attr($feed_name); ?>" >
311 </div>
312 <div class="clear"></div>
313 </div>
314 </div>
315 </div>
316 <div class="vx_div">
317 <div class="vx_head">
318 <div class="crm_head_div"> <?php esc_html_e('2. Select Mailchimp Account.', 'contact-form-mailchimp-crm'); ?></div>
319 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
320 <div class="crm_clear"></div>
321 </div>
322
323 <div class="vx_group">
324 <div class="vx_row">
325 <div class="vx_col1">
326 <label for="vx_account" class="left_header"><?php esc_html_e("Mailchimp Account", 'contact-form-mailchimp-crm'); ?>
327 <?php $this->tooltip("vx_sel_object") ?>
328 </label>
329 </div>
330 <div class="vx_col2">
331 <select id="vx_account" class="crm_sel load_object" name="account" autocomplete="off">
332 <option value=""><?php esc_html_e("Select a Mailchimp Account", 'contact-form-mailchimp-crm'); ?></option>
333 <?php
334 $this->account=$account=$this->post('account',$feed);
335 $account_found=false;
336 foreach ($accounts as $k=>$v){
337 $sel='';
338 if($account == $v['id']){
339 $sel='selected="selected"';
340 $account_found=true;
341 }
342 ?>
343 <option value="<?php echo esc_attr($v['id']) ?>" <?php echo $sel; ?>><?php echo esc_html($v['name']) ?></option>
344 <?php
345 }
346 ?>
347 </select>
348
349 </div>
350 <div class="clear"></div>
351 </div>
352 </div>
353 </div>
354
355 <div class="vx_div">
356 <div class="vx_head">
357 <div class="crm_head_div"> <?php esc_html_e('3. Select Contact Form.', 'contact-form-mailchimp-crm'); ?></div>
358 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
359 <div class="crm_clear"></div>
360 </div>
361
362 <div class="vx_group">
363 <div class="vx_row">
364 <div class="vx_col1">
365 <label for="vx_form_id" class="left_header"><?php esc_html_e("Contact Form Form", 'contact-form-mailchimp-crm'); ?>
366 <?php $this->tooltip("vx_sel_form") ?>
367 </label>
368 </div>
369 <div class="vx_col2">
370 <select id="vx_form_id" class="crm_sel load_object" name="form_id" autocomplete="off">
371 <option value=""><?php esc_html_e("Select a Form", 'contact-form-mailchimp-crm'); ?></option>
372 <?php
373
374 foreach($forms as $f_key=>$platform){
375 if(isset($platform['label'])){
376 ?>
377 <optgroup label="<?php echo esc_attr($platform['label']) ?>">
378 <?php
379 if(isset($platform['forms']) && is_array($platform['forms'])){
380 foreach($platform['forms'] as $form_id_=>$form_title){
381 $sel="";
382 $form_id_arr=$f_key.'_'.$form_id_;
383 if($form_id == $form_id_arr)
384 $sel="selected='selected'";
385 echo "<option value='".esc_attr($form_id_arr)."' $sel>".esc_html($form_title)."</option>";
386 }
387 }
388 ?>
389 </optgroup>
390 <?php
391 } }
392 ?>
393 </select>
394
395 </div>
396 <div class="clear"></div>
397 </div>
398 </div>
399 </div>
400
401 <div id="crm_ajax_div_object" style="display:none; text-align: center; line-height: 100px;"><i> <?php esc_html_e('Loading, Please Wait...','contact-form-mailchimp-crm'); ?></i></div>
402
403 <div id="crm_object_div" style="<?php if(empty($info) || empty($form_id)) {echo 'display:none';} ?>">
404 <?php
405 if(!empty($info) && !empty($form_id)){
406 $this->field_map_object($account,$form_id,$feed,$info);
407 }
408 ?>
409 </div>
410
411
412 </form>
413 </div>
414
415 </div>
416 <script type="text/javascript">
417 var vx_crm_ajax='<?php echo wp_create_nonce("vx_crm_ajax") ?>';
418 var vx_form_id='<?php echo esc_attr($form_id); ?>';
419 var vx_ajax=false;
420 jQuery(document).ready(function($) {
421
422 $(document).on("change",".vxc_field_type",function(e){
423 e.preventDefault();
424 var div=$(this).parents('.crm_panel');
425 var val=$(this).val();
426 div.find('.vxc_fields').hide();
427 div.find('.vxc_field_'+val).show();
428 if(val){
429 var input=div.find('.vxc_field_input');
430 if(!input.val()){
431 var option=div.find('.vxc_field_option').val();
432 if(option){ input.val("{"+option+"}"); }
433 }
434 }
435 if(div.find('.vxcf_options_row').length){
436 if(!val){
437 div.find('.vxc_field_option').show();
438 }else{
439 div.find('.vxc_field_option').hide();
440 }
441 }
442 });
443 $(document).on("change",".vxc_field_option",function(e){
444 var col=$(this).parents('.entry_col2');
445 var val=$(this).val();
446 var input=col.find('.vxc_field_input');
447 if(input.is(':visible')){
448 var input_val=input.val();
449
450 input_val+=' {'+val+'}';
451 input_val=$.trim(input_val);
452 input.val(input_val);
453 }
454 });
455 $(document).on("click",".vx_refresh_btn",function(e){
456 var check=$(this);
457 if(check.is(':checked')){
458 var box=check.parents('.vx_group');
459 box.find('.vx_refresh_data').trigger('click');
460 }
461 });
462 $(document).on("click","#toggle_camp",function(e){
463 e.preventDefault();
464 var btn=$(this);
465 var ok=btn.find(".reg_ok");
466 var proc=btn.find(".reg_proc");
467 var sel=$("#crm_sel_camp");
468 var input=$("#crm_camp_id");
469 var camp_type=$("#crm_camp_type");
470 if(ok.is(":visible")){
471 //
472 ok.hide();
473 proc.show();
474 input.show();
475 sel.hide();
476 camp_type.val('input');
477 }else{
478 button_state_vx("ok",btn);
479 input.hide();
480 sel.show();
481 camp_type.val('');
482 ok.show();
483 proc.hide();
484 }
485 });
486
487 $(document).on("click",".vx_refresh_data",function(e){
488 e.preventDefault();
489 var btn=$(this);
490 var action=$(this).data('id');
491 var account=$("#vx_account").val();
492 var object=$("#vx_module").val();
493 button_state_vx("ajax",btn);
494 $.post(ajaxurl,{action:'refresh_data_<?php echo esc_attr($this->id) ?>',vx_crm_ajax:vx_crm_ajax,vx_action:action,account:account,object:object},function(res){
495 var re=$.parseJSON(res);
496 button_state_vx("ok",btn);
497 if(re.status){
498 if(re.status == "ok"){
499 $.each(re.data,function(k,v){
500 if($("#"+k).length){
501 $("#"+k).html(v);
502 }
503 })
504 }else{
505 if(re.error && re.error!=""){
506 alert(re.error);
507 }
508 }
509 }
510
511 });
512 });
513
514 //toggle boxes
515 $(document).on("click",".crm_toggle_btn",function(e){
516 e.preventDefault();
517 var btn=jQuery(this);
518 if(btn.hasClass("vx_btn_inner")){
519 var panel=btn.parents(".crm_panel");
520 var div=panel.find(".crm_panel_content");
521 }else{
522 var panel=btn.parents(".vx_div");
523 var div=panel.find(".vx_group");
524 }
525
526 div.slideToggle('fast',function(){
527 if(div.is(":visible")){
528 btn.removeClass('fa-plus');
529 btn.addClass('fa-minus');
530 }else{
531 btn.addClass('fa-plus');
532 btn.removeClass('fa-minus');
533 }
534 });
535 });
536 $(document).on("dblclick",".vx_head,.crm_panel_head2",function(e){
537 e.preventDefault();
538 $(this).find('.crm_toggle_btn').trigger('click');
539 });
540 //post validation
541
542 $("form").submit(function(e){
543 if($(".vx_required").length){
544
545 $(".vx_required").each(function(){
546 var value="";
547 if($(this).hasClass('vx_req_parent')){
548 var panel=$(this).parents(".vx_div");
549 var attach_error=field_div=group=panel.find('.vx_group');
550 var head=panel.find('.vx_head');
551 var input=group.find(".crm_toggle_check");
552 if(input.is(":checked")){
553 var input=group.find("select");
554 value=input.val();
555 }
556
557 }else{
558 var panel=$(this).parents(".crm_panel");
559 var parent=panel.parents(".vx_div");
560 var field_div=panel.find(".crm_panel_content");
561 var group=parent.find('.vx_group');
562 var head=parent.find('.vx_head');
563 var attach_error=panel.find(".vx_margin");
564
565 var field=panel.find(".vxc_field_type").val();
566 var row=panel.find(".vxc_field_"+field);
567 var input=row.find(":input");
568 value=input.val();
569 }
570
571
572 panel.find(".vx_entry_error").remove();
573 if(value == ""){
574 e.preventDefault();
575
576 if(!group.is(":visible")){
577 head.find(".crm_toggle_btn").trigger('click');
578 setTimeout(function(){ input.focus();},500);
579 }else{
580 input.focus();
581 }
582 if(field_div.is(":hidden")){
583 panel.find(".crm_toggle_btn").trigger('click');
584 }
585 attach_error.append('<div class="entry_row vx_entry_error"><div class="vx_error"><i class="fa fa-warning"></i> <?php esc_html_e('This is a required field','contact-form-mailchimp-crm') ?></div></div>');
586 return false;
587 }
588 })
589 }
590 })
591
592 $(document).on("click",".crm_toggle_check",function(e){
593 var id=$(this).attr('id');
594 var div=$("#"+id+"_div");
595 if(this.checked){
596 div.show();
597 if(this.id == 'crm_note'){
598 add_note_sel();
599 }
600 }else{
601 div.hide();
602 }
603 })
604
605 $(document).on("click","#vx_refresh_fields",function(e){
606 e.preventDefault();
607 load_fields(true);
608 });
609 $(document).on("click","#vx_refresh_objects",function(e){
610 e.preventDefault();
611 var button=$(this);
612 var select=$("#vx_module");
613 var account=$("#vx_account").val();
614 var object=select.val();
615 button_state_vx('ajax',button);
616 $.post(ajaxurl,{action:'get_objects_<?php echo esc_attr($this->id) ?>',vx_crm_ajax:vx_crm_ajax,object:object,account:account},function(res){
617 button_state_vx('ok',button);
618 if(res!=""){
619 select.html(res);
620 }
621 })
622 });
623 $(document).on("change",".load_form",function(e){
624 e.preventDefault();
625 load_fields(false);
626 });
627 $(document).on("change",".load_object",function(e){
628 load_object();
629 });
630
631 $(document).on("click",".vx_remove_btn",function(e){
632 e.preventDefault();
633 if(!confirm('<?php esc_html_e('Are you sure to remove ?','contact-form-mailchimp-crm') ?>')){
634 return;
635 }
636 var temp=$(this).parents(".crm_panel");
637 temp.find('.crm-desc-name').removeClass('crm-desc-name');
638
639 mark_del(temp);
640 update_fields_sel_vx();
641 });
642 //
643 $(document).on("click","#xv_add_custom_field",function(e){
644 var temp=$("#vx_field_temp .vx_fields").clone();
645 var field_name_select=$('#vx_add_fields_select');
646 if(field_name_select.length){
647 var field_name=id=field_name_select.val();
648 if(field_name == '' || crm_fields[field_name] == ''){
649 alert('<?php esc_html_e('Please Select Field Name','contact-form-mailchimp-crm') ?>');
650 return;
651 }
652 var field=crm_fields[field_name];
653 if(field.type){
654 temp.find('.crm-desc-type').text(field.type);
655 }else{
656 temp.find('.crm-desc-type-div').remove();
657 }
658 //
659 if(field.name){
660 temp.find('.crm-desc-name').text(field.name);
661 }else{
662 temp.find('.crm-desc-name-div').remove();
663 }
664 //
665 if(field.maxlength){
666 temp.find('.crm-desc-len').text(field.maxlength);
667 }else{
668 temp.find('.crm-desc-len-div').remove();
669 }
670 //
671 if(field.label){
672 temp.find('.crm_text_label').text(field.label);
673 }
674 if(field.eg){
675 temp.find('.crm-desc-eg').text(field.eg);
676 }else{
677 temp.find('.crm-desc-eg-div').hide();
678 }
679 }else{
680
681 var id=rand();
682 }
683 temp.find(":input").each(function(){
684 var name=$(this).attr('name');
685 if(name){
686 $(this).attr('name','meta[map]['+id+']['+name+']');
687 }
688 });
689 verify_options(temp);
690 $("#vx_field_temp").before(temp);
691 update_fields_sel_vx();
692 $(this).blur();
693 });
694 jQuery('.crm_panel').each(function(){
695 var panel=$(this);
696 verify_options(panel);
697 });
698 function verify_options(panel){
699 var name=$.trim(panel.find('.crm-desc-name').text());
700 if(name && crm_fields[name].options){
701 var row=panel.find('.entry_row2');
702 var type=panel.find('.vxc_field_type').val();
703 var input=row.find('.vxc_field_input');
704 var val=input.val();
705 var str='<select name="'+input.attr('name')+'" id="'+input.attr('id')+'" class="vxc_field_input vx_input_100">';
706 str+='<option value="">Select any option</option>';
707
708 jQuery.each(crm_fields[name].options,function(k,v){
709 if(v.hasOwnProperty('value')){
710 if(v.hasOwnProperty('name')){
711 k=v.name;
712 }
713 v=v.value;
714 }
715 str+='<option value="'+k+'">'+v+'</option>';
716 });
717 str+='</select>';
718 input.replaceWith(str);
719 input=row.find('.vxc_field_input');
720 input.val(val);
721
722 row.addClass('vxcf_options_row');
723 if(type){ row.find('.vxc_field_option').hide(); }
724 }
725 }
726 //
727 $(document).on("click",".vx_add_or",function(e){
728 e.preventDefault();
729 var par=$(this).parent(".vx_btn_div");
730 var div=$("#vx_filter_temp");
731 var temp=div.find(".vx_filter_or").clone();
732 var par_id=rand();
733 temp.attr('data-id',par_id);
734 var id=rand();
735 temp.find(":input").each(function(){
736 var name=$(this).attr('name');
737 if(name)
738 $(this).attr('name','meta[filters]['+par_id+']['+id+']['+name+']');
739 });
740 temp.find(".vx_filter_label_and").remove();
741 temp.find(".vx_filter_field4").remove();
742 par.before(temp);
743 });
744 $(document).on("click",".vx_trash_or",function(e){
745 e.preventDefault();
746 var temp=$(this).parents(".vx_filter_or");
747 mark_del(temp);
748 });
749 $(document).on("click",".vx_trash_and",function(e){
750 e.preventDefault();
751 var temp=$(this).parents(".vx_filter_and");
752 mark_del(temp);
753 });
754 $(document).on("click",".vx_add_and",function(e){
755 e.preventDefault();
756 var par=$(this).parent(".vx_btn_div");
757 var div=$("#vx_filter_temp");
758 var temp=div.find(".vx_filter_and").clone();
759 var par_id=$(this).parents(".vx_filter_or").attr('data-id');
760 var id=rand();
761 temp.find(":input").each(function(){
762 var name=$(this).attr('name');
763 if(name)
764 $(this).attr('name','meta[filters]['+par_id+']['+id+']['+name+']');
765 })
766 par.before(temp);
767 });
768 $(document).on('click','.vxc_tips',function(e){
769 e.preventDefault();
770 });
771 function add_note_sel(){
772 jQuery('#crm_note_fields').select2({ placeholder: '<?php esc_html_e('Select Field','contact-form-mailchimp-crm') ?>'});
773 }
774 function mark_del(obj){
775 obj.css({'opacity':'.5'});
776 obj.fadeOut(500,function(){
777 $(this).remove();
778 });
779 }
780 function rand(){
781 return Math.round(Math.random()*1000000000);
782 }
783 function update_fields_sel_vx(){
784 if(!jQuery('#vx_add_fields_select').length){
785 return;
786 }
787 var fields_boxes=[];
788 jQuery('.crm-desc-name').each(function(){
789 var val= jQuery.trim(jQuery(this).text());
790 if(val){
791 fields_boxes.push(val);
792 }
793 });
794 var str='';
795 if(crm_fields){
796 jQuery.each(crm_fields , function(k,v){
797 var disable='';
798 if(jQuery.inArray(k,fields_boxes) > -1){
799 disable='disabled="disabled"';
800 }
801 str+='<option value="'+k+'" '+disable+'>'+v.label+'</option>';
802 //}
803 })
804 }
805 jQuery('#vx_add_fields_select').html(str);
806 jQuery('#vx_add_fields_select').val('');
807 jQuery('#vx_add_fields_select').trigger('change');
808 }
809
810 function load_fields(refresh){
811 if(vx_ajax && vx_ajax.abort){
812 vx_ajax.abort();
813 }
814 var module=$("#vx_module").val();
815 var account=$("#vx_account").val();
816 var id=$("#vx_id").val();
817 ///var primary=$("#crm_primary_field");
818 var ajax=$("#crm_ajax_div");
819 var fields=$("#crm_field_group");
820 var form_id=$("#vx_form_id").val();
821 ///var fields_div=$("#fields_div");
822 //if(form_id == "" || module == "")
823 //return;
824 ajax.show();
825 fields.hide();
826 var button=$("#vx_refresh_fields");
827 button_state_vx('ajax',button);
828 vx_ajax=$.post(ajaxurl,{action:'get_field_map_<?php echo esc_attr($this->id) ?>',form_id:form_id,account:account,module:module,id:id,vx_crm_ajax:vx_crm_ajax,refresh:refresh},function(res){
829 fields.html(res);
830 // primary.html(re.fields);
831 fields.slideDown(); button_state_vx('ok',button);
832 start_tooltip();
833 vx_select();
834 ajax.hide();
835
836
837 jQuery('.crm_panel').each(function(){
838 var panel=$(this);
839 verify_options(panel);
840 });
841 })
842 }
843 function load_object(){
844 if(vx_ajax && vx_ajax.abort){
845 vx_ajax.abort();
846 }
847 var account=$("#vx_account").val();
848 var id=$("#vx_id").val();
849 ///var primary=$("#crm_primary_field");
850 var ajax=$("#crm_ajax_div_object");
851 var fields=$("#crm_object_div");
852 var form_id=$("#vx_form_id").val();
853 // if(form_id == "" || account == "")
854 // return;
855 ajax.show();
856 fields.hide();
857
858 vx_ajax=$.post(ajaxurl,{action:'get_field_map_object_<?php echo esc_attr($this->id) ?>',form_id:form_id,account:account,id:id,vx_crm_ajax:vx_crm_ajax},function(res){
859 fields.html(res);
860 // primary.html(re.fields);
861 fields.slideDown();
862 start_tooltip();
863 vx_select();
864 ajax.hide();
865 })
866 }
867 vx_select();
868 function vx_select(){
869 $('#vx_add_fields_select').select2({ placeholder: '<?php esc_html_e('Select Field','contact-form-mailchimp-crm') ?>'});
870 add_note_sel();
871 }
872 $(document).on("click","#load_objects",function(e){
873 e.preventDefault();
874 var id=$("#vx_id").val();
875 var ajax=$("#crm_ajax_div");
876 var fields=$("#vx_module");
877 var fields_div=$("#crm_field_group");
878 ajax.show();
879 fields_div.hide();
880 $.post(ajaxurl,{action:'get_objects_list_<?php echo esc_attr($this->id) ?>',id:id},function(res){
881 fields.html(res);
882 ajax.hide();
883 })
884 });
885 function button_state_vx(state,button){
886 var ok=button.find('.reg_ok');
887 var proc=button.find('.reg_proc');
888 if(state == "ajax"){
889 button.attr({'disabled':'disabled'});
890 ok.hide();
891 proc.show();
892 }else{
893 button.removeAttr('disabled');
894 ok.show();
895 proc.hide();
896 }
897 }
898 });
899
900 </script>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?><div class="vx_div">
5 <div class="vx_head">
6 <div class="crm_head_div"> <?php esc_html_e('4. Select the Object to create when a form is submitted.', 'contact-form-mailchimp-crm'); ?></div>
7 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
8 <div class="crm_clear"></div>
9 </div>
10
11 <div class="vx_group">
12 <div class="vx_row">
13 <div class="vx_col1">
14 <label for="vx_module" class="left_header"><?php esc_html_e("Mailchimp List", 'contact-form-mailchimp-crm'); ?>
15 <?php $this->tooltip("vx_sel_object") ?>
16 </label>
17 </div>
18 <div class="vx_col2">
19 <select id="vx_module" class="load_form crm_sel" name="object" autocomplete="off">
20 <option value=""><?php esc_html_e("Select a Mailchimp List", 'contact-form-mailchimp-crm'); ?></option>
21 <?php
22 foreach ($objects as $k=>$v){
23 $sel=$feed['object'] == $k ? 'selected="selected"' : "";
24
25 ?>
26 <option value="<?php echo esc_attr($k) ?>" <?php echo $sel; ?>><?php echo esc_html($v) ?></option>
27 <?php
28 }
29 ?>
30 </select>
31 <span style="margin-left: 10px;"></span>
32 <button class="button" id="vx_refresh_objects" title="<?php esc_html_e('Refresh Lists','contact-form-mailchimp-crm'); ?>">
33 <span class="reg_ok"><i class="fa fa-refresh"></i> <?php esc_html_e('Refresh Lists','contact-form-mailchimp-crm') ?></span>
34 <span class="reg_proc"><i class="fa fa-refresh fa-spin"></i> <?php esc_html_e('Refreshing...','contact-form-mailchimp-crm') ?></span>
35 </button>
36 <button class="button" id="vx_refresh_fields" title="<?php esc_html_e('Refresh Fields','contact-form-mailchimp-crm'); ?>">
37 <span class="reg_ok"><i class="fa fa-refresh"></i> <?php esc_html_e('Refresh Fields','contact-form-mailchimp-crm') ?></span>
38 <span class="reg_proc"><i class="fa fa-refresh fa-spin"></i> <?php esc_html_e('Refreshing...','contact-form-mailchimp-crm') ?></span>
39 </button>
40 </div>
41 <div class="clear"></div>
42 </div>
43 </div>
44 </div>
45
46 <div id="crm_ajax_div" style="display:none; text-align: center; line-height: 100px;"><i> <?php esc_html_e('Loading, Please Wait...','contact-form-mailchimp-crm'); ?></i></div>
47 <div id="crm_err_div" class="alert_danger" style="display:none;"></div>
48 <div id="crm_field_group" style="<?php if($object == "" || $form_id == "") {echo 'display:none';} ?>">
49 <?php
50 if(!empty($object) && !empty($form_id)){
51 $this->get_field_mapping($feed,$info);
52 }
53 ?>
54 </div>
55
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?> <style type="text/css">
5 .user-list tr {
6 cursor: move;
7 }
8 .user-list tr td a {
9 cursor: pointer;
10 }
11 .user-list tr:nth-child(even) {
12 background-color: #f5f5f5;
13 }
14 .vx_col{
15 width: 35px; padding-top: 12px !important; text-align: center; cursor: auto;
16 }
17 .vx_date{
18 width: 18%;
19 }
20 .ui-sortable-helper {
21 display: table;
22 background: #eee;
23 }
24
25 </style>
26 <div class="vx_wrap">
27 <h2 class="vx_img_head"><img alt="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" title="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" src="<?php echo $this->get_base_url()?>images/mailchimp-crm-logo.png?ver=1" /> <?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm'); ?> <a class="page-title-action" href="<?php echo $new_feed_link?>">
28 <?php esc_html_e("Add New", 'contact-form-mailchimp-crm') ?>
29 </a> </h2>
30 <div class="clear"></div>
31 <?php
32 if(!$valid_accounts){
33 ?>
34 <div class="error below-h2" id="message" style="margin-top:20px;">
35 <p><?php echo sprintf( esc_html__("To get started, please configure your %s Mailchimp Settings %s.", 'contact-form-mailchimp-crm'), '<a href="'.esc_url($page_link).'">', "</a>") ?></p>
36 </div>
37 <?php
38 }
39 ?>
40
41 <form id="feed_form" method="post">
42 <?php wp_nonce_field('vx_crm_ajax') ?>
43 <input type="hidden" id="action" name="action"/>
44 <input type="hidden" id="action_argument" name="action_argument"/>
45 <div class="tablenav">
46 <div class="alignleft actions" style="padding:8px 0 7px; ">
47 <label class="hidden" for="bulk_action">
48 <?php esc_html_e("Bulk action", 'contact-form-mailchimp-crm') ?>
49 </label>
50 <select name="bulk_action" id="bulk_action" style="width: 200px">
51 <option value=''>
52 <?php esc_html_e("Bulk action", 'contact-form-mailchimp-crm') ?>
53 </option>
54 <option value='delete'>
55 <?php esc_html_e("Delete", 'contact-form-mailchimp-crm') ?>
56 </option>
57 </select>
58 <button type="submit" title="<?php esc_html_e("Apply Action", 'contact-form-mailchimp-crm') ?>" class="button" id="vx_bulk_actions_submit">
59 <?php esc_html_e("Apply", 'contact-form-mailchimp-crm') ?>
60 </button>
61 </div>
62 </div>
63 <table class="widefat fixed sort" cellspacing="0">
64 <thead>
65 <tr>
66 <td id="cb" class="column-cb check-column" style=""><input type="checkbox" /></td>
67 <th id="active" class="vx_col"></th>
68 <th><?php esc_html_e("Name", 'contact-form-mailchimp-crm') ?></th>
69 <th><?php esc_html_e("Mailchimp Object", 'contact-form-mailchimp-crm') ?></th>
70 <th><?php esc_html_e("Primary Key", 'contact-form-mailchimp-crm'); ?></th>
71 <th class="vx_date"><?php esc_html_e("Created", 'contact-form-mailchimp-crm') ?></th>
72 </tr>
73 </thead>
74 <tfoot>
75 <tr>
76 <td id="cb" class="column-cb check-column" style=""><input type="checkbox" /></td>
77 <th id="active" class="vx_col"></th>
78 <th><?php esc_html_e("Name", 'contact-form-mailchimp-crm') ?></th>
79 <th><?php esc_html_e("Mailchimp Object", 'contact-form-mailchimp-crm') ?></th>
80 <th><?php esc_html_e("Primary Key", 'contact-form-mailchimp-crm'); ?></th>
81 <th class="vx_date"><?php esc_html_e("Created", 'contact-form-mailchimp-crm') ?></th>
82 </tr>
83 </tfoot>
84 <tbody class="list:user user-list">
85 <?php
86
87 if(is_array($feeds) && !empty($feeds)){
88 $objects=$this->get_objects();
89 foreach($feeds as $feed){
90 $data=$this->post('data',$feed);
91 $meta=$this->post('meta',$feed);
92 $data=json_decode($data,true);
93 $fields=json_decode($meta,true);
94 $fields=$this->post('fields',$fields);
95 $primary_key=!empty($data['primary_key']) && isset($fields[$data['primary_key']]['label']) ? $fields[$data['primary_key']]['label'] : esc_html__('N/A','contact-form-mailchimp-crm');
96 $edit_link=$this->get_feed_link($feed['id']);
97 if(isset($objects[$feed['object']])){
98 $feed['object']=$objects[$feed['object']];
99 }else{
100 $feed['object']='';
101 }
102 ?>
103 <tr class='author-self status-inherit' data-id="<?php echo $feed['id'] ?>">
104 <th scope="row" class="check-column"><input type="checkbox" class="vx_check" name="feed[]" value="<?php echo $feed["id"] ?>"/></th>
105 <td class="vx_col"><img src="<?php echo $this->get_base_url() ?>images/active<?php echo intval($feed["is_active"]) ?>.png" alt="<?php echo $feed["is_active"] ? esc_html__("Active", 'contact-form-mailchimp-crm') : esc_html__("Inactive", 'contact-form-mailchimp-crm');?>" title="<?php echo $feed["is_active"] ? esc_html__("Active", 'contact-form-mailchimp-crm') : esc_html__("Inactive", 'contact-form-mailchimp-crm');?>" class="vx_toggle_status" /></td>
106 <td><a href="<?php echo $edit_link ?>" title="<?php echo esc_html( $feed["name"] ) ?>"><?php echo esc_attr($feed["name"]) ?></a>
107
108 <div class="row-actions"> <span class="edit">
109 <a title="<?php esc_attr_e("Edit Settings", 'contact-form-mailchimp-crm') ?>" href="<?php echo $edit_link ?>">
110 <?php esc_html_e("Edit", 'contact-form-mailchimp-crm') ?>
111 </a> |
112 </span>
113 <span class="edit">
114 <a title="<?php esc_html_e("Delete", 'contact-form-mailchimp-crm') ?>" href="#" class="vx_del_feed">
115 <?php esc_html_e("Delete", 'contact-form-mailchimp-crm')?>
116 </a>
117 </span>
118
119 </div></td>
120 <td><p><?php echo $feed["object"]; ?></p></td>
121 <td><p><?php echo $primary_key; ?></p></td>
122 <td><p><?php echo date('M-d-Y H:i:s', strtotime($feed['time'])+$offset); ?></p></td>
123 </tr>
124 <?php
125 }
126 }
127 else {
128 if($valid_accounts){
129 ?>
130 <tr>
131 <td colspan="4" style="padding:20px;"><?php echo sprintf(esc_html__("You don't have any Mailchimp feeds configured. Let's go %s create one %s!", 'contact-form-mailchimp-crm'), '<a href="'.$new_feed_link.'">', "</a>"); ?></td>
132 </tr>
133 <?php
134 }
135 else{
136 ?>
137 <tr>
138 <td colspan="4" style="padding:20px;"><?php echo sprintf(esc_html__("To get started, please configure your %s Mailchimp Settings%s.", 'contact-form-mailchimp-crm'), '<a href="'.esc_url($page_link).'">', "</a>"); ?></td>
139 </tr>
140 <?php
141 }
142 }
143 ?>
144 </tbody>
145 </table>
146 </form>
147 </div>
148
149 <?php
150 do_action('vx_plugin_upgrade_notice_'.$this->type);
151 ?>
152
153 <script type="text/javascript">
154 var vx_crm_nonce='<?php echo wp_create_nonce("vx_crm_ajax") ?>';
155
156 (function( $ ) {
157
158 $(document).ready( function($) {
159
160 $(".vx_del_feed").click(function(e){
161 e.preventDefault();
162 if(!confirm("<?php esc_html_e("Delete this feed? 'Cancel' to stop, 'OK' to delete.", 'contact-form-mailchimp-crm') ?>")){
163 return;
164 }
165 var id=$(this).closest('tr').data('id');
166 jQuery("#action_argument").val(id);
167 jQuery("#action").val("delete");
168 jQuery("#feed_form")[0].submit();
169 });
170 $(".vx_toggle_status").click(function(e){
171 e.preventDefault();
172 var feed_id;
173 var img=this;
174 var is_active = img.src.indexOf("active1.png") >=0
175 var $img=$(this);
176
177 if(is_active){
178 img.src=img.src.replace("active1.png", "active0.png");
179 $img.attr('title','<?php esc_html_e("Inactive", 'contact-form-mailchimp-crm') ?>').attr('alt', '<?php esc_html_e("Inactive", 'contact-form-mailchimp-crm') ?>');
180 }
181 else{
182 img.src = img.src.replace("active0.png", "active1.png");
183 $img.attr('title','<?php esc_html_e("Active", 'contact-form-mailchimp-crm') ?>').attr('alt', '<?php esc_html_e("Active", 'contact-form-mailchimp-crm') ?>');
184 }
185
186 if(feed_id = $img.closest('tr').attr('data-id')) {
187 $.post(ajaxurl,{action:"update_feed_<?php echo esc_attr($this->id) ?>",vx_crm_ajax:vx_crm_nonce,feed_id:feed_id,is_active:is_active ? 0 : 1})
188 }
189 });
190
191 $("#vx_bulk_actions_submit").click(function(e){
192 if($("#bulk_action").val() == ""){
193 alert('<?php esc_html_e('Please Select Action','contact-form-mailchimp-crm') ?>');
194 return false;
195 }
196 if($(".vx_check:checked").length == 0){
197 alert('<?php esc_html_e('Please Select Feed','contact-form-mailchimp-crm') ?>');
198 return false;
199 }
200 if(!confirm('<?php esc_html_e("Are you sure to Delete selected feeds?",'contact-form-mailchimp-crm'); ?>' )){
201 return false;
202 }
203 })
204 $('.sort tbody').sortable({
205 axis: 'y',
206 helper: "clone",
207 helper: function(e, tr)
208 {
209 var $originals = tr.children();
210 var $helper = tr.clone();
211 $helper.children().each(function(index)
212 {
213 // Set helper cell sizes to match the original sizes
214 $(this).width($originals.eq(index).width());
215 });
216 return $helper;
217 },
218 update: function(event, ui){
219 var data = {
220 'action': 'update_feed_sort_<?php echo esc_attr($this->id) ?>',
221 'sort': [],
222 'vx_crm_ajax': vx_crm_nonce,
223 };
224
225 $(this).children().each(function(index, element) {
226 var id = $(element).attr('data-id')
227 data.sort.push(id);
228 })
229
230 $.post( ajaxurl, data );
231
232 }
233 });
234
235 });
236
237 }(jQuery));
238 </script>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 ?>
6 <div class="vx_div">
7 <div class="vx_head">
8 <div class="crm_head_div"> <?php esc_html_e('5. Map Form Fields to Mailchimp Fields.', 'contact-form-mailchimp-crm'); ?></div>
9 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
10 <div class="crm_clear"></div>
11 </div>
12 <div class="vx_group">
13 <div class="vx_col1">
14 <label>
15 <?php esc_html_e("Fields Mapping", 'contact-form-mailchimp-crm'); ?>
16 <?php $this->tooltip("vx_map_fields") ?>
17 </label>
18 </div>
19 <div class="vx_col2">
20 <div id="vx_fields_div">
21 <?php
22 $req_span=" <span class='vx_red vx_required'>(".__('Required','contact-form-mailchimp-crm').")</span>";
23 $req_span2=" <span class='vx_red vx_required vx_req_parent'>(".__('Required','contact-form-mailchimp-crm').")</span>";
24
25
26 foreach($map_fields as $k=>$v){
27
28 $sel_val=isset($map[$k]['field']) ? $map[$k]['field'] : "";
29 $val_type=isset($map[$k]['type']) && !empty($map[$k]['type']) ? $map[$k]['type'] : "field";
30
31 if(isset($skipped_fields[$k])){
32 continue;
33 }
34
35 $display="none"; $btn_icon="fa-plus";
36 if(isset($map[$k][$val_type]) && !empty($map[$k][$val_type])){
37 $display="block";
38 $btn_icon="fa-minus";
39 }
40 $required=isset($v['req']) && $v['req'] == "true" ? true : false;
41 $req_html=$required ? $req_span : ""; $k=esc_attr($k);
42 ?>
43 <div class="crm_panel crm_panel_100">
44 <div class="crm_panel_head2">
45 <div class="crm_head_div"><span class="crm_head_text crm_text_label"> <?php echo $v['label'];?></span> <?php echo wp_kses_post($req_html) ?></div>
46 <div class="crm_btn_div">
47 <?php
48 if(! $required){
49 ?>
50 <i class="vx_remove_btn vx_remove_btn vx_action_btn fa fa-trash-o" title="<?php esc_html_e('Delete','contact-form-mailchimp-crm'); ?>"></i>
51 <?php } ?>
52 <i class="fa crm_toggle_btn vx_action_btn vx_btn_inner <?php echo esc_attr($btn_icon) ?>" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"></i>
53 </div>
54 <div class="crm_clear"></div> </div>
55 <div class="more_options crm_panel_content" style="display: <?php echo esc_attr($display) ?>;">
56 <?php if(!isset($v['name_c'])){ ?>
57
58 <div class="crm-panel-description">
59 <span class="crm-desc-name-div"><?php echo esc_html__('Name:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-name"><?php echo $v['name']; ?></span> </span>
60 <?php if($this->post('type',$v) !=""){ ?>
61 <span class="crm-desc-type-div">, <?php echo esc_html__('Type:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-type"><?php echo $v['type'] ?></span> </span>
62 <?php
63 }
64 if($this->post('maxlength',$v) !=""){
65 ?>
66 <span class="crm-desc-len-div">, <?php echo esc_html__('Max Length:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-len"><?php echo $v['maxlength']; ?></span> </span>
67 <?php
68 } if($this->post('eg',$v) !=""){
69 ?>
70 <span class="crm-desc-eg-div">, <?php echo esc_html__('e.g:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-eg"><?php echo $v['eg']; ?></span> </span>
71 <?php
72 }
73 ?>
74 </div>
75 <?php
76 }
77 ?>
78
79 <div class="vx_margin">
80
81
82 <div class="entry_row">
83 <div class="entry_col1 vx_label"><label for="vx_type_<?php echo esc_attr($k) ?>"><?php esc_html_e('Field Type','contact-form-mailchimp-crm') ?></label></div>
84 <div class="entry_col2">
85 <select name='meta[map][<?php echo esc_attr($k) ?>][type]' id="vx_type_<?php echo esc_attr($k) ?>" class='vxc_field_type vx_input_100'>
86 <?php
87 foreach($sel_fields as $f_key=>$f_val){
88 $select="";
89 if($this->post2($k,'type',$map) == $f_key)
90 $select='selected="selected"';
91 ?>
92 <option value="<?php echo esc_attr($f_key) ?>" <?php echo $select ?>><?php echo esc_attr($f_val); ?></option>
93 <?php } ?>
94 </select>
95 </div>
96 <div class="crm_clear"></div>
97 </div>
98 <div class="entry_row entry_row2">
99 <div class="entry_col1 vx_label">
100 <label for="vx_field_<?php echo esc_attr($k) ?>" style="<?php if($this->post2($k,'type',$map) != ''){echo 'display:none';} ?>" class="vxc_fields vxc_field_"><?php esc_html_e('Select Field','contact-form-mailchimp-crm') ?></label>
101
102 <label for="vx_value_<?php echo esc_attr($k) ?>" style="<?php if($this->post2($k,'type',$map) != 'value'){echo 'display:none';} ?>" class="vxc_fields vxc_field_value"> <?php esc_html_e('Custom Value','contact-form-mailchimp-crm') ?></label>
103 </div>
104 <div class="entry_col2">
105 <div class="vxc_fields vxc_field_value" style="<?php if($this->post2($k,'type',$map) != 'value'){echo 'display:none';} ?>">
106 <input type="text" name='meta[map][<?php echo esc_attr($k)?>][value]' id="vx_value_<?php echo esc_attr($k) ?>" value='<?php echo $this->post2($k,'value',$map)?>' placeholder='<?php esc_html_e("Custom Value",'contact-form-mailchimp-crm')?>' class='vx_input_100 vxc_field_input'>
107 <div class="howto"><?php echo sprintf(esc_html__('You can add a form field %s in custom value from following form fields','contact-form-mailchimp-crm'),'<code>{field_id}</code>')?></div>
108 </div>
109
110
111 <select name="meta[map][<?php echo esc_attr($k) ?>][field]" id="vx_field_<?php echo esc_attr($k) ?>" class="vxc_field_option vx_input_100">
112 <?php echo $this->form_fields_options($form_id,$sel_val); ?>
113 </select>
114
115
116 </div>
117 <div class="crm_clear"></div>
118 </div>
119
120 </div></div>
121 <div class="clear"></div>
122 </div>
123 <?php
124 }
125 ?>
126
127 <div id="vx_field_temp" style="display:none">
128 <div class="crm_panel crm_panel_100 vx_fields">
129 <div class="crm_panel_head2">
130 <div class="crm_head_div"><span class="crm_head_text crm_text_label"> <?php esc_html_e('Custom Field', 'contact-form-mailchimp-crm');?></span> </div>
131 <div class="crm_btn_div">
132 <i class="vx_remove_btn vx_action_btn fa fa-trash-o" title="<?php esc_html_e('Delete','contact-form-mailchimp-crm'); ?>"></i>
133 <i class="fa crm_toggle_btn vx_action_btn vx_btn_inner fa-minus" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"></i>
134 </div>
135 <div class="crm_clear"></div> </div>
136 <div class="more_options crm_panel_content" style="display: block;">
137
138
139 <div class="crm-panel-description">
140 <span class="crm-desc-name-div"><?php echo esc_html__('Name:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-name"></span> </span>
141 <span class="crm-desc-type-div">, <?php echo esc_html__('Type:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-type"></span> </span>
142 <span class="crm-desc-len-div">, <?php echo esc_html__('Max Length:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-len"></span> </span>
143
144 <span class="crm-desc-eg-div">, <?php echo esc_html__('e.g:','contact-form-mailchimp-crm')." ";?><span class="crm-desc-eg"></span> </span>
145
146 </div>
147
148
149 <div class="vx_margin">
150
151
152 <div class="entry_row">
153 <div class="entry_col1 vx_label"><label for="vx_type"><?php esc_html_e('Field Type','contact-form-mailchimp-crm') ?></label></div>
154 <div class="entry_col2">
155 <select name='type' class='vxc_field_type vx_input_100'>
156 <?php
157 foreach($sel_fields as $f_key=>$f_val){
158 ?>
159 <option value="<?php echo esc_attr($f_key) ?>"><?php echo esc_html($f_val)?></option>
160 <?php } ?>
161 </select>
162 </div>
163 <div class="crm_clear"></div>
164 </div>
165
166 <div class="entry_row entry_row2">
167 <div class="entry_col1 vx_label">
168 <label for="vx_field_" class="vxc_fields vxc_field_"><?php esc_html_e('Select Field','contact-form-mailchimp-crm') ?></label>
169
170 <label for="vx_value_" style="display:none" class="vxc_fields vxc_field_value"> <?php esc_html_e('Custom Value','contact-form-mailchimp-crm') ?></label>
171 </div>
172 <div class="entry_col2">
173 <div class="vxc_fields vxc_field_value" style="display:none">
174 <input type="text" name='value' id="vx_value_" placeholder="<?php esc_html_e("Custom Value",'contact-form-mailchimp-crm')?>" class="vx_input_100 vxc_field_input">
175 <div class="howto"><?php echo sprintf(esc_html__('You can add a form field %s in custom value from following form fields','contact-form-mailchimp-crm'),'<code>{field_id}</code>')?></div>
176 </div>
177
178
179 <select name="field" id="vx_field_" class="vxc_field_option vx_input_100">
180 <?php echo $this->form_fields_options($form_id) ?>
181 </select>
182
183
184 </div>
185 <div class="crm_clear"></div>
186 </div>
187
188 </div></div>
189 <div class="clear"></div>
190 </div>
191 </div>
192 <!--end field box template--->
193
194 <div class="crm_panel crm_panel_100">
195 <div class="crm_panel_head2">
196 <div class="crm_head_div"><span class="crm_head_text "> <?php esc_html_e("Add New Field", 'contact-form-mailchimp-crm');?></span> </div>
197 <div class="crm_btn_div"><i class="fa crm_toggle_btn vx_btn_inner fa-minus" style="display: none;" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm'); ?>"></i></div>
198 <div class="crm_clear"></div> </div>
199 <div class="more_options crm_panel_content" style="display: block;">
200
201 <div class="vx_margin">
202 <div style="display: table">
203 <div style="display: table-cell; width: 85%; padding-right: 14px;">
204 <select id="vx_add_fields_select" class="vx_input_100" autocomplete="off">
205 <option value=""></option>
206 <?php
207 $json_fields=array();
208 foreach($fields as $k=>$v){
209 $v['type']=ucfirst($v['type']);
210 if(!empty($v['options'])){
211 $ops=array();
212 foreach($v['options'] as $op_id=>$op){
213 if($k != 'interests'){
214 $op_id=$op;
215 }
216 $ops[$op_id]=$op;
217 }
218 $v['options']=$ops;
219 }
220
221 $json_fields[$k]=$v;
222 $disable='';
223 if(isset($map_fields[$k]) || isset($skip_fields[$k])){
224 $disable='disabled="disabled"';
225 }
226 echo '<option value="'.esc_html($k).'" '.$disable.' >'.esc_html($v['label']).'</option>';
227 } ?>
228 </select>
229 </div><div style="display: table-cell;">
230 <button type="button" class="button button-default" style="vertical-align: middle;" id="xv_add_custom_field"><i class="fa fa-plus-circle" ></i> <?php esc_html_e('Add Field','contact-form-mailchimp-crm')?></button>
231
232 </div></div>
233
234
235 </div></div>
236 <div class="clear"></div>
237 </div>
238 <!--add new field box template--->
239 <script type="text/javascript">
240 var crm_fields=<?php echo json_encode($json_fields); ?>;
241
242 </script>
243
244 </div>
245 </div>
246 <div class="clear"></div>
247 </div>
248 </div>
249 <div class="vx_div">
250 <div class="vx_head">
251 <div class="crm_head_div"> <?php esc_html_e('6. When to Send Entry to Mailchimp.', 'contact-form-mailchimp-crm'); ?></div>
252 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn vx_action_btn fa-minus"></i></div>
253 <div class="crm_clear"></div>
254 </div>
255
256 <div class="vx_group">
257 <div class="vx_row">
258 <div class="vx_col1">
259 <label for="crm_manual_export">
260 <?php esc_html_e('Disable Automatic Export', 'contact-form-mailchimp-crm'); ?>
261 <?php $this->tooltip("vx_manual_export") ?>
262 </label>
263 </div>
264 <div class="vx_col2">
265 <fieldset>
266 <legend class="screen-reader-text"><span>
267 <?php esc_html_e('Disable Automatic Export', 'contact-form-mailchimp-crm'); ?>
268 </span></legend>
269 <label for="crm_manual_export">
270 <input name="meta[manual_export]" id="crm_manual_export" type="checkbox" value="1" <?php echo isset($meta['manual_export'] ) ? 'checked="checked"' : ''; ?>>
271 <?php esc_html_e( 'Manually send the entries to Mailchimp.', 'contact-form-mailchimp-crm'); ?> </label>
272 </fieldset>
273 </div>
274 <div style="clear: both;"></div>
275 </div>
276 <div class="vx_row">
277 <div class="vx_col1">
278 <label for="crm_optin">
279 <?php esc_html_e("Opt-In Condition", 'contact-form-mailchimp-crm'); ?>
280 <?php $this->tooltip("vx_optin_condition") ?>
281 </label>
282 </div>
283 <div class="vx_col2">
284 <div>
285 <input type="checkbox" style="margin-top: 0px;" id="crm_optin" class="crm_toggle_check" name="meta[optin_enabled]" value="1" <?php echo !empty($meta["optin_enabled"]) ? "checked='checked'" : ""?>/>
286 <label for="crm_optin">
287 <?php esc_html_e("Enable", 'contact-form-mailchimp-crm'); ?>
288 </label>
289 </div>
290 <div style="clear: both;"></div>
291 <div id="crm_optin_div" style="margin-top: 16px; <?php echo empty($meta["optin_enabled"]) ? "display:none" : ""?>">
292 <div>
293 <?php
294 $sno=0;
295 foreach($filters as $filter_k=>$filter_v){ $filter_k=esc_attr($filter_k);
296 $sno++;
297 ?>
298 <div class="vx_filter_or" data-id="<?php echo esc_attr($filter_k) ?>">
299 <?php if($sno>1){ ?>
300 <div class="vx_filter_label">
301 <?php esc_html_e('OR','contact-form-mailchimp-crm') ?>
302 </div>
303 <?php } ?>
304 <div class="vx_filter_div">
305 <?php
306 if(is_array($filter_v)){
307 $sno_i=0;
308 foreach($filter_v as $s_k=>$s_v){ $s_k=esc_attr($s_k);
309 $sno_i++;
310
311 ?>
312 <div class="vx_filter_and">
313 <?php if($sno_i>1){ ?>
314 <div class="vx_filter_label">
315 <?php esc_html_e('AND','contact-form-mailchimp-crm') ?>
316 </div>
317 <?php } ?>
318 <div class="vx_filter_field vx_filter_field1">
319 <select id="crm_optin_field" name="meta[filters][<?php echo esc_attr($filter_k) ?>][<?php echo esc_attr($s_k) ?>][field]">
320 <?php
321 echo $this->form_fields_options($form_id,$this->post('field',$s_v));
322 ?>
323 </select>
324 </div>
325 <div class="vx_filter_field vx_filter_field2">
326 <select name="meta[filters][<?php echo esc_attr($filter_k) ?>][<?php echo esc_attr($s_k) ?>][op]" >
327 <?php
328 foreach($vx_op as $k=>$v){
329 $sel="";
330 if($this->post('op',$s_v) == $k)
331 $sel='selected="selected"';
332 echo "<option value='".esc_attr($k)."' $sel >".esc_html($v)."</option>";
333 }
334 ?>
335 </select>
336 </div>
337 <div class="vx_filter_field vx_filter_field3">
338 <input type="text" class="vxc_filter_text" placeholder="<?php esc_html_e('Value','contact-form-mailchimp-crm') ?>" value="<?php echo $this->post('value',$s_v) ?>" name="meta[filters][<?php echo esc_attr($filter_k) ?>][<?php echo esc_attr($s_k) ?>][value]">
339 </div>
340 <?php if( $sno_i>1){ ?>
341 <div class="vx_filter_field vx_filter_field4"><i class="vx_icons-h vx_trash_and vxc_tips fa fa-trash-o" data-tip="Delete"></i></div>
342 <?php } ?>
343 <div style="clear: both;"></div>
344 </div>
345 <?php
346 } }
347 ?>
348 <div class="vx_btn_div">
349 <button class="button button-default button-small vx_add_and" title="<?php esc_html_e('Add AND Filter','contact-form-mailchimp-crm'); ?>"><i class="vx_icons-s vx_trash_and fa fa-hand-o-right"></i>
350 <?php esc_html_e('Add AND Filter','contact-form-mailchimp-crm') ?>
351 </button>
352 <?php if($sno>1){ ?>
353 <a href="#" class="vx_trash_or">
354 <?php esc_html_e('Trash','contact-form-mailchimp-crm') ?>
355 </a>
356 <?php } ?>
357 </div>
358 </div>
359 </div>
360 <?php
361 }
362 ?>
363 <div class="vx_btn_div">
364 <button class="button button-default vx_add_or" title="<?php esc_html_e('Add OR Filter','contact-form-mailchimp-crm'); ?>"><i class="vx_icons vx_trash_and fa fa-check"></i>
365 <?php esc_html_e('Add OR Filter','contact-form-mailchimp-crm') ?>
366 </button>
367 </div>
368 </div>
369 <!--------- template------------>
370 <div style="display: none;" id="vx_filter_temp">
371 <div class="vx_filter_or">
372 <div class="vx_filter_label">
373 <?php esc_html_e('OR','contact-form-mailchimp-crm') ?>
374 </div>
375 <div class="vx_filter_div">
376 <div class="vx_filter_and">
377 <div class="vx_filter_label vx_filter_label_and">
378 <?php esc_html_e('AND','contact-form-mailchimp-crm') ?>
379 </div>
380 <div class="vx_filter_field vx_filter_field1">
381 <select id="crm_optin_field" name="field">
382 <?php
383 echo $this->form_fields_options($form_id);
384 ?>
385 </select>
386 </div>
387 <div class="vx_filter_field vx_filter_field2">
388 <select name="op" >
389 <?php
390 foreach($vx_op as $k=>$v){
391
392 echo "<option value='".esc_attr($k)."' >".esc_html($v)."</option>";
393 }
394 ?>
395 </select>
396 </div>
397 <div class="vx_filter_field vx_filter_field3">
398 <input type="text" class="vxc_filter_text" placeholder="<?php esc_html_e('Value','contact-form-mailchimp-crm') ?>" name="value">
399 </div>
400 <div class="vx_filter_field vx_filter_field4"><i class="vx_icons vx_trash_and vxc_tips fa fa-trash-o"></i></div>
401 <div style="clear: both;"></div>
402 </div>
403 <div class="vx_btn_div">
404 <button class="button button-default button-small vx_add_and" title="<?php esc_html_e('Add AND Filter','contact-form-mailchimp-crm'); ?>"><i class="vx_icons vx_trash_and fa fa-hand-o-right"></i>
405 <?php esc_html_e('Add AND Filter','contact-form-mailchimp-crm') ?>
406 </button>
407 <a href="#" class="vx_trash_or">
408 <?php esc_html_e('Trash','contact-form-mailchimp-crm') ?>
409 </a> </div>
410 </div>
411 </div>
412 </div>
413 <!--------- template end ------------>
414 <p><input type="checkbox" style="margin-top: 0px; " id="crm_unsub" class="crm_toggle_check" name="meta[un_sub]" value="1" <?php echo !empty($meta["un_sub"]) ? "checked='checked'" : ""?> autocomplete="off"/>
415 <label for="crm_unsub"><?php esc_html_e('If Condition(s) do not match then remove from List', 'contact-form-mailchimp-crm'); ?></label></p>
416
417 </div>
418 </div>
419 <div style="clear: both;"></div>
420 </div>
421 <?php
422 if($api_type != "web"){
423 $settings=get_option($this->type.'_settings',array());
424 if(!empty($settings['notes'])){
425 ?>
426
427 <div class="vx_row">
428 <div class="vx_col1">
429 <label for="vx_notes"><?php esc_html_e('Entry Notes ', 'contact-form-mailchimp-crm'); $this->tooltip('vx_entry_notes');?></label>
430 </div>
431 <div class="vx_col2">
432 <input type="checkbox" style="margin-top: 0px;" id="vx_notes" class="crm_toggle_check" name="meta[entry_notes]" value="1" <?php echo !empty($meta['entry_notes']) ? 'checked="checked"' : ''?> autocomplete="off"/>
433 <label for="vx_notes"><?php esc_html_e('Add / delete notes to Mailchimp when added / deleted in Contact Form Entries Plugin', 'contact-form-mailchimp-crm'); ?></label>
434
435 </div>
436 <div class="clear"></div>
437 </div>
438 <?php
439 }
440 }
441 ?>
442
443 </div>
444 </div>
445 <?php
446
447 $panel_count=6;
448
449 $panel_count++;
450 ?>
451 <div class="vx_div ">
452 <div class="vx_head ">
453 <div class="crm_head_div"> <?php echo sprintf(esc_html__('%s. Choose Primary Key.', 'contact-form-mailchimp-crm' ),$panel_count); ?></div>
454 <div class="crm_btn_div"><i class="fa crm_toggle_btn fa-minus" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"></i></div>
455 <div class="crm_clear"></div>
456 </div>
457 <div class="vx_group">
458 <div class="vx_row">
459 <div class="vx_col1">
460 <label for="crm_primary_field"><?php esc_html_e('Select Primary Key','%dd%') ?></label>
461 </div><div class="vx_col2">
462 <select id="crm_primary_field" name="meta[primary_key]" class="vx_sel vx_input_100" autocomplete="off">
463 <?php echo $this->crm_select($fields,$this->post('primary_key',$meta)); ?>
464 </select>
465 <div class="description" style="float: none; width: 90%"><?php esc_html_e('If you want to update a pre-existing object, select what should be used as a unique identifier ("Primary Key"). For example, this may be an email address, lead ID, or address. When a new entry comes in with the same "Primary Key" you select, a new object will not be created, instead the pre-existing object will be updated.', '%dd%'); ?></div>
466 </div>
467 <div class="clear"></div>
468 </div>
469 <div class="vx_row">
470 <div class="vx_col1">
471 <label for="vx_update"><?php esc_html_e('Update Entry ', '%dd%');?></label>
472 </div>
473 <div class="vx_col2">
474 <input type="checkbox" style="margin-top: 0px;" id="vx_update" class="crm_toggle_check" name="meta[update]" value="1" <?php echo !empty($meta['update']) ? 'checked="checked"' : ''?> autocomplete="off"/>
475 <label for="vx_update"><?php esc_html_e('Do not update entry, if already exists', '%dd%'); ?></label>
476
477 </div>
478 <div class="clear"></div>
479 </div>
480
481
482 </div>
483
484 </div>
485 <!-------------------------- lead owner -------------------->
486
487 <div class="vx_div">
488 <div class="vx_head">
489 <div class="crm_head_div"> <?php echo sprintf(esc_html__('%s. Add Note.', 'contact-form-mailchimp-crm'),$panel_count+=1); ?></div>
490 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"><i class="fa crm_toggle_btn fa-minus"></i></div>
491 <div class="crm_clear"></div>
492 </div>
493
494
495 <div class="vx_group">
496
497 <div class="vx_row">
498 <div class="vx_col1">
499 <label for="crm_note">
500 <?php esc_html_e("Add Note ", 'contact-form-mailchimp-crm'); ?>
501 <?php $this->tooltip('vx_entry_note') ?>
502 </label>
503 </div>
504 <div class="vx_col2">
505 <input type="checkbox" style="margin-top: 0px;" id="crm_note" class="crm_toggle_check" name="meta[note_check]" value="1" <?php echo !empty($meta['note_check']) ? "checked='checked'" : ""?>/>
506 <label for="crm_note_div">
507 <?php esc_html_e("Enable", 'contact-form-mailchimp-crm'); ?>
508 </label>
509 </div>
510 <div style="clear: both;"></div>
511 </div>
512 <div id="crm_note_div" style="margin-top: 16px; <?php echo empty($meta["note_check"]) ? "display:none" : ""?>">
513 <div class="vx_row">
514 <div class="vx_col1">
515 <label for="crm_note_fields">
516 <?php esc_html_e( 'Note Fields ', 'contact-form-mailchimp-crm' ); $this->tooltip("vx_note_fields") ?>
517 </label>
518 </div>
519 <div class="vx_col2">
520 <select name="meta[note_fields][]" id="crm_note_fields" multiple="multiple" class="crm_sel crm_note_sel crm_sel2 vx_input_100" style="width: 100%" autocomplete="off">
521
522 <?php echo $this->form_fields_options($form_id,$this->post('note_fields',$meta)); ?>
523 </select>
524 <span class="howto">
525 <?php esc_html_e('You can select multiple fields.', 'contact-form-mailchimp-crm'); ?>
526 </span>
527 </div>
528 <div style="clear: both;"></div>
529 </div>
530
531 <div class="vx_row">
532 <div class="vx_col1">
533 <label for="crm_disable_note">
534 <?php esc_html_e( 'Disable Note ', 'contact-form-mailchimp-crm' ); $this->tooltip("vx_disable_note") ?>
535 </label>
536 </div>
537 <div class="vx_col2">
538
539 <input type="checkbox" style="margin-top: 0px;" id="crm_disable_note" class="crm_toggle_check" name="meta[disable_entry_note]" value="1" <?php echo !empty($meta['disable_entry_note']) ? "checked='checked'" : ""?>/>
540 <label for="crm_disable_note">
541 <?php esc_html_e('Do not Add Note if entry already exists in Mailchimp', 'contact-form-mailchimp-crm'); ?>
542 </label>
543
544 </div>
545 <div style="clear: both;"></div>
546 </div>
547
548 </div>
549
550 </div>
551 </div>
552
553 <?php
554 $panel_count++;
555 $statuses=array('subscribed'=>'Subscribed','unsubscribed'=>'UnSubscribed','cleaned'=>'Cleaned','pending'=>'Pending (double optin)');
556 $langs=array("en"=>"English","ar"=>"Arabic","af"=>"Afrikaans","be"=>"Belarusian","bg"=>"Bulgarian","ca"=>"Catalan","zh"=>"Chinese","hr"=>"Croatian","cs"=>"Czech","da"=>"Danish","nl"=>"Dutch","et"=>"Estonian","fa"=>"Farsi","fi"=>"Finnish","fr"=>"French (France)","fr_CA"=>"French (Canada)","de"=>"German","el"=>"Greek","he"=>"Hebrew","hi"=>"Hindi","hu"=>"Hungarian","is"=>"Icelandic","id"=>"Indonesian","ga"=>"Irish","it"=>"Italian","ja"=>"Japanese","km"=>"Khmer","ko"=>"Korean","lv"=>"Latvian","lt"=>"Lithuanian","mt"=>"Maltese","ms"=>"Malay","mk"=>"Macedonian","no"=>"Norwegian","pl"=>"Polish","pt"=>"Portuguese (Brazil)","pt_PT"=>"Portuguese (Portugal)","ro"=>"Romanian","ru"=>"Russian","sr"=>"Serbian","sk"=>"Slovak","sl"=>"Slovenian","es"=>"Spanish (Mexico)","es_ES"=>"Spanish (Spain)","sw"=>"Swahili","sv"=>"Swedish","ta"=>"Tamil","th"=>"Thai","tr"=>"Turkish","uk"=>"Ukrainian","vi"=>"Vietnamese");
557 $email_types=array('html'=>'Html', 'text'=>'Text');
558 if(empty($meta['status'])){ $meta['status']='subscribed'; }
559 if(empty($meta['language'])){ $meta['language']='en'; }
560 if(empty($meta['email_type'])){ $meta['email_type']='html'; }
561 ?>
562 <div class="vx_div vx_refresh_panel">
563 <div class="vx_head ">
564 <div class="crm_head_div"> <?php echo sprintf(esc_html__('%s. Status and other settings', 'contact-form-mailchimp-crm' ),$panel_count); ?></div>
565 <div class="crm_btn_div"><i class="fa crm_toggle_btn fa-minus" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"></i></div>
566 <div class="crm_clear"></div>
567 </div>
568 <div class="vx_group ">
569 <div class="vx_row">
570 <div class="vx_col1">
571 <label for="crm_sel_status"><?php esc_html_e('Status/ Double Optin', 'contact-form-mailchimp-crm'); ?></label>
572 </div>
573 <div class="vx_col2">
574 <select id="crm_sel_status" name="meta[status]" style="width: 100%;" autocomplete="off">
575 <?php echo $this->gen_select($statuses,$this->post('status',$meta)); ?>
576 </select>
577 <div class="howto"><?php esc_html_e('Select status as "pending" if you want people to confirm their email address before being subscribed', 'contact-form-mailchimp-crm'); ?></div>
578 </div>
579 <div class="clear"></div>
580 </div>
581
582 <div class="vx_row">
583 <div class="vx_col1">
584 <label for="crm_sel_language"><?php esc_html_e('Language', 'contact-form-mailchimp-crm'); ?></label>
585 </div>
586 <div class="vx_col2">
587 <select id="crm_sel_language" name="meta[language]" style="width: 100%;" autocomplete="off">
588 <?php echo $this->gen_select($langs,$this->post('language',$meta)); ?>
589 </select>
590
591 </div>
592 <div class="clear"></div>
593 </div>
594
595 <div class="vx_row">
596 <div class="vx_col1">
597 <label for="crm_sel_email"><?php esc_html_e('Email Type', 'contact-form-mailchimp-crm'); ?></label>
598 </div>
599 <div class="vx_col2">
600 <select id="crm_sel_email" name="meta[email_type]" style="width: 100%;" autocomplete="off">
601 <?php echo $this->gen_select($email_types,$this->post('email_type',$meta)); ?>
602 </select>
603
604 </div>
605 <div class="clear"></div>
606 </div>
607
608 <div class="vx_row">
609 <div class="vx_col1">
610 <label for="crm_sel_vip"><?php esc_html_e('Add to VIP', 'contact-form-mailchimp-crm'); ?></label>
611 </div>
612 <div class="vx_col2">
613 <select id="crm_sel_vip" name="meta[vip]" style="width: 100%;" autocomplete="off">
614 <option value=""><?php esc_html_e('No', 'contact-form-mailchimp-crm'); ?></option>
615 <option value="yes" <?php if(!empty($meta['vip'])){ echo 'selected="selected"'; } ?>><?php esc_html_e('Yes', 'contact-form-mailchimp-crm'); ?></option>
616 </select>
617
618 </div>
619 <div class="clear"></div>
620 </div>
621
622 </div>
623 </div>
624 <?php
625 if(vxcf_mailchimp::$is_pr){
626
627 $panel_count++;
628 $groups=$this->post('groups',$info_meta);
629 ?>
630 <div class="vx_div vx_refresh_panel ">
631 <div class="vx_head ">
632 <div class="crm_head_div"> <?php echo sprintf(esc_html__('%s. Groups', 'contact-form-mailchimp-crm' ),$panel_count); ?></div>
633 <div class="crm_btn_div"><i class="fa crm_toggle_btn fa-minus" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm') ?>"></i></div>
634 <div class="crm_clear"></div>
635 </div>
636 <div class="vx_group ">
637 <div class="vx_row">
638 <div class="vx_col1">
639 <label for="crm_camp"><?php esc_html_e("Assign Interests ", 'contact-form-mailchimp-crm'); $this->tooltip('vx_stage_check');?></label>
640 </div>
641 <div class="vx_col2">
642 <input type="checkbox" style="margin-top: 0px;" id="crm_camp" class="crm_toggle_check <?php if(empty($groups)){echo 'vx_refresh_btn';} ?>" name="meta[assign_group]" value="1" <?php echo !empty($meta["assign_group"]) ? "checked='checked'" : ""?> autocomplete="off"/>
643 <label for="crm_optin"><?php esc_html_e("Enable", 'contact-form-mailchimp-crm'); ?></label>
644 </div>
645 <div class="clear"></div>
646 </div>
647 <div id="crm_camp_div" style="<?php echo empty($meta["assign_group"]) ? "display:none" : ""?>">
648
649 <div class="vx_row">
650 <div class="vx_col1">
651 <label><?php esc_html_e('Groups List ','contact-form-mailchimp-crm'); $this->tooltip('vx_stages'); ?></label>
652 </div>
653 <div class="vx_col2">
654 <button class="button vx_refresh_data" data-id="refresh_groups" type="button" autocomplete="off" style="vertical-align: baseline;">
655 <span class="reg_ok"><i class="fa fa-refresh"></i> <?php esc_html_e('Refresh Data','contact-form-mailchimp-crm') ?></span>
656 <span class="reg_proc"><i class="fa fa-refresh fa-spin"></i> <?php esc_html_e('Refreshing...','contact-form-mailchimp-crm') ?></span>
657 </button>
658 </div>
659 <div class="clear"></div>
660 </div>
661
662 <div id="vx_groups_data">
663 <?php $this->groups($meta,$info_meta); ?>
664 </div>
665
666
667 </div>
668
669
670 </div>
671 </div>
672 <?php
673 }
674 ?>
675 <div class="button-controls submit" style="padding-left: 5px;">
676 <input type="hidden" name="form_id" value="<?php echo esc_attr($form_id) ?>">
677 <button type="submit" title="<?php esc_html_e('Save Feed','contact-form-mailchimp-crm'); ?>" name="<?php echo esc_attr($this->id) ?>_submit" class="button button-primary button-hero"> <i class="vx_icons vx vx-arrow-50"></i> <?php echo empty($fid) ? esc_html__("Save Feed", 'contact-form-mailchimp-crm') : esc_html__("Update Feed", 'contact-form-mailchimp-crm'); ?> </button>
678 </div>
679
680 <?php
681 do_action('vx_plugin_upgrade_notice_'.$this->type);
682 ?>
683
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 ?>
6 <div class="vxa_entry">
7 <div>
8 <div class="crm_panel crm_panel_50">
9 <div class="crm_panel_head">
10 <div class="crm_head_div"><span class="crm_head_text"><?php esc_html_e('Data Sent','contact-form-mailchimp-crm') ?></span></div>
11 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm'); ?>"><i class="fa crm_toggle_btn fa-minus"></i></div>
12 <div class="crm_clear"></div>
13 </div>
14 <div class="crm_panel_content crm-block-content">
15 <?php
16
17 if(is_array($data) && count($data)>0){
18 foreach($data as $k=>$v){
19 $label=isset($v['label']) ? $v['label'] : $k;
20 $value=$v;
21 if(is_array($v) && isset($v['value'])){
22 $value=$v['value'];
23 }
24 if(is_array($value)){
25 $value=json_encode($v);
26 }
27
28 ?>
29 <div class="entry_row">
30 <div class="entry_col1 vx_label"><span title="<?php echo esc_attr($k) ?>"><?php echo esc_html($label); ?></span></div>
31 <div class="entry_col2"><?php echo is_array($value) ? esc_html(json_encode($value)) : esc_html($value) ?></div>
32 <div class="crm_clear"></div>
33 </div>
34 <?php
35 }
36 }else{
37 ?>
38 <div class="vx_error"><i class="fa fa-warning"></i> <?php esc_html_e('Nothing Posted to Mailchimp','contact-form-mailchimp-crm');?></div>
39 <?php
40 }
41 ?>
42 </div></div>
43 <?php
44 if(is_array($response) && count($response)>0){
45 $error=false;
46 ?>
47 <div class="crm_panel crm_panel_50">
48 <div class="crm_panel_head">
49 <div class="crm_head_div"><span class="crm_head_text"><?php esc_html_e('Mailchimp Response','contact-form-mailchimp-crm') ?></span></div>
50 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm'); ?>"><i class="fa crm_toggle_btn fa-minus"></i></div>
51 <div class="crm_clear"></div>
52 </div>
53 <div class="crm_panel_content crm-block-content">
54 <?php
55 foreach($response as $k=>$v){
56 ?>
57 <div class="entry_row">
58 <div class="entry_col1 vx_label"><?php echo esc_attr($k) ?></div>
59 <div class="entry_col2"><?php echo is_array($v) ? json_encode($v) : $v ?></div>
60 <div class="crm_clear"></div>
61 </div>
62 <?php
63 }
64 ?>
65 </div></div>
66 <?php
67 }
68 if(is_array($extra) && count($extra)>0){
69 $detail_class=!$error ? 'crm_panel_100' : 'crm_panel_50';
70 $error=false;
71 ?>
72 <div class="crm_panel <?php echo esc_attr($detail_class) ?>">
73 <div class="crm_panel_head">
74 <div class="crm_head_div"><span class="crm_head_text"><?php esc_html_e('More Detail','contact-form-mailchimp-crm') ?></span></div>
75 <div class="crm_btn_div" title="<?php esc_html_e('Expand / Collapse','contact-form-mailchimp-crm'); ?>"><i class="fa crm_toggle_btn fa-minus"></i></div>
76 <div class="crm_clear"></div>
77 </div>
78 <div class="crm_panel_content crm-block-content">
79 <?php
80 foreach($extra as $k=>$v){
81 ?>
82 <div class="entry_row">
83 <div class="entry_col1 vx_label"><?php echo isset($labels[$k]) ? esc_attr($labels[$k]) : esc_attr($k) ?></div>
84 <div class="entry_col2"><?php
85 if($k == "filter"){
86 if(is_array($v)){
87 $or_count=0;
88 foreach($v as $or){
89 if(is_array($or)){
90 if($or_count>0){ echo "<div class='vx_or '>OR</div>";}
91 $or_count++;
92 $and_count=0;
93 foreach($or as $con){
94 $con['field']=$this->get_gf_field_label($form_id,$con['field']);
95 $icon="times"; $color="vx_red";
96 if($con['check'] == "true"){
97 $icon="check"; $color="vx_green";
98 }
99 $op=isset($vx_ops[$con['op']]) ? $vx_ops[$con['op']] : $con['op'];
100 if($and_count>0){ echo "<div class='vx_or'>AND</div>";}
101 echo "<i class='fa fa-".$icon." vx_left_2'></i> ".esc_html($con['field'])." ( <span class='vx_val'>".esc_html($con['input'])."</span> ) <code>".esc_html($op)."</code> <span class='vx_val'>".esc_html($con['field_val'])."</span>";
102 $and_count++;
103 }
104 }
105 }
106 }
107 }else{
108 echo is_array($v) ? esc_html(json_encode($v)) : esc_html($v);
109 } ?></div>
110 <div class="crm_clear"></div>
111 </div>
112 <?php
113 }
114 ?>
115 </div></div>
116 <?php
117 }
118 if($error){
119 ?>
120 <div class="vx_error"><i class="fa fa-warning"></i> <?php esc_html_e('Detail Not Found','contact-form-mailchimp-crm');?></div>
121 <?php
122 } ?>
123 <div style="clear: both"></div>
124 </div>
125 <div class="vx_log_detail_footer">
126 <?php
127 if($log['feed_id']!=""){
128 $feed_link=$this->get_feed_link($log['feed_id'],$log['form_id']);
129 ?>
130 <a href="<?php echo esc_url($feed_link) ?>" title="<?php esc_html_e('Edit Feed','contact-form-mailchimp-crm') ?>" class="button"><i class="fa fa-edit"></i> <?php esc_html_e('Edit Feed','contact-form-mailchimp-crm') ?></a>
131 <?php
132 }
133 ?>
134 <a href="<?php echo esc_url($log_link) ?>" title="<?php esc_html_e('Open in New Window','contact-form-mailchimp-crm') ?>" target="_blank" class="button"><i class="fa fa-external-link"></i> <?php esc_html_e('Open in New Window','contact-form-mailchimp-crm') ?></a>
135 <a href="#" class="button vx_close_detail" title="<?php esc_html_e('Close','contact-form-mailchimp-crm') ?>"><i class="fa fa-times"></i> <?php esc_html_e('Close','contact-form-mailchimp-crm') ?></a>
136
137 </div>
138 </div>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 $feeds = $this->data->get_feeds();
6 ?><style type="text/css">
7 .vx_col{
8 width: 16px;
9 }
10 .widefat tr td.vx_icon_col{
11 padding-left: 0px;
12 }
13 .widefat tr td.vx_icon_col img{
14 margin-top: 2px;
15 }
16 .widefat tr th input{
17 margin-left: 0px;
18 }
19 .crm_status_img{
20 width:18px; display: block; margin: 1px auto;
21 }
22
23 .crm_actions{
24 padding: 12px 0px 10px 0px; clear: both;
25 }
26 .crm_input_inline{
27 float: left; height: 28px; margin-right:5px;
28 }
29 .vx_sort{
30 cursor: pointer;
31 }
32
33 .vx_sort .vx_hide_sort{
34 display: none;
35 }
36 table .vx_icons{
37 color: #888;
38 font-size: 18px;
39 cursor: pointer;
40 }
41 .vx_icons:hover{
42 color: #333;
43 }
44 .vx_sort_icon{
45 vertical-align: middle; margin-left: 5px;
46 }
47 .wrap form .vx_left_10{
48 margin-left: 8px;
49 }
50 .entry_detail{
51 border-top: 0px solid #ddd;
52 border-bottom: 0px solid #ddd;
53 }
54 @media screen and (max-width: 782px) {
55 .crm_input_inline{
56 float: left; height: 36px !important;
57 }
58 }
59 @media screen and (max-width: 1028px) {
60
61 table .crm_panel_50{
62 width: 98%;
63 }
64 }
65 /*********************crm panel******************/
66 .crm_panel_content{
67 border: 1px solid #ddd;
68 border-top: 0px;
69 display: none;
70 padding: 16px;
71 background: #fff;
72 }
73 .crm_panel * {
74 -webkit-box-sizing: border-box; /* Safari 3.0 - 5.0, Chrome 1 - 9, Android 2.1 - 3.x */
75 -moz-box-sizing: border-box; /* Firefox 1 - 28 */
76 box-sizing: border-box;
77 }
78 .crm_panel_100{
79 margin: 1%;
80 clear: both;
81 }
82 .crm_panel_50{
83 width: 48%;
84 margin: 1%;
85 min-width: 300px;
86 float: left;
87 }
88 .crm_panel_head{
89 background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(229, 229, 229, 1) 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
90 border: 1px solid #ddd;
91 -moz-user-select: none;
92 -webkit-user-select: none;
93 -ms-user-select: none;
94 }
95 .crm_panel_head2{
96 background: #f6f6f6;
97 border: 1px solid #ddd;
98 }
99 .crm_panel_head , .crm_head_text{
100 font-size: 14px; color:#666; font-weight: bold;
101 }
102 .crm_head_div{
103 float: left;
104 width: 80%; padding: 8px 20px;
105 }
106 .crm_panel_content{
107 border: 1px solid #ddd;
108 border-top: 0px;
109 display: block;
110 padding: 12px;
111 background: #fff;
112 overflow: auto;
113 }
114 .crm-block-content{
115 height: 200px;
116 overflow: auto;
117 }
118 .crm_btn_div{
119 float: right;
120 font-size: 18px;
121 width:20%; padding: 8px 20px;
122 text-align: right;
123 }
124 .crm_toggle_btn:hover{
125 color: #333;
126 }
127 .crm_toggle_btn{
128
129 color: #999; cursor: pointer;
130 }
131
132 .vx_input_100{
133 width: 100%;
134 }
135 .crm_clear{
136 clear: both;
137 }
138 .entry_row {
139 margin: 7px auto;
140 }
141 .entry_col1 {
142 float: left;
143 width: 25%;
144 padding: 0px 7px;
145 text-align: left;
146 }
147 .entry_col2 {
148 float: left;
149 width: 75%;
150 padding-left: 7px;
151 }
152 .vx_margin{
153 margin-top: 10px;
154 }
155 .vx_red{
156 color: #E31230;
157 }
158 .vx_label{
159 font-weight: bold;
160 }
161 .vx_blue{
162 color: #1874CD;
163 }
164 .vx_val{
165 text-decoration: underline;
166 }
167 .vx_or{
168 font-style: italic;
169 }.vx_op{
170 font-style: italic;
171 }
172 .vx_u{
173 text-decoration: underline;
174 }
175 .vx_left_20{
176 margin-left: 8px;
177 }
178 .vx_error{
179 background: #ca5952;
180 padding: 10px;
181 font-size: 14px;
182 margin: 1% 2%;
183 color: #fff;
184 }
185 .vx_yellow{
186 background-color: #F9ECBE;
187 }
188 .vx_log_detail_footer{
189 padding: 2px 10px;
190 text-align: right;
191 }
192 .vx_wrap .crm_actions a.button{
193 display:inline-block;
194 margin-top: 0px;
195 }
196 .tablenav .tablenav-pages a:focus,.tablenav .tablenav-pages a:hover{border-color:#5b9dd9;color:#fff;background:#00a0d2;box-shadow:none;outline:0}
197
198 .tablenav .tablenav-pages a,.tablenav-pages span.current{text-decoration:none;padding:3px 6px}
199
200 .tablenav .tablenav-pages a,.tablenav-pages-navspan{display:inline-block;min-width:17px;border:1px solid #ccc;padding:3px 5px 7px;background:#e5e5e5;font-size:16px;line-height:1;font-weight:400;text-align:center}
201 </style>
202 <div class="vx_wrap">
203 <div>
204 <h2 class="vx_img_head"><img alt="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" title="<?php esc_html_e("Mailchimp Feeds", 'contact-form-mailchimp-crm') ?>" src="<?php echo $this->get_base_url()?>images/mailchimp-crm-logo.png?ver=1" /> <?php esc_html_e("Mailchimp Log", 'contact-form-mailchimp-crm'); ?>
205
206 <select style="min-width: 120px; max-width: 200px; margin-left: 12px; font-weight: normal;" id="vx_sel_feed">
207 <option value=""><?php esc_html_e('All Feeds','contact-form-mailchimp-crm') ?></option>
208 <?php
209 foreach($feeds as $val){
210 $sel="";
211 if(isset($_REQUEST['feed_id']) && $_REQUEST['feed_id'] == $val['id'])
212 $sel="selected='selected'";
213 echo "<option value='".esc_attr($val['id'])."' $sel>".esc_html($val['name'])."</option>";
214 }
215 ?>
216 </select>
217 </h2>
218 <div class="clear"></div>
219 </div>
220
221 <div>
222
223 <div style="float: right;">
224 <form id="vx_form" class="crm_form" method="get"><div>
225
226 <input type="hidden" name="page" value="<?php echo esc_attr($this->post('page')) ?>" />
227 <input type="hidden" name="id" value="<?php echo esc_attr($this->post('id')) ?>" />
228 <input type="hidden" name="tab" value="<?php echo esc_attr($this->post('tab')) ?>" />
229 <input type="text" placeholder="<?php esc_html_e('Search','contact-form-mailchimp-crm') ?>" value="<?php echo esc_attr($this->post('search')) ?>" name="search" class="crm_input_inline">
230 <?php
231 if($this->post('entry_id') !=""){
232 ?>
233 <input type="hidden" name="entry_id" value="<?php echo esc_attr($_REQUEST['entry_id']) ?>" />
234 <?php
235 }
236 ?>
237 <input type="hidden" name="order" value="<?php echo esc_attr($this->post('order')) ?>" />
238 <input type="hidden" name="orderby" value="<?php echo esc_attr($this->post('orderby')) ?>" />
239 <input type="hidden" name="vx_tab_action_<?php echo esc_attr($this->id) ?>" id="vx_export_log" value="" autocomplete="off" />
240 <input type="hidden" id="vx_nonce_field" value="<?php echo wp_create_nonce('vx_nonce'); ?>">
241 <select name="object" class="crm_input_inline" style="max-width: 100px;">
242 <option value=""><?php esc_html_e('All Objects','contact-form-mailchimp-crm') ?></option>
243 <?php
244 foreach($objects as $f_key=>$f_val){
245 $sel="";
246 if(isset($_REQUEST['object']) && $_REQUEST['object'] == $f_key)
247 $sel="selected='selected'";
248 echo "<option value='".esc_attr($f_key)."' $sel>".esc_attr($f_val)."</option>";
249 }
250 ?>
251 </select>
252 <select name="status" class="crm_input_inline">
253 <option value=""><?php esc_html_e('All Status','contact-form-mailchimp-crm') ?></option>
254 <?php
255
256 foreach($statuses as $f_key=>$f_val){
257 $sel="";
258 if(isset($_REQUEST['status']) && $_REQUEST['status'] == $f_key)
259 $sel="selected='selected'";
260 echo "<option value='".esc_attr($f_key)."' $sel>".esc_attr($f_val)."</option>";
261 }
262 ?>
263 </select>
264 <select name="time" class="crm_time_select crm_input_inline" style="max-width: 100px;">
265 <option value=""><?php esc_html_e('All Times','contact-form-mailchimp-crm') ?></option>
266 <?php
267 foreach($times as $f_key=>$f_val){
268 $sel="";
269 if(isset($_REQUEST['time']) && $_REQUEST['time'] == $f_key)
270 $sel="selected='selected'";
271 echo "<option value='".esc_attr($f_key)."' $sel>".esc_attr($f_val)."</option>";
272 }
273 ?>
274 </select>
275 <span style="<?php if($this->post('time') != "custom"){echo "display:none";} ?>" class="crm_custom_range">
276 <input type="text" name="start_date" placeholder="<?php esc_html_e('From Date','contact-form-mailchimp-crm') ?>" value="<?php if(isset($_REQUEST['start_date'])){echo esc_attr($_REQUEST['start_date']);}?>" class="vxc_date crm_input_inline" style="width: 100px">
277 <input type="text" class="vxc_date crm_input_inline" value="<?php if(isset($_REQUEST['end_date'])){echo esc_attr($_REQUEST['end_date']);}?>" placeholder="<?php esc_html_e('To Date','contact-form-mailchimp-crm') ?>" name="end_date" style="width: 100px">
278 </span>
279
280 <button type="submit" title="<?php esc_html_e('Search','contact-form-mailchimp-crm') ?>" name="search" class="button-secondary button crm_input_inline"><i class="fa fa-search"></i> <?php esc_html_e('Search','contact-form-mailchimp-crm') ?></button>
281
282 </div> </form>
283 <div style="clear: both;"></div>
284 </div>
285 <form method="post">
286
287 <div class="crm_actions tablenav">
288 <div class="alignleft actions">
289 <select name="bulk_action" id="vx_bulk_action" class="crm_input_inline" style="min-width: 100px; max-width: 250px;">
290 <?php
291 foreach($bulk_actions as $k=>$v){
292 echo '<option value="'.esc_attr($k).'">'.esc_html($v).'</option>';
293 }
294 ?>
295 </select>
296 <input type="hidden" name="vx_nonce" value="<?php echo wp_create_nonce('vx_nonce'); ?>">
297 <button type="submit" class="button-secondary button crm_input_inline" title="<?php esc_html_e('Apply','contact-form-mailchimp-crm') ?>" id="vx_apply_bulk"><i class="fa fa-check"></i> <?php esc_html_e('Apply','contact-form-mailchimp-crm') ?></button>
298
299 <?php
300 $log_link= admin_url("admin.php?page={$this->id}&tab=logs");
301
302 if($items>0){
303
304 ?>
305 <button type="button" name="tab_action" title="<?php esc_html_e('Export as CSV','contact-form-mailchimp-crm') ?>" id="vx_export" class="button-secondary button crm_input_inline vx_left_10"><i class="fa fa-download"></i> <?php esc_html_e('Export as CSV','contact-form-mailchimp-crm') ?></button>
306 <?php
307 }
308
309 $_log_id=isset($_GET['log_id']) ? $this->post('log_id') : '';
310 if($_log_id !="" ){
311 if(isset($data['feeds'][0]['entry_id']) && $data['feeds'][0]['entry_id']!=""){
312 $entry_id=$data['feeds'][0]['entry_id'];
313 ?>
314 <a href="<?php echo esc_url( $log_link.'&entry_id='.$entry_id);?>" title="<?php echo sprintf(esc_html__('View Entry# %s Logs','contact-form-mailchimp-crm'),$entry_id); ?>" class="button vx_left_10"><i class="fa fa-hand-o-right"></i> <?php echo sprintf(esc_html__('View Entry# %s Logs','contact-form-mailchimp-crm'),$entry_id); ?></a><?php
315 }}
316 if($this->post('entry_id') !="" || $_log_id !=""){
317 ?><a href="<?php echo esc_url($log_link);?>" title="<?php esc_html_e('View All Logs','contact-form-mailchimp-crm') ?>" class="button vx_left_10"><i class="fa fa-external-link"></i> <?php esc_html_e('View All Logs','contact-form-mailchimp-crm') ?></a>
318 <?php
319 }
320
321 ?>
322 </div>
323 <?php
324 if($items>0){
325 ?>
326 <div class="tablenav-pages"> <span id="paging_header" class="displaying-num"><?php esc_html_e('Displaying','contact-form-mailchimp-crm') ?> <span id="paging_range_min_header"><?php echo esc_html($data['min']); ?></span> - <span id="paging_range_max_header"><?php echo esc_html($data['max']) ?></span> of <span id="paging_total_header"><?php echo esc_html($data['items']) ?></span></span><?php echo wp_kses_post($data['links']) ?></div>
327 <?php
328 }
329 ?>
330 </div>
331
332 <table class="widefat fixed sort" cellspacing="0">
333
334 <thead>
335 <tr>
336 <th scope="col" id="active" class="manage-column vx_col"><input type="checkbox" class="crm_head_check"> </th>
337 <th scope="col" class="manage-column vx_col"> </th>
338 <th scope="col" class="manage-column vx_sort" data-name="crm_id"><?php esc_html_e("Mailchimp ID", 'contact-form-mailchimp-crm') ?>
339 <i class="fa fa-caret-<?php echo esc_attr($crm_order) ?> vx_sort_icon <?php echo esc_attr($crm_class) ?>"></i>
340 </th>
341 <th scope="col" class="manage-column vx_sort" data-name="entry_id"><?php esc_html_e("Entry ID", 'contact-form-mailchimp-crm') ?>
342 <i class="fa fa-caret-<?php echo esc_attr($entry_order) ?> vx_sort_icon <?php echo esc_attr($entry_class) ?>"></i>
343 </th>
344 <th scope="col"><?php esc_html_e('Feed ID', 'contact-form-mailchimp-crm') ?> </th>
345 <th scope="col" class="manage-column" data-name="object"><?php esc_html_e("Description", 'contact-form-mailchimp-crm') ?>
346 </th>
347 <th scope="col" class="manage-column vx_sort" data-name="time"><?php esc_html_e("Time", 'contact-form-mailchimp-crm') ?>
348 <i class="fa fa-caret-<?php echo esc_attr($time_order) ?> vx_sort_icon <?php echo esc_attr($time_class) ?>"></i>
349 </th>
350 <th style="width: 40px"><?php esc_html_e('Detail','contact-form-mailchimp-crm') ?></th>
351 </tr>
352 </thead>
353
354 <tfoot>
355 <tr>
356 <th scope="col" id="active" class="manage-column vx_col"><input type="checkbox" class="crm_head_check"> </th>
357 <th scope="col" class="manage-column vx_col"> </th>
358 <th scope="col" class="manage-column vx_sort" data-name="crm_id"><?php esc_html_e("Mailchimp ID", 'contact-form-mailchimp-crm') ?>
359 <i class="fa fa-caret-<?php echo esc_attr($crm_order) ?> vx_sort_icon <?php echo esc_attr($crm_class) ?>"></i>
360 </th>
361 <th scope="col" class="manage-column vx_sort" data-name="entry_id"><?php esc_html_e("Entry ID", 'contact-form-mailchimp-crm') ?>
362 <i class="fa fa-caret-<?php echo esc_attr($entry_order) ?> vx_sort_icon <?php echo esc_attr($entry_class) ?>"></i>
363 </th>
364 <th scope="col"><?php esc_html_e('Feed ID', 'contact-form-mailchimp-crm') ?> </th>
365 <th scope="col" class="manage-column" data-name="object"><?php esc_html_e("Description", 'contact-form-mailchimp-crm') ?>
366 </th>
367 <th scope="col" class="manage-column vx_sort" data-name="time"><?php esc_html_e("Time", 'contact-form-mailchimp-crm') ?>
368 <i class="fa fa-caret-<?php echo esc_attr($time_order) ?> vx_sort_icon <?php echo esc_attr($time_class) ?>"></i>
369 </th>
370 <th><?php esc_html_e('Detail','contact-form-mailchimp-crm') ?></th>
371 </tr>
372
373 </tfoot>
374 <tbody class="list:user user-list">
375 <?php
376 if(is_array($data['feeds']) && !empty($data['feeds'])){
377 $entries_plugin=class_exists('vxcf_form') ? true : false ;
378 $analytics_addon=class_exists('vx_track_pages') ? true : false ;
379 $sno=0;
380 foreach($data['feeds'] as $feed){
381 $sno++;
382 $row=$this->verify_log($feed,$objects);
383 $e_id=(int)$row['entry_id'];
384 $p_id=(int)$row['parent_id'];
385 ?>
386 <tr class='author-self status-inherit <?php if(in_array($row['id'],$log_ids)){echo 'vx_yellow ';} echo $sno%2 == 0 ? 'alternate' :'' ?>' id="tr_<?php echo esc_attr($row['id']) ?>" data-id="<?php echo esc_attr($row['id']); ?>" >
387 <td class="vx_check_col"><input type="checkbox" name="log_id[]" value="<?php echo esc_attr($row['id']); ?>" class="crm_input_check"></td>
388 <td class="vx_icon_col"><img src="<?php echo esc_url($base_url) ?>images/<?php echo esc_attr($row["status_img"]); ?>.png" alt="<?php echo $row["status"] ? esc_html__("Active", 'contact-form-mailchimp-crm') : esc_html__("Inactive", 'contact-form-mailchimp-crm');?>" title="<?php echo esc_html($row['title']);?>" class="crm_status_img" /></td>
389 <td class="column-name" style="width:40%"><?php echo wp_kses_post($row['a_link']) ?></td>
390 <td class="column-title">
391 <?php
392 $entry_link='';
393 if(!empty($e_id)){
394 if($p_id < 0){
395 if($analytics_addon){
396 $entry_link=add_query_arg(array('page'=>'vx_analytics','entrty_id'=>$e_id), admin_url('admin.php'));
397 }
398 $e_id='#'.$e_id;
399
400 }else if($entries_plugin){
401 if(in_array($row['form_id'],array('vx_calls','vx_sms'))){
402 $link_tab=substr($row['form_id'],3);
403 $link_tab=$link_tab == 'calls' ? 'Call' : 'SMS';
404 $e_id=ucfirst($link_tab).' #'.$e_id;
405
406 }else{
407 $link_tab='entries';
408 if($row['form_id'] == 'vx_contacts'){
409 $link_tab='contacts';
410 }
411 $entry_link=add_query_arg(array('page'=>'vxcf_leads','tab'=> $link_tab,'id'=>$e_id), admin_url('admin.php'));
412 }
413 }}
414
415 if(! empty($entry_link) ){
416 ?>
417 <a href="<?php echo esc_url($entry_link) ?>" title="<?php echo esc_attr($row["entry_id"]); ?>" target="_blank" ><?php echo esc_html($e_id); ?></a>
418 <?php
419 }else{
420 echo esc_html($e_id);
421 }
422 ?>
423 </td>
424 <td scope="col" class="manage-column"><?php
425 if(!empty($row['feed_id'])){
426 $feed_link=$this->get_feed_link($row['feed_id'],$row['form_id']);
427 ?><a href="<?php echo esc_url($feed_link) ?>" title="<?php esc_html_e('Edit Feed','contact-form-mailchimp-crm') ?>">#<?php echo $row['feed_id'] ?></a><?php } ?>
428 </td>
429 <td scope="col" class="manage-column"><?php echo esc_html($row['desc']); ?></td>
430 <td scope="col" class="manage-column"><?php echo date('M-d-Y H:i:s', strtotime($row['time'])+$offset);?></td>
431 <td><i class="vx_icons vx_detail fa fa-th-list" title="<?php esc_html_e('Expand Details','contact-form-mailchimp-crm') ?>"></i></td>
432 </tr>
433 <tr style="display: none;"><td colspan="8" class="entry_detail"></td></tr>
434 <?php
435 }
436 }
437 else {
438 ?>
439 <tr>
440 <td colspan="4" style="padding:20px;">
441 <?php esc_html_e("No Record(s) Found", 'contact-form-mailchimp-crm'); ?>
442 </td>
443 </tr>
444 <?php
445 }
446 ?>
447 </tbody>
448 </table>
449
450 <?php
451 if($items>0){
452 ?>
453 <div class="crm_actions tablenav">
454 <a id="vx_clear_logs" class="button" title="<?php esc_html_e('Clear Mailchimp Log','contact-form-mailchimp-crm') ?>" href="<?php echo esc_url(wp_nonce_url(admin_url('admin.php?page='.$this->post('page')."&view=log&vx_tab_action_".$this->id."=clear_logs"),'vx_nonce','vx_nonce')); ?>"><?php esc_html_e('Clear Mailchimp Log','contact-form-mailchimp-crm') ?></a>
455 <div class="tablenav-pages"> <span id="paging_header" class="displaying-num"><?php esc_html_e('Displaying','contact-form-mailchimp-crm') ?> <span id="paging_range_min_header"><?php echo esc_html($data['min']); ?></span> - <span id="paging_range_max_header"><?php echo esc_html($data['max']) ?></span> of <span id="paging_total_header"><?php echo esc_html($data['items']) ?></span></span><?php echo wp_kses_post($data['links']) ?></div>
456 </div>
457 <?php
458 }
459 ?>
460 </form>
461
462
463 </div>
464
465
466
467
468
469 </div>
470 <script type="text/javascript">
471 var vx_crm_ajax='<?php echo wp_create_nonce("vx_crm_ajax") ?>';
472 (function( $ ) {
473 $(document).ready( function($) {
474
475 $("#vx_sel_feed").change(function(){
476 var link='<?php echo $this->link_to_settings('logs'); ?>';
477 link+='&feed_id='+$(this).val();
478 window.location.href=link;
479 });
480
481 $(".vx_sort").click(function(){
482 var orby=$(this).attr('data-name');
483 if(!orby || orby =="")
484 return;
485 var form=$("#vx_form");
486 var order=form.find("input[name=order]");
487 var orderby=form.find("input[name=orderby]");
488 var or="asc";
489 if(orderby.val() == orby && order.val() == "asc"){
490 or="desc";
491 }
492 order.val(or);
493 orderby.val(orby);
494 form.submit();
495 });
496 $(".crm_head_check").click(function(e){
497 if($(this).is(":checked")){
498 $(".crm_input_check,.crm_head_check").attr('checked','checked');
499 }else{
500 $(".crm_input_check,.crm_head_check").removeAttr('checked');
501 }
502 });
503 $(".crm_input_check").click(function(e){
504 var head_checked=$(".crm_head_check").eq(0).is(':checked');
505 if(!head_checked && $(".crm_input_check:checked").length == $(".crm_input_check").length){
506 $(".crm_head_check").attr('checked','checked');
507 }else if(head_checked){
508 $(".crm_head_check").removeAttr('checked');
509 }
510 });
511 $("#vx_export").click(function(e){
512 e.preventDefault();
513 $("#vx_export_log").val('export_log');
514 $("#vx_nonce_field").attr('name','vx_nonce');
515 var form=$("#vx_form");
516 form.attr({method:'post'});
517 form.submit();
518 form.attr({method:'get'});
519 $("#vx_export_log").val('');
520 $("#vx_nonce_field").removeAttr('name');
521 // form[0].reset();
522 });
523 $("#vx_apply_bulk").click(function(e){
524 var sel=$("#vx_bulk_action");
525 if(sel.val() == ""){
526 alert('<?php esc_html_e('Please Select Action','contact-form-mailchimp-crm') ?>');
527 return false;
528 }
529 if($(".crm_input_check:checked").length == 0){
530 alert('<?php esc_html_e('Please select at least one entry','contact-form-mailchimp-crm') ?>');
531 return false;
532 }
533 var action=sel.val();
534 if( $.inArray(action,["send_to_crm_bulk_force","send_to_crm_bulk"]) !=-1 && $(".crm_input_check:checked").length>4){
535 if(!confirm('<?php esc_html_e('Exporting more than 4 entries may take too long.\\n Are you sure you want to continue?','contact-form-mailchimp-crm') ?>')){
536 e.preventDefault();
537 }
538 }
539 })
540 $("#vx_clear_logs").click(function(e){
541 if(!confirm('<?php esc_html_e('Mailchimp Logs will be deleted permanently. Do you want to continue?','contact-form-mailchimp-crm') ?>')){
542 e.preventDefault();
543 }
544 })
545 $(".vx_sort").hover(function(){
546 $(this).find(".vx_hide_sort").show();
547 },function(){
548 $(this).find(".vx_hide_sort").hide();
549 })
550 $(".vxc_date").datepicker({ changeMonth: true,
551 changeYear: true,
552 showButtonPanel: true,
553 yearRange: "-100:+10",
554 dateFormat: 'dd-M-yy' });
555 $(document).on("change",".crm_time_select",function(){
556 var form=$(this).parents(".crm_form");
557 var input=form.find(".crm_custom_range");
558 if($(this).val() != "custom"){
559 form.find(".vxc_date").val("");
560 }
561 if($(this).val() == "custom"){
562 input.show();
563 }else{
564 input.hide();
565 }
566 });
567
568
569 $(".vx_log_link").click(function(e){
570 e.preventDefault();
571 if($(this).data('id')){
572 $('html, body').animate({
573 scrollTop: $("#tr_"+$(this).data('id')).offset().top-35
574 }, 500);
575 var tr=$("#tr_"+$(this).data('id'));
576 var next_tr=tr.next("tr");
577 if(!next_tr.find("td").is(":visible")){
578 tr.find(".vx_detail").click();
579 }
580 }
581 })
582 ////////////
583 $(document).on("click",".vx_detail,.vx_close_detail",function(e){
584 e.preventDefault();
585 var next_tr=tr=$(this).parents("tr");
586 var is_main=false;
587 if(!$(this).hasClass("vx_close_detail")){
588 next_tr=tr.next(tr);
589 is_main=true;
590 }
591 var icon=$(this);
592 var td=next_tr.find("td");
593 if(td.is(":visible"))
594 {
595 next_tr.find('.vxa_entry').slideUp('fast',function(){
596 next_tr.hide();
597 })
598 if(is_main){
599 icon.attr('title','<?php esc_html_e('Expand Detail','contact-form-mailchimp-crm'); ?>');
600 }
601 return;
602 }else{
603 next_tr.show('fast');
604 next_tr.find('.vxa_entry').slideDown('fast');
605 if(is_main){
606 icon.attr('title','<?php esc_html_e('Collapse Detail','contact-form-mailchimp-crm'); ?>');
607 }
608 }
609 if(!td.find("div").length){
610 var id=$.trim(tr.attr("data-id"));
611 td.html("<div style='text-align:center'><i class='fa fa-spinner fa-spin' style='margin: 20px auto'></i></div>");
612 $.post(ajaxurl,{action:'log_detail_<?php echo esc_attr($this->id) ?>',id:id,vx_crm_ajax:vx_crm_ajax},function(res){
613 td.html(res);
614 });
615 }
616 });
617 //logs detail boxes
618 $(document).on("dblclick",".crm_panel_head",function(e){
619 e.preventDefault();
620 var elem=jQuery(this);
621 vx_toggle_log_panel(elem);
622 });
623 $(document).on("click",".crm_toggle_btn",function(e){
624 e.preventDefault();
625 var elem=jQuery(this);
626 vx_toggle_log_panel(elem);
627 });
628 });
629
630 }(jQuery));
631 function vx_toggle_log_panel(elem){
632 var panel=elem.parents(".crm_panel");
633 var div=panel.find(".crm_panel_content");
634 var btn=panel.find(".crm_toggle_btn");
635 div.slideToggle('fast',function(){
636 if(jQuery(this).is(":visible")){
637 btn.removeClass('fa-plus');
638 btn.addClass('fa-minus');
639 }else{
640 btn.addClass('fa-plus');
641 btn.removeClass('fa-minus');
642 }
643 });
644 }
645 </script>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?><div class="crm_fields_table">
5 <div class="crm_field">
6 <div class="crm_field_cell1"><label for="vx_name"><?php esc_html_e("Account Name",'contact-form-mailchimp-crm'); ?></label>
7 </div>
8 <div class="crm_field_cell2">
9 <input type="text" name="crm[name]" value="<?php echo !empty($name) ? esc_html($name) : 'Account #'.esc_html($id); ?>" id="vx_name" class="crm_text">
10
11 </div>
12 <div class="clear"></div>
13 </div>
14
15 <?php if(isset($info['api_token']) && $info['api_token']!="") {
16 ?>
17 <div class="crm_field">
18 <div class="crm_field_cell1"><label><?php esc_html_e("Test Connection",'contact-form-mailchimp-crm'); ?></label></div>
19 <div class="crm_field_cell2"> <button type="submit" class="button button-secondary" name="vx_test_connection"><i class="fa fa-refresh"></i> <?php esc_html_e("Test Connection",'contact-form-mailchimp-crm'); ?></button>
20 </div>
21 <div class="clear"></div>
22 </div>
23 <?php
24 }
25 ?>
26 <div class="crm_field">
27 <div class="crm_field_cell1"><label for="vx_pass"><?php esc_html_e('API Key','contact-form-mailchimp-crm'); ?></label></div>
28 <div class="crm_field_cell2">
29 <div class="vx_tr" >
30 <div class="vx_td">
31 <input type="password" id="vx_pass" name="crm[api_key]" class="crm_text" placeholder="<?php esc_html_e('API Key','contact-form-mailchimp-crm'); ?>" value="<?php echo $this->post('api_key',$info); ?>" required>
32 </div>
33 <div class="vx_td2">
34 <a href="#" class="button vx_toggle_btn vx_toggle_key" title="<?php esc_html_e('Toggle Key','contact-form-mailchimp-crm'); ?>"><?php esc_html_e('Show Key','contact-form-mailchimp-crm') ?></a>
35
36 </div>
37 </div>
38 </div>
39 <div class="clear"></div>
40 </div>
41 <div class="crm_field">
42 <div class="crm_field_cell1"><label for="vx_error_email"><?php esc_html_e("Notify by Email on Errors",'contact-form-mailchimp-crm'); ?></label></div>
43 <div class="crm_field_cell2"><textarea name="crm[error_email]" id="vx_error_email" placeholder="<?php esc_html_e("Enter comma separated email addresses",'contact-form-mailchimp-crm'); ?>" class="crm_text" style="height: 70px"><?php echo isset($info['error_email']) ? esc_html($info['error_email']) : ""; ?></textarea>
44 <span class="howto"><?php esc_html_e("Enter comma separated email addresses. An email will be sent to these email addresses if an order is not properly added to Mailchimp. Leave blank to disable.",'contact-form-mailchimp-crm'); ?></span>
45 </div>
46 <div class="clear"></div>
47 </div>
48
49
50 <button type="submit" value="save" class="button-primary" title="<?php esc_html_e('Save Changes','contact-form-mailchimp-crm'); ?>" name="save"><?php esc_html_e('Save Changes','contact-form-mailchimp-crm'); ?></button>
51 </div>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5 wp_enqueue_script('vx-sorter');
6 ?><style type="text/css">
7 .vx_red{
8 color: #E31230;
9 }
10 .vx_green{
11 color:rgb(0, 132, 0);
12 }
13 .crm_fields_table input , .crm_fields_table select{
14 margin: 0px;
15 }
16 .vx_accounts_table .vx_pointer{
17 cursor: pointer;
18 }
19 .vx_accounts_table .fa-caret-up , .vx_accounts_table .fa-caret-down{
20 display: none;
21 }
22 .vx_accounts_table th.headerSortUp .fa-caret-down{
23 display: inline;
24 }
25 .vx_accounts_table th.headerSortDown .fa-caret-up{
26 display: inline;
27 }
28 </style>
29 <table class="widefat fixed sort striped vx_accounts_table" style="margin: 20px 0 50px 0">
30 <thead>
31 <tr> <th class="manage-column column-cb vx_pointer" style="width: 30px" ><?php esc_html_e("#",'contact-form-mailchimp-crm'); ?> <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
32 <th class="manage-column vx_pointer"> <?php esc_html_e("Account",'contact-form-mailchimp-crm'); ?> <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
33 <th class="manage-column"> <?php esc_html_e("Status",'contact-form-mailchimp-crm'); ?> </th>
34 <th class="manage-column vx_pointer"> <?php esc_html_e("Created",'contact-form-mailchimp-crm'); ?> <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
35 <th class="manage-column vx_pointer"> <?php esc_html_e("Last Connection",'contact-form-mailchimp-crm'); ?> <i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></th>
36 <th class="manage-column"> <?php esc_html_e("Action",'contact-form-mailchimp-crm'); ?> </th> </tr>
37 </thead>
38 <tbody>
39 <?php
40
41 $nonce=wp_create_nonce("vx_nonce");
42 if(is_array($accounts) && count($accounts) > 0){
43 $sno=0;
44 foreach($accounts as $id=>$v){
45 $sno++; $id=$v['id'];
46 $icon= $v['status'] == "1" ? 'fa-check vx_green' : 'fa-times vx_red';
47 $icon_title= $v['status'] == "1" ? esc_html__('Connected','contact-form-mailchimp-crm') : esc_html__('Disconnected','contact-form-mailchimp-crm');
48 ?>
49 <tr> <td><?php echo esc_attr($id) ?></td> <td> <?php echo esc_html($v['name']) ?></td>
50 <td> <i class="fa <?php echo esc_attr($icon) ?>" title="<?php echo esc_attr($icon_title) ?>"></i> </td> <td> <?php echo date('M-d-Y H:i:s', strtotime($v['time'])+$offset); ?> </td>
51 <td> <?php echo date('M-d-Y H:i:s', strtotime($v['updated'])+$offset); ?> </td>
52 <td><span class="row-actions visible"> <a href="<?php echo esc_url($page_link."&id=".$id); ?>"><?php
53 if($v['status'] == "1"){
54 _e('View','contact-form-mailchimp-crm');
55 }else{
56 _e('Edit','contact-form-mailchimp-crm');
57 }
58 ?></a> | <span class="delete"><a href="<?php echo esc_url($page_link.'&'.$this->id.'_tab_action=del_account&id='.$id.'&vx_nonce='.$nonce) ?>" class="vx_del_account" > <?php esc_html_e("Delete",'contact-form-mailchimp-crm'); ?> </a></span></span> </td> </tr>
59 <?php
60 } }else{
61 ?>
62 <tr><td colspan="6"><p><?php echo sprintf(esc_html__("No Mailchimp Account Found. %sAdd New Account%s",'contact-form-mailchimp-crm'),'<a href="'.esc_url($new_account).'">','</a>'); ?></p></td></tr>
63 <?php
64 }
65 ?>
66 </tbody>
67 <tfoot>
68 <tr> <th class="manage-column column-cb" style="width: 30px" ><?php esc_html_e("#",'contact-form-mailchimp-crm'); ?></th>
69 <th class="manage-column"> <?php esc_html_e("Account",'contact-form-mailchimp-crm'); ?> </th>
70 <th class="manage-column"> <?php esc_html_e("Status",'contact-form-mailchimp-crm'); ?> </th>
71 <th class="manage-column"> <?php esc_html_e("Created",'contact-form-mailchimp-crm'); ?> </th>
72 <th class="manage-column"> <?php esc_html_e("Last Connection",'contact-form-mailchimp-crm'); ?> </th>
73 <th class="manage-column"> <?php esc_html_e("Action",'contact-form-mailchimp-crm'); ?> </th> </tr>
74 </tfoot>
75 </table>
76 <script>
77 jQuery(document).ready(function($){
78 $('.vx_accounts_table').tablesorter( {headers: { 2:{sorter: false}, 5:{sorter: false}}} );
79 $(".vx_del_account").click(function(e){
80 if(!confirm('<?php esc_html_e('Are you sure to delete Account ?','contact-form-mailchimp-crm') ?>')){
81 e.preventDefault();
82 }
83 })
84 })
85 </script>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 } ?> <style type="text/css">
5 .crm_fields_table{
6 width: 100%; margin-top: 30px;
7 }.crm_fields_table .crm_field_cell1 label{
8 font-weight: bold; font-size: 14px;
9 }
10 .crm_fields_table .clear{
11 clear: both;
12 }
13 .crm_fields_table .crm_field{
14 margin: 20px 0px;
15 }
16 .crm_fields_table .crm_text{
17 width: 100%;
18 }
19 .crm_fields_table .crm_field_cell1{
20 width: 20%; min-width: 100px; float: left; display: inline-block;
21 line-height: 26px;
22 }
23 .crm_fields_table .crm_field_cell2{
24 width: 80%; float: left; display: inline-block;
25 }
26 .vxc_alert{
27 padding: 10px 20px;
28 }
29 .vx_icons{
30 color: #888;
31 }
32 .vx_green{
33 color:rgb(0, 132, 0);
34 }
35 #tiptip_content{
36 max-width: 200px;
37 }
38 .vx_tr{
39 display: table; width: 100%;
40 }
41 .vx_td{
42 display: table-cell; width: 90%;
43 }
44 .vx_td2{
45 display: table-cell;
46 }
47 .crm_field .vx_td2 .vx_toggle_btn{
48 margin: 0 0 0 10px; vertical-align: baseline; width: 80px;
49 }
50
51 </style>
52
53 <div class="vx_wrap">
54
55 <form id="mainform" method="post">
56 <?php wp_nonce_field("vx_nonce") ?>
57 <h2>
58 <?php esc_html_e("Settings", 'contact-form-mailchimp-crm') ?>
59 </h2>
60 <table class="form-table">
61 <tr>
62 <th scope="row"><label for="vx_plugin_data"><?php esc_html_e("Plugin Data", 'contact-form-mailchimp-crm'); ?></label>
63 </th>
64 <td>
65 <label for="vx_plugin_data"><input type="checkbox" name="meta[plugin_data]" value="yes" <?php if($this->post('plugin_data',$meta) == "yes"){echo 'checked="checked"';} ?> id="vx_plugin_data"><?php esc_html_e('On deleting this plugin remove all of its data','contact-form-mailchimp-crm'); ?></label>
66 </td>
67 </tr>
68
69
70 <?php
71 if(class_exists('vxcf_form')){
72 ?>
73 <tr>
74 <th><label for="update_entry"><?php esc_html_e("Update Entry",'contact-form-mailchimp-crm'); ?></label></th>
75 <td><label for="update_entry"><input type="checkbox" id="update_entry" name="meta[update]" value="yes" <?php if($this->post('update',$meta) == "yes"){echo 'checked="checked"';} ?> ><?php esc_html_e("Update entry data in Mailchimp when updated in Contact Form Entries Plugin",'contact-form-mailchimp-crm'); ?></label></td>
76 </tr>
77 <tr>
78 <th><label for="delet_entry"><?php esc_html_e("Delete Entry",'contact-form-mailchimp-crm'); ?></label></th>
79 <td><label for="delet_entry"><input type="checkbox" id="delet_entry" name="meta[delete]" value="yes" <?php if($this->post('delete',$meta) == "yes"){echo 'checked="checked"';} ?> ><?php esc_html_e("Delete entry data from Mailchimp when deleted from Contact Form Entries Plugin",'contact-form-mailchimp-crm'); ?></label></td>
80 </tr>
81 <tr>
82 <th><label for="restore_entry"><?php esc_html_e("Restore Entry",'contact-form-mailchimp-crm'); ?></label></th>
83 <td><label for="restore_entry"><input type="checkbox" id="restore_entry" name="meta[restore]" value="yes" <?php if($this->post('restore',$meta) == "yes"){echo 'checked="checked"';} ?> ><?php esc_html_e("Restore entry in Mailchimp when restored in Contact Form Entries Plugin",'contact-form-mailchimp-crm'); ?></label></td>
84 </tr>
85 <tr>
86 <th><label for="notes_meta"><?php esc_html_e("Entry Notes",'contact-form-mailchimp-crm'); ?></label></th>
87 <td><label for="notes_meta"><input type="checkbox" id="notes_meta" name="meta[notes]" value="yes" <?php if($this->post('notes',$meta) == "yes"){echo 'checked="checked"';} ?> ><?php esc_html_e("Add / delete notes to Mailchimp when added / deleted in Contact Form Entries Plugin",'contact-form-mailchimp-crm'); ?></label></td>
88 </tr>
89
90 <?php
91 }
92 ?>
93 </table>
94
95 <p class="submit"><input type="submit" name="save" class="button-primary" title="<?php esc_html_e('Save Settings','contact-form-mailchimp-crm'); ?>" value="<?php esc_html_e("Save Settings", 'contact-form-mailchimp-crm') ?>" /></p>
96 </form>
97
98 <?php
99 //var_dump(self::$tooltips);
100 do_action('add_section_'.$this->id);
101 ?>
102
103 </div>
1 <?php
2 /**
3 * Uninstall
4 */
5 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
6 exit;
7 }
8 $path=plugin_dir_path(__FILE__);
9 include_once($path . "cf7-mailchimp.php");
10 include_once($path . "includes/install.php");
11 $install=new vxcf_mailchimp_install();
12 $settings=get_option($install->id.'_settings',array());
13 if(!empty($settings['plugin_data'])){
14 $install->remove_data();
15 }
16
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5 if( !class_exists( 'vx_crmperks_notice_vxcf_mailchimp' )):
6
7 class vx_crmperks_notice_vxcf_mailchimp extends vxcf_mailchimp{
8
9 public $plugin_url="https://www.crmperks.com";
10 public $review_link='https://wordpress.org/support/plugin/cf7-mailchimp/reviews/?filter=5#new-post';
11 public $option='vxcf_form';
12
13 public function __construct(){
14
15 add_filter('vx_plugin_tabs_'.$this->id, array($this, 'add_section_cf'),99);
16 add_filter( 'plugin_row_meta', array( $this , 'pro_link' ), 10, 2 );
17 $slug=$this->get_slug();
18 //add_action( 'after_plugin_row_'.$slug, array( $this, 'plugin_msgs' ),99,3 );
19 add_action( 'wp_ajax_review_dismiss_'.$this->id, array( $this, 'review_dismiss' ) );
20 add_action('add_section_'.$this->id, array($this, 'free_plugins_notice'),99);
21 add_action('vx_plugin_upgrade_notice_'.$this->type, array($this, 'notice'),99);
22
23 if(isset($_GET['page']) && $_GET['page'] == $this->id ){
24 add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
25 //install forms
26 add_action( 'admin_notices', array( $this , 'install_forms_notice' ) );
27 }
28 add_filter( 'plugins_api', array( $this, 'forms_info' ), 11, 3 );
29 }
30
31 public function install_forms_notice(){
32
33 if(!empty($_GET['page']) && $_GET['page'] == $this->id){
34
35 if(!empty($_GET['cfx_form_dissmiss_notice'])){
36 check_admin_referer('vx_nonce');
37 update_option('cfx_form_install_entries_notice','true',false);
38 }
39
40 $show=get_option('cfx_form_install_entries_notice');
41 if(empty($show)){
42 //var_dump($link);
43 if(!class_exists('vxcf_form')) {
44 $plugin_file='contact-form-entries/contact-form-entries.php';
45 $plugin_msg='';
46 $link=wp_nonce_url($this->link_to_settings().'&cfx_form_dissmiss_notice=true','vx_nonce');
47
48 if(file_exists(WP_PLUGIN_DIR.'/'.$plugin_file)) {
49 $url=admin_url("plugins.php?action=activate&plugin=$plugin_file");
50 $url=wp_nonce_url( $url , "activate-plugin_{$plugin_file}");
51 $plugin_msg=__('Activate Plugin','crm-perks-forms');
52 }else{
53 $url=admin_url("update.php?action=install-plugin&plugin=$plugin_file");
54 $url=wp_nonce_url( $url, "install-plugin_$plugin_file");
55 $plugin_msg=__('Install Plugin','crm-perks-forms');
56 }
57 $msg =sprintf(__('Want to save conatct form 7 submissions? Manage contact form 7 entries , View Mailchimp status of any entry and Send any entry to Mailchimp with free %sConatct Form Entries Plugin%s','crm-perks-forms'),'<a href="https://wordpress.org/plugins/contact-form-entries/" target="_blank">','</a>');
58 ?>
59 <div class="notice-warning settings-error notice is-dismissible below-h2" style="font-weight: bold">
60 <p><?php echo wp_kses_post($msg); ?></p>
61 <p><a href="<?php echo $url ?>"><?php echo $plugin_msg; ?></a> | <a href="<?php echo $link; ?>"><?php esc_html_e('Dismiss this notice','crm-perks-forms'); ?></a></p>
62 </div>
63 <?php
64 }
65 } }
66
67 }
68
69 public function install_forms_notice_accounts(){
70
71 if(!empty($_GET['tab']) && $_GET['tab'] == 'accounts' && empty($_GET['id'])){
72
73 $plugin_file='contact-form-entries/contact-form-entries.php';
74 if(!class_exists('vxcf_form') && !file_exists(WP_PLUGIN_DIR.'/'.$plugin_file)) {
75 $plugin_msg='';
76 $link=wp_nonce_url($this->link_to_settings().'&cfx_form_dissmiss_notice=true','vx_nonce');
77
78 if(file_exists(WP_PLUGIN_DIR.'/'.$plugin_file)) {
79 $url=admin_url("plugins.php?action=activate&plugin=$plugin_file");
80 $url=wp_nonce_url( $url , "activate-plugin_{$plugin_file}");
81 $plugin_msg=__('Activate','crm-perks-forms');
82 }else{
83 $url=admin_url("update.php?action=install-plugin&plugin=$plugin_file");
84 $url=wp_nonce_url( $url, "install-plugin_$plugin_file");
85 $plugin_msg=__('Install','crm-perks-forms');
86 }
87
88 ?>
89 <style type="text/css">
90 .vx_pro_version .fa{
91 color: #727f30; font-size: 18px; vertical-align: middle;
92 }
93 </style>
94 <div class="notice-warning notice is-dismissible below-h2 vx_pro_version">
95 <p><i class="fa fa-check"></i> Save Contact Form 7 Submissions in Wordpress.</p>
96 <p><i class="fa fa-check"></i> View mailchimp status(sent or not sent) of any entry.</p>
97 <p><i class="fa fa-check"></i> Easily Resend any entry to mailchimp.</p>
98 <p><a href="<?php echo $url ?>" style="font-weight: bold;"><?php esc_html_e('Install 100% free Conatct Form Entries Plugin','crm-perks-forms') ?></a> </p>
99 </div>
100 <?php
101 }
102 }
103
104 }
105 public function forms_info( $data, $action = '', $args = null ) {
106 $plugin=isset($_REQUEST['plugin']) ? sanitize_text_field($_REQUEST['plugin']) : '';
107 $slug = isset( $args->slug ) ? $args->slug : $plugin;
108 if($slug == 'contact-form-entries/contact-form-entries.php'){
109 $arr=new stdClass();
110 $arr->download_link='https://downloads.wordpress.org/plugin/contact-form-entries.zip';
111 return $arr;
112 }
113 return $data;
114 }
115
116 /**
117 * display plgin messages
118 *
119 * @param mixed $type
120 */
121 public function plugin_msgs($file,$data,$status){
122 $plugin_url=$this->plugin_url();
123 $message=__('This plugin has Premium add-ons and many powerful features.','contact-form-entries');
124 $message.=' <a href="'.$plugin_url.'" target="_blank" style="font-color: #fff; font-weight: bold;">'.__('Go Premium','contact-form-entries').'</a>';
125 ?>
126 <tr class="plugin-update-tr"><td colspan="5" class="plugin-update">
127 <style type="text/css"> .vx_msg a{color: #fff; text-decoration: underline;} .vx_msg a:hover{color: #eee} </style>
128 <div style="background-color: rgba(224, 224, 224, 0.5); padding: 5px; margin: 0px 10px 10px 28px "><div style="background-color: #d54d21; padding: 5px 10px; color: #fff" class="vx_msg"> <span class="dashicons dashicons-info"></span> <?php echo wp_kses_post($message) ?>
129 </div></div></td></tr>
130 <?php
131 }
132
133 public function review_dismiss(){
134 $install_time=get_option($this->id."_install_data");
135 if(!is_array($install_time)){ $install_time =array(); }
136 $install_time['review_closed']='true';
137 update_option($this->id."_install_data",$install_time,false);
138 die();
139 }
140 public function admin_footer($text) {
141 if(isset($_GET['page']) && $_GET['page'] == $this->id ){
142 $text=sprintf(__( 'if you enjoy using %s, please %s leave us a %s rating%s. A %shuge%s thank you in advance.','contact-form-entries'),'<b>'.self::$title.'</b>','<a href="'.$this->review_link.'" target="_blank" rel="noopener noreferrer">','&#9733;&#9733;&#9733;&#9733;&#9733;','</a>','<b>','</b>');
143 } return $text;
144 }
145 public function review_notice() {
146 $install_time=get_option($this->id."_install_data");
147 if(!is_array($install_time)){ $install_time =array(); }
148 if(empty($install_time['time'])){
149 $install_time['time']=current_time( 'timestamp' , 1 );
150 update_option($this->id."_install_data",$install_time,false);
151 }
152 //$install_time['review_closed']='';
153 $time=current_time( 'timestamp' , 1 )-(3600*28);
154 if(!empty($install_time) && is_array($install_time) && !empty($install_time['time']) && empty($install_time['review_closed'])){
155 $time_i=(int)$install_time['time'];
156 if($time > $time_i){
157 ?>
158 <div class="notice notice-info is-dismissible vxcf-review-notice" style="margin: 14px 0 -4px 0">
159 <p><?php echo sprintf(esc_html__( 'You\'ve been using Contact Form 7 mailchimp Plugin for some time now; we hope you love it!.%s If you do, please %s leave us a %s rating on WordPress.org%s to help us spread the word and boost our motivation.','contact-form-entries'),'<br/>','<a href="'.$this->review_link.'" target="_blank" rel="noopener noreferrer">','&#9733;&#9733;&#9733;&#9733;&#9733;','</a>'); ?></p>
160 <p><a href="<?php echo $this->review_link ?>" target="_blank" rel="noopener noreferrer" class="vxcf_close_notice_a"><?php esc_html_e('Yes, you deserve it','contact-form-entries') ?></a> | <a href="#" class="vxcf_close_notice_a"><?php esc_html_e('Dismiss this notice','contact-form-entries'); ?></a></p>
161 </div>
162 <script type="text/javascript">
163 jQuery( document ).ready( function ( $ ) {
164 $( document ).on( 'click', '.vxcf-review-notice .vxcf_close_notice_a', function ( e ) {
165 //e.preventDefault();
166 $('.vxcf-review-notice .notice-dismiss').click();
167 //$.ajax({ type: "POST", url: ajaxurl, async : false, data: {action:"vxcf_form_review_dismiss"} });
168 $.post( ajaxurl, { action: 'review_dismiss_<?php echo esc_attr($this->id) ?>' } );
169 } );
170 } );
171 </script>
172 <?php
173 } }
174 }
175
176 public function add_section_cf($tabs){
177 $tabs["vxc_notice"]=array('label'=>__('Go Premium','contact-form-entries'),'function'=>array($this, 'notice'));
178 $this->review_notice();
179
180 return $tabs;
181 }
182
183 public function notice(){
184 $url=$this->get_base_url();
185 $plugin_url=$this->plugin_url();
186 $this->install_forms_notice_accounts();
187 ?>
188 <style type="text/css">
189
190 .vx_pro_version .fa{
191 color: #727f30; font-size: 18px; vertical-align: middle;
192 }
193 </style>
194 <div class="updated below-h2 vx_pro_version" style="border-left-color: #1192C1; margin: 30px 20px 30px 0px">
195 <h2>Premium Version</h2>
196 <p><i class="fa fa-check"></i> Mailchimp memeber's tags.</p>
197 <p><i class="fa fa-check"></i> Mailchimp Phone Number and All Custom fields.</p>
198 <p><i class="fa fa-check"></i> Mailchimp memeber's interest groups .</p>
199 <p><i class="fa fa-check"></i> Google Analytics Parameters and Geolocation of a visitor who submitted the form.</p>
200 <p><i class="fa fa-check"></i> Lookup lead's email using email lookup apis.We support all googd email lookup apis like Fullcontact , Towerdata and pipl.com API.</p>
201 <p><i class="fa fa-check"></i> Verify lead's phone number and get detailed information about phone number using phone lookup apis, We support many good phone lookup apis like everyoneapi, Clearbit api , whitepages api , twilio api and numverify api.</p>
202 <p><i class="fa fa-check"></i> 20+ addons.</p>
203
204 <p>By purchasing the premium version of the plugin you will get access to advanced marketing features and you will get one year of free updates & support</p>
205 <p>
206 <a href="<?php echo esc_url($plugin_url) ?>" target="_blank" class="button-primary button">Go Premium</a>
207 </p>
208 </div>
209
210 <?php
211 return;
212 }
213 public function plugin_url() {
214 return $this->plugin_url.'?vx_product='.$this->domain;
215 }
216 public function wp_id() {
217 $id='';
218 if(function_exists('wp_get_theme')){
219 $theme=wp_get_theme();
220 if(property_exists($theme,'stylesheet')){
221 $id=md5($theme->stylesheet);}
222 }
223 return $id;
224 }
225 public function pro_link($links,$file){
226 $slug=$this->get_slug();
227 if($file == $slug){
228 $url=$this->plugin_url();
229 $links[]='<a href="'.$url.'"><b>Go Premium</b></a>';
230 }
231 return $links;
232 }
233 public function free_plugins_notice(){
234 ?>
235 <div class="updated below-h2" style="border: 1px solid #1192C1; border-left-width: 6px; padding: 5px 12px;">
236 <h3>Our Other Free Plugins</h3>
237
238 <p><b><a href="https://wordpress.org/plugins/crm-perks-forms/" target="_blank">CRM Perks Forms</a></b> is lightweight and highly optimized contact form builder with Poups and floating buttons.</p>
239
240 <p><b><a href="https://wordpress.org/plugins/support-x/" target="_blank">Support X - Wordpress Helpdesk</a></b> Shows user tickets from HelpScout, mailchimp, FreshDesk, Desk.com and Teamwork in wordpress. Users can create new tickets and reply to old tickets from wordpress.</p>
241 </div>
242 <?php
243 }
244
245
246
247 }
248 new vx_crmperks_notice_vxcf_mailchimp();
249 endif;