@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @param Media|null $media Reference media object |
| 64 | 64 | */ |
| 65 | - public function __construct(Media $media = null){ |
|
| 65 | + public function __construct(Media $media = null) { |
|
| 66 | 66 | $this->media = $media; |
| 67 | 67 | $this->use_ttf = function_exists('imagettftext'); |
| 68 | 68 | $this->expire_offset = 3600 * 24; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return ImageBuilder |
| 88 | 88 | */ |
| 89 | 89 | public function setExpireOffset($expireOffset) { |
| 90 | - if($expireOffset) $this->expire_offset = $expireOffset; |
|
| 90 | + if ($expireOffset) $this->expire_offset = $expireOffset; |
|
| 91 | 91 | return $this; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @return ImageBuilder |
| 108 | 108 | */ |
| 109 | 109 | public function setShowWatermark($show_watermark) { |
| 110 | - if(!is_null($show_watermark)) $this->show_watermark = $show_watermark; |
|
| 110 | + if (!is_null($show_watermark)) $this->show_watermark = $show_watermark; |
|
| 111 | 111 | return $this; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @return ImageBuilder |
| 119 | 119 | */ |
| 120 | 120 | public function setFontMaxSize($font_max_size) { |
| 121 | - if($font_max_size) $this->font_max_size = $font_max_size; |
|
| 121 | + if ($font_max_size) $this->font_max_size = $font_max_size; |
|
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,32 +129,32 @@ discard block |
||
| 129 | 129 | * @return ImageBuilder |
| 130 | 130 | */ |
| 131 | 131 | public function setFontColor($font_color) { |
| 132 | - if($font_color) $this->font_color = $font_color; |
|
| 132 | + if ($font_color) $this->font_color = $font_color; |
|
| 133 | 133 | return $this; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Render the image to the output. |
| 138 | 138 | */ |
| 139 | - public function render(){ |
|
| 139 | + public function render() { |
|
| 140 | 140 | |
| 141 | 141 | if (!$this->media || !$this->media->canShow()) { |
| 142 | - Log::addMediaLog('Image Builder error: >' . I18N::translate('Missing or private media object.')); |
|
| 142 | + Log::addMediaLog('Image Builder error: >'.I18N::translate('Missing or private media object.')); |
|
| 143 | 143 | $this->renderError(); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $serverFilename = $this->media->getServerFilename(); |
| 147 | 147 | |
| 148 | 148 | if (!file_exists($serverFilename)) { |
| 149 | - Log::addMediaLog('Image Builder error: >'. I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<'); |
|
| 149 | + Log::addMediaLog('Image Builder error: >'.I18N::translate('The media object does not exist.').'< for path >'.$serverFilename.'<'); |
|
| 150 | 150 | $this->renderError(); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $mimetype = $this->media->mimeType(); |
| 154 | 154 | $imgsize = $this->media->getImageAttributes(); |
| 155 | 155 | $filetime = $this->media->getFiletime(); |
| 156 | - $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT'; |
|
| 157 | - $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()) . ' GMT'; |
|
| 156 | + $filetimeHeader = gmdate('D, d M Y H:i:s', $filetime).' GMT'; |
|
| 157 | + $expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $this->getExpireOffset()).' GMT'; |
|
| 158 | 158 | |
| 159 | 159 | $type = Functions::isImageTypeSupported($imgsize['ext']); |
| 160 | 160 | $usewatermark = false; |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // add caching headers. allow browser to cache file, but not proxy |
| 189 | - header('Last-Modified: ' . $filetimeHeader); |
|
| 190 | - header('ETag: "' . $etag . '"'); |
|
| 191 | - header('Expires: ' . $expireHeader); |
|
| 192 | - header('Cache-Control: max-age=' . $this->getExpireOffset() . ', s-maxage=0, proxy-revalidate'); |
|
| 189 | + header('Last-Modified: '.$filetimeHeader); |
|
| 190 | + header('ETag: "'.$etag.'"'); |
|
| 191 | + header('Expires: '.$expireHeader); |
|
| 192 | + header('Cache-Control: max-age='.$this->getExpireOffset().', s-maxage=0, proxy-revalidate'); |
|
| 193 | 193 | |
| 194 | 194 | // if this file is already in the user’s cache, don’t resend it |
| 195 | 195 | // first check if the if_modified_since param matches |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // send headers for the image |
| 206 | - header('Content-Type: ' . $mimetype); |
|
| 207 | - header('Content-Disposition: filename="' . addslashes(basename($this->media->getFilename())) . '"'); |
|
| 206 | + header('Content-Type: '.$mimetype); |
|
| 207 | + header('Content-Disposition: filename="'.addslashes(basename($this->media->getFilename())).'"'); |
|
| 208 | 208 | |
| 209 | 209 | if ($usewatermark) { |
| 210 | 210 | // generate the watermarked image |
| 211 | - $imCreateFunc = 'imagecreatefrom' . $type; |
|
| 212 | - $imSendFunc = 'image' . $type; |
|
| 211 | + $imCreateFunc = 'imagecreatefrom'.$type; |
|
| 212 | + $imSendFunc = 'image'.$type; |
|
| 213 | 213 | |
| 214 | 214 | if (function_exists($imCreateFunc) && function_exists($imSendFunc)) { |
| 215 | 215 | $im = $imCreateFunc($serverFilename); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | return; |
| 223 | 223 | } else { |
| 224 | 224 | // this image is defective. log it |
| 225 | - Log::addMediaLog('Image Builder error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage()); |
|
| 225 | + Log::addMediaLog('Image Builder error: >'.I18N::translate('This media file is broken and cannot be watermarked.').'< in file >'.$serverFilename.'< memory used: '.memory_get_usage()); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $filesize = filesize($serverFilename); |
| 231 | 231 | |
| 232 | 232 | // set content-length header, send file |
| 233 | - header('Content-Length: ' . $filesize); |
|
| 233 | + header('Content-Length: '.$filesize); |
|
| 234 | 234 | |
| 235 | 235 | // Some servers disable fpassthru() and readfile() |
| 236 | 236 | if (function_exists('readfile')) { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $bgc = imagecolorallocate($im, 255, 255, 255); /* set background color */ |
| 261 | 261 | imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */ |
| 262 | 262 | |
| 263 | - $this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left'); |
|
| 263 | + $this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT.Config::FONT_DEJAVU_SANS_TTF, 'top', 'left'); |
|
| 264 | 264 | |
| 265 | 265 | http_response_code(404); |
| 266 | 266 | header('Content-Type: image/png'); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | protected function applyWatermark($im) { |
| 279 | 279 | |
| 280 | 280 | // text to watermark with |
| 281 | - if(method_exists($this->media, 'getWatermarkText')) { |
|
| 281 | + if (method_exists($this->media, 'getWatermarkText')) { |
|
| 282 | 282 | $word1_text = $this->media->getWatermarkText(); |
| 283 | 283 | } |
| 284 | 284 | else { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $word1_text, |
| 291 | 291 | $this->font_max_size, |
| 292 | 292 | $this->font_color, |
| 293 | - WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, |
|
| 293 | + WT_ROOT.Config::FONT_DEJAVU_SANS_TTF, |
|
| 294 | 294 | 'top', |
| 295 | 295 | 'left' |
| 296 | 296 | ); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | * @param string $hexstr |
| 410 | 410 | * @return int[] |
| 411 | 411 | */ |
| 412 | - protected function hexrgb ($hexstr) |
|
| 412 | + protected function hexrgb($hexstr) |
|
| 413 | 413 | { |
| 414 | 414 | $int = hexdec($hexstr); |
| 415 | 415 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | function imageTtfTextErrorHandler($errno, $errstr) { |
| 453 | 453 | // log the error |
| 454 | - Log::addErrorLog('Image Builder error: >' . $errno . '/' . $errstr . '< while processing file >' . $this->media->getServerFilename() . '<'); |
|
| 454 | + Log::addErrorLog('Image Builder error: >'.$errno.'/'.$errstr.'< while processing file >'.$this->media->getServerFilename().'<'); |
|
| 455 | 455 | |
| 456 | 456 | // change value of useTTF to false so the fallback watermarking can be used. |
| 457 | 457 | $this->use_ttf = false; |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | public function buildLineages() { |
| 55 | 55 | $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); |
| 56 | 56 | |
| 57 | - if(count($indis) == 0) return null; |
|
| 57 | + if (count($indis) == 0) return null; |
|
| 58 | 58 | |
| 59 | 59 | $root_lineages = array(); |
| 60 | 60 | |
| 61 | - foreach($indis as $indi) { |
|
| 61 | + foreach ($indis as $indi) { |
|
| 62 | 62 | $pid = $indi->getXref(); |
| 63 | - if(!isset($this->used_indis[$pid])){ |
|
| 63 | + if (!isset($this->used_indis[$pid])) { |
|
| 64 | 64 | //Find the root of the lineage |
| 65 | 65 | /** @var Fisharebest\Webtrees\Individual $indiFirst */ |
| 66 | - $indiFirst= $this->getLineageRootIndividual($indi); |
|
| 67 | - if($indiFirst){ |
|
| 66 | + $indiFirst = $this->getLineageRootIndividual($indi); |
|
| 67 | + if ($indiFirst) { |
|
| 68 | 68 | $this->used_indis[$indiFirst->getXref()] = true; |
| 69 | - if($indiFirst->canShow()){ |
|
| 69 | + if ($indiFirst->canShow()) { |
|
| 70 | 70 | //Check if the root individual has brothers and sisters, without parents |
| 71 | 71 | $indiChildFamily = $indiFirst->getPrimaryChildFamily(); |
| 72 | - if($indiChildFamily !== null){ |
|
| 72 | + if ($indiChildFamily !== null) { |
|
| 73 | 73 | $root_node = new LineageRootNode(null); |
| 74 | 74 | $root_node->addFamily($indiChildFamily); |
| 75 | 75 | } |
| 76 | - else{ |
|
| 76 | + else { |
|
| 77 | 77 | $root_node = new LineageRootNode($indiFirst); |
| 78 | 78 | } |
| 79 | 79 | $root_node = $this->buildLineage($root_node); |
| 80 | - if($root_node) $root_lineages[] = $root_node; |
|
| 80 | + if ($root_node) $root_lineages[] = $root_node; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -94,45 +94,45 @@ discard block |
||
| 94 | 94 | * @return (Individual|null) Root individual |
| 95 | 95 | */ |
| 96 | 96 | protected function getLineageRootIndividual(Individual $indi) { |
| 97 | - $is_first=false; |
|
| 97 | + $is_first = false; |
|
| 98 | 98 | $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
| 99 | - $indi_surname=$dindi->getUnprotectedPrimarySurname(); |
|
| 99 | + $indi_surname = $dindi->getUnprotectedPrimarySurname(); |
|
| 100 | 100 | $resIndi = $indi; |
| 101 | - while(!$is_first){ |
|
| 101 | + while (!$is_first) { |
|
| 102 | 102 | //Get the individual parents family |
| 103 | - $fam=$resIndi->getPrimaryChildFamily(); |
|
| 104 | - if($fam){ |
|
| 105 | - $husb=$fam->getHusband(); |
|
| 106 | - $wife=$fam->getWife(); |
|
| 103 | + $fam = $resIndi->getPrimaryChildFamily(); |
|
| 104 | + if ($fam) { |
|
| 105 | + $husb = $fam->getHusband(); |
|
| 106 | + $wife = $fam->getWife(); |
|
| 107 | 107 | //If the father exists, take him |
| 108 | - if($husb){ |
|
| 108 | + if ($husb) { |
|
| 109 | 109 | $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
| 110 | - $dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb; |
|
| 110 | + $dhusb->isNewAddition() ? $is_first = true : $resIndi = $husb; |
|
| 111 | 111 | } |
| 112 | 112 | //If only a mother exists |
| 113 | - else if($wife){ |
|
| 113 | + else if ($wife) { |
|
| 114 | 114 | $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
| 115 | - $wife_surname=$dwife->getUnprotectedPrimarySurname(); |
|
| 115 | + $wife_surname = $dwife->getUnprotectedPrimarySurname(); |
|
| 116 | 116 | //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) |
| 117 | - if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){ |
|
| 118 | - $resIndi=$wife; |
|
| 117 | + if (!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0) { |
|
| 118 | + $resIndi = $wife; |
|
| 119 | 119 | } |
| 120 | - else{ |
|
| 121 | - $is_first=true; |
|
| 120 | + else { |
|
| 121 | + $is_first = true; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - else{ |
|
| 125 | - $is_first=true; |
|
| 124 | + else { |
|
| 125 | + $is_first = true; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - else{ |
|
| 129 | - $is_first=true; |
|
| 128 | + else { |
|
| 129 | + $is_first = true; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - if(isset($this->used_indis[$resIndi->getXref()])){ |
|
| 132 | + if (isset($this->used_indis[$resIndi->getXref()])) { |
|
| 133 | 133 | return null; |
| 134 | 134 | } |
| 135 | - else{ |
|
| 135 | + else { |
|
| 136 | 136 | return $resIndi; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | * @return LineageNode Computed lineage |
| 146 | 146 | */ |
| 147 | 147 | protected function buildLineage(LineageNode $node) { |
| 148 | - if($node === null) return; |
|
| 148 | + if ($node === null) return; |
|
| 149 | 149 | |
| 150 | 150 | $indi_surname = null; |
| 151 | 151 | |
| 152 | 152 | $indi_node = $node->getIndividual(); |
| 153 | - if($indi_node) { |
|
| 154 | - if(count($node->getFamiliesNodes()) == 0) { |
|
| 153 | + if ($indi_node) { |
|
| 154 | + if (count($node->getFamiliesNodes()) == 0) { |
|
| 155 | 155 | $indiSpouseFamilies = $indi_node->getSpouseFamilies(); |
| 156 | - foreach($indiSpouseFamilies as $indiSpouseFamily) { |
|
| 156 | + foreach ($indiSpouseFamilies as $indiSpouseFamily) { |
|
| 157 | 157 | $node->addFamily($indiSpouseFamily); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -162,62 +162,62 @@ discard block |
||
| 162 | 162 | $indi_surname = $dindi_node->getUnprotectedPrimarySurname(); |
| 163 | 163 | |
| 164 | 164 | //Get the estimated birth place and put it in the place table |
| 165 | - $place=$dindi_node->getEstimatedBirthPlace(false); |
|
| 166 | - if($place && strlen($place) > 0){ |
|
| 167 | - $place=trim($place); |
|
| 165 | + $place = $dindi_node->getEstimatedBirthPlace(false); |
|
| 166 | + if ($place && strlen($place) > 0) { |
|
| 167 | + $place = trim($place); |
|
| 168 | 168 | $node->getRootNode()->addPlace(new Place($place, $this->tree)); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | //Tag the individual as used |
| 172 | - $this->used_indis[$indi_node->getXref()]=true; |
|
| 172 | + $this->used_indis[$indi_node->getXref()] = true; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - foreach($node->getFamiliesNodes() as $family) { |
|
| 175 | + foreach ($node->getFamiliesNodes() as $family) { |
|
| 176 | 176 | $spouse_surname = null; |
| 177 | - if($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
| 177 | + if ($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
| 178 | 178 | $dspouse = new \MyArtJaub\Webtrees\Individual($spouse); |
| 179 | - $spouse_surname=$dspouse->getUnprotectedPrimarySurname(); |
|
| 179 | + $spouse_surname = $dspouse->getUnprotectedPrimarySurname(); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $children = $family->getChildren(); |
| 183 | 183 | |
| 184 | - $nbChildren=0; |
|
| 185 | - $nbNatural=0; |
|
| 184 | + $nbChildren = 0; |
|
| 185 | + $nbNatural = 0; |
|
| 186 | 186 | |
| 187 | - foreach($children as $child){ |
|
| 187 | + foreach ($children as $child) { |
|
| 188 | 188 | $dchild = new \MyArtJaub\Webtrees\Individual($child); |
| 189 | - $child_surname=$dchild->getUnprotectedPrimarySurname(); |
|
| 189 | + $child_surname = $dchild->getUnprotectedPrimarySurname(); |
|
| 190 | 190 | |
| 191 | - if(!$dchild->isNewAddition()) { |
|
| 191 | + if (!$dchild->isNewAddition()) { |
|
| 192 | 192 | $nbChildren++; |
| 193 | 193 | //If the root individual is the mother |
| 194 | - if($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
| 194 | + if ($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
| 195 | 195 | //Print only lineages of children with the same surname as their mother (supposing they are natural children) |
| 196 | - if(!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)){ |
|
| 197 | - if(I18N::strcasecmp($child_surname, $indi_surname) == 0){ |
|
| 196 | + if (!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)) { |
|
| 197 | + if (I18N::strcasecmp($child_surname, $indi_surname) == 0) { |
|
| 198 | 198 | $nbNatural++; |
| 199 | 199 | $node_child = new LineageNode($child, $node->getRootNode()); |
| 200 | 200 | $node_child = $this->buildLineage($node_child); |
| 201 | - if($node_child) $node->addChild($family, $node_child); |
|
| 201 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | //If the root individual is the father |
| 206 | 206 | else { |
| 207 | 207 | //Print if the children does not bear the same name as his mother (and different from his father) |
| 208 | - if( strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
| 208 | + if (strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
| 209 | 209 | I18N::strcasecmp($child_surname, $indi_surname) == 0 || |
| 210 | - I18N::strcasecmp($child_surname, $spouse_surname) != 0 ) |
|
| 210 | + I18N::strcasecmp($child_surname, $spouse_surname) != 0) |
|
| 211 | 211 | { |
| 212 | 212 | $nbNatural++; |
| 213 | 213 | $node_child = new LineageNode($child, $node->getRootNode()); |
| 214 | 214 | $node_child = $this->buildLineage($node_child); |
| 215 | - if($node_child) $node->addChild($family, $node_child); |
|
| 215 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 216 | 216 | } |
| 217 | 217 | else { |
| 218 | 218 | $nbNatural++; |
| 219 | 219 | $node_child = new LineageNode($child, $node->getRootNode(), $child_surname); |
| 220 | - if($node_child) $node->addChild($family, $node_child); |
|
| 220 | + if ($node_child) $node->addChild($family, $node_child); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | //Do not print other children |
| 228 | - if(($nbChildren-$nbNatural)>0){ |
|
| 228 | + if (($nbChildren - $nbNatural) > 0) { |
|
| 229 | 229 | $node->addChild($family, null); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
| 37 | 37 | $tree = $this->data->get('tree'); |
| 38 | 38 | |
| 39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 39 | + echo '<h2 class="center">', $this->data->get('title'), '</h2>'; |
|
| 40 | 40 | echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
| 41 | 41 | |
| 42 | - if($this->data->get('issurnames', false)) { |
|
| 42 | + if ($this->data->get('issurnames', false)) { |
|
| 43 | 43 | $surns = $this->data->get('surnameslist', array()); |
| 44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 44 | + $extra_params = array('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | 45 | // Show the surname list |
| 46 | 46 | switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
| 47 | 47 | case 'style1': |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | else if ($this->data->get('islineages', false)) { |
| 60 | 60 | //Link to indilist |
| 61 | 61 | echo '<p class="center"><strong>'. |
| 62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 62 | + '<a href="indilist.php?ged='.$tree->getNameUrl().'&surname='.rawurlencode($this->data->get('surname')).'">'. |
|
| 63 | 63 | I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
| 64 | 64 | '</a></strong></p>'; |
| 65 | 65 | |
| 66 | 66 | $lineages = $this->data->get('lineages', null); |
| 67 | 67 | $nb_lineages = count($lineages); |
| 68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
| 68 | + if (is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | 69 | echo '<p class="center"><span class="warning">', |
| 70 | 70 | I18N::translate('No individuals with surname %s has been found. Please try another name.', |
| 71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 71 | + '<span dir="auto">'.$this->data->get('legend').'</span>'), |
|
| 72 | 72 | '</span></p>'; |
| 73 | 73 | } else { |
| 74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | echo '<div class="list_value_wrap">'; |
| 81 | 81 | |
| 82 | - foreach($lineages as $i => $lineage) { |
|
| 82 | + foreach ($lineages as $i => $lineage) { |
|
| 83 | 83 | $this->printRootLineage($lineage); |
| 84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 84 | + if ($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | echo '</div>'; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $list = array(); |
| 105 | 105 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
| 106 | 106 | $tree = $this->data->get('tree'); |
| 107 | - $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 107 | + $script_base_url = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
| 108 | 108 | |
| 109 | 109 | foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
| 110 | 110 | switch ($letter) { |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | if ($count) { |
| 122 | 122 | if ($letter == $this->data->get('alpha')) { |
| 123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 123 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" class="warning" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
| 124 | 124 | } else { |
| 125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 125 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
| 126 | 126 | } |
| 127 | 127 | } else { |
| 128 | 128 | $list[] = $html; |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | // Search spiders don't get the "show all" option as the other links give them everything. |
| 133 | 133 | if (!Auth::isSearchEngine()) { |
| 134 | 134 | if ($this->data->get('show_all') === 'yes') { |
| 135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 135 | + $list[] = '<span class="warning">'.I18N::translate('All').'</span>'; |
|
| 136 | 136 | } else { |
| 137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 137 | + $list[] = '<a href="'.$script_base_url.'&show_all=yes'.'&ged='.$tree->getNameUrl().'">'.I18N::translate('All').'</a>'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | private function printRootLineage(LineageRootNode $node) { |
| 149 | 149 | print '<div class="patrolin_tree">'; |
| 150 | - if($node->getIndividual() === null) { |
|
| 150 | + if ($node->getIndividual() === null) { |
|
| 151 | 151 | $fam_nodes = $node->getFamiliesNodes(); |
| 152 | - foreach($fam_nodes as $fam){ |
|
| 153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | - if($child_node) { |
|
| 152 | + foreach ($fam_nodes as $fam) { |
|
| 153 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
| 154 | + if ($child_node) { |
|
| 155 | 155 | $this->printLineage($child_node); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | echo '</div>'; |
| 164 | 164 | |
| 165 | 165 | $places = $node->getPlaces(); |
| 166 | - if($places && count($places)>0){ |
|
| 166 | + if ($places && count($places) > 0) { |
|
| 167 | 167 | echo '<div class="patrolin_places">'; |
| 168 | 168 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
| 169 | 169 | echo '</div>'; |
@@ -178,34 +178,34 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | echo '<ul>'; |
| 180 | 180 | $fam_nodes = $node->getFamiliesNodes(); |
| 181 | - if(count($fam_nodes) > 0) { |
|
| 181 | + if (count($fam_nodes) > 0) { |
|
| 182 | 182 | $is_first_family = true; |
| 183 | - foreach($fam_nodes as $fam) { |
|
| 183 | + foreach ($fam_nodes as $fam) { |
|
| 184 | 184 | $node_indi = $node->getIndividual(); |
| 185 | 185 | echo '<li>'; |
| 186 | - if($is_first_family){ |
|
| 186 | + if ($is_first_family) { |
|
| 187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
| 188 | 188 | } |
| 189 | - else{ |
|
| 189 | + else { |
|
| 190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
| 191 | 191 | } |
| 192 | 192 | //Get individual's spouse |
| 193 | 193 | $dfam = new Family($fam); |
| 194 | - $spouse=$dfam->getSpouseById($node_indi); |
|
| 194 | + $spouse = $dfam->getSpouseById($node_indi); |
|
| 195 | 195 | //Print the spouse if relevant |
| 196 | - if($spouse){ |
|
| 196 | + if ($spouse) { |
|
| 197 | 197 | $marrdate = I18N::translate('yes'); |
| 198 | 198 | $marryear = ''; |
| 199 | 199 | echo ' <a href="'.$fam->getHtmlUrl().'">'; |
| 200 | - if ($fam->getMarriageYear()){ |
|
| 200 | + if ($fam->getMarriageYear()) { |
|
| 201 | 201 | $marrdate = strip_tags($fam->getMarriageDate()->Display()); |
| 202 | 202 | $marryear = $fam->getMarriageYear(); |
| 203 | 203 | } |
| 204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
| 205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
| 206 | 206 | } |
| 207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | - if($child_node) { |
|
| 207 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
| 208 | + if ($child_node) { |
|
| 209 | 209 | $this->printLineage($child_node); |
| 210 | 210 | } |
| 211 | 211 | else { |
@@ -218,10 +218,10 @@ discard block |
||
| 218 | 218 | else { |
| 219 | 219 | echo '<li>'; |
| 220 | 220 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
| 221 | - if($node->hasFollowUpSurname()) { |
|
| 222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 221 | + if ($node->hasFollowUpSurname()) { |
|
| 222 | + $url_base = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
| 223 | 223 | echo ' '. |
| 224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 224 | + '<a href="'.$url_base.'&surname='.rawurlencode($node->getFollowUpSurname()).'&ged='.$this->data->get('tree')->getNameUrl().'">'. |
|
| 225 | 225 | '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
| 226 | 226 | '</a>'; |
| 227 | 227 | } |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | * {@inhericDoc} |
| 53 | 53 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
| 54 | 54 | */ |
| 55 | - public function getRealCertificatesDirectory(){ |
|
| 56 | - return WT_DATA_DIR . $this->root_path; |
|
| 55 | + public function getRealCertificatesDirectory() { |
|
| 56 | + return WT_DATA_DIR.$this->root_path; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * {@inhericDoc} |
| 61 | 61 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
| 62 | 62 | */ |
| 63 | - public function getCitiesList(){ |
|
| 64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 63 | + public function getCitiesList() { |
|
| 64 | + if (!isset($this->cities_list) || is_null($this->cities_list)) { |
|
| 65 | 65 | $certdir = $this->getRealCertificatesDirectory(); |
| 66 | 66 | $this->cities_list = array(); |
| 67 | 67 | |
| 68 | 68 | $dir = opendir($certdir); |
| 69 | 69 | |
| 70 | - while($entry = readdir($dir)){ |
|
| 71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 70 | + while ($entry = readdir($dir)) { |
|
| 71 | + if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) { |
|
| 72 | + $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | sort($this->cities_list); |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | * {@inhericDoc} |
| 82 | 82 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
| 83 | 83 | */ |
| 84 | - public function getCertificatesList($selCity){ |
|
| 84 | + public function getCertificatesList($selCity) { |
|
| 85 | 85 | |
| 86 | 86 | $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
| 87 | 87 | |
| 88 | 88 | $certdir = $this->getRealCertificatesDirectory(); |
| 89 | - $tabCertif= array(); |
|
| 89 | + $tabCertif = array(); |
|
| 90 | 90 | |
| 91 | - if(is_dir($certdir.$selCity)){ |
|
| 92 | - $dir=opendir($certdir.$selCity); |
|
| 93 | - while($entry = readdir($dir)){ |
|
| 94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 91 | + if (is_dir($certdir.$selCity)) { |
|
| 92 | + $dir = opendir($certdir.$selCity); |
|
| 93 | + while ($entry = readdir($dir)) { |
|
| 94 | + if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) { |
|
| 95 | 95 | $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
| 96 | 96 | $certificate = new Certificate($path, $this->tree, $this); |
| 97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | - $tabCertif[] = $certificate; |
|
| 97 | + if (Functions::isImageTypeSupported($certificate->extension())) { |
|
| 98 | + $tabCertif[] = $certificate; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * {@inhericDoc} |
| 108 | 108 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
| 109 | 109 | */ |
| 110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | - $tabFiles= array(); |
|
| 112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 110 | + public function getCertificatesListBeginWith($city, $contains, $limit = 9999) { |
|
| 111 | + $tabFiles = array(); |
|
| 112 | + $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | 113 | $contains = utf8_decode($contains); |
| 114 | 114 | $nbCert = 0; |
| 115 | 115 | |
| 116 | - if(is_dir($dirPath)){ |
|
| 117 | - $dir=opendir($dirPath); |
|
| 118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 116 | + if (is_dir($dirPath)) { |
|
| 117 | + $dir = opendir($dirPath); |
|
| 118 | + while (($entry = readdir($dir)) && $nbCert < $limit) { |
|
| 119 | + if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) { |
|
| 120 | + $tabFiles[] = Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | 121 | $nbCert++; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
| 29 | 29 | */ |
| 30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
| 30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
| 31 | 31 | $this->place = $place; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
| 40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
| 41 | 41 | */ |
| 42 | - public static function getIntance($place_str, Tree $tree){ |
|
| 42 | + public static function getIntance($place_str, Tree $tree) { |
|
| 43 | 43 | $dplace = null; |
| 44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
| 44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
| 45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
| 46 | 46 | } |
| 47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
| 54 | 54 | */ |
| 55 | - public function getDerivedPlace(){ |
|
| 55 | + public function getDerivedPlace() { |
|
| 56 | 56 | return $this->place; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param bool $anchor Option to print a link to placelist |
| 66 | 66 | * @return string HTML code for formatted place |
| 67 | 67 | */ |
| 68 | - public function htmlFormattedName($format, $anchor = false){ |
|
| 69 | - $html=''; |
|
| 68 | + public function htmlFormattedName($format, $anchor = false) { |
|
| 69 | + $html = ''; |
|
| 70 | 70 | |
| 71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
| 72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
| 75 | 75 | foreach ($matches[0] as $match2) { |
| 76 | 76 | $index = str_replace('%', '', $match2); |
| 77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
| 78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
| 77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
| 78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
| 79 | 79 | } |
| 80 | - else{ |
|
| 81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
| 80 | + else { |
|
| 81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
| 85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
| 85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | $html .= $displayPlace; |
| 88 | 88 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @param string $gedcom |
| 31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
| 32 | 32 | */ |
| 33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 34 | 34 | $dfam = null; |
| 35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
| 36 | - if($fam){ |
|
| 36 | + if ($fam) { |
|
| 37 | 37 | $dfam = new Family($fam); |
| 38 | 38 | } |
| 39 | 39 | return $dfam; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return int Level of sources |
| 46 | 46 | * */ |
| 47 | - function isMarriageSourced(){ |
|
| 48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 47 | + function isMarriageSourced() { |
|
| 48 | + if ($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 49 | 49 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
| 50 | 50 | return $this->is_marriage_sourced; |
| 51 | 51 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | class Individual extends GedcomRecord { |
| 22 | 22 | |
| 23 | 23 | /** @var array|null List of titles the individal holds */ |
| 24 | - protected $titles=null; |
|
| 24 | + protected $titles = null; |
|
| 25 | 25 | |
| 26 | 26 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
| 27 | 27 | protected $unprotected_prim_surname = null; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @param null|string $gedcom |
| 44 | 44 | * @return null|Individual |
| 45 | 45 | */ |
| 46 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 46 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 47 | 47 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
| 48 | - if($indi){ |
|
| 48 | + if ($indi) { |
|
| 49 | 49 | return new Individual($indi); |
| 50 | 50 | } |
| 51 | 51 | return null; |
@@ -56,18 +56,18 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return array Array of titles |
| 58 | 58 | */ |
| 59 | - public function getTitles(){ |
|
| 60 | - if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
| 59 | + public function getTitles() { |
|
| 60 | + if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
| 61 | 61 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
| 62 | - $this->titles=array(); |
|
| 62 | + $this->titles = array(); |
|
| 63 | 63 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
| 64 | - foreach($titlefacts as $titlefact){ |
|
| 64 | + foreach ($titlefacts as $titlefact) { |
|
| 65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
| 66 | - if($ct2>0){ |
|
| 67 | - $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
|
| 66 | + if ($ct2 > 0) { |
|
| 67 | + $this->titles[$match2[1][0]][] = trim($match2[2][0]); |
|
| 68 | 68 | } |
| 69 | - else{ |
|
| 70 | - $this->titles[$titlefact->getValue()][]=''; |
|
| 69 | + else { |
|
| 70 | + $this->titles[$titlefact->getValue()][] = ''; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | * @return string Primary surname |
| 82 | 82 | */ |
| 83 | 83 | public function getUnprotectedPrimarySurname() { |
| 84 | - if(!$this->unprotected_prim_surname){ |
|
| 85 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
| 84 | + if (!$this->unprotected_prim_surname) { |
|
| 85 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
| 86 | 86 | $this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
| 87 | 87 | } |
| 88 | 88 | return $this->unprotected_prim_surname; |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | * @param boolean $perc Should the coefficient of reliability be returned |
| 95 | 95 | * @return string|array Estimated birth place if found, null otherwise |
| 96 | 96 | */ |
| 97 | - public function getEstimatedBirthPlace($perc=false){ |
|
| 98 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 99 | - if($perc){ |
|
| 100 | - return array ($bplace, 1); |
|
| 97 | + public function getEstimatedBirthPlace($perc = false) { |
|
| 98 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 99 | + if ($perc) { |
|
| 100 | + return array($bplace, 1); |
|
| 101 | 101 | } |
| 102 | - else{ |
|
| 102 | + else { |
|
| 103 | 103 | return $bplace; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param boolean $perc Should the coefficient of reliability be returned |
| 113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 114 | 114 | */ |
| 115 | - public function getSignificantPlace(){ |
|
| 116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 115 | + public function getSignificantPlace() { |
|
| 116 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
| 117 | 117 | return $bplace; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 126 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
| 127 | 127 | return $dplace; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 130 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | 131 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
| 132 | 132 | if ($rplace) { |
| 133 | 133 | return $rplace; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @return boolean Is the individual a Sosa ancestor |
| 145 | 145 | */ |
| 146 | - public function isSosa(){ |
|
| 146 | + public function isSosa() { |
|
| 147 | 147 | return count($this->getSosaNumbers()) > 0; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | * @uses \MyArtJaub\Webtrees\Functions\ModuleManager |
| 155 | 155 | * @return array List of Sosa numbers |
| 156 | 156 | */ |
| 157 | - public function getSosaNumbers(){ |
|
| 158 | - if($this->sosa === null) { |
|
| 157 | + public function getSosaNumbers() { |
|
| 158 | + if ($this->sosa === null) { |
|
| 159 | 159 | $provider = new SosaProvider($this->gedcomrecord->getTree()); |
| 160 | 160 | $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
| 161 | 161 | } |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @return int Level of sources |
| 169 | 169 | * */ |
| 170 | - public function isBirthSourced(){ |
|
| 171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
| 170 | + public function isBirthSourced() { |
|
| 171 | + if ($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
| 172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
| 173 | 173 | return $this->is_birth_sourced; |
| 174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @return int Level of sources |
| 180 | 180 | * */ |
| 181 | - public function isDeathSourced(){ |
|
| 182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
| 181 | + public function isDeathSourced() { |
|
| 182 | + if ($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
| 183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
| 184 | 184 | return $this->is_death_sourced; |
| 185 | 185 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string $file Filename containing the task object |
| 81 | 81 | * @param TaskProviderInterface $provider Provider for tasks |
| 82 | 82 | */ |
| 83 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 83 | + public function __construct($file, TaskProviderInterface $provider = null) { |
|
| 84 | 84 | $this->name = trim(basename($file, '.php')); |
| 85 | 85 | $this->provider = $provider; |
| 86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return TaskProviderInterface |
| 92 | 92 | */ |
| 93 | - public function getProvider(){ |
|
| 93 | + public function getProvider() { |
|
| 94 | 94 | return $this->provider; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param TaskProviderInterface $provider |
| 101 | 101 | * @return self Enable method-chaining |
| 102 | 102 | */ |
| 103 | - public function setProvider(TaskProviderInterface $provider){ |
|
| 103 | + public function setProvider(TaskProviderInterface $provider) { |
|
| 104 | 104 | $this->provider = $provider; |
| 105 | 105 | return $this; |
| 106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
| 116 | 116 | * @param bool $is_running Indicates if the task is currently running |
| 117 | 117 | */ |
| 118 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 118 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running) { |
|
| 119 | 119 | $this->is_enabled = $is_enabled; |
| 120 | 120 | $this->last_updated = $last_updated; |
| 121 | 121 | $this->last_result = $last_result; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | - public function getName(){ |
|
| 132 | + public function getName() { |
|
| 133 | 133 | return $this->name; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return boolean True if enabled |
| 141 | 141 | */ |
| 142 | - public function isEnabled(){ |
|
| 142 | + public function isEnabled() { |
|
| 143 | 143 | return $this->is_enabled; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return \DateTime |
| 150 | 150 | */ |
| 151 | - public function getLastUpdated(){ |
|
| 151 | + public function getLastUpdated() { |
|
| 152 | 152 | return $this->last_updated; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return bool |
| 159 | 159 | */ |
| 160 | - public function isLastRunSuccess(){ |
|
| 160 | + public function isLastRunSuccess() { |
|
| 161 | 161 | return $this->last_result; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @return int |
| 168 | 168 | */ |
| 169 | - public function getFrequency(){ |
|
| 169 | + public function getFrequency() { |
|
| 170 | 170 | return $this->frequency; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param int $frequency |
| 177 | 177 | * @return self Enable method-chaining |
| 178 | 178 | */ |
| 179 | - public function setFrequency($frequency){ |
|
| 179 | + public function setFrequency($frequency) { |
|
| 180 | 180 | $this->frequency = $frequency; |
| 181 | 181 | return $this; |
| 182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return int |
| 188 | 188 | */ |
| 189 | - public function getRemainingOccurrences(){ |
|
| 189 | + public function getRemainingOccurrences() { |
|
| 190 | 190 | return $this->nb_occurrences; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param int $nb_occur |
| 197 | 197 | * @return self Enable method-chaining |
| 198 | 198 | */ |
| 199 | - public function setRemainingOccurrences($nb_occur){ |
|
| 199 | + public function setRemainingOccurrences($nb_occur) { |
|
| 200 | 200 | $this->nb_occurrences = $nb_occur; |
| 201 | 201 | return $this; |
| 202 | 202 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return bool |
| 208 | 208 | */ |
| 209 | - public function isRunning(){ |
|
| 209 | + public function isRunning() { |
|
| 210 | 210 | return $this->is_running; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function save() { |
| 238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 238 | + if (!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | 239 | return $this->provider->updateTask($this); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,23 +243,23 @@ discard block |
||
| 243 | 243 | * Execute the task, default skeleton |
| 244 | 244 | * |
| 245 | 245 | */ |
| 246 | - public function execute(){ |
|
| 246 | + public function execute() { |
|
| 247 | 247 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 248 | + if ($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | 249 | $this->is_running = false; |
| 250 | 250 | |
| 251 | - if(!$this->is_running){ |
|
| 251 | + if (!$this->is_running) { |
|
| 252 | 252 | $this->last_result = false; |
| 253 | 253 | $this->is_running = true; |
| 254 | 254 | $this->save(); |
| 255 | 255 | |
| 256 | 256 | Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
| 257 | 257 | $this->last_result = $this->executeSteps(); |
| 258 | - if($this->last_result){ |
|
| 258 | + if ($this->last_result) { |
|
| 259 | 259 | $this->last_updated = new \DateTime(); |
| 260 | - if($this->nb_occurrences > 0){ |
|
| 260 | + if ($this->nb_occurrences > 0) { |
|
| 261 | 261 | $this->nb_occurrences--; |
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 262 | + if ($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | $this->is_running = false; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend |
| 34 | 34 | */ |
| 35 | - public function __construct(fw\Controller\IndividualController $ctrl_individual_in){ |
|
| 35 | + public function __construct(fw\Controller\IndividualController $ctrl_individual_in) { |
|
| 36 | 36 | $this->ctrl_individual = $ctrl_individual_in; |
| 37 | 37 | $this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual()); |
| 38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 45 | 45 | */ |
| 46 | - public function printHeaderExtensions(){ |
|
| 46 | + public function printHeaderExtensions() { |
|
| 47 | 47 | $hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft'); |
| 48 | 48 | $hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight'); |
| 49 | 49 | $hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | echo '<div id="indi_perso_header">', |
| 53 | 53 | '<div id="indi_perso_header_left">'; |
| 54 | 54 | foreach ($hook_extend_indi_header_left as $div) { |
| 55 | - if(count($div)==2){ |
|
| 55 | + if (count($div) == 2) { |
|
| 56 | 56 | echo '<div id="', $div[0], '" class="indi_perso_header_left_div">', |
| 57 | 57 | $div[1], '</div>'; |
| 58 | 58 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | echo '</div>', |
| 61 | 61 | '<div id="indi_perso_header_right">'; |
| 62 | 62 | foreach ($hook_extend_indi_header_right as $div) { |
| 63 | - if(count($div)==2){ |
|
| 63 | + if (count($div) == 2) { |
|
| 64 | 64 | echo '<div id="', $div[0], '" class="indi_perso_header_right_div">', |
| 65 | 65 | $div[1], '</div>'; |
| 66 | 66 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
| 77 | 77 | */ |
| 78 | - public function printHeaderExtraIcons(){ |
|
| 78 | + public function printHeaderExtraIcons() { |
|
| 79 | 79 | $hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons'); |
| 80 | 80 | $hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual); |
| 81 | 81 | |