Merge "Http::getProxy() method to get proxy configuration"
[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
25 /**
26 * Represents a link rendering service for %MediaWiki.
27 *
28 * This is designed to encapsulate the knowledge about how page titles map to
29 * URLs, and how links are encoded in a given output format.
30 *
31 * @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
32 * @since 1.23
33 */
34 interface PageLinkRenderer {
35 /**
36 * Returns the URL for the given page.
37 *
38 * @todo expand this to cover the functionality of Linker::linkUrl
39 *
40 * @param LinkTarget $page The link's target
41 * @param array $params Any additional URL parameters.
42 *
43 * @return string
44 */
45 public function getPageUrl( LinkTarget $page, $params = [] );
46
47 /**
48 * Returns an HTML link to the given page, using the given surface text.
49 *
50 * @todo expand this to cover the functionality of Linker::link
51 *
52 * @param LinkTarget $page The link's target
53 * @param string $text The link's surface text (will be derived from $page if not given).
54 *
55 * @return string
56 */
57 public function renderHtmlLink( LinkTarget $page, $text = null );
58
59 /**
60 * Returns a wikitext link to the given page, using the given surface text.
61 *
62 * @param LinkTarget $page The link's target
63 * @param string $text The link's surface text (will be derived from $page if not given).
64 *
65 * @return string
66 */
67 public function renderWikitextLink( LinkTarget $page, $text = null );
68 }