Rev 25 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 25 | Rev 79 | ||
---|---|---|---|
Line 23... | Line 23... | ||
23 | 23 | ||
24 | protected $_defaultPrefix; |
24 | protected $_defaultPrefix; |
25 | protected $_defaultSuffix; |
25 | protected $_defaultSuffix; |
26 | 26 | ||
27 | protected $_makeTooltip; |
27 | protected $_makeTooltip; |
- | 28 | ||
- | 29 | /* (non-PHPdoc) @see Footnote::_html4Compat */
|
|
- | 30 | protected $_html4Compat; |
|
28 | 31 | ||
29 | public function __construct($defaultPrefix = '', $defaultSuffix = '', $makeTooltip = false) |
32 | public function __construct($defaultPrefix = '', $defaultSuffix = '', $makeTooltip = false, $html4Compatible = false) |
30 | {
|
33 | {
|
31 | $this->clear(); |
34 | $this->clear(); |
32 | $this->_defaultPrefix = $defaultPrefix; |
35 | $this->_defaultPrefix = $defaultPrefix; |
33 | $this->_defaultSuffix = $defaultSuffix; |
36 | $this->_defaultSuffix = $defaultSuffix; |
34 | $this->_makeTooltip = $makeTooltip; |
37 | $this->_makeTooltip = $makeTooltip; |
- | 38 | $this->_html4Compat = $html4Compatible; |
|
35 | }
|
39 | }
|
36 | 40 | ||
37 | public function __get($name) |
41 | public function __get($name) |
38 | {
|
42 | {
|
39 | if (property_exists($this, "_$name")) |
43 | if (property_exists($this, "_$name")) |
Line 61... | Line 65... | ||
61 | * Name of the footnote
|
65 | * Name of the footnote
|
62 | * @param string $sign
|
66 | * @param string $sign
|
63 | * Sign of the footnote. If empty, the next available number is used.
|
67 | * Sign of the footnote. If empty, the next available number is used.
|
64 | * @param string $text
|
68 | * @param string $text
|
65 | * Text for the footnote
|
69 | * Text for the footnote
|
- | 70 | * @param string $tooltip
|
|
- | 71 | * Tooltip for the footnote
|
|
66 | * @return string
|
72 | * @return string
|
67 | * The code for printing the footnote reference.
|
73 | * The code for printing the footnote reference.
|
68 | */
|
74 | */
|
69 | public function add($name, $sign = '', $text = '', $tooltip = null) |
75 | public function add($name, $sign = '', $text = '', $tooltip = null) |
70 | {
|
76 | {
|
Line 81... | Line 87... | ||
81 | $this->_lastNumberSign = $sign; |
87 | $this->_lastNumberSign = $sign; |
82 | }
|
88 | }
|
83 | 89 | ||
84 | $footnotes[$name] = new Footnote($name, $sign, $text, |
90 | $footnotes[$name] = new Footnote($name, $sign, $text, |
85 | $this->_defaultSuffix, $this->_defaultPrefix, |
91 | $this->_defaultSuffix, $this->_defaultPrefix, |
86 | $this->_makeTooltip ? ($tooltip !== null ? $tooltip : $text) : ''); |
92 | $this->_makeTooltip ? ($tooltip !== null ? $tooltip : $text) : '', |
- | 93 | $this->_html4Compat); |
|
87 | }
|
94 | }
|
88 | 95 | ||
89 | return $footnotes[$name]->getRef(); |
96 | return $footnotes[$name]->getRef(); |
90 | }
|
97 | }
|
91 | 98 | ||
Line 173... | Line 180... | ||
173 | protected $_text = ''; |
180 | protected $_text = ''; |
174 | 181 | ||
175 | protected $_prefix = ''; |
182 | protected $_prefix = ''; |
176 | protected $_suffix = ''; |
183 | protected $_suffix = ''; |
177 | protected $_tooltip = ''; |
184 | protected $_tooltip = ''; |
- | 185 | ||
- | 186 | /**
|
|
- | 187 | * HTML 4 compatibility: If <code>true</code>, generates
|
|
- | 188 | * <code>name</code> attributes. Default: <code>false</code>.
|
|
- | 189 | *
|
|
- | 190 | * @var boolean
|
|
- | 191 | */
|
|
- | 192 | protected $_html4Compat = false; |
|
178 | 193 | ||
179 | /**
|
194 | /**
|
180 | * The number of times this footnote has been referred
|
195 | * The number of times this footnote has been referred
|
181 | *
|
196 | *
|
182 | * @var int
|
197 | * @var int
|
Line 196... | Line 211... | ||
196 | * The suffix for this footnote
|
211 | * The suffix for this footnote
|
197 | * @param string $prefix
|
212 | * @param string $prefix
|
198 | * The prefix for this footnote
|
213 | * The prefix for this footnote
|
199 | */
|
214 | */
|
200 | public function __construct($name, $sign, $text, $suffix = '', $prefix = '', |
215 | public function __construct($name, $sign, $text, $suffix = '', $prefix = '', |
201 | $tooltip = '') |
216 | $tooltip = '', $html4Compatible = false) |
202 | {
|
217 | {
|
203 | $this->_name = $name; |
218 | $this->_name = $name; |
204 | $this->_sign = (is_numeric($sign) ? (int) $sign : $sign); |
219 | $this->_sign = (is_numeric($sign) ? (int) $sign : $sign); |
205 | $this->_text = $text; |
220 | $this->_text = $text; |
206 | $this->_suffix = $suffix; |
221 | $this->_suffix = $suffix; |
207 | $this->_prefix = $prefix; |
222 | $this->_prefix = $prefix; |
208 | $this->_tooltip = $tooltip; |
223 | $this->_tooltip = $tooltip; |
- | 224 | $this->_html4Compat = $html4Compatible; |
|
209 | }
|
225 | }
|
210 | 226 | ||
211 | /**
|
227 | /**
|
212 | * Universal getter
|
228 | * Universal getter
|
213 | *
|
229 | *
|
Line 235... | Line 251... | ||
235 | * @return string
|
251 | * @return string
|
236 | */
|
252 | */
|
237 | public function getRef() |
253 | public function getRef() |
238 | {
|
254 | {
|
239 | $s = $this->_name; |
255 | $s = $this->_name; |
240 | 256 | ||
241 | $ret = "<sup><a href='#footnote-{$s}'" |
257 | $ret = "<sup><a href='#footnote-{$s}'" |
242 | . ($this->_references === 0 |
258 | . ($this->_references === 0 |
243 | ? " name='fn-{$s}-ref' id='fn-{$s}-ref'"
|
259 | ? (($this->_html4Compat ? " name='fn-{$s}-ref'" : "") . " id='fn-{$s}-ref'") |
244 | : '') |
260 | : '') |
245 | . ' class="footnote"' |
261 | . ' class="footnote"' |
246 | . ($this->_tooltip |
262 | . ($this->_tooltip |
247 | ? ' title="'
|
263 | ? ' title="'
|
248 | . preg_replace('/"/', '"', |
264 | . preg_replace('/"/', '"', |
Line 263... | Line 279... | ||
263 | public function printMe() |
279 | public function printMe() |
264 | {
|
280 | {
|
265 | $s = $this->_name; |
281 | $s = $this->_name; |
266 | 282 | ||
267 | echo " <tr> |
283 | echo " <tr> |
- | 284 | <th><sup><a" . ($this->_html4Compat ? " name='footnote-{$s}'" : "") |
|
268 | <th><sup><a name='footnote-{$s}' id='footnote-{$s}' class='footnote'
|
285 | . " id='footnote-{$s}' class='footnote' |
269 | >{$this->_sign}</a></sup><a
|
286 | >{$this->_sign}</a></sup><a
|
270 | href='#fn-{$s}-ref' class='backref'>↑</a></th>
|
287 | href='#fn-{$s}-ref' class='backref'>↑</a></th>
|
271 | <td>{$this->_text}</td>
|
288 | <td>{$this->_text}</td>
|
272 | </tr>
|
289 | </tr>
|
273 | "; |
290 | "; |
274 | }
|
291 | }
|
275 | }
|
292 | }
|
276 | 293 | ||
277 | ?>
|
- | |
278 | 294 | ?>
|
|
- | 295 |