MCPcopy Create free account
hub / github.com/TUM-Dev/CalendarProxy / cleanEvent

Function cleanEvent

index.php:38–121  ·  view source on GitHub ↗
(&$e)

Source from the content-addressed store, hash-verified

36 */
37
38function cleanEvent(&$e) {
39 //Add missing fields if possible
40 if (!isset($e['GEO'])) {
41 $e['GEO'] = '';
42 }
43 if (!isset($e['LOCATION'])) {
44 $e['LOCATION'] = '';
45 }
46 if (!isset($e['LOCATIONTITLE'])) {
47 $e['LOCATIONTITLE'] = '';
48 }
49 if (!isset($e['URL'])) {
50 $e['URL'] = '';
51 }
52 if (!isset($e['DESCRIPTION'])) {
53 $e['DESCRIPTION'] = '';
54 }
55
56 //Strip added slashes by the parser
57 $e['SUMMARY'] = stripcslashes($e['SUMMARY']);
58 $e['DESCRIPTION'] = stripcslashes($e['DESCRIPTION']);
59 $e['LOCATION'] = stripcslashes($e['LOCATION']);
60
61 //Remember the old title in the description
62 $e['DESCRIPTION'] = $e['SUMMARY'] . "\n" . $e['DESCRIPTION'];
63
64 //Remove the TAG and anything after e.g.: (IN0001)
65 $e['SUMMARY'] = preg_replace("/(\\(IN[0-9]+\\)|\\[MA[0-9]+\\]).+/", '', $e['SUMMARY']);
66
67 //Some common replacements: yes its a long list
68 $searchReplace = array();
69 $searchReplace['Tutorübungen'] = 'TÜ';
70 $searchReplace['Grundlagen'] = 'G';
71 $searchReplace['Betriebssysteme und Systemsoftware'] = 'BS';
72 $searchReplace['Einführung in die Informatik '] = 'INFO';
73 $searchReplace['Praktikum: Grundlagen der Programmierung'] = 'PGP';
74 $searchReplace['Einführung in die Rechnerarchitektur (Einführung in die Technische Informatik)'] = 'ERA';
75 $searchReplace['Einführung in die Softwaretechnik'] = 'EIST';
76 $searchReplace['Algorithmen und Datenstrukturen'] = 'AD';
77 $searchReplace['Rechnernetze und Verteilte Systeme'] = 'RNVS';
78 $searchReplace['Einführung in die Theoretische Informatik'] = 'THEO';
79 $searchReplace['Diskrete Strukturen'] = 'DS';
80 $searchReplace['Diskrete Wahrscheinlichkeitstheorie'] = 'DWT';
81 $searchReplace['Numerisches Programmieren'] = 'NumProg';
82 $searchReplace['Lineare Algebra für Informatik'] = 'LinAlg';
83 $searchReplace['Analysis für Informatik'] = 'Analysis';
84
85 //Do the replacement
86 $e['SUMMARY'] = strtr($e['SUMMARY'], $searchReplace);
87
88 //Remove some stuff which is not really needed
89 $e['SUMMARY'] = str_replace(array('Standardgruppe', 'PR, ', 'VO, ', 'FA, '), '', $e['SUMMARY']);
90
91 //Try to make sense out of the location
92 if (!empty($e['LOCATION'])) {
93 if (strpos($e['LOCATION'], '(56') !== false) {
94 // Informatik
95 switchLocation($e, 'Boltzmannstraße 3, 85748 Garching bei München');

Callers 1

index.phpFile · 0.85

Calls 1

switchLocationFunction · 0.85

Tested by

no test coverage detected