xref: /webtrees/app/Helpers/functions.php (revision 78f07ab5bc1e5a259d876b2292039bdd6fab5f50)
11f3fb95cSGreg Roach<?php
21f3fb95cSGreg Roach/**
31f3fb95cSGreg Roach * webtrees: online genealogy
41f3fb95cSGreg Roach * Copyright (C) 2017 webtrees development team
51f3fb95cSGreg Roach * This program is free software: you can redistribute it and/or modify
61f3fb95cSGreg Roach * it under the terms of the GNU General Public License as published by
71f3fb95cSGreg Roach * the Free Software Foundation, either version 3 of the License, or
81f3fb95cSGreg Roach * (at your option) any later version.
91f3fb95cSGreg Roach * This program is distributed in the hope that it will be useful,
101f3fb95cSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
111f3fb95cSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
121f3fb95cSGreg Roach * GNU General Public License for more details.
131f3fb95cSGreg Roach * You should have received a copy of the GNU General Public License
141f3fb95cSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
151f3fb95cSGreg Roach */
16*78f07ab5SGreg Roachdeclare(strict_types=1);
171f3fb95cSGreg Roach
181f3fb95cSGreg Roachuse Fisharebest\Webtrees\Html;
191f3fb95cSGreg Roach
201f3fb95cSGreg Roach/**
21*78f07ab5SGreg Roach * Escape a string for inclusion within HTML.
22*78f07ab5SGreg Roach *
23*78f07ab5SGreg Roach * @param $text
24*78f07ab5SGreg Roach *
25*78f07ab5SGreg Roach * @return string
26*78f07ab5SGreg Roach */
27*78f07ab5SGreg Roachfunction e(string $text): string {
28*78f07ab5SGreg Roach	return Html::escape($text);
29*78f07ab5SGreg Roach}
30*78f07ab5SGreg Roach
31*78f07ab5SGreg Roach/**
321f3fb95cSGreg Roach * Generate a URL for a named route.
331f3fb95cSGreg Roach *
341f3fb95cSGreg Roach * @param string $route
351f3fb95cSGreg Roach * @param array  $parameters
361f3fb95cSGreg Roach *
371f3fb95cSGreg Roach * @return string
381f3fb95cSGreg Roach */
391f3fb95cSGreg Roachfunction route(string $route, array $parameters = []): string {
401f3fb95cSGreg Roach	$parameters = ['route' => $route] + $parameters;
411f3fb95cSGreg Roach
421f3fb95cSGreg Roach	return Html::url('index.php', $parameters);
431f3fb95cSGreg Roach}
44