my php website :D https://j0.lol
1<?php
2
3enum SpeechEmotion
4{
5 case Neutral;
6 case Worried;
7 case Shocked;
8 case Happy;
9}
10
11enum SpeechCharacter
12{
13 case Deer;
14 case You;
15
16 public function img(SpeechEmotion|null $emotion): string
17 {
18 $deeremotion = match ($emotion) {
19 SpeechEmotion::Neutral => "/static/speech/deer/neutral.png",
20 SpeechEmotion::Worried => "/static/speech/deer/sad.png",
21 SpeechEmotion::Happy => "/static/speech/deer/happy.png",
22 SpeechEmotion::Shocked => "/static/speech/deer/shock.png",
23 null => "",
24 };
25
26 return match ($this) {
27 SpeechCharacter::Deer => $deeremotion,
28 SpeechCharacter::You => "/static/speech/you.png",
29 };
30 }
31
32 public function alt(?SpeechEmotion $emotion): string
33 {
34 $deeremotion = match ($emotion) {
35 SpeechEmotion::Neutral => "drawing of a deer, talking to you.",
36 SpeechEmotion::Worried
37 => "drawing of a sad or worried deer, talking to you.",
38 SpeechEmotion::Happy => "drawing of a happy deer, talking to you.",
39 SpeechEmotion::Shocked
40 => "drawing of a shocked deer, talking to you.",
41 null => "",
42 };
43
44 return match ($this) {
45 SpeechCharacter::Deer => $deeremotion,
46 SpeechCharacter::You => "drawing of you, smiling.",
47 };
48 }
49
50 public function clazz()
51 {
52 return match ($this) {
53 SpeechCharacter::Deer => "deer",
54 SpeechCharacter::You => "you",
55 };
56 }
57}
58function speech_start(SpeechCharacter $char, ?SpeechEmotion $emotion)
59{
60 ?>
61<div class="dialog-box">
62 <img width="120" height="120" class="raw dialog profile" src="<?= $char->img(
63 $emotion
64 ) ?>" alt="<?= $char->alt($emotion) ?>">
65 <div class="dialog speech <?= $char->clazz() ?>">
66<?php
67}
68
69function speech_end()
70{
71 ?>
72 </div>
73</div>
74<?php
75}
76
77enum CssGgIcon: string
78{
79 case Time = '<!-- From CSS.GG: time. Thanks for free icons! --><svg
80 style="height: 1em; width: 1em; vertical-align: top;"
81 viewBox="0 0 24 24"
82 fill="none"
83 xmlns="http://www.w3.org/2000/svg"
84 >
85 <path d="M9 7H11V12H16V14H9V7Z" fill="currentColor" />
86 <path
87 fill-rule="evenodd"
88 clip-rule="evenodd"
89 d="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12ZM20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12Z"
90 fill="currentColor"
91 />
92 </svg>';
93}
94
95function icon_time()
96{
97 echo CssGgIcon::Time->value;
98}