1<?php
2
3// must be run within Dokuwiki
4if(!defined('DOKU_INC')) die();
5
6/**
7 * Contains all data needed to build an internal link.
8 *
9 * Latexport Plugin: Exports to latex
10 *
11 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
12 * @author Jean-Michel Gonet <jmgonet@yahoo.com>
13 */
14class InternalLink {
15
16	/** The internal link. */
17	private $link;
18
19	/** The link title. */
20	private $title;
21
22	/** The heading level in which the link was found. */
23	private $headingLevel;
24
25	/**
26	 * Class constructor.
27	 * @param link The link, as provided by internallink method.
28	 * @param headingLevel The heading level in which the link was found.
29	 * @param title The title, as provided by internallink method.
30	 */
31	function __construct($link, $headingLevel, $title = null) {
32		$this->link = $link;
33		if ($headingLevel < 2) {
34			$this->headingLevel = 2;
35		} else {
36			$this->headingLevel = $headingLevel;
37		}
38		$this->title = $title;
39	}
40
41	/** The internal link. */
42	function getLink() {
43		return $this->link;
44	}
45
46	/** The link title. */
47	function getTitle() {
48		return $this->title;
49	}
50
51	function getHeadingLevel() {
52		return $this->headingLevel;
53	}
54
55	function toString() {
56		return "$this->title ($this->headingLevel) --- $this->link";
57	}
58}
59