function biblio_normalize_title in Bibliography Module 6.2
Same name and namespace in other branches
- 7 includes/biblio.util.inc \biblio_normalize_title()
- 7.2 includes/biblio.util.inc \biblio_normalize_title()
Parameters
string $title:
2 calls to biblio_normalize_title()
- biblio_update_6034 in ./
biblio.install - Update ...
- _biblio_prepare_submit in ./
biblio.module - Prepares a biblio node for submit to database.
File
- includes/
biblio.util.inc, line 16
Code
function biblio_normalize_title($title) {
$stop_words = 'a,an,the,is,on';
$stop_words = explode(',', variable_get('biblio_stop_words', $stop_words));
if (!@preg_match('/\\pL/u', 'a')) {
// probably a broken PCRE library
$title = trim(_strip_punctuation($title));
}
else {
// Unicode safe filter for the value
$title = trim(_strip_punctuation_utf8($title));
}
$title = trim(_strip_punctuation($title));
mb_regex_encoding("utf-8");
$title_words = mb_split(' +', $title);
while (array_search(drupal_strtolower($title_words[0]), $stop_words) !== FALSE) {
array_shift($title_words);
}
return drupal_substr(implode(' ', $title_words), 0, 64);
}