Rev 12 | Rev 15 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 12 | Rev 13 | ||
|---|---|---|---|
| Line 19... | Line 19... | ||
| 19 |    *
 | 
            19 |    *
 | 
          
| 20 |    * @var int
 | 
            20 |    * @var int
 | 
          
| 21 |    */
 | 
            21 |    */
 | 
          
| 22 | protected $lastNumberSign;  | 
            22 | protected $lastNumberSign;  | 
          
| 23 | 23 | ||
| - | 24 | protected $defaultPrefix;  | 
          |
| 24 | public function __construct()  | 
            25 | protected $defaultSuffix;  | 
          
| - | 26 | ||
| - | 27 | protected $makeTooltip;  | 
          |
| - | 28 | ||
| - | 29 | public function __construct($defaultPrefix = '', $defaultSuffix = '', $makeTooltip = false)  | 
          |
| 25 |   {
 | 
            30 |   {
 | 
          
| 26 | $this->clear();  | 
            31 | $this->clear();  | 
          
| - | 32 | $this->defaultPrefix = $defaultPrefix;  | 
          |
| - | 33 | $this->defaultSuffix = $defaultSuffix;  | 
          |
| - | 34 | $this->makeTooltip = $makeTooltip;  | 
          |
| 27 |   }
 | 
            35 |   }
 | 
          
| 28 | 36 | ||
| 29 |   /**
 | 
            37 |   /**
 | 
          
| 30 |    * Clears the footnote list
 | 
            38 |    * Clears the footnote list
 | 
          
| 31 |    */
 | 
            39 |    */
 | 
          
| Line 45... | Line 53... | ||
| 45 |    * @param string $text
 | 
            53 |    * @param string $text
 | 
          
| 46 |    *   Text for the footnote
 | 
            54 |    *   Text for the footnote
 | 
          
| 47 |    * @return string
 | 
            55 |    * @return string
 | 
          
| 48 |    *   The code for printing the footnote reference.
 | 
            56 |    *   The code for printing the footnote reference.
 | 
          
| 49 |    */
 | 
            57 |    */
 | 
          
| 50 | public function add($name, $sign = '', $text = '')  | 
            58 | public function add($name, $sign = '', $text = '', $tooltip = null)  | 
          
| 51 |   {
 | 
            59 |   {
 | 
          
| 52 | $footnotes =& $this->footnotes;  | 
            60 | $footnotes =& $this->footnotes;  | 
          
| 53 | 61 | ||
| 54 | if (!isset($footnotes[$name]))  | 
            62 | if (!isset($footnotes[$name]))  | 
          
| 55 |     {
 | 
            63 |     {
 | 
          
| Line 60... | Line 68... | ||
| 60 | else if (is_int($sign))  | 
            68 | else if (is_int($sign))  | 
          
| 61 |       {
 | 
            69 |       {
 | 
          
| 62 | $this->lastNumberSign = $sign;  | 
            70 | $this->lastNumberSign = $sign;  | 
          
| 63 |       }
 | 
            71 |       }
 | 
          
| 64 | 72 | ||
| 65 | $footnotes[$name] = new Footnote($name, $sign, $text);  | 
            73 | $footnotes[$name] = new Footnote($name, $sign, $text,  | 
          
| - | 74 | $this->defaultSuffix, $this->defaultPrefix,  | 
          |
| - | 75 | $this->makeTooltip ? ($tooltip !== null ? $tooltip : $text) : '');  | 
          |
| 66 |     }
 | 
            76 |     }
 | 
          
| 67 | 77 | ||
| 68 | return $footnotes[$name]->getRef();  | 
            78 | return $footnotes[$name]->getRef();  | 
          
| 69 |   }
 | 
            79 |   }
 | 
          
| 70 | 80 | ||
| Line 140... | Line 150... | ||
| 140 |    *
 | 
            150 |    *
 | 
          
| 141 |    * @var string
 | 
            151 |    * @var string
 | 
          
| 142 |    */
 | 
            152 |    */
 | 
          
| 143 | protected $text = '';  | 
            153 | protected $text = '';  | 
          
| 144 | 154 | ||
| - | 155 | protected $prefix = '';  | 
          |
| - | 156 | protected $suffix = '';  | 
          |
| - | 157 | protected $tooltip = '';  | 
          |
| - | 158 | ||
| 145 |   /**
 | 
            159 |   /**
 | 
          
| 146 |    * The number of times this footnote has been referred
 | 
            160 |    * The number of times this footnote has been referred
 | 
          
| 147 |    *
 | 
            161 |    *
 | 
          
| 148 |    * @var int
 | 
            162 |    * @var int
 | 
          
| 149 |    */
 | 
            163 |    */
 | 
          
| Line 156... | Line 170... | ||
| 156 |    *   The name of this footnote
 | 
            170 |    *   The name of this footnote
 | 
          
| 157 |    * @param string $sign
 | 
            171 |    * @param string $sign
 | 
          
| 158 |    *   The sign that should be used for referring to this footnote
 | 
            172 |    *   The sign that should be used for referring to this footnote
 | 
          
| 159 |    * @param string $text
 | 
            173 |    * @param string $text
 | 
          
| 160 |    *   The text for this footnote
 | 
            174 |    *   The text for this footnote
 | 
          
| - | 175 |    * @param string $suffix
 | 
          |
| - | 176 |    *   The suffix for this footnote
 | 
          |
| - | 177 |    * @param string $prefix
 | 
          |
| - | 178 |    *   The prefix for this footnote
 | 
          |
| 161 |    */
 | 
            179 |    */
 | 
          
| 162 | public function __construct($name, $sign, $text)  | 
            180 | public function __construct($name, $sign, $text, $suffix = '', $prefix = '',  | 
          
| - | 181 | $tooltip = '')  | 
          |
| 163 |   {
 | 
            182 |   {
 | 
          
| 164 | $this->name = $name;  | 
            183 | $this->name = $name;  | 
          
| 165 | $this->sign = $sign;  | 
            184 | $this->sign = $sign;  | 
          
| 166 | $this->text = $text;  | 
            185 | $this->text = $text;  | 
          
| - | 186 | $this->suffix = $suffix;  | 
          |
| - | 187 | $this->prefix = $prefix;  | 
          |
| - | 188 | $this->tooltip = $tooltip;  | 
          |
| 167 |   }
 | 
            189 |   }
 | 
          
| 168 | 190 | ||
| 169 |   /**
 | 
            191 |   /**
 | 
          
| 170 |    * Universal getter
 | 
            192 |    * Universal getter
 | 
          
| 171 |    *
 | 
            193 |    *
 | 
          
| Line 200... | Line 222... | ||
| 200 | 222 | ||
| 201 | $ret = "<sup><a href='#footnote-{$s}'"  | 
            223 | $ret = "<sup><a href='#footnote-{$s}'"  | 
          
| 202 | . ($this->references === 0  | 
            224 | . ($this->references === 0  | 
          
| 203 |         ? " name='fn-{$s}-ref' id='fn-{$s}-ref'"
 | 
            225 |         ? " name='fn-{$s}-ref' id='fn-{$s}-ref'"
 | 
          
| 204 | : '')  | 
            226 | : '')  | 
          
| - | 227 | . " class='footnote'"  | 
          |
| - | 228 | . ($this->tooltip  | 
          |
| - | 229 |         ? ' title="'
 | 
          |
| - | 230 | . preg_replace('/"/', '"',  | 
          |
| - | 231 | trim(reduceWhitespace(strip_tags($this->tooltip))))  | 
          |
| - | 232 | . '"'  | 
          |
| - | 233 | : '')  | 
          |
| 205 | . " class='footnote'>{$this->sign}</a></sup>";  | 
            234 | . "'>{$this->prefix}{$this->sign}{$this->suffix}"  | 
          
| - | 235 | . '</a></sup>';  | 
          |
| 206 | 236 | ||
| 207 | ++$this->references;  | 
            237 | ++$this->references;  | 
          
| 208 | 238 | ||
| 209 | return $ret;  | 
            239 | return $ret;  | 
          
| 210 |   }
 | 
            240 |   }
 | 
          
| Line 216... | Line 246... | ||
| 216 |   {
 | 
            246 |   {
 | 
          
| 217 | $s = $this->name;  | 
            247 | $s = $this->name;  | 
          
| 218 | 248 | ||
| 219 | echo " <tr>  | 
            249 | echo " <tr>  | 
          
| 220 |         <th><sup><a name='footnote-{$s}' id='footnote-{$s}' class='footnote'
 | 
            250 |         <th><sup><a name='footnote-{$s}' id='footnote-{$s}' class='footnote'
 | 
          
| - | 251 |           >{$this->sign}</a></sup><a
 | 
          |
| 221 |           >{$this->sign}</a></sup><a href='#fn-{$s}-ref' name='footnote-{$s}'
 | 
            252 |           href='#fn-{$s}-ref' name='footnote-{$s}' id='footnote-{$s}'
 | 
          
| 222 |           id='footnote-{$s}' class='backref'>↑</a></th>
 | 
            253 |           class='backref'>↑</a></th>
 | 
          
| 223 |         <td>{$this->text}</td>
 | 
            254 |         <td>{$this->text}</td>
 | 
          
| 224 |       </tr>
 | 
            255 |       </tr>
 | 
          
| 225 | ";  | 
            256 | ";  | 
          
| 226 |   }
 | 
            257 |   }
 | 
          
| 227 | }
 | 
            258 | }
 |