]> git.agnieray.net Git - galette.git/blob - galette/includes/functions.inc.php
Improve coding standards
[galette.git] / galette / includes / functions.inc.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 if (!defined('GALETTE_ROOT')) {
23 die("Sorry. You can't access directly to this file");
24 }
25
26 /**
27 * Check URL validity
28 *
29 * @param string $url The URL to check
30 *
31 * @return boolean
32 */
33 function isValidWebUrl(string $url): bool
34 {
35 return (preg_match(
36 '#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i',
37 $url
38 ));
39 }