function _biblio_filter_replace_callback in Bibliography Module 5
Same name and namespace in other branches
- 6.2 biblio.module \_biblio_filter_replace_callback()
- 6 biblio.module \_biblio_filter_replace_callback()
- 7 biblio.module \_biblio_filter_replace_callback()
- 7.2 biblio.module \_biblio_filter_replace_callback()
Helper function called from preg_replace_callback() above
Uses static vars to temporarily store footnotes found. In my understanding, this is not threadsafe?!
1 call to _biblio_filter_replace_callback()
- biblio_filter in ./
biblio.module - Implementation of hook_filter().
1 string reference to '_biblio_filter_replace_callback'
- biblio_filter in ./
biblio.module - Implementation of hook_filter().
File
- ./
biblio.module, line 3586
Code
function _biblio_filter_replace_callback($matches, $op = '') {
static $n = 0;
static $store_matches = array();
$str = '';
if ($op == 'output footer') {
theme('biblio_add_css');
if ($n > 0) {
$str = '<p><hr /><p><h3>' . t('References') . '</h3></p>';
$str .= '<div class="references"><ol>';
for ($m = 1; $m <= $n; $m++) {
$str .= '<li id="reference' . $m . '">' . _biblio_citekey_print($store_matches[$m - 1]) . " </li>\n\n";
}
$str .= '</ol></div>';
}
$n = 0;
$store_matches = array();
return $str;
}
//default op: act as called by preg_replace_callback()
array_push($store_matches, $matches[1]);
$n++;
$allowed_tags = array();
$title = filter_xss($matches[1], $allowed_tags);
//html attribute cannot contain quotes
$title = str_replace('"', """, $title);
//remove newlines. Browsers don't support them anyway and they'll confuse line break converter in filter.module
$title = str_replace("\n", " ", $title);
$title = str_replace("\r", "", $title);
//return '<sup class="see_reference" title="'. $title .'"><a href="#reference' . $n . '">' . $n . '</a></sup>';
//$text = '<span><a href="#reference' . $n . '">[' . $n . ']</a> </span>';
//$text = '<span>[' . $n . ']</span>';
//$text .= '<span class="hovertip">'._biblio_citekey_print($title) .'</span>';
$text = '<span hovertip="reference' . $n . '">[' . $n . ']</span>';
if (module_exists('hovertip')) {
$text .= '<div id="reference' . $n . '" class="hovertip"><h1>Reference</h1>' . _biblio_citekey_print($title) . '</div>';
}
return $text;
}