-
Notifications
You must be signed in to change notification settings - Fork 1
/
wsuwp-university-taxonomies.php
1599 lines (1462 loc) · 49.5 KB
/
wsuwp-university-taxonomies.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: WSUWP University Taxonomies
Version: 2.0.2
Plugin URI: https://web.wsu.edu/
Description: Provides Washington State University taxonomies to WordPress
Author: washingtonstateuniversity, jeremyfelt, philcable
Author URI: https://web.wsu.edu/
*/
class WSUWP_University_Taxonomies {
/**
* Maintain a record of the taxonomy schema. This should be changed whenever
* a schema change should be initiated on any site using the taxonomy.
*
* @var string Current version of the taxonomy schema.
*/
var $taxonomy_schema_version = '20210305-002';
/**
* @var string Taxonomy slug for the WSU University Category taxonomy.
*/
var $university_category = 'wsuwp_university_category';
/**
* @var string Taxonomy slug for the University Location taxonomy.
*/
var $university_location = 'wsuwp_university_location';
/**
* @var string Taxonomy slug for the University Organization taxonomy.
*/
var $university_organization = 'wsuwp_university_org';
/**
* Fire necessary hooks when instantiated.
*/
function __construct() {
//add_action( 'wpmu_new_blog', array( $this, 'pre_load_taxonomies' ), 10 );
//add_action( 'admin_init', array( $this, 'check_schema' ), 10 );
//add_action( 'wsu_taxonomy_update_schema', array( $this, 'update_schema' ) );
add_action( 'init', array( $this, 'modify_default_taxonomy_labels' ), 10 );
add_action( 'init', array( $this, 'register_taxonomies' ), 11 );
//add_action( 'load-edit-tags.php', array( $this, 'compare_schema' ), 10 );
//add_action( 'load-edit-tags.php', array( $this, 'display_terms' ), 11 );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 9 );
//add_filter( 'pre_insert_term', array( $this, 'prevent_term_creation' ), 10, 2 );
//add_filter( 'parent_file', array( $this, 'parent_file' ) );
//add_filter( 'submenu_file', array( $this, 'submenu_file' ), 10, 2 );
add_action( 'do_meta_boxes', array( $this, 'taxonomy_meta_boxes' ), 10, 2 );
add_action( 'wp_ajax_add_term', array( $this, 'ajax_add_term' ) );
add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
}
/**
* Pre-load University wide taxonomies whenever a new site is created on the network.
*
* @param int $site_id The ID of the new site.
*/
public function pre_load_taxonomies( $site_id ) {
switch_to_blog( $site_id );
$this->update_schema();
restore_current_blog();
}
/**
* Check the current version of the taxonomy schema on every admin page load. If it is
* out of date, fire a single wp-cron event to process the changes.
*/
public function check_schema() {
if ( get_option( 'wsu_taxonomy_schema', false ) !== $this->taxonomy_schema_version ) {
// Don't schedule a duplicate event if one has already been scheduled.
$next = wp_next_scheduled( 'wsu_taxonomy_update_schema', array() );
if ( $next ) {
return;
}
wp_schedule_single_event( time() + 60, 'wsu_taxonomy_update_schema' );
}
}
/**
* Update the taxonomy schema and version.
*/
public function update_schema() {
$this->load_terms( $this->university_category );
$this->load_terms( $this->university_location );
$this->load_terms( $this->university_organization );
update_option( 'wsu_taxonomy_schema', $this->taxonomy_schema_version );
}
/**
* Modify the default labels assigned by WordPress to built in taxonomies.
*/
public function modify_default_taxonomy_labels() {
global $wp_taxonomies;
$wp_taxonomies['category']->labels->name = 'Site Categories';
$wp_taxonomies['category']->labels->singular_name = 'Site Category';
$wp_taxonomies['category']->labels->menu_name = 'Site Categories';
$wp_taxonomies['post_tag']->labels->name = 'University Tags';
$wp_taxonomies['post_tag']->labels->singular_name = 'University Tag';
$wp_taxonomies['post_tag']->labels->menu_name = 'University Tags';
}
/**
* In normal term entry situations, we prevent new terms being created for the
* taxonomies that we statically maintain.
*
* @param string $term Term being added.
* @param string $taxonomy Taxonomy of the term being added.
*
* @return string|WP_Error Pass on the term untouched if not one of our taxonomies. WP_Error otherwise.
*/
public function prevent_term_creation( $term, $taxonomy ) {
if ( in_array( $taxonomy, array( $this->university_location, $this->university_organization, $this->university_category ), true ) ) {
$term = new WP_Error( 'invalid_term', 'These terms cannot be modified.' );
}
return $term;
}
/**
* Register the central University taxonomies provided.
*
* Taxonomies are registered to core post types by default. To take advantage of these
* custom taxonomies in your custom post types, use register_taxonomy_for_object_type().
*/
public function register_taxonomies() {
$labels = array(
'name' => 'University Categories',
'singular_name' => 'University Category',
'search_items' => 'Search Categories',
'all_items' => 'All Categories',
'edit_item' => 'Edit Category',
'update_item' => 'Update Category',
'add_new_item' => 'Add New Category',
'new_item_name' => 'New Category Name',
'menu_name' => 'University Categories',
);
$args = array(
'labels' => $labels,
'description' => 'The central category taxonomy for Washington State University',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'rewrite' => false,
'query_var' => $this->university_category,
);
register_taxonomy( $this->university_category, array( 'post', 'page', 'attachment' ), $args );
$labels = array(
'name' => 'University Location',
'search_items' => 'Search Locations',
'all_items' => 'All Locations',
'edit_item' => 'Edit Location',
'update_item' => 'Update Location',
'add_new_item' => 'Add New Location',
'new_item_name' => 'New Location Name',
'menu_name' => 'University Locations',
);
$args = array(
'labels' => $labels,
'description' => 'The central location taxonomy for Washington State University',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'rewrite' => false,
'query_var' => $this->university_location,
);
register_taxonomy( $this->university_location, array( 'post', 'page', 'attachment' ), $args );
$labels = array(
'name' => 'University Organization',
'search_items' => 'Search Organizations',
'all_items' => 'All Organizations',
'edit_item' => 'Edit Organization',
'update_item' => 'Update Organization',
'add_new_item' => 'Add New Organization',
'new_item_name' => 'New Organization Name',
'menu_name' => 'University Organizations',
);
$args = array(
'labels' => $labels,
'description' => 'The central organization taxonomy for Washington State University',
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_rest' => true,
'rewrite' => false,
'query_var' => $this->university_organization,
);
register_taxonomy( $this->university_organization, array( 'post', 'page' ), $args );
}
/**
* Clear all cache for a given taxonomy.
*
* @param string $taxonomy A taxonomy slug.
*/
private function clear_taxonomy_cache( $taxonomy ) {
wp_cache_delete( 'all_ids', $taxonomy );
wp_cache_delete( 'get', $taxonomy );
delete_option( $taxonomy . '_children' );
_get_term_hierarchy( $taxonomy );
}
/**
* Compare the existing schema version on taxonomy page loads and run update
* process if a mismatch is present.
*/
public function compare_schema() {
if ( ! in_array( get_current_screen()->taxonomy, array( $this->university_location, $this->university_organization, $this->university_category ), true ) ) {
return;
}
if ( get_option( 'wsu_taxonomy_schema', false ) !== $this->taxonomy_schema_version ) {
$this->update_schema();
}
}
/**
* Process term removals or name changes.
*
* @param strong $taxonomy Taxonomy for which to process term changes.
*/
public function process_term_updates( $taxonomy ) {
$existing_terms = get_terms( array(
'taxonomy' => $taxonomy,
'hide_empty' => false,
'fields' => 'id=>name',
) );
// Bail if there are no existing terms.
if ( empty( $existing_terms ) ) {
return;
}
// Flip the array of terms so we have IDs keyed by name.
$existing_terms = array_flip( $existing_terms );
// Get the array of terms that have been updated.
$updated_names = $this->get_university_term_updates( $taxonomy );
foreach ( $updated_names as $previous_name => $new_name ) {
// Confirm an existing match before processing any change.
if ( ! array_key_exists( $previous_name, $existing_terms ) ) {
continue;
}
$existing_term_id = $existing_terms[ $previous_name ];
if ( '' === $new_name ) {
wp_delete_term( $existing_term_id, $taxonomy );
} else {
wp_update_term( $existing_term_id, $taxonomy, array(
'name' => $new_name,
) );
}
}
}
/**
* Ensure all of the pre-configured terms for a given taxonomy are loaded with
* the proper parent -> child relationships.
*
* @param string $taxonomy Taxonomy being loaded.
*/
public function load_terms( $taxonomy ) {
$this->clear_taxonomy_cache( $taxonomy );
// Get a master list of terms used to populate this taxonomy.
if ( $this->university_category === $taxonomy ) {
$master_list = $this->get_university_categories();
} elseif ( $this->university_location === $taxonomy ) {
$master_list = $this->get_university_locations();
} elseif ( $this->university_organization === $taxonomy ) {
$master_list = $this->get_university_organizations();
} else {
return;
}
// Process term removals or name changes.
$this->process_term_updates( $taxonomy );
// Get our current list of top level parents.
$level1_exist = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => '0',
) );
$level1_assign = array();
foreach ( $level1_exist as $level1 ) {
$level1_assign[ $level1->name ] = array(
'term_id' => $level1->term_id,
);
}
remove_filter( 'pre_insert_term', array( $this, 'prevent_term_creation' ), 10 );
$level1_names = array_keys( $master_list );
/**
* Look for mismatches between the master list and the existing parent terms list.
*
* In this loop:
*
* * $level1_names array of top level parent names.
* * $level1_name string containing a top level category.
* * $level1_children array containing all of the current parent's child arrays.
* * $level1_assign array of top level parents that exist in the database with term ids.
*/
foreach ( $level1_names as $level1_name ) {
if ( ! array_key_exists( $level1_name, $level1_assign ) ) {
$new_term = wp_insert_term( $level1_name, $taxonomy, array(
'parent' => '0',
) );
if ( ! is_wp_error( $new_term ) ) {
$level1_assign[ $level1_name ] = array(
'term_id' => $new_term['term_id'],
);
}
}
}
/**
* Process the children of each top level parent.
*
* In this loop:
*
* * $level1_names array of top level parent names.
* * $level1_name string containing a top level category.
* * $level1_children array containing all of the current parent's child arrays.
* * $level2_assign array of this parent's second level categories that exist in the database with term ids.
*/
foreach ( $level1_names as $level1_name ) {
$level2_exists = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => $level1_assign[ $level1_name ]['term_id'],
) );
$level2_assign = array();
foreach ( $level2_exists as $level2 ) {
$level2_assign[ $level2->name ] = array(
'term_id' => $level2->term_id,
);
}
$level2_names = array_keys( $master_list[ $level1_name ] );
/**
* Look for mismatches between the expected and real children of the current parent.
*
* In this loop:
*
* * $level2_names array of the current parent's child level names.
* * $level2_name string containing a second level category.
* * $level2_children array containing the current second level category's children. Unused in this context.
* * $level2_assign array of this parent's second level categories that exist in the database with term ids.
*/
foreach ( $level2_names as $level2_name ) {
if ( ! array_key_exists( $level2_name, $level2_assign ) ) {
$new_term = wp_insert_term( $level2_name, $taxonomy, array(
'parent' => $level1_assign[ $level1_name ]['term_id'],
) );
if ( ! is_wp_error( $new_term ) ) {
$level2_assign[ $level2_name ] = array(
'term_id' => $new_term['term_id'],
);
}
}
}
/**
* Look for mismatches between second and third level category relationships.
*/
foreach ( $level2_names as $level2_name ) {
$level3_exists = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => $level2_assign[ $level2_name ]['term_id'],
) );
$level3_exists = wp_list_pluck( $level3_exists, 'name' );
$level3_names = $master_list[ $level1_name ][ $level2_name ];
foreach ( $level3_names as $level3_name ) {
if ( ! in_array( $level3_name, $level3_exists, true ) ) {
wp_insert_term( $level3_name, $taxonomy, array(
'parent' => $level2_assign[ $level2_name ]['term_id'],
) );
}
}
}
}
add_filter( 'pre_insert_term', array( $this, 'prevent_term_creation' ), 10 );
$this->clear_taxonomy_cache( $taxonomy );
}
/**
* Enqueue styles to be used for the display of taxonomy terms.
*
* @param string $hook Hook indicating the current admin page.
*/
public function admin_enqueue_scripts( $hook ) {
if ( false === apply_filters( 'wsu_taxonomy_select2_interface', true ) ) {
return;
}
// Register scripts and styles so they can be easily enqueued by other plugins if needed.
wp_register_style( 'select2', plugins_url( 'assets/select2.min.css', __FILE__ ) );
wp_register_script( 'select2', plugins_url( 'assets/select2.min.js', __FILE__ ), array( 'jquery' ) );
wp_register_style( 'wsuwp-select2', plugins_url( 'css/wsuwp-select2.css', __FILE__ ), array( 'select2' ) );
wp_register_script( 'wsuwp-select2', plugins_url( 'js/wsuwp-select2.js', __FILE__ ), array( 'select2' ), null, true );
if ( 'edit-tags.php' !== $hook && 'post.php' !== $hook && 'post-new.php' !== $hook ) {
return;
}
if ( in_array( get_current_screen()->taxonomy, array( $this->university_organization, $this->university_category, $this->university_location ), true ) ) {
wp_enqueue_style( 'wsuwp-taxonomy-admin', plugins_url( 'css/edit-tags-style.css', __FILE__ ) );
}
if ( 'post.php' === $hook || 'post-new.php' === $hook ) {
if ( in_array( get_current_screen()->post_type, array_keys( $this->get_default_metabox_post_types() ), true ) ) {
wp_enqueue_style( 'select2' );
wp_enqueue_style( 'wsuwp-select2' );
wp_enqueue_script( 'select2' );
wp_enqueue_script( 'wsuwp-select2' );
wp_localize_script( 'wsuwp-select2', 'wsuwp_taxonomies', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wsuwp-add-term' ),
) );
} else {
wp_enqueue_style( 'wsuwp-edit-post', plugins_url( 'css/edit-post.css', __FILE__ ) );
}
}
}
/**
* Display a dashboard for a custom taxonomy rather than the default term
* management screen provided by WordPress core.
*/
public function display_terms() {
if ( ! in_array( get_current_screen()->taxonomy, array( $this->university_organization, $this->university_category, $this->university_location ), true ) ) {
return;
}
$taxonomy = get_current_screen()->taxonomy;
// Setup the page.
$tax = get_taxonomy( $taxonomy );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
echo '<div class="wrap nosubsub"><h2>' . esc_html( $tax->labels->name ) . '</h2>';
$parent_terms = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => '0',
) );
foreach ( $parent_terms as $term ) {
echo '<h3>' . esc_html( $term->name ) . '</h3>';
$child_terms = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => $term->term_id,
) );
foreach ( $child_terms as $child ) {
echo '<h4>' . esc_html( $child->name ) . '</h4>';
$grandchild_terms = get_terms( $taxonomy, array(
'hide_empty' => false,
'parent' => $child->term_id,
) );
echo '<ul>';
if ( empty( $grandchild_terms ) ) {
echo '<li><em>No level 3 categories for this term.</em></li>';
}
foreach ( $grandchild_terms as $grandchild ) {
echo '<li>' . esc_html( $grandchild->name ) . '</li>';
}
echo '</ul>';
}
}
// Close the page.
echo '</div>';
include( ABSPATH . 'wp-admin/admin-footer.php' );
die();
}
/**
* Sets the active parent menu item for a taxonomy dashboard page.
* Using the `load-edit-tags.php` hook prevents this from being set by default.
*
* @param string $parent_file The parent file.
*
* @return string
*/
public function parent_file( $parent_file ) {
if ( ! isset( $_GET['taxonomy'] ) || ! in_array( $_GET['taxonomy'], array( $this->university_category, $this->university_location, $this->university_organization ), true ) ) { // WPCS: CSRF ok.
return $parent_file;
}
if ( ! isset( $_GET['post_type'] ) ) { // WPCS: CSRF ok.
$parent_file = 'edit.php';
return $parent_file;
}
$post_type = sanitize_text_field( $_GET['post_type'] );
$parent_file .= "edit.php?post_type=$post_type";
return $parent_file;
}
/**
* Sets the active menu item for a taxonomy dashboard page.
* Using the `load-edit-tags.php` hook prevents this from being set by default.
*
* @param string $submenu_file The submenu file.
* @param string $parent_file The parent file.
*
* @return string
*/
public function submenu_file( $submenu_file, $parent_file ) {
if ( ! isset( $_GET['taxonomy'] ) || ! in_array( $_GET['taxonomy'], array( $this->university_category, $this->university_location, $this->university_organization ), true ) ) { // WPCS: CSRF ok.
return $submenu_file;
}
$taxonomy = sanitize_text_field( $_GET['taxonomy'] );
$submenu_file = "edit-tags.php?taxonomy=$taxonomy";
if ( isset( $_GET['post_type'] ) ) { // WPCS: CSRF ok.
$args = array(
'public' => true,
);
$post_types = get_post_types( $args, 'names' );
if ( in_array( $_GET['post_type'], $post_types, true ) ) { // WPCS: CSRF ok.
$post_type = sanitize_text_field( $_GET['post_type'] );
$submenu_file .= "&post_type=$post_type";
}
}
return $submenu_file;
}
/**
* Maintain an array of current university organizations.
*
* @return array University Organizations
*/
public function get_university_organizations() {
$organizations = array(
'Office' => array(
'Academic Outreach and Innovation' => array(),
'Alumni Association' => array(),
'Budget Office' => array(),
'Cougar Health Services' => array(),
'Office of Emergency Management' => array(),
'Enrollment Management' => array(
'Office of Admissions and Recruitment',
'New Student Programs',
'Student Financial Services',
'Office of the Registrar',
'Enrollment Information Technology',
),
'Extension' => array(
'Agriculture and Natural Resources',
'Community and Economic Development',
'Youth and Family',
),
'External Affairs and Government Relations' => array(
'Small Business Development Center',
),
'Facilities Services' => array(),
'Faculty Senate' => array(),
'Finance and Administration' => array(),
'Foundation' => array(),
'Graduate School' => array(
'Molecular Plant Sciences',
),
'Human Resource Services' => array(),
'Information Technology Services' => array(),
'Intercollegiate Athletics' => array(),
'Office of Internal Audit' => array(),
'Office of International Programs' => array(
'International Student and Scholar Services',
'GPRS',
),
'Libraries' => array(),
'Office of the President' => array(),
'Office of the Provost' => array(
'Jordan Schnitzer Museum of Art WSU',
'Association for Faculty Women',
),
'Public Safety' => array(),
'Office of Research' => array(
'Office of Commercialization',
'Office of Research Advancement and Partnerships',
),
'Sleep and Performance Research Center' => array(),
'Division of Student Affairs' => array(),
'Transportation Services' => array(),
'Office of Undergraduate Education' => array(),
'University Marketing and Communications' => array(
'Administration - University Marketing and Communications',
'Finance and Administrative Support Team - University Marketing and Communications',
'Finance and Administration',
'Financial Services - University Marketing and Communications',
'IT Support - University Marketing and Communications',
'Strategic Communications - University Marketing and Communications',
'EM Marketing - University Marketing and Communications',
'University Events - University Marketing and Communications',
'News and Media Relations - University Marketing and Communications',
'Presidential Communications - University Marketing and Communications',
'Visual Design - University Marketing and Communications',
'Photo Services - University Marketing and Communications',
'Video Services - University Marketing and Communications',
'WA State Magazine - University Marketing and Communications',
'Web Communications - University Marketing and Communications',
'University Publishing - University Marketing and Communications',
'Coug Prints Plus - University Marketing and Communications',
'Coug Copies - University Marketing and Communications',
'Graphic Design - University Marketing and Communications',
'Mailing Services - University Marketing and Communications',
'Printing Services - University Marketing and Communications',
'Production Coordination - University Marketing and Communications',
'WSU Press - University Marketing and Communications',
),
'Office of Veterans Affairs' => array(),
),
'College' => array(
'Carson College of Business' => array(
'Accounting',
'Finance and Management Science',
'School of Hospitality Business Management',
'Management, Information Systems and Entrepreneurship',
'Marketing and International Business',
),
'College of Agricultural, Human, and Natural Resource Sciences' => array(
'Animal Science',
'Apparel, Merchandising, Design, and Textiles',
'Biological Systems Engineering',
'Crop and Soil Sciences',
'School of Economic Sciences',
'Entomology',
'School of the Environment', // Shared with College of Arts and Sciences.
'School of Food Science',
'Horticulture',
'Human Development',
'Institute of Biological Chemistry',
'International Research and Agricultural Development',
'Plant Pathology',
),
'College of Arts and Sciences' => array(
'Anthropology',
'Asian Program',
'School of Biological Sciences',
'Chemistry',
'Creative Media and Digital Culture Program',
'Criminal Justice and Criminology',
'Digital Technology and Culture Program',
'English',
'School of the Environment', // Shared with CAHNRS.
'Fine Arts',
'History',
'School of Languages, Cultures, and Race',
'Mathematics and Statistics',
'School of Music',
'Physics and Astronomy',
'School of Politics, Philosophy, and Public Affairs',
'Psychology',
'Sociology',
'Women\'s Studies Program',
),
'College of Education' => array(
'Teaching and Learning',
'Kinesiology and Educational Psychology',
),
'Elson S. Floyd College of Medicine' => array(
'Biomedical Sciences',
'Medical Education and Clinical Sciences',
'Nutrition and Exercise Physiology',
'Speech and Hearing Sciences',
'Admissions, Recruiting and inclusion',
'Behavioral Health Innovations',
'Health Policy and Administration',
'Sleep and Performance Research Center',
'Virtual Care Clinic',
'WSU Health Sciences Spokane',
),
'College of Nursing' => array(),
'College of Pharmacy and Pharmaceutical Sciences' => array(
'Experimental and Systems Pharmacology',
'Pharmaceutical Sciences',
'Pharmacotherapy',
),
'College of Veterinary Medicine' => array(
'School for Global Animal Health',
'Integrative Physiology and Neuroscience',
'School of Molecular Biosciences',
'Veterinary Clinical Sciences',
'Veterinary Microbiology and Pathology',
),
'Edward R. Murrow College of Communication' => array(
'Communication and Society',
'Journalism and Media Production',
'Strategic Communication',
),
'Honors College' => array(),
'Voiland College of Engineering and Architecture' => array(
'School of Chemical Engineering and Bioengineering',
'Civil and Environmental Engineering',
'School of Design and Construction',
'School of Electrical Engineering and Computer Science',
'Engineering and Computer Science (Tri-Cities)',
'School of Engineering and Computer Science (Vancouver)',
'School of Mechanical and Materials Engineering',
),
'Veterinary Hospital' => array(
'Veterinary Clinical Sciences - Veterinary hospital',
'Integrative Physiology and Neuroscience - Veterinary hospital',
'School of Global Animal Health - Veterinary hospital',
'School of Molecular Biosciences - Veterinary hospital',
'Veterinary Microbiology and Pathology - Veterinary hospital',
),
),
);
return $organizations;
}
/**
* Maintain an array of current university locations.
*
* @return array Current university locations.
*/
public function get_university_locations() {
$locations = array(
'WSU Pullman' => array(),
'WSU West/Downtown Seattle' => array(),
'WSU Health Sciences Spokane' => array(),
'WSU Tri-Cities' => array(),
'WSU Vancouver' => array(),
'WSU Global Campus' => array(),
'WSU Extension' => array(
'Adams County' => array(),
'Asotin County' => array(),
'Benton County' => array(),
'Chelan County' => array(),
'Clallam County' => array(),
'Clark County' => array(),
'Columbia County' => array(),
'Colville Reservation' => array(),
'Cowlitz County' => array(),
'Douglas County' => array(),
'Ferry County' => array(),
'Franklin County' => array(),
'Garfield County' => array(),
'Grant County' => array(),
'Grays Harbor County' => array(),
'Island County' => array(),
'Jefferson County' => array(),
'King County' => array(),
'Kitsap County' => array(),
'Kittitas County' => array(),
'Klickitat County' => array(),
'Lewis County' => array(),
'Lincoln County' => array(),
'Mason County' => array(),
'Okanogan County' => array(),
'Pacific County' => array(),
'Pend Oreille County' => array(),
'Pierce County' => array(),
'San Juan County' => array(),
'Skagit County' => array(),
'Skamania County' => array(),
'Snohomish County' => array(),
'Spokane County' => array(),
'Stevens County' => array(),
'Thurston County' => array(),
'Wahkiakum County' => array(),
'Walla Walla County' => array(),
'Whatcom County' => array(),
'Whitman County' => array(),
'Yakima County' => array(),
),
'WSU Seattle' => array(),
'WSU Everett' => array(),
'WSU Research Centers' => array(
'Lind' => array(),
'Long Beach' => array(),
'Mount Vernon' => array(),
'Othello' => array(),
'Prosser' => array(),
'Puyallup' => array(),
'Wenatchee' => array(),
),
'WSU Bremerton' => array(
'Olympic College' => array(),
),
);
return $locations;
}
/**
* Maintain an array of current university categories.
*
* @return array Current university categories.
*/
public function get_university_categories() {
$categories = array(
'Academic Subjects' => array(
'Agriculture' => array(
'Agriculture Business',
'Agriculture Economics',
'Agriculture Engineering',
'Animal Sciences',
'Berries',
'Crop Sciences',
'Equipment / Mechanization',
'Fodder / Silage',
'Food Science',
'Forestry',
'Fruit Trees',
'Fungus',
'Horticulture',
'Irrigation / Water Management',
'Legumes, Pulse',
'Mint',
'Oil Seed',
'Organic Farming',
'Pests and Weeds',
'Plant Pathology',
'Small Grains',
'Soil Sciences',
'Tubers',
'Vegetables',
'Viticulture / Enology / Wine',
'Weather, Climate',
),
'Arts' => array(
'Digital Media',
'Fine Arts',
'Performing Arts',
),
'Biology' => array(
'Botany',
'Entomology',
'Genomics and Bioinformatics',
'Molecular Biology',
'Neuroscience',
'Zoology',
),
'Business' => array(
'Accounting',
'Construction Management',
'Economics',
'Finance',
'Hospitality',
'Information Systems',
'Investment',
'Management',
'Sports Management',
),
'Chemistry' => array(),
'Communication, Academic' => array(
'Advertising',
'Broadcasting',
'Electronic',
'Journalism',
'Public Relations',
),
'Computer Sciences' => array(
'Computer Engineering',
'Computer Science',
'Power Systems',
'Smart Environments',
),
'Design, Construction' => array(
'Architecture',
'Interior Design',
'Landscape Architecture',
),
'Earth Sciences' => array(
'Environmental Studies',
'Geology',
'Natural Resources',
),
'Education, Academic' => array(
'Administration',
'Special Education',
'Teaching',
),
'Engineering' => array(
'Atmospheric Research',
'Catalysis',
'Energy Conversion',
'Infrastructure',
'Structures',
),
'Family and Consumer Science' => array(
'Apparel and Textile Design',
'Food and Sensory Science',
'Home Economics',
'Human Development',
'Nutrition',
),
'Health Sciences' => array(
'Addictions',
'Cancer',
'Childhood Trauma',
'Chronic Illness',
'Exercise Physiology',
'Health Administration',
'Health Policy',
'Medical Health',
'Metabolic Disorders',
'Nursing',
'Nutrition, Health',
'Pharmacy',
'Physical Performance / Recreation',
'Sleep',
'Speech and Hearing',
),
'Humanities' => array(
'English',
'History',
'Languages',
'Literature',
'Philosophy',
),
'Mathematics' => array(),
'Music' => array(
'Instrumental',
'Vocal',
),
'Physics' => array(),
'Social Sciences' => array(
'Anthropology',
'Archaeology',
'Criminology / Criminal Justice',
'Cultural and Ethnic Studies',
'Gender and Sexuality Studies',
'Geography',
'Military',
'Political Science',
'Psychology',
'Religion',
'Sociology',
),
'Space Sciences' => array(
'Astronomy',
),
'Veterinary Medicine' => array(
'Companion Animals',
'Emerging Diseases',
'Equine',
'Exotic / Pocket Pets',
'Food Animal',
'Foreign Animal Diseases',
'Pathology',
'Pharmacology, Animal',
'Zoonoses',
),
),
'Alumni' => array(
'Alumni Association' => array(
'Alumni Centre',
'Awards',
'Alumni Benefits',
'Alumni Events',
'Membership',
),
'Notable Alumni' => array(
'Athletes',
'Business Leaders',
'Government Leaders',
'Other Notable Alumni',
'Philanthropists',
'Scientists',
),
),
'Community and Economic Development' => array(
'4-H' => array(),
'Economic Development' => array(
'Entrepreneurship',
),