diff options
| author | Greg Roach <fisharebest@gmail.com> | 2014-01-25 15:28:20 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2014-01-25 15:28:20 +0000 |
| commit | bda04417b3faf574e34e583750bee01f26a1a9c3 (patch) | |
| tree | 58e176e93b0419e6f25e3f5b7a7f4e01ac64ccac /library/WT/Note.php | |
| parent | f33c74572b530d3ab92d8fc7dfe86dedcb89b0a0 (diff) | |
| download | webtrees-bda04417b3faf574e34e583750bee01f26a1a9c3.tar.gz webtrees-bda04417b3faf574e34e583750bee01f26a1a9c3.tar.bz2 webtrees-bda04417b3faf574e34e583750bee01f26a1a9c3.zip | |
New name code needs special case for note records
Diffstat (limited to 'library/WT/Note.php')
| -rw-r--r-- | library/WT/Note.php | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/library/WT/Note.php b/library/WT/Note.php index 3f1943a37a..e3fa36f6ea 100644 --- a/library/WT/Note.php +++ b/library/WT/Note.php @@ -73,22 +73,17 @@ class WT_Note extends WT_GedcomRecord { return $statement->execute(array($xref, $gedcom_id))->fetchOne(); } - // The 'name' of a note record is the first line. This can be - // somewhat unwieldy if lots of CONC records are used. Limit to 100 chars - protected function _addName($type, $value, $gedrec) { - if (utf8_strlen($value)<100) { - parent::_addName($type, $value, $gedrec); - } else { - parent::_addName($type, utf8_substr($value, 0, 100).WT_I18N::translate('…'), $gedrec); - } - } - // Get an array of structures containing all the names in the record - public function getAllNames() { + public function extractNames() { // Uniquely, the NOTE objects have data in their level 0 record. - // Hence the REGEX passed in the second parameter - if (preg_match('0 @' . WT_REGEX_XREF . '@ NOTE (.+)', $this->getGedcom())) { - $this->_addName('NOTE', $match[1]); + if (preg_match('/^0 @' . WT_REGEX_XREF . '@ NOTE (.+)/', $this->getGedcom(), $match)) { + // The 'name' of a note record is the first line. This can be + // somewhat unwieldy if lots of CONC records are used. Limit to 100 chars + if (utf8_strlen($match[1])<100) { + $this->_addName('NOTE', $match[1], $this->getGedcom()); + } else { + $this->_addName('NOTE', utf8_substr($match[1], 0, 100).WT_I18N::translate('…'), $this->getGedcom()); + } } } } |
