Introduce mediawiki.RegExp module
[mediawiki.git] / includes / title / PageLinkRenderer.php
blobca91f58331787a7c322e8a1281fcdebce0024bf6
1 <?php
2 /**
3 * Represents a link rendering service for %MediaWiki.
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.
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.
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
20 * @file
21 * @license GPL 2+
22 * @author Daniel Kinzler
25 /**
26 * Represents a link rendering service for %MediaWiki.
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.
31 * @see https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue
32 * @since 1.23
34 interface PageLinkRenderer {
35 /**
36 * Returns the URL for the given page.
38 * @todo expand this to cover the functionality of Linker::linkUrl
40 * @param TitleValue $page The link's target
41 * @param array $params Any additional URL parameters.
43 * @return string
45 public function getPageUrl( TitleValue $page, $params = array() );
47 /**
48 * Returns an HTML link to the given page, using the given surface text.
50 * @todo expand this to cover the functionality of Linker::link
52 * @param TitleValue $page The link's target
53 * @param string $text The link's surface text (will be derived from $page if not given).
55 * @return string
57 public function renderHtmlLink( TitleValue $page, $text = null );
59 /**
60 * Returns a wikitext link to the given page, using the given surface text.
62 * @param TitleValue $page The link's target
63 * @param string $text The link's surface text (will be derived from $page if not given).
65 * @return string
67 public function renderWikitextLink( TitleValue $page, $text = null );