diff options
| author | Greg Roach <fisharebest@gmail.com> | 2014-10-17 15:30:30 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2014-10-17 15:30:30 +0100 |
| commit | a53b963443b54a2ae0a60dec432a796b9406aca4 (patch) | |
| tree | cb6d95d7bf7ca6c8b3eea07dcb6cee35d407fc50 /library/WT/Note.php | |
| parent | f2396f93bfc8c5624bf087287f699b1e282557d8 (diff) | |
| download | webtrees-a53b963443b54a2ae0a60dec432a796b9406aca4.tar.gz webtrees-a53b963443b54a2ae0a60dec432a796b9406aca4.tar.bz2 webtrees-a53b963443b54a2ae0a60dec432a796b9406aca4.zip | |
PHPDoc
Diffstat (limited to 'library/WT/Note.php')
| -rw-r--r-- | library/WT/Note.php | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/library/WT/Note.php b/library/WT/Note.php index 20c0c16089..94b01dfaf7 100644 --- a/library/WT/Note.php +++ b/library/WT/Note.php @@ -23,25 +23,31 @@ class WT_Note extends WT_GedcomRecord { const RECORD_TYPE = 'NOTE'; - const URL_PREFIX = 'note.php?nid='; + const URL_PREFIX = 'note.php?nid='; - // Get the text contents of the note + /** + * Get the text contents of the note + * + * @return string|null + */ public function getNote() { - if (preg_match('/^0 @' . WT_REGEX_XREF . '@ NOTE ?(.*(?:\n1 CONT ?.*)*)/', $this->gedcom.$this->pending, $match)) { + if (preg_match('/^0 @' . WT_REGEX_XREF . '@ NOTE ?(.*(?:\n1 CONT ?.*)*)/', $this->gedcom . $this->pending, $match)) { return preg_replace("/\n1 CONT ?/", "\n", $match[1]); } else { return null; } } - // Implement note-specific privacy logic + /** + * {@inheritDoc} + */ protected function canShowByType($access_level) { // Hide notes if they are attached to private records - $linked_ids=WT_DB::prepare( + $linked_ids = WT_DB::prepare( "SELECT l_from FROM `##link` WHERE l_to=? AND l_file=?" )->execute(array($this->xref, $this->gedcom_id))->fetchOneColumn(); foreach ($linked_ids as $linked_id) { - $linked_record=WT_GedcomRecord::getInstance($linked_id); + $linked_record = WT_GedcomRecord::getInstance($linked_id); if ($linked_record && !$linked_record->canShow($access_level)) { return false; } @@ -51,17 +57,21 @@ class WT_Note extends WT_GedcomRecord { return parent::canShowByType($access_level); } - // Generate a private version of this record + /** + * {@inheritDoc} + */ protected function createPrivateGedcomRecord($access_level) { return '0 @' . $this->xref . '@ NOTE ' . WT_I18N::translate('Private'); } - // Fetch the record from the database + /** + * {@inheritDoc} + */ protected static function fetchGedcomRecord($xref, $gedcom_id) { - static $statement=null; + static $statement = null; - if ($statement===null) { - $statement=WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=? AND o_type='NOTE'"); + if ($statement === null) { + $statement = WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=? AND o_type='NOTE'"); } return $statement->execute(array($xref, $gedcom_id))->fetchOne(); @@ -70,6 +80,8 @@ class WT_Note extends WT_GedcomRecord { /** * Create a name for this note - apply (and remove) markup, then take * a maximum of 100 characters from the first line. + * + * {@inheritDoc} */ public function extractNames() { global $WT_TREE; |
