summaryrefslogtreecommitdiff
path: root/app/Report/ReportParserGenerate.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-08-30 09:17:02 +0100
committerGreg Roach <fisharebest@webtrees.net>2018-08-30 09:17:12 +0100
commit83cdc021ef3cbd30c7b73b429e75d0d3c95ff416 (patch)
tree1353c1d9c8b2848c12cfc88bc807308d5bd68c97 /app/Report/ReportParserGenerate.php
parentc7ff415313b94d2d6d06ec673249f39fae9865e9 (diff)
downloadwebtrees-83cdc021ef3cbd30c7b73b429e75d0d3c95ff416.tar.gz
webtrees-83cdc021ef3cbd30c7b73b429e75d0d3c95ff416.tar.bz2
webtrees-83cdc021ef3cbd30c7b73b429e75d0d3c95ff416.zip
Report images - types and phpdoc
Diffstat (limited to 'app/Report/ReportParserGenerate.php')
-rw-r--r--app/Report/ReportParserGenerate.php103
1 files changed, 21 insertions, 82 deletions
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php
index ea713c3e44..232c57a19b 100644
--- a/app/Report/ReportParserGenerate.php
+++ b/app/Report/ReportParserGenerate.php
@@ -1636,56 +1636,26 @@ class ReportParserGenerate extends ReportParserBase
*/
private function highlightedImageStartHandler($attrs)
{
- $id = '';
- $match = [];
+ $id = '';
if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
$id = $match[1];
}
- // mixed Position the top corner of this box on the page. the default is the current position
- $top = '.';
- if (isset($attrs['top'])) {
- if ($attrs['top'] === '0') {
- $top = 0;
- } elseif ($attrs['top'] === '.') {
- $top = '.';
- } elseif (!empty($attrs['top'])) {
- $top = (int) $attrs['top'];
- }
- }
+ // Position the top corner of this box on the page. the default is the current position
+ $top = (int) ($attrs['top'] ?? -1);
// mixed Position the left corner of this box on the page. the default is the current position
- $left = '.';
- if (isset($attrs['left'])) {
- if ($attrs['left'] === '0') {
- $left = 0;
- } elseif ($attrs['left'] === '.') {
- $left = '.';
- } elseif (!empty($attrs['left'])) {
- $left = (int) $attrs['left'];
- }
- }
+ $left = (int) ($attrs['left'] ?? -1);
- // string Align the image in left, center, right
- $align = '';
- if (!empty($attrs['align'])) {
- $align = $attrs['align'];
- }
+ // string Align the image in left, center, right (or empty to use x/y position).
+ $align = $attrs['align'] ?? '';
// string Next Line should be T:next to the image, N:next line
- $ln = '';
- if (!empty($attrs['ln'])) {
- $ln = $attrs['ln'];
- }
+ $ln = $attrs['ln'] ?? 'T';
- $width = 0;
- $height = 0;
- if (!empty($attrs['width'])) {
- $width = (int) $attrs['width'];
- }
- if (!empty($attrs['height'])) {
- $height = (int) $attrs['height'];
- }
+ // Width, height (or both).
+ $width = (int) ($attrs['width'] ?? 0);
+ $height = (int) ($attrs['height'] ?? 0);
$person = Individual::getInstance($id, $this->tree);
$media_file = $person->findHighlightedMediaFile();
@@ -1719,55 +1689,24 @@ class ReportParserGenerate extends ReportParserBase
*/
private function imageStartHandler($attrs)
{
- // mixed Position the top corner of this box on the page. the default is the current position
- $top = '.';
- if (isset($attrs['top'])) {
- if ($attrs['top'] === '0') {
- $top = 0;
- } elseif ($attrs['top'] === '.') {
- $top = '.';
- } elseif (!empty($attrs['top'])) {
- $top = (int) $attrs['top'];
- }
- }
+ // Position the top corner of this box on the page. the default is the current position
+ $top = (int) ($attrs['top'] ?? -1);
// mixed Position the left corner of this box on the page. the default is the current position
- $left = '.';
- if (isset($attrs['left'])) {
- if ($attrs['left'] === '0') {
- $left = 0;
- } elseif ($attrs['left'] === '.') {
- $left = '.';
- } elseif (!empty($attrs['left'])) {
- $left = (int) $attrs['left'];
- }
- }
+ $left = (int) ($attrs['left'] ?? -1);
- // string Align the image in left, center, right
- $align = '';
- if (!empty($attrs['align'])) {
- $align = $attrs['align'];
- }
+ // string Align the image in left, center, right (or empty to use x/y position).
+ $align = $attrs['align'] ?? '';
// string Next Line should be T:next to the image, N:next line
- $ln = 'T';
- if (!empty($attrs['ln'])) {
- $ln = $attrs['ln'];
- }
+ $ln = $attrs['ln'] ?? 'T';
- $width = 0;
- $height = 0;
- if (!empty($attrs['width'])) {
- $width = (int) $attrs['width'];
- }
- if (!empty($attrs['height'])) {
- $height = (int) $attrs['height'];
- }
+ // Width, height (or both).
+ $width = (int) ($attrs['width'] ?? 0);
+ $height = (int) ($attrs['height'] ?? 0);
+
+ $file = $attrs['file'] ?? '';
- $file = '';
- if (!empty($attrs['file'])) {
- $file = $attrs['file'];
- }
if ($file == '@FILE') {
$match = [];
if (preg_match("/\d OBJE @(.+)@/", $this->gedrec, $match)) {