';
$sup_close = '';
}else{
$sup_open = '';
$sup_close = '';
}
// Check for starting number
$start_number = 0;
if($sn_open = strpos($data, "');
$sn_length = $sn_close - $sn_open - 13;
$start_number = (int) substr($data, $sn_open + 13, $sn_length);
$start_number--;
}
// Create the footnotes
$counter = $start_number;
while($footnote_start = strpos($data, $footnote_open)) {
$counter++;
$footnote_end = strpos($data, $footnote_close);
$footnote_true_end = $footnote_end + $footnote_close_len;
$before = substr($data, 0, $footnote_start);
$after = substr($data, $footnote_true_end);
$footnote_length = $footnote_end - ($footnote_start + $footnote_open_len);
$footnote_text = substr($data, $footnote_start + $footnote_open_len, $footnote_length);
if (substr($footnote_text,0,4) == 'ref:'){
$ref = substr($footnote_text,4);
$data = $before.$sup_open.$current_settings['pre_link'].''.swas_counter_symbol($ref).''.$current_settings['post_link'].$sup_close.$after;
$counter--;
}else {
$footnotes[] = $footnote_text;
$data = $before.$sup_open.$current_settings['pre_link'].''.swas_counter_symbol($counter).''.$current_settings['post_link'].$sup_close.$after;
}
}
// A little bit of legacy support
if ($current_settings['legacy']){
$tag = "footnote";
$taglength = strlen($tag);
while($footnote_start = strpos($data, "<".$tag.">")) {
$counter++;
$footnote_end = strpos($data, "".$tag.">");
$footnote_true_end = $footnote_end + $taglenth + 3 + $taglength;
$before = substr($data, 0, $footnote_start);
$after = substr($data, $footnote_true_end);
$footnote_length = $footnote_end - ($footnote_start+2+$taglength);
$footnote_text = substr($data, $footnote_start+2+$taglength, $footnote_length);
if (substr($footnote_text,0,4) == 'ref:'){
$ref = substr($footnote_text,4);
$data = $before.$sup_open.$current_settings['pre_link'].''.swas_counter_symbol($ref).''.$current_settings['post_link'].$sup_close.$after;
$counter--;
}else {
$footnotes[] = $footnote_text;
$data = $before.$sup_open.$current_settings['pre_link'].''.swas_counter_symbol($counter).''.$current_settings['post_link'].$sup_close.$after;
}
}
}
if ($footnotes){
$counter = $start_number;
if ($current_settings['use_symbols'])
$ol_style = ' style="list-style-type: none; padding-left: 0;"';
else
$ol_style = '';
if ($start_number != 0) $data = $data.'
Options saved.
There are a few options you can set for displaying your footnotes using this Footnotes plugin.
You can use any HTML entity for the back link. One that is quite popular is ↩ (↩). But more importantly this feature allows the footnotes to be addapted for other languages.