Merge "OutputPageTest: Don't assume Vector is the default skin"
[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 */
33 interface PageLinkRenderer {
34 /**
35 * Returns the URL for the given page.
36 *
37 * @todo expand this to cover the functionality of Linker::linkUrl
38 *
39 * @param TitleValue $page The link's target
40 * @param array $params Any additional URL parameters.
41 *
42 * @return string
43 */
44 public function getPageUrl( TitleValue $page, $params = array() );
45
46 /**
47 * Returns an HTML link to the given page, using the given surface text.
48 *
49 * @todo expand this to cover the functionality of Linker::link
50 *
51 * @param TitleValue $page The link's target
52 * @param string $text The link's surface text (will be derived from $page if not given).
53 *
54 * @return string
55 */
56 public function renderHtmlLink( TitleValue $page, $text = null );
57
58 /**
59 * Returns a wikitext link to the given page, using the given surface text.
60 *
61 * @param TitleValue $page The link's target
62 * @param string $text The link's surface text (will be derived from $page if not given).
63 *
64 * @return string
65 */
66 public function renderWikitextLink( TitleValue $page, $text = null );
67 }