]>
Commit | Line | Data |
---|---|---|
d8c46ff7 | 1 | <?php |
9184e8d4 GJ |
2 | /* |
3 | * Uguu | |
4 | * | |
5 | * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se> | |
6 | * | |
7 | * Note that this was previously distributed under the MIT license 2015-2022. | |
8 | * | |
9 | * If you are a company that wants to use Uguu I urge you to contact me to | |
10 | * solve any potential license issues rather then using pre-2022 code. | |
11 | * | |
12 | * A special thanks goes out to the open source community around the world | |
13 | * for supporting and being the backbone of projects like Uguu. | |
14 | * | |
15 | * This project can be found at <https://github.com/nokonoko/Uguu>. | |
16 | * | |
17 | * This program is free software: you can redistribute it and/or modify | |
18 | * it under the terms of the GNU General Public License as published by | |
19 | * the Free Software Foundation, either version 3 of the License, or | |
20 | * (at your option) any later version. | |
21 | * | |
22 | * This program is distributed in the hope that it will be useful, | |
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | * GNU General Public License for more details. | |
26 | * | |
27 | * You should have received a copy of the GNU General Public License | |
28 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
29 | */ | |
cec6349e | 30 | |
9184e8d4 GJ |
31 | namespace Pomf\Uguu\Classes; |
32 | ||
33 | class CuteGrills | |
34 | { | |
35 | public array $GRILLS; | |
cec6349e | 36 | |
9184e8d4 GJ |
37 | /** |
38 | * Loads the list of grills, then redirects to a random grill | |
39 | */ | |
40 | public function showGrills():void | |
41 | { | |
42 | $this->loadGrills(); | |
43 | if (!headers_sent()) { | |
44 | header( | |
45 | 'Location: /img/grills/' . | |
cec6349e | 46 | $this->GRILLS[array_rand($this->GRILLS)], |
9184e8d4 GJ |
47 | true, |
48 | 303, | |
49 | ); | |
cec6349e | 50 | } |
9184e8d4 | 51 | } |
cec6349e | 52 | |
9184e8d4 GJ |
53 | /** |
54 | * Loads the images from the `img/grills/` directory into the `GRILLS` array | |
55 | */ | |
56 | public function loadGrills():void | |
57 | { | |
58 | $this->GRILLS = array_slice(scandir('img/grills/'), 2); | |
e480c0e5 | 59 | } |
9184e8d4 | 60 | } |