refactoring

This commit is contained in:
Martin Monperrus
2016-04-01 00:29:30 +02:00
parent 8fe8c897fb
commit d6e0700503
+6 -1
View File
@@ -1490,6 +1490,11 @@ class BibEntry {
return $this->getField('year'); return $this->getField('year');
} }
/** returns the array of keywords */
function getKeywords() {
return preg_split('/[,;\\/]/', $bib->getField("keywords"));
}
/** Returns the value of the given field? */ /** Returns the value of the given field? */
function getField($name) { function getField($name) {
// 2010-06-07: profiling showed that this is very costly // 2010-06-07: profiling showed that this is very costly
@@ -3589,7 +3594,7 @@ class BibDataBase {
$result = array(); $result = array();
foreach ($this->bibdb as $bib) { foreach ($this->bibdb as $bib) {
if (!$bib->hasField("keywords")) continue; if (!$bib->hasField("keywords")) continue;
$tags =preg_split('/[,;\\/]/', $bib->getField("keywords")); $tags = $bib->getKeywords();
foreach($tags as $a){ foreach($tags as $a){
$ta = trim($a); $ta = trim($a);
$result[$ta] = $ta; $result[$ta] = $ta;