Convert Special:DeletedContributions to use OOUI.
[lhc/web/wiklou.git] / includes / title / PageLinkRenderer.php
1 <?php
2 /**
3 * Represents a link rendering service for %MediaWiki.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @license GPL 2+
22 * @author Daniel Kinzler
23 */
24 use MediaWiki\Linker\LinkTarget;
25
26 /**
27 * Represents a link rendering service for %MediaWiki.
28 *
29 * This is designed to encapsulate the knowledge about how page titles map to
30 * URLs, and how links are encoded in a given output format.
31 *
32 * @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
33 * @since 1.23
34 */
35 interface PageLinkRenderer {
36 /**
37 * Returns the URL for the given page.
38 *
39 * @todo expand this to cover the functionality of Linker::linkUrl
40 *
41 * @param LinkTarget $page The link's target
42 * @param array $params Any additional URL parameters.
43 *
44 * @return string
45 */
46 public function getPageUrl( LinkTarget $page, $params = [] );
47
48 /**
49 * Returns an HTML link to the given page, using the given surface text.
50 *
51 * @todo expand this to cover the functionality of Linker::link
52 *
53 * @param LinkTarget $page The link's target
54 * @param string $text The link's surface text (will be derived from $page if not given).
55 *
56 * @return string
57 */
58 public function renderHtmlLink( LinkTarget $page, $text = null );
59
60 /**
61 * Returns a wikitext link to the given page, using the given surface text.
62 *
63 * @param LinkTarget $page The link's target
64 * @param string $text The link's surface text (will be derived from $page if not given).
65 *
66 * @return string
67 */
68 public function renderWikitextLink( LinkTarget $page, $text = null );
69 }