-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·6134 lines (5552 loc) · 266 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
Plugin Name: Shul Admin by Victor Escobar, based on Church Admin by Andy Moyle
Plugin URI: <TBD>
Description: Manage shul life with address book, schedule, classes, small groups, and advanced communication tools - bulk email and sms.
Version: 0.1
Author: Victor Escobar
Text Domain: shul-admin
Author URI: <TBD>
License:
----------------------------------------
Copyright (C) 2020 by Victor Escobar
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
http://www.gnu.org/licenses/
----------------------------------------
*/
if ( ! defined( 'ABSPATH' ) ) exit('You need Jesus!'); // Exit if accessed directly
//define('CA_DEBUG',TRUE);
//sandbox
//define('CA_PAYPAL',"https://www.sandbox.paypal.com/cgi-bin/webscr");
//live
define('CA_PAYPAL',"https://www.paypal.com/cgi-bin/webscr");
$church_admin_version = '2.6911';
$church_admin_url='admin.php?page=church_admin/index.php';
$people_type=get_option('church_admin_people_type');
$level=get_option('church_admin_levels');
/******************************************
*
* Blur Cookies set/unset
*
*******************************************/
add_action('admin_init','church_admin_save_forms');
function church_admin_save_forms(){
/*****************************************************************************
*
* New save functionality on init so redirect to list page can happen
*
******************************************************************************/
if(!empty($_POST['church-admin-save']))
{
require_once(plugin_dir_path(__FILE__).'includes/church_admin_save.php');
church_admin_save();
//church_admin_debug('ServiceSaved');
exit();
}
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='blur')
{
church_admin_debug('Blur');
setcookie('churchAdminBlur', 'Blurred', time()+24*60*60,'/' );
church_admin_debug(print_r($_COOKIE,TRUE));
//wp_redirect(admin_url('admin.php?page=church_admin/index.php&action=settings§ion=settings'));
//exit();
}
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='unblur')
{
unset( $_COOKIE['churchAdminBlur'] );
setcookie( 'churchAdminBlur', FALSE, time() - ( 15 * 60 ),'/' );
//wp_redirect(admin_url('admin.php?page=church_admin/index.php&action=settings§ion=settings'));
}
}
/* initialise plugin */
add_action( 'plugins_loaded', 'church_admin_initialise' );
function church_admin_initialise() {
global $level,$church_admin_version,$wpdb,$current_user,$church_admin_prayer_request_success,$member_type;
define('CA_PATH',plugin_dir_path( __FILE__));
wp_get_current_user();
church_admin_constants();//setup constants first
//Version Number
define('OLD_CHURCH_ADMIN_VERSION',get_option('church_admin_version'));
if(OLD_CHURCH_ADMIN_VERSION!= $church_admin_version)
{
church_admin_backup();
require_once(plugin_dir_path( __FILE__) .'/includes/install.php');
church_admin_install();
}
$rota_order=ca_rota_order();
$member_type=church_admin_member_type_array();
if(!empty($_GET['ca_refresh']))
{
delete_option('church-admin-directory-output');
}
//handle move household to member type
if(!empty($_POST['move_household_id']))
{
if(ctype_digit($_POST['move_household_id']) &&ctype_digit($_POST['member_type_id']))
{
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET member_type_id="'.intval($_POST['member_type_id']).'" WHERE household_id="'.intval(($_POST['move_household_id'])).'"');
}
}
//handle unit save
if(!empty($_POST['save-unit']))
{
if(!empty($_GET['unit_id']))$unit_id=intval($_GET['unit_id']);
$name=esc_sql(stripslashes($_POST['unit_name']));
$description=esc_sql(stripslashes($_POST['unit_description']));
if(empty($unit_id))$unit_id=$wpdb->get_var('SELECT unit_id FROM '.CA_UNI_TBL.' WHERE name="'.$name.'" AND description="'.$description.'"');
if(empty($unit_id)){$wpdb->query('INSERT INTO '.CA_UNI_TBL.' (name,description)VALUES("'.$name.'","'.$description.'")');}
else{$wpdb->query('UPDATE '.CA_UNI_TBL.' SET name="'.$name.'",description="'.$description.'" WHERE unit_id="'.intval($unit_id).'"');}
}
if(!empty($_POST['save-subunit']))
{
if(!empty($_GET['unit_id']))$unit_id=intval($_GET['unit_id']);
if(!empty($_GET['subunit_id']))$subunit_id=intval($_GET['subunit_id']);
$name=esc_sql(stripslashes($_POST['unit_name']));
$description=esc_sql(stripslashes($_POST['unit_description']));
if(empty($subunit_id))$subunit_id=$wpdb->get_var('SELECT subunit_id FROM '.CA_SUBU_TBL.' WHERE name="'.$name.'" AND description="'.$description.'"');
if(empty($subunit_id))
{
$wpdb->query('INSERT INTO '.CA_SUBU_TBL.' (name,description,unit_id,active)VALUES("'.$name.'","'.$description.'","'.$unit_id.'",1)');
$subunit_id=$wpdb->insert_id;
//church_admin_debug($wpdb->last_query);
}else{$wpdb->query('UPDATE '.CA_SUBU_TBL.' SET name="'.$name.'",description="'.$description.'" WHERE subunit_id="'.intval($subunit_id).'"');}
//handle people
$wpdb->query('DELETE FROM '.CA_MET_TBL.' WHERE meta_type="unit" AND ID="'.intval($subunit_id).'"'); $autocompleted=maybe_unserialize(church_admin_get_people_id(trim(stripslashes($_POST['people']))));
foreach($autocompleted AS $x=>$name)
{
$p_id=church_admin_get_one_id(trim($name));//get the people_id
if(!empty($p_id))
{
church_admin_update_people_meta($subunit_id,$p_id,'unit');//update person
}
}
}
//handle reset app menu
if(!empty($_GET['action'])&&$_GET['action']=='reset-app-menu'&& wp_verify_nonce($_GET['_wpnonce'],'reset-app-menu'))
{
delete_option('church_admin_app_new_menu');
$defaultMenu = array(
'home'=>array('edit'=>false,'item'=>__('Home','church-admin'),'order'=>1,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'account'=>array('edit'=>false,'item'=>__('Account','church-admin'),'order'=>2,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'courage'=>array('edit'=>true,'item'=>__('Acts of Courage',"church-admin"),'order'=>3,'show'=>FALSE,'type'=>'app','loggedinOnly'=>0),
'address'=>array('edit'=>true,'item'=>__('Address','church-admin'),'order'=>4,'show'=>TRUE,'type'=>'app','loggedinOnly'=>1),
'bible'=>array('edit'=>true,'item'=>__('Bible','church-admin'),'order'=>5,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'calendar'=>array('edit'=>true,'item'=>__('Calendar','church-admin'),'order'=>6,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'checkin'=>array('edit'=>true,'item'=>__('Checkin','church-admin'),'order'=>7,'show'=>TRUE,'type'=>'app','loggedinOnly'=>1),
'classes'=>array('edit'=>true,'item'=>__('Classes','church-admin'),'order'=>8,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'giving'=>array('edit'=>true,'item'=>__('Giving','church-admin'),'order'=>9,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'smallgroup'=>array('edit'=>true,'item'=>__('Groups','church-admin'),'order'=>10,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'media'=>array('edit'=>true,'item'=>__('Media','church-admin'),'order'=>11,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'messages'=>array('edit'=>TRUE,'item'=>__('Messages','church-admin'),'order'=>12,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'news'=>array('edit'=>true,'item'=>__('News','church-admin'),'order'=>13,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'prayer'=>array('edit'=>true,'item'=>__('Prayer','church-admin'),'order'=>14,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'myprayer'=>array('edit'=>true,'item'=>__('My prayer list','church-admin'),'order'=>15,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'rota'=>array('edit'=>true,'item'=>__('Schedule','church-admin'),'order'=>16,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'service-prebooking'=>array('edit'=>TRUE,'item'=>__('Service Prebooking','church-admin'),'order'=>17,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0),
'settings'=>array('edit'=>false,'item'=>__('Settings','church-admin'),'order'=>18,'show'=>TRUE,'type'=>'app','loggedinOnly'=>1),
'logout'=>array('edit'=>false,'item'=>__('Reset church','church-admin'),'order'=>19,'show'=>TRUE,'type'=>'app','loggedinOnly'=>0)
);
//church_admin_debug(print_r($defaultMenu,TRUE));
update_option('church_admin_app_new_menu',$defaultMenu);
$url=admin_url().'admin.php?page=church_admin%2Findex.php&action=app§ion=app&refresh=true';
wp_redirect( $url );
exit();
}
//handle unconfirm GDPR
if(!empty($_GET['action'])&&$_GET['action']=='ca_unconfirm_GDPR')
{
if(current_user_can('manage_options'))
{
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET gdpr_reason=NULL');
}
}
//handle unsubscribe link from email
if(!empty($_GET['ca_unsub']))
{
$details=$wpdb->get_row('SELECT * FROM '.CA_PEO_TBL.' WHERE md5(people_id)="'.esc_sql($_GET['ca_unsub']).'"');
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET email_send=0 WHERE md5(people_id)="'.esc_sql($_GET['ca_unsub']).'"');
require_once(plugin_dir_path(__FILE__).'includes/unsubscribe.php');
exit();
}
//handle re-subscribe
if(!empty($_GET['ca_sub']))
{
$details=$wpdb->get_row('SELECT * FROM '.CA_PEO_TBL.' WHERE md5(people_id)="'.esc_sql($_GET['ca_sub']).'"');
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET email_send=1 WHERE md5(people_id)="'.esc_sql($_GET['ca_sub']).'"');
require_once(plugin_dir_path(__FILE__).'includes/resubscribe.php');
exit();
}
//handle gdpr link
if(!empty($_GET['confirm']))
{
$details=explode("/",$_GET['confirm']);
$household_id=$wpdb->get_var('SELECT household_id FROM '.CA_PEO_TBL.' WHERE last_name LIKE "'.esc_sql($details[0]).'" AND people_id="'.intval($details[1]).'"');
if($household_id)
{
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET email_send=1, sms_send=1, gdpr_reason="'.esc_sql(__('User confirmed on website','church-admin').' '.date(get_option('date_format'))).'" WHERE household_id="'.intval($household_id).'"' );
$wpdb->query('UPDATE '.CA_HOU_TBL.' SET privacy=0 WHERE household_id="'.intval($household_id).'"' );
}
require_once(plugin_dir_path(__FILE__).'includes/confirmed.php');
exit();
}
//temp fix fo bug in app
if(isset($_GET['action'])&&$_GET['action']=='ca_classes'){require_once(plugin_dir_path(__FILE__).'app/app-admin.php');ca_classes();exit();}
if(isset($_GET['action'])&&$_GET['action']=='auto_backup'){require_once(plugin_dir_path(__FILE__).'includes/pdf_creator.php');church_admin_backup_pdf();exit();}
if(isset($_GET['action'])&&$_GET['action']=="delete_backup"){check_admin_referer('delete_backup');church_admin_delete_backup();}
if(isset($_GET['action'])&&$_GET['action']=="refresh_backup") {check_admin_referer('refresh_backup');church_admin_backup();}
//remove cron auto email rotas
if(isset($_GET['action'])&&$_GET['action']=="delete-cron")
{
check_admin_referer('delete-cron');
require_once(plugin_dir_path(__FILE__).'includes/rota.new.php');
church_admin_delete_cron($_GET['ts'],$_GET['key']);
$url=admin_url().'admin.php?page=church_admin%2Findex.php&action=rota§ion=rota';
wp_redirect( $url );
}
if(!empty($_POST['ind_att_csv'])){require_once(plugin_dir_path(__FILE__).'includes/individual_attendance.php');church_admin_output_ind_att_csv();exit();}
//load_plugin_textdomain( 'church-admin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
load_plugin_textdomain( 'church-admin');
if(empty($level['Directory']))$level['Directory']='administrator';
if(empty($level['Kidswork']))$level['Kidswork']='administrator';
if(empty($level['Small Groups']))$level['Small Groups']='administrator';
if(empty($level['Rota']))$level['Rota']='administrator';
if(empty($level['Funnel'])) $level['Funnel']='administrator';
if(empty($level['Bulk Email']))$level['Bulk Email']='administrator';
if(empty($level['Sermons']))$level['Sermons']='administrator';
if(empty($level['Bulk SMS']))$level['Bulk SMS']='administrator';
if(empty($level['Calendar']))$level['Calendar']='administrator';
if(empty($level['Attendance']))$level['Attendance']='administrator';
if(empty($level['Member Type']))$level['Member Type']='administrator';
if(empty($level['Service']))$level['Service']='administrator';
if(empty($level['Prayer Chain']))$level['Prayer Chain']='administrator';
if(empty($level['Sessions']))$level['Sessions']='administrator';
if(empty($level['App']))$level['App']='administrator';
if(empty($level['Prayer Requests']))$level['Prayer Requests']='administrator';
if(empty($level['Events']))$level['Events']='administrator';
if(empty($level['Ministries']))$level['Ministries']='administrator';
update_option('church_admin_levels',$level);
if(!empty($_POST['one_site']))$wpdb->query('UPDATE '.CA_PEO_TBL.' SET site_id="'.intval($_POST['site_id']).'"');
//church admin app initialisation
if(!empty($_GET['ca-app']))
{
require_once(plugin_dir_path(__FILE__).'app/app-admin.php');
switch($_GET['ca-app'])
{
case'latest_media': header("Content-Type: application/json");echo church_admin_json_latest_media();exit();break;
}
}
//copy rota and then redirect
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='copy_rota_data' &&church_admin_level_check('Rota'))
{
require_once(plugin_dir_path(__FILE__).'includes/rota.new.php');
church_admin_copy_rota($_GET['rotaDate1'],$_GET['rotaDate2'], $_GET['service_id'],$_GET['mtg_type']);
//MICK WALL – redirect back to the list for current service.
$service_id=!empty($_REQUEST['service_id'])?$_REQUEST['service_id']:NULL;
$url=admin_url().'admin.php?page=church_admin%2Findex.php&action=church_admin_rota_list§ion=rota&service_id='.$service_id;
wp_redirect( $url );
exit();
}
//reset version
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='reset-version')
{
check_admin_referer('reset-version');
delete_option("church_admin_version");
$url=admin_url().'admin.php?page=church_admin%2Findex.php&message=Church+Admin+Version+Reset';
wp_redirect( $url );
exit;
}
//reset version
//upgrade rota for 1.095
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='upgrade_rota')
{
check_admin_referer('upgrade_rota');
delete_option("church_admin_version");
$wpdb->query('TRUNCATE TABLE '.CA_ROTA_TBL);
$url=admin_url().'admin.php?page=church_admin%2Findex.php&message=Rota+Table+Reset';
wp_redirect( $url );
exit;
}
//upgrade rota for 1.095
if(!empty($_GET['page'])&&($_GET['page']=='church_admin/index.php')&&!empty($_GET['action'])&& $_GET['action']=='clear_debug')
{
check_admin_referer('clear_debug');
$upload_dir = wp_upload_dir();
$debug_path=$upload_dir['basedir'].'/church-admin-cache/debug_log.php';
if(file_exists($debug_path))unlink($debug_path);
$url=admin_url().'admin.php?page=church_admin%2Findex.php&action=settings§ion=general-settings&message=Church+Admin+Debug+Log+has+been+deleted.';
wp_redirect( $url );
exit;
}
//save the church admin note before any display happens
if(!empty($_POST['save-ca-comment']))
{
if(defined('CA_DEBUG'))church_admin_debug('******************************'."\r\n Save Comment ".date('Y-m-d H:i:s')."\r\n");
$sqlsafe=array();
if(!empty($_POST['parent_id']))$parent_id=intval($_POST['parent_id']);
if(empty($parent_id))$parent_id=null;
foreach($_POST AS $key=>$value)$sqlsafe[$key]=esc_sql(stripslashes($value));
if(!empty($_POST['comment_id']))
{
$sql='UPDATE '.CA_COM_TBL.' SET comment="'.$sqlsafe['comment'].'",comment_type="'.$sqlsafe['comment_type'].'",parent_id="'.$parent_id.'",author_id="'.intval($current_user->ID).'",timestamp="'.date('Y-m-d h:i:s').'" comment_id="'.intval($sqlsafe['comment_id']).'"';
}
else
{
$sql='INSERT INTO '.CA_COM_TBL.' (comment,comment_type,parent_id,author_id,timestamp,ID)VALUES("'.$sqlsafe['comment'].'","'.$sqlsafe['comment_type'].'","'.$parent_id.'","'.intval($current_user->ID).'","'.date('Y-m-d h:i:s').'","'.intval($sqlsafe['ID']).'")';
}
if(defined('CA_DEBUG'))church_admin_debug('******************************'."\r\n $sql \r\n");
$wpdb->query($sql);
if(empty($sqlsafe['comment_id']))$sqlsafe['comment_id']=$wpdb->insert_id;
$comment=$wpdb->get_row('SELECT * FROM '.CA_COM_TBL.' WHERE comment_id="'.intval($sqlsafe['comment_id']).'"');
}
}
require_once(plugin_dir_path(__FILE__) .'includes/functions.php');
//require_once(plugin_dir_path(__FILE__).'includes/admin.php');
require_once(plugin_dir_path(__FILE__).'app/app-admin.php');
require_once(plugin_dir_path(__FILE__).'includes/custom_fields.php');
if(function_exists('register_block_type'))require_once(plugin_dir_path(__FILE__) .'gutenberg/php-blocks.php');
add_action( 'delete_user', 'church_admin_delete_user' );//make sure user account disconnected from directory
function church_admin_delete_user($user_id)
{
global $wpdb;
$wpdb->query('UPDATE '.CA_PEO_TBL.' SET user_id="NULL" WHERE user_id="'.intval($user_id).'"');
}
//add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
add_action('activated_plugin','church_admin_save_error');
function church_admin_save_error(){
update_option('church_admin_plugin_error', ob_get_contents());
}
add_action('load-church-admin', 'church_admin_add_screen_meta_boxes');
//update_option('church_admin_roles',array(2=>'Elder',1=>'Small group Leader'));
$oldroles=get_option('church_admin_roles');
if(!empty($oldroles))
{
update_option('church_admin_departments',$oldroles);
delete_option('church_admin_roles');
}
function church_admin_constants()
{
/**
*
* Sets up constants for plugin
*
* @author Andy Moyle
* @param null
* @return
* @version 0.1
*
*/
global $wpdb;
// DB
define('CA_COV_TBL',$wpdb->prefix.'church_admin_covid_attendance');
define('CA_VIS_TBL',$wpdb->prefix.'church_admin_plan_visit');
define('CA_ATT_TBL',$wpdb->prefix.'church_admin_attendance');
define('CA_BRP_TBL',$wpdb->prefix.'church_admin_brplan');
define('CA_APP_TBL',$wpdb->prefix.'church_admin_app');
define('CA_APV_TBL',$wpdb->prefix.'church_admin_app_visits');
define('CA_CP_TBL',$wpdb->prefix.'church_admin_safeguarding');
define ('CA_BIB_TBL',$wpdb->prefix.'church_admin_bible_books');
define ('CA_CAT_TBL',$wpdb->prefix.'church_admin_calendar_category');
define('CA_CEL_TBL',$wpdb->prefix.'church_admin_cell_structure');
define('CA_CLA_TBL',$wpdb->prefix.'church_admin_classes');
define('CA_COM_TBL',$wpdb->prefix.'church_admin_comments');
define('CA_CUST_TBL',$wpdb->prefix.'church_admin_custom_fields');
define('CA_DATE_TBL',$wpdb->prefix.'church_admin_calendar_date');
define('CA_EVE_TBL',$wpdb->prefix.'church_admin_events');
define('CA_BOO_TBL',$wpdb->prefix.'church_admin_bookings');
define('CA_TIK_TBL',$wpdb->prefix.'church_admin_tickets');
define ('CA_FIL_TBL',$wpdb->prefix.'church_admin_sermon_files');
define ('CA_KJV_TBL',$wpdb->prefix.'church_admin_kjv');
define('CA_EMA_TBL',$wpdb->prefix.'church_admin_email');
define('CA_EBU_TBL',$wpdb->prefix.'church_admin_email_build');
define ('CA_FAC_TBL',$wpdb->prefix.'church_admin_facilities');
define('CA_FUN_TBL',$wpdb->prefix.'church_admin_funnels');
define('CA_FP_TBL',$wpdb->prefix.'church_admin_follow_up');
define('CA_HOU_TBL',$wpdb->prefix.'church_admin_household');
define('CA_HOP_TBL',$wpdb->prefix.'church_admin_hope_team');
define('CA_IND_TBL',$wpdb->prefix.'church_admin_individual_attendance');
define('CA_KID_TBL',$wpdb->prefix.'church_admin_kidswork');
define('CA_MET_TBL',$wpdb->prefix.'church_admin_people_meta');
define('CA_METRICS_TBL',$wpdb->prefix.'church_admin_metrics');
define('CA_METRICS_META_TBL',$wpdb->prefix.'church_admin_metrics_meta');
define('CA_MTY_TBL',$wpdb->prefix.'church_admin_member_types');
define('CA_MIN_TBL',$wpdb->prefix.'church_admin_ministries');
define('CA_PAY_TBL',$wpdb->prefix.'church_admin_event_payments');
define('CA_PEO_TBL',$wpdb->prefix.'church_admin_people');
define('CA_ROTA_TBL',$wpdb->prefix.'church_admin_new_rota');
define('CA_ROT_TBL',$wpdb->prefix.'church_admin_rotas');
define('CA_RST_TBL',$wpdb->prefix.'church_admin_rota_settings');
define('CA_SMG_TBL',$wpdb->prefix.'church_admin_smallgroup');
define('CA_SER_TBL',$wpdb->prefix.'church_admin_services');
define('CA_SES_TBL',$wpdb->prefix.'church_admin_session');
define('CA_SMET_TBL',$wpdb->prefix.'church_admin_session_meta');
define('CA_SIT_TBL',$wpdb->prefix.'church_admin_sites');
define ('CA_SERM_TBL',$wpdb->prefix.'church_admin_sermon_series');
define ('CA_UNI_TBL',$wpdb->prefix.'church_admin_units');
define ('CA_SUBU_TBL',$wpdb->prefix.'church_admin_unit_meta');
//define DB
define('OLD_CHURCH_ADMIN_EMAIL_CACHE',WP_PLUGIN_DIR.'/church-admin-cache/');
define('OLD_CHURCH_ADMIN_EMAIL_CACHE_URL',WP_PLUGIN_URL.'/church-admin-cache/');
define('CA_POD_URL',content_url().'/uploads/sermons/');
$upload_dir = wp_upload_dir();
if(!is_dir( $upload_dir['basedir'].'/sermons/'))
{
$old = umask(0);
mkdir( $upload_dir['basedir'].'/sermons/');
chmod($upload_dir['basedir'].'/sermons/', 0755);
umask($old);
$index="<?php\r\n//nothing is good;\r\n?>";
$fp = fopen($upload_dir['basedir'].'/sermons/'.'index.php', 'w');
fwrite($fp, $index);
fclose($fp);
}
if(!is_dir($upload_dir['basedir'].'/church-admin-cache/'))
{
$old = umask(0);
mkdir($upload_dir['basedir'].'/church-admin-cache/');
chmod($upload_dir['basedir'].'/church-admin-cache/', 0755);
umask($old);
$index="<?php\r\n//nothing is good;\r\n?>";
$fp = fopen($upload_dir['basedir'].'/church-admin-cache/'.'index.php', 'w');
fwrite($fp, $index);
fclose($fp);
}
//this needs to happen very early in page call!
}//end constants
/**
*
* Add new household to admin toolbar
*
* @author Andy Moyle
* @param null
* @return Array, key is order
* @version 0.1
*
*/
function church_admin_menu_item ($wp_admin_bar) {
$args = array (
'id' => 'household',
'title' => __('Household','church-admin'),
'href' => wp_nonce_url('admin.php?page=church_admin/index.php&section=people&action=add-household','add-household'),
'parent' => 'new-content'
);
if(church_admin_level_check('Directory')) $wp_admin_bar->add_node( $args );
}
add_action('admin_bar_menu', 'church_admin_menu_item',71);
function ca_rota_order()
{
/**
*
* Retrieves rota items in order
*
* @author Andy Moyle
* @param null
* @return Array, key is order
* @version 0.1
*
*/
global $wpdb;
//rota_order
$results=$wpdb->get_results('SELECT * FROM '.CA_RST_TBL.' ORDER BY rota_order ASC');
if($results)
{
$rota_order=array();
foreach($results AS $row)
{
$rota_order[]=$row->rota_id;
}
return $rota_order;
}
}
/******************************************************************************************************************************
*
* For prayer request, if made private in settings we want to show the login form at the template_redirect hook
*
******************************************************************************************************************************/
add_action( 'template_redirect', 'church_admin_prayer_requests_login_only' );
function church_admin_prayer_requests_login_only() {
global $post;
//church_admin_debug("POST:".print_r($post,true));
//if ( $post->post_type == 'prayer-requests' || $post->post_type == 'acts-of-courage') {
if(church_admin_is_post_type('prayer-requests')){
$private=get_option('church-admin-private-prayer-requests');
if($private)
{
if(!is_user_logged_in())
{
//auth_redirect();
//church_admin_debug(get_post_type_archive_link('prayer-requests'));
wp_redirect(wp_login_url(get_post_type_archive_link('prayer-requests')),307);
}
}
}
}
/******************************************************************************************************************************
*
* Show a submit prayer requests form at the top of the archive
*
******************************************************************************************************************************/
$theme = wp_get_theme(); // gets the current theme
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
add_action('presscore_before_loop', 'church_admin_draft_prayer_request');
}elseif( 'Omega' == $theme->name || 'Omega' == $theme->parent_theme ){
add_action('omega_before_content', 'church_admin_draft_prayer_request');
}
else{
add_action('loop_start', 'church_admin_draft_prayer_request');
}
function church_admin_draft_prayer_request($content)
{
global $wpdb,$church_admin_prayer_request_success;
if(is_post_type_archive('prayer-requests')&& is_archive())
{
$private=get_option('church-admin-private-prayer-requests');
//only show form if not private or logged in
if (!$private ||(is_user_logged_in() && $private))
{
$out='';
if(empty($_POST['save_prayer_request'])&&empty($_POST['non_spammer'])||!wp_verify_nonce($_POST['non_spammer'],'prayer-request'))
{
$out.='<h3>'.__('Submit a prayer request','church-admin').'</h3>';
$message=get_option('church_admin_prayer_request_message');
if(!empty($message))$out.='<p>'. esc_html($message).'</p>';
$out.='<form action="" method="POST">';
$out.='<table class="form-table"><tbody>';
$out.='<tr><th scope="row">'.__('Title','church-admin').'</th><td><input type="text" name="request_title"></td></tr>';
$out.='<tr><th scope="row">'.__('Prayer request','church-admin').'</th><td><textarea name="request_content"></textarea></td></tr>';
$out.='<tr id="spam-proof"> </td></tr>';
$out.='<tr><td cellspacing=2><input type="hidden" value="TRUE" name="save_prayer_request"/><input type="submit" value="'.__('Save','church-admin').'"/></td></tr></table>';
$out.='</form>';
$nonce=wp_create_nonce('prayer-request');
$out.='<script>jQuery(document).ready(function($) {var content="<th scope=\"row\">'.__('Check box if not a spammer','church-admin').'</th><td><input type=\"checkbox\" name=\"non_spammer\" value=\"'.$nonce.'\"/></td></tr>";$("#spam-proof").html(content);});</script>';
}
else{$out=$church_admin_prayer_request_success;}
echo $out;
}
}
}
add_action('loop_start', 'church_admin_draft_act_of_courage');
function church_admin_draft_act_of_courage($content)
{
global $wpdb,$church_admin_acts_success;
if(is_post_type_archive('acts-of-courage'))
{
$private=get_option('church-admin-private-acts-of-courage');
//only show form if not private or logged in
if (!$private ||(is_user_logged_in() && $private))
{
$out='';
if(empty($_POST['save_acts_request'])&&empty($_POST['non_spammer'])||!wp_verify_nonce($_POST['non_spammer'],'acts-of-courage'))
{
$out.='<h3>'.__('Submit an act of courage','church-admin').'</h3>';
$message=get_option('church-admin-acts-of-courage-message');
if(!empty($message))$out.='<p>'. esc_html($message).'</p>';
$out.='<form action="" method="POST">';
$out.='<table class="form-table"><tbody>';
$out.='<tr><th scope="row">'.__('Title','church-admin').'</th><td><input type="text" name="request_title"></td></tr>';
$out.='<tr><th scope="row">'.__('Your act of courage','church-admin').'</th><td><textarea name="request_content"></textarea></td></tr>';
$out.='<tr id="spam-proof"> </td></tr>';
$out.='<tr><td cellspacing=2><input type="hidden" value="TRUE" name="save_act_of_courage_request"/><input type="submit" value="'.__('Save','church-admin').'"/></td></tr></table>';
$out.='</form>';
$nonce=wp_create_nonce('acts-of-courage');
$out.='<script>jQuery(document).ready(function($) {var content="<th scope=\"row\">'.__('Check box if not a spammer','church-admin').'</th><td><input type=\"checkbox\" name=\"non_spammer\" value=\"'.$nonce.'\"/></td></tr>";$("#spam-proof").html(content);});</script>';
}
else{$out=$church_admin_acts_success;}
echo $out;
}
}
}
/****************************************************************************
*
* From 1.2800 register front end scripts early then enqueue on shortcode process
*
*****************************************************************************/
add_action( 'wp_enqueue_scripts', 'church_admin_register_frontend_scripts' );
function church_admin_register_frontend_scripts() {
global $church_admin_version;
wp_register_script('church-admin-event-booking',plugins_url( '/', __FILE__ ) . 'includes/event-booking.js',array( 'jquery' ),FALSE, TRUE);
wp_register_script('church-admin-calendar-script',plugins_url( '/', __FILE__ ) . 'includes/calendar.js',array( 'jquery' ),FALSE, TRUE);
wp_register_script('church-admin-calendar',plugins_url( '/', __FILE__ ) . 'includes/jQueryCalendar.js',array( 'jquery' ),FALSE, TRUE);
wp_enqueue_script( 'jquery-ui-datepicker',plugins_url('church-admin/includes/jquery-ui.min.js',dirname(__FILE__)),array('jquery'),NULL );
wp_enqueue_style( 'jquery.ui.theme', plugins_url('css/jquery-ui-1.8.21.custom.css',__FILE__ ) ,'',NULL);
$ajax_nonce = wp_create_nonce("church_admin_mp3_play");
//wp_register_script('ca_podcast_audio',plugins_url('church-admin/includes/audio.min.js',dirname(__FILE__) ) , array( 'jquery' ) ,FALSE, TRUE);
wp_localize_script( 'ca_podcast_audio', 'ChurchAdminAjax1', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_register_script('ca_podcast_audio_use',plugins_url('church-admin/includes/audio.use.js',dirname(__FILE__) ), array( 'jquery' ) ,$church_admin_version, TRUE);
wp_localize_script( 'ca_podcast_audio_use', 'ChurchAdminAjax', array('security'=>$ajax_nonce, 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_register_script( 'jquery-ui-datepicker','','',NULL );
wp_enqueue_style( 'jquery.ui.theme', plugins_url('css/jquery-ui-1.8.21.custom.css',__FILE__ ) ,'',NULL);
wp_register_script('church_admin_form_clone',plugins_url('church-admin/includes/jquery-formfields.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
//fix issue caused by some "premium" themes, which call google maps w/o key on every admin page. D'uh!
wp_dequeue_script('avia-google-maps-api');
//now enqueue google map api with the key
$src = 'https://maps.googleapis.com/maps/api/js';
$key='?key='.get_option('church_admin_google_api_key');
wp_register_script( 'church_admin_google_maps_api',$src.$key, array() ,FALSE);
wp_register_script('church_admin_map', plugins_url('church-admin/includes/google_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE);
wp_register_script('church_admin_map_script', plugins_url('church-admin/includes/maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE);
wp_register_script('church_admin_frontend_sg_map_script', plugins_url('church-admin/includes/smallgroup_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE);
wp_register_script('church_admin_sg_map', plugins_url('church-admin/includes/admin_sg_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
//google graph needs to be called early and in header, didn't like being registered and then enqueued later
wp_enqueue_script('church_admin_google_graph_api','https://www.google.com/jsapi', array( 'jquery' ) ,FALSE, FALSE);
}
add_action('wp_head','church_admin_ajaxurl');
function church_admin_ajaxurl()
{
$ajax_nonce = wp_create_nonce("church_admin_mp3_play");
?>
<script type="text/javascript">
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
var security= '<?php echo $ajax_nonce; ?>';
</script>
<?php
}
add_action('wp_enqueue_scripts', 'church_admin_init');
add_action('admin_enqueue_scripts', 'church_admin_init',9999);//adding withlow priority to be last to call google maps api
/**
*
* Initialises js scripts and css
*
* @author Andy Moyle
* @param null
* @return
* @version 0.1
*
*/
function church_admin_init()
{
if(!empty($_COOKIE['churchAdminBlur']))wp_enqueue_style( 'church-admin-blur', plugins_url('includes/blur.css',__FILE__ ) ,'',NULL);
wp_enqueue_style('font-awesome','https://use.fontawesome.com/releases/v5.7.1/css/all.css');
//This function add scripts as needed
wp_enqueue_style( 'dashicons' );
wp_enqueue_script('common','','',NULL);
wp_enqueue_script('wp-lists','','',NULL);
wp_enqueue_script('postbox','','',NULL);
wp_enqueue_style('font-awesome','https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
wp_enqueue_script('church_admin_google_graph_api','https://www.google.com/jsapi', array( 'jquery' ) ,FALSE, FALSE);
ca_thumbnails();
if(!empty($_POST['church_admin_search']))church_admin_editable_script();
if(isset($_GET['action']))
{
switch($_GET['action'])
{
case 'edit-subunit':church_admin_autocomplete_script();break;
case 'podcast-settings':church_admin_media_uploader_enqueue();break;
case 'app':church_admin_sortable_script();break;
case'edit-service':case'add-event':case'edit_safeguarding':case 'rota':case'church_admin_rota_list':church_admin_date_picker_script();break;
case 'edit_event':
case 'edit_ticket_type':
church_admin_date_picker_script();break;
case 'settings':case 'edit_ministry':church_admin_autocomplete_script();break;
case 'bulk_geocode':
check_admin_referer('bulk_geocode');
church_admin_google_map_api();
wp_enqueue_script('ca_batch_geocode', plugins_url('church-admin/includes/batch_geocode.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
break;
case 'services':case'attendance':church_admin_date_picker_script();church_admin_frontend_graph_script();break;
case'church_admin_cron_email':
if(defined('CA_DEBUG'))church_admin_debug('Cron fired:'.date('Y-m-d h:i:s')."/r/n");
church_admin_bulk_email();exit();
break;
case 'remove-queue':check_admin_referer('remove-queue');church_admin_remove_queue();break;
case'send-email':case'church_admin_send_email':church_admin_email_script();church_admin_autocomplete_script();church_admin_date_picker_script();break;
case'edit_resend':church_admin_email_script();church_admin_autocomplete_script();church_admin_date_picker_script();break;
case'resend_new':church_admin_email_script();church_admin_autocomplete_script();break;
case'resend_email':church_admin_email_script();church_admin_autocomplete_script();break;
case'church_admin_send_sms':church_admin_email_script();church_admin_autocomplete_script();break;
case'delete_small_group':church_admin_sg_map_script();church_admin_autocomplete_script();break;
case'church_admin_search';church_admin_editable_script();break;
//calendar
case'church_admin_add_category':
case'church_admin_edit_category':
case 'edit-category':
church_admin_farbtastic_script();
break;
case 'small_groups':case'show-groups':case'smallgroups-cleanup':
church_admin_sortable_script();
church_admin_form_script();
church_admin_autocomplete_script();
$key=get_option('church_admin_google_api_key');
if(!empty($key))church_admin_sg_map_script();
break;
case 'edit-service':
case 'edit_service':church_admin_form_script();church_admin_date_picker_script();break;
case 'edit-site':
case 'edit_site':church_admin_form_script();
church_admin_media_uploader_enqueue();
$key=get_option('church_admin_google_api_key');
if(!empty($key))
{
church_admin_map_script();
church_admin_sg_map_script();
}
break;
case 'edit_small_group':
//church_admin_form_script();
church_admin_autocomplete_script();
church_admin_media_uploader_enqueue();
$key=get_option('church_admin_google_api_key');
if(!empty($key))
{
church_admin_map_script();
church_admin_sg_map_script();
}
break;
case 'small_groups':
$key=get_option('church_admin_google_api_key');
if(!empty($key))
{
church_admin_map_script();
church_admin_sg_map_script();
}
break;
case'classes':church_admin_date_picker_script();church_admin_frontend_graph_script();break;
case'view_class':church_admin_date_picker_script();church_admin_autocomplete_script();church_admin_frontend_graph_script();break;
case'church_admin_add_calendar':
case 'add-calendar':
case 'view-rota':
case'church_admin_series_event_edit':
case'church_admin_single_event_edit':
case 'show-attendance':
case'edit_attendance':
case'church_admin_new_edit_calendar':
case'edit_kidswork':
case 'add-attendance':
case 'individual-attendance':
case 'individual-attendance-csv':
case'individual_attendance':
case 'csv-rota':
church_admin_date_picker_script();
break;
case'edit_class':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'edit_hope_team':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'permissions':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'edit_file':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'file_add':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'church_admin_member_type':church_admin_sortable_script();break;
//rota
case'rota';church_admin_editable_script();break;
case'edit_rota';church_admin_editable_script();church_admin_autocomplete_script();church_admin_date_picker_script();break;
case'list';church_admin_editable_script();break;
case'church_admin_rota_settings_list':church_admin_sortable_script();break;
case'church_admin_edit_rota_settings':church_admin_sortable_script();break;
//directory
case'new_household':
case 'add-household':
case'church_admin_new_household':
church_admin_form_script();
church_admin_map_script();
church_admin_media_uploader_enqueue();
church_admin_date_picker_script();
break;
case'edit_household':
case'view_household':
church_admin_map_script();church_admin_date_picker_script();church_admin_media_uploader_enqueue();
break;
case 'edit_people':
church_admin_form_script();
church_admin_date_picker_script();
church_admin_media_uploader_enqueue();
break;
case'app':case'edit_sermon_series':church_admin_media_uploader_enqueue();
break;
case'church_admin_permissions':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case'view_ministry':church_admin_autocomplete_script();break;
case'church_admin_update_order': church_admin_update_order($_GET['which']);exit();break;
case'get_people':church_admin_ajax_people(TRUE);break;
case'people':case'edit_funnel':case'delete_funnel':church_admin_sortable_script();break;
case 'upload-mp3':church_admin_date_picker_script();church_admin_autocomplete_script();break;
case 'send-sms':church_admin_autocomplete_script();break;
}
}
}
function church_admin_media_uploader_enqueue() {
if(is_admin()) wp_enqueue_media();//enqueue media uploader if on admin page
}
/**
*
* Enqueues jquery
*
* @author Andy Moyle
* @param null
* @return
* @version 0.1
*
*/
function church_admin_calendar_script()
{
wp_enqueue_script(
'church-admin-calendar-script',
plugins_url( '/', __FILE__ ) . 'includes/calendar.js',
array( 'jquery' ),
FALSE, TRUE
);
}
/**
*
* Registers google map api with low priority, so it happens last on enqueuing!
*
* @author Andy Moyle
* @param null
* @return
* @version 0.1
*
*/
function church_admin_google_map_api()
{
//fix issue caused by some "premium" themes, which call google maps w/o key on every admin page. D'uh!
wp_dequeue_script('avia-google-maps-api');
//now enqueue google map api with the key
$src = 'https://maps.googleapis.com/maps/api/js';
$key='?key='.get_option('church_admin_google_api_key');
wp_enqueue_script( 'Google Map Script',$src.$key, array() ,FALSE, TRUE);
}
/**
*
* Initialises js scripts for Google graph api
*
* @author Andy Moyle
* @param null
* @return
* @version 0.1
*
*/
function church_admin_frontend_graph_script()
{
wp_enqueue_script('google-graph-api','https://www.google.com/jsapi', array( 'jquery' ) ,FALSE, FALSE);
}
function church_admin_podcast_script()
{
$ajax_nonce = wp_create_nonce("church_admin_mp3_play");
wp_enqueue_script('jquery');
//wp_enqueue_script('ca_podcast_audio',plugins_url('church-admin/includes/audio.min.js',dirname(__FILE__) ) , array( 'jquery' ) ,FALSE, TRUE);
wp_localize_script( 'ca_podcast_audio', 'ChurchAdminAjax1', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script('ca_podcast_audio_use');//,plugins_url('church-admin/includes/audio.use.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
wp_localize_script( 'ca_podcast_audio_use', 'ChurchAdminAjax', array('security'=>$ajax_nonce, 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
function church_admin_sortable_script()
{
wp_enqueue_script( 'jquery-ui-sortable' ,'','',NULL);
wp_enqueue_script('touch-punch',plugins_url('church-admin/includes/jQuery.touchpunch.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}
function church_admin_form_script()
{
wp_enqueue_script('form-clone',plugins_url('church-admin/includes/jquery-formfields.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}
function church_admin_sg_map_script()
{
church_admin_google_map_api();
wp_enqueue_script('ca_google_map_script', plugins_url('church-admin/includes/admin_sg_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}
function church_admin_frontend_sg_map_script()
{
church_admin_google_map_api();
wp_enqueue_script('ca_google_map_script', plugins_url('church-admin/includes/smallgroup_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}
function church_admin_map_script()
{
church_admin_google_map_api();
wp_enqueue_script('js_map', plugins_url('church-admin/includes/maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}
function church_frontend_map_script()
{
church_admin_google_map_api();
wp_enqueue_script('js_map', plugins_url('church-admin/includes/google_maps.js',dirname(__FILE__) ), array( 'jquery' ) ,FALSE, TRUE);
}