Fix bug when a user removes their full-name.
[lw2-viewer.git] / compute_FontAwesome_subset.php
blob675981ad96d954ba869681d031fb51b0eba60efa
1 <?php
3 $directories = [
4 "www/",
5 "www/accordius/",
6 "www/ea/"
7 ];
8 $files = [
9 "head.js",
10 "script.js",
11 "style.css.php",
12 "style_mobile_additions.css.php",
13 "theme_tweaker.css.php",
14 "theme-brutalist.css.php",
15 "theme-classic.css.php",
16 "theme-default.css.php",
17 "theme-grey.css.php",
18 "theme-less.css.php",
19 "theme-rts.css.php",
20 "theme-ultramodern.css.php",
21 "theme-zero.css.php",
23 $additional_files = [
24 "www/about.html",
25 "lw2.lisp",
26 "src/data-viewers/comment.lisp",
27 "src/data-viewers/post.lisp",
28 "src/data-viewers/tag.lisp",
30 $characters = [ ];
32 function process_file($filename) {
33 if (!file_exists($filename))
34 return;
36 global $characters;
38 $contents = file_get_contents($filename);
40 preg_match_all('/&#x(.{4})/', $contents, $matches);
41 $characters = array_merge($characters, $matches[1]);
43 preg_match_all('/\\\([FE].{3})/i', $contents, $matches);
44 $characters = array_merge($characters, $matches[1]);
47 foreach ($directories as $directory) {
48 foreach ($files as $file) {
49 process_file($directory.$file);
52 foreach ($additional_files as $file) {
53 process_file($file);
56 foreach ($characters as $key => $value) {
57 $characters[$key] = strtoupper($value);
59 $characters = array_unique($characters);
60 sort($characters);
61 echo implode(",",$characters);
62 echo "\n";