Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 78 → Rev 79

/trunk/footnotes.class.php
25,13 → 25,17
protected $_defaultSuffix;
protected $_makeTooltip;
 
/* (non-PHPdoc) @see Footnote::_html4Compat */
protected $_html4Compat;
public function __construct($defaultPrefix = '', $defaultSuffix = '', $makeTooltip = false)
public function __construct($defaultPrefix = '', $defaultSuffix = '', $makeTooltip = false, $html4Compatible = false)
{
$this->clear();
$this->_defaultPrefix = $defaultPrefix;
$this->_defaultSuffix = $defaultSuffix;
$this->_makeTooltip = $makeTooltip;
$this->_html4Compat = $html4Compatible;
}
public function __get($name)
63,6 → 67,8
* Sign of the footnote. If empty, the next available number is used.
* @param string $text
* Text for the footnote
* @param string $tooltip
* Tooltip for the footnote
* @return string
* The code for printing the footnote reference.
*/
83,7 → 89,8
$footnotes[$name] = new Footnote($name, $sign, $text,
$this->_defaultSuffix, $this->_defaultPrefix,
$this->_makeTooltip ? ($tooltip !== null ? $tooltip : $text) : '');
$this->_makeTooltip ? ($tooltip !== null ? $tooltip : $text) : '',
$this->_html4Compat);
}
return $footnotes[$name]->getRef();
175,6 → 182,14
protected $_prefix = '';
protected $_suffix = '';
protected $_tooltip = '';
 
/**
* HTML 4 compatibility: If <code>true</code>, generates
* <code>name</code> attributes. Default: <code>false</code>.
*
* @var boolean
*/
protected $_html4Compat = false;
/**
* The number of times this footnote has been referred
198,7 → 213,7
* The prefix for this footnote
*/
public function __construct($name, $sign, $text, $suffix = '', $prefix = '',
$tooltip = '')
$tooltip = '', $html4Compatible = false)
{
$this->_name = $name;
$this->_sign = (is_numeric($sign) ? (int) $sign : $sign);
206,6 → 221,7
$this->_suffix = $suffix;
$this->_prefix = $prefix;
$this->_tooltip = $tooltip;
$this->_html4Compat = $html4Compatible;
}
 
/**
237,10 → 253,10
public function getRef()
{
$s = $this->_name;
 
$ret = "<sup><a href='#footnote-{$s}'"
. ($this->_references === 0
? " name='fn-{$s}-ref' id='fn-{$s}-ref'"
? (($this->_html4Compat ? " name='fn-{$s}-ref'" : "") . " id='fn-{$s}-ref'")
: '')
. ' class="footnote"'
. ($this->_tooltip
265,7 → 281,8
$s = $this->_name;
echo " <tr>
<th><sup><a name='footnote-{$s}' id='footnote-{$s}' class='footnote'
<th><sup><a" . ($this->_html4Compat ? " name='footnote-{$s}'" : "")
. " id='footnote-{$s}' class='footnote'
>{$this->_sign}</a></sup><a
href='#fn-{$s}-ref' class='backref'>&#8593;</a></th>
<td>{$this->_text}</td>
274,4 → 291,4
}
}
 
?>
?>