1<?php
2
3// must be run within Dokuwiki
4if(!defined('DOKU_INC')) die();
5
6/**
7 * Contains all data needed to represent an internal media.
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 InternalMedia {
15	/**
16	 * @param string $src     media ID
17	 * @param string $title   descriptive text
18	 * @param string $align   left|center|right
19	 * @param int    $width   width of media in pixel
20	 * @param int    $height  height of media in pixel
21	 * @param string $cache   cache|recache|nocache
22	 * @param string $linking linkonly|detail|nolink
23	 */
24
25	/** Media ID.*/
26	private $src;
27
28	/** Descriptive text.*/
29	private $title;
30
31	/** left | center | right */
32	private $align;
33
34	/** Width of media, in pixels. */
35	private $width;
36
37	/** Height of media, in pixels. */
38	private $height;
39
40	/** cache|recache|nocache */
41	private $cache;
42
43	/** linkonly|detail|nolink */
44	private $linking;
45
46	/**
47	 * Class constructor.
48	 * @param string $src     media ID
49	 * @param string $title   descriptive text
50	 * @param string $align   left|center|right
51	 * @param int    $width   width of media in pixel
52	 * @param int    $height  height of media in pixel
53	 * @param string $cache   cache|recache|nocache
54	 * @param string $linking linkonly|detail|nolink
55	 */
56	function __construct($src, $title, $align, $width, $height, $cache, $linking) {
57
58	 	$this->src = $src;
59	 	$this->title = $title;
60	 	$this->align = $align;
61	 	$this->width = $width;
62	 	$this->height = $height;
63	 	$this->cache = $cache;
64	 	$this->linking = $linking;
65
66	}
67
68	/** Media ID.*/
69	function getSrc() {
70		return $this->src;
71	}
72
73	/** Descriptive text.*/
74	function getTitle() {
75		return $this->title;
76	}
77
78	/** left | center | right */
79	function getAlign() {
80		return $this->align;
81	}
82
83	/** Width of media, in pixels. */
84	function getWidth() {
85		return $this->width;
86	}
87
88	/** Height of media, in pixels. */
89	function getHeight() {
90		return $this->height;
91	}
92
93	/** cache|recache|nocache */
94	function getCache() {
95		return $this->cache;
96	}
97
98	/** linkonly|detail|nolink */
99	function getLinking() {
100		return $this->linking;
101	}
102
103	/**
104	 * Can be casted into a string.
105	 */
106	function __toString() {
107		return "$this->src ($this->align $this->width x $this->height) '$this->title'";
108	}
109}
110