@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Interface for providers of certificates |
| 17 | 17 | */ |
| 18 | -interface CertificateProviderInterface { |
|
| 18 | +interface CertificateProviderInterface { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Returns the certificates directory path as it is really (within the firewall directory). |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class Certificate extends Media { |
| 37 | 37 | |
| 38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
| 38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
| 39 | 39 | |
| 40 | 40 | /** @var string The "TITL" value from the GEDCOM |
| 41 | 41 | * This is a tweak to overcome the private level from the parent object... |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | $this->title = basename($this->getFilename(), '.'.$this->extension()); |
| 95 | 95 | |
| 96 | 96 | $ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match); |
| 97 | - if($ct > 0){ |
|
| 98 | - $monthId = (int) $match['month']; |
|
| 97 | + if ($ct > 0) { |
|
| 98 | + $monthId = (int)$match['month']; |
|
| 99 | 99 | $calendarShortMonths = Functions::getCalendarShortMonths(); |
| 100 | 100 | $monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId; |
| 101 | 101 | $this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']); |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
| 112 | 112 | */ |
| 113 | 113 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
| 114 | - try{ |
|
| 114 | + try { |
|
| 115 | 115 | $certfile = Functions::decryptFromSafeBase64($xref); |
| 116 | 116 | |
| 117 | 117 | //NEED TO CHECK THAT !!! |
| 118 | - if(Functions::isValidPath($certfile, true)) { |
|
| 118 | + if (Functions::isValidPath($certfile, true)) { |
|
| 119 | 119 | return new Certificate($certfile, $tree, $provider); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @param string|Source $xref |
| 154 | 154 | */ |
| 155 | - public function setSource($xref){ |
|
| 156 | - if($xref instanceof Source){ |
|
| 155 | + public function setSource($xref) { |
|
| 156 | + if ($xref instanceof Source) { |
|
| 157 | 157 | $this->source = $data; |
| 158 | 158 | } else { |
| 159 | 159 | $this->source = Source::getInstance($xref, $this->tree); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * |
| 174 | 174 | * @return Date Certificate date |
| 175 | 175 | */ |
| 176 | - public function getCertificateDate(){ |
|
| 176 | + public function getCertificateDate() { |
|
| 177 | 177 | return $this->certDate; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @return string Certificate date |
| 184 | 184 | */ |
| 185 | - public function getCertificateType(){ |
|
| 185 | + public function getCertificateType() { |
|
| 186 | 186 | return $this->certType; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @return string Certificate details |
| 193 | 193 | */ |
| 194 | - public function getCertificateDetails(){ |
|
| 194 | + public function getCertificateDetails() { |
|
| 195 | 195 | return $this->certDetails; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return string|NULL Certificate city |
| 202 | 202 | */ |
| 203 | - public function getCity(){ |
|
| 203 | + public function getCity() { |
|
| 204 | 204 | $chunks = explode('/', $this->getFilename(), 2); |
| 205 | - if(count($chunks) > 1) return $chunks[0]; |
|
| 205 | + if (count($chunks) > 1) return $chunks[0]; |
|
| 206 | 206 | return null; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * {@inhericDoc} |
| 211 | 211 | * @see \Fisharebest\Webtrees\Media::getServerFilename() |
| 212 | 212 | */ |
| 213 | - public function getServerFilename($which='main') { |
|
| 214 | - $filename = $this->provider->getRealCertificatesDirectory() . $this->getFilename(); |
|
| 213 | + public function getServerFilename($which = 'main') { |
|
| 214 | + $filename = $this->provider->getRealCertificatesDirectory().$this->getFilename(); |
|
| 215 | 215 | return Functions::encodeUtf8ToFileSystem($filename); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | public function getHtmlUrlDirect($which = 'main', $download = false) { |
| 223 | 223 | $sidstr = ($this->source) ? '&sid='.$this->source->getXref() : ''; |
| 224 | 224 | return |
| 225 | - 'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 226 | - '&mod_action=Certificate@image' . |
|
| 227 | - '&ged='. $this->tree->getNameUrl() . |
|
| 228 | - '&cid=' . $this->getXref() . $sidstr . |
|
| 229 | - '&cb=' . $this->getEtag($which); |
|
| 225 | + 'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. |
|
| 226 | + '&mod_action=Certificate@image'. |
|
| 227 | + '&ged='.$this->tree->getNameUrl(). |
|
| 228 | + '&cid='.$this->getXref().$sidstr. |
|
| 229 | + '&cb='.$this->getEtag($which); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -237,26 +237,26 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return string Watermark text |
| 239 | 239 | */ |
| 240 | - public function getWatermarkText(){ |
|
| 240 | + public function getWatermarkText() { |
|
| 241 | 241 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
| 242 | 242 | |
| 243 | - if($module) { |
|
| 243 | + if ($module) { |
|
| 244 | 244 | $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
| 245 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
| 245 | + $sid = Filter::get('sid', WT_REGEX_XREF); |
|
| 246 | 246 | |
| 247 | - if($sid){ |
|
| 247 | + if ($sid) { |
|
| 248 | 248 | $this->source = Source::getInstance($sid, $this->tree); |
| 249 | 249 | } |
| 250 | - else{ |
|
| 251 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
| 250 | + else { |
|
| 251 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if($this->source) { |
|
| 254 | + if ($this->source) { |
|
| 255 | 255 | $wmtext = '©'; |
| 256 | 256 | $repofact = $this->source->getFirstFact('REPO'); |
| 257 | - if($repofact) { |
|
| 257 | + if ($repofact) { |
|
| 258 | 258 | $repo = $repofact->getTarget(); |
| 259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
| 259 | + if ($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
| 260 | 260 | } |
| 261 | 261 | $wmtext .= $this->source->getFullName(); |
| 262 | 262 | } |
@@ -279,45 +279,45 @@ discard block |
||
| 279 | 279 | '; |
| 280 | 280 | |
| 281 | 281 | $script = ''; |
| 282 | - if($controller && !($controller instanceof IndividualController)){ |
|
| 282 | + if ($controller && !($controller instanceof IndividualController)) { |
|
| 283 | 283 | $controller->addInlineJavascript('$(document).ready(function() { '.$js.' });'); |
| 284 | 284 | } else { |
| 285 | - $script = '<script>' . $js . '</script>'; |
|
| 285 | + $script = '<script>'.$js.'</script>'; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | if ($which == 'icon' || !file_exists($this->getServerFilename())) { |
| 289 | 289 | // Use an icon |
| 290 | 290 | $image = |
| 291 | - '<i dir="auto" class="icon-maj-certificate margin-h-2"' . |
|
| 292 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
| 291 | + '<i dir="auto" class="icon-maj-certificate margin-h-2"'. |
|
| 292 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
| 293 | 293 | '></i>'; |
| 294 | 294 | } else { |
| 295 | 295 | $imgsize = getimagesize($this->getServerFilename()); |
| 296 | 296 | $image = |
| 297 | - '<img' . |
|
| 298 | - ' class ="'. 'certif_image' . '"' . |
|
| 299 | - ' dir="' . 'auto' . '"' . // For the tool-tip |
|
| 300 | - ' src="' . $this->getHtmlUrlDirect() . '"' . |
|
| 301 | - ' alt="' . strip_tags($this->getFullName()) . '"' . |
|
| 302 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
| 303 | - $imgsize[3] . // height="yyy" width="xxx" |
|
| 297 | + '<img'. |
|
| 298 | + ' class ="'.'certif_image'.'"'. |
|
| 299 | + ' dir="'.'auto'.'"'.// For the tool-tip |
|
| 300 | + ' src="'.$this->getHtmlUrlDirect().'"'. |
|
| 301 | + ' alt="'.strip_tags($this->getFullName()).'"'. |
|
| 302 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
| 303 | + $imgsize[3].// height="yyy" width="xxx" |
|
| 304 | 304 | '>'; |
| 305 | 305 | } |
| 306 | 306 | return |
| 307 | - '<a' . |
|
| 308 | - ' class="' . 'certgallery' . '"' . |
|
| 309 | - ' href="' . $this->getHtmlUrlDirect() . '"' . |
|
| 310 | - ' type="' . $this->mimeType() . '"' . |
|
| 311 | - ' data-obje-url="' . $this->getHtmlUrl() . '"' . |
|
| 312 | - ' data-title="' . strip_tags($this->getFullName()) . '"' . |
|
| 313 | - '>' . $image . '</a>'.$script; |
|
| 307 | + '<a'. |
|
| 308 | + ' class="'.'certgallery'.'"'. |
|
| 309 | + ' href="'.$this->getHtmlUrlDirect().'"'. |
|
| 310 | + ' type="'.$this->mimeType().'"'. |
|
| 311 | + ' data-obje-url="'.$this->getHtmlUrl().'"'. |
|
| 312 | + ' data-title="'.strip_tags($this->getFullName()).'"'. |
|
| 313 | + '>'.$image.'</a>'.$script; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
| 317 | 317 | * {@inhericDoc} |
| 318 | 318 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals() |
| 319 | 319 | */ |
| 320 | - public function linkedIndividuals($link = '_ACT'){ |
|
| 320 | + public function linkedIndividuals($link = '_ACT') { |
|
| 321 | 321 | $rows = Database::prepare( |
| 322 | 322 | 'SELECT i_id AS xref, i_gedcom AS gedcom'. |
| 323 | 323 | ' FROM `##individuals`'. |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * {@inhericDoc} |
| 342 | 342 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies() |
| 343 | 343 | */ |
| 344 | - public function linkedFamilies($link = '_ACT'){ |
|
| 344 | + public function linkedFamilies($link = '_ACT') { |
|
| 345 | 345 | $rows = Database::prepare( |
| 346 | 346 | 'SELECT f_id AS xref, f_gedcom AS gedcom'. |
| 347 | 347 | ' FROM `##families`'. |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * |
| 367 | 367 | * @return Source|NULL Linked source |
| 368 | 368 | */ |
| 369 | - public function fetchALinkedSource(){ |
|
| 369 | + public function fetchALinkedSource() { |
|
| 370 | 370 | $sid = null; |
| 371 | 371 | |
| 372 | 372 | // Try to find in individual, then families, then other types of records. We are interested in the first available value. |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | 'gedcom_id' => $this->tree->getTreeId(), |
| 379 | 379 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
| 380 | 380 | ))->fetchOne(); |
| 381 | - if(!$ged){ |
|
| 381 | + if (!$ged) { |
|
| 382 | 382 | $ged = Database::prepare( |
| 383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
| 384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | 'gedcom_id' => $this->tree->getTreeId(), |
| 387 | 387 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
| 388 | 388 | ))->fetchOne(); |
| 389 | - if(!$ged){ |
|
| 389 | + if (!$ged) { |
|
| 390 | 390 | $ged = Database::prepare( |
| 391 | 391 | 'SELECT o_gedcom AS gedrec FROM `##other`'. |
| 392 | 392 | ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
@@ -397,28 +397,28 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | //If a record has been found, parse it to find the source reference. |
| 400 | - if($ged){ |
|
| 400 | + if ($ged) { |
|
| 401 | 401 | $gedlines = explode("\n", $ged); |
| 402 | 402 | $level = 0; |
| 403 | 403 | $levelsource = -1; |
| 404 | - $sid_tmp=null; |
|
| 404 | + $sid_tmp = null; |
|
| 405 | 405 | $sourcefound = false; |
| 406 | - foreach($gedlines as $gedline){ |
|
| 406 | + foreach ($gedlines as $gedline) { |
|
| 407 | 407 | // Get the level |
| 408 | 408 | if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) { |
| 409 | 409 | $level = $match[1]; |
| 410 | 410 | //If we are not any more within the context of a source, reset |
| 411 | - if($level <= $levelsource){ |
|
| 411 | + if ($level <= $levelsource) { |
|
| 412 | 412 | $levelsource = -1; |
| 413 | 413 | $sid_tmp = null; |
| 414 | 414 | } |
| 415 | 415 | // If a source, get the level and the reference |
| 416 | 416 | if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) { |
| 417 | 417 | $levelsource = $level; |
| 418 | - $sid_tmp=$match2[1]; |
|
| 418 | + $sid_tmp = $match2[1]; |
|
| 419 | 419 | } |
| 420 | 420 | // If the image has be found, get the source reference and exit. |
| 421 | - if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){ |
|
| 421 | + if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) { |
|
| 422 | 422 | $sid = $sid_tmp; |
| 423 | 423 | $sourcefound = true; |
| 424 | 424 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
| 429 | + if ($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
| 430 | 430 | |
| 431 | 431 | return $this->source; |
| 432 | 432 | } |
@@ -35,39 +35,39 @@ discard block |
||
| 35 | 35 | protected function update() { |
| 36 | 36 | global $WT_TREE; |
| 37 | 37 | |
| 38 | - if(Auth::isAdmin()){ |
|
| 38 | + if (Auth::isAdmin()) { |
|
| 39 | 39 | |
| 40 | 40 | $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
| 41 | 41 | $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
| 42 | 42 | |
| 43 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
| 43 | + if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
| 44 | 44 | $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
| 47 | + if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
| 48 | 48 | $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Only accept valid color for MAJ_WM_FONT_COLOR |
| 52 | 52 | $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
| 53 | - if($MAJ_WM_FONT_COLOR) { |
|
| 53 | + if ($MAJ_WM_FONT_COLOR) { |
|
| 54 | 54 | $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Only accept valid folders for MAJ_CERT_ROOTDIR |
| 58 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
| 58 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR').'/'); |
|
| 59 | 59 | if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
| 60 | 60 | $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if ($MAJ_CERT_ROOTDIR) { |
| 64 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 64 | + if (is_dir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
| 65 | 65 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
| 66 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 66 | + } elseif (File::mkdir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
| 67 | 67 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
| 68 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
| 68 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'info'); |
|
| 69 | 69 | } else { |
| 70 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
| 70 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'danger'); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | global $WT_TREE; |
| 89 | 89 | |
| 90 | 90 | $action = Filter::post('action'); |
| 91 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 91 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 92 | 92 | |
| 93 | 93 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
| 94 | 94 | $ctrl = new PageController(); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | <div id="maj-cert-page" class="center"> |
| 31 | 31 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 32 | 32 | |
| 33 | - <?php if($this->data->get('has_certif', false)) { |
|
| 33 | + <?php if ($this->data->get('has_certif', false)) { |
|
| 34 | 34 | /** @var Certificate $certificate */ |
| 35 | 35 | $certificate = $this->data->get('certificate'); |
| 36 | 36 | $has_linked_indis = $this->data->get('has_linked_indis', false); |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | <div id="certificate-edit"> |
| 50 | 50 | <?php echo $certificate->displayImage(); ?> |
| 51 | 51 | </div> |
| 52 | - <?php if($has_linked_indis || $has_linked_fams) { ?> |
|
| 52 | + <?php if ($has_linked_indis || $has_linked_fams) { ?> |
|
| 53 | 53 | <ul> |
| 54 | - <?php if($has_linked_indis) { ?> |
|
| 54 | + <?php if ($has_linked_indis) { ?> |
|
| 55 | 55 | <li> |
| 56 | 56 | <a href="#indi-certificate"> |
| 57 | 57 | <span id="indisource"><?php echo I18N::translate('Individuals'); ?></span> |
| 58 | 58 | </a> |
| 59 | 59 | </li> |
| 60 | 60 | <?php } ?> |
| 61 | - <?php if($has_linked_fams) { ?> |
|
| 61 | + <?php if ($has_linked_fams) { ?> |
|
| 62 | 62 | <li> |
| 63 | 63 | <a href="#fam-certificate"> |
| 64 | 64 | <span id="famsource"><?php echo I18N::translate('Families'); ?></span> |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | <?php } ?> |
| 68 | 68 | </ul> |
| 69 | 69 | |
| 70 | - <?php if($has_linked_indis) { ?> |
|
| 70 | + <?php if ($has_linked_indis) { ?> |
|
| 71 | 71 | <div id="indi-certificate"> |
| 72 | 72 | <?php echo FunctionsPrintLists::individualTable($this->data->get('linked_indis')); ?> |
| 73 | 73 | </div> |
| 74 | 74 | <?php } ?> |
| 75 | 75 | |
| 76 | - <?php if($has_linked_fams) { ?> |
|
| 76 | + <?php if ($has_linked_fams) { ?> |
|
| 77 | 77 | <div id="fam-certificate"> |
| 78 | 78 | <?php echo FunctionsPrintLists::familyTable($this->data->get('linked_fams')); ?> |
| 79 | 79 | </div> |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 36 | 36 | |
| 37 | 37 | <form method="get" name="selcity" action="module.php"> |
| 38 | - <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>"> |
|
| 39 | - <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action');?>"> |
|
| 40 | - <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged');?>"> |
|
| 38 | + <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module'); ?>"> |
|
| 39 | + <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action'); ?>"> |
|
| 40 | + <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged'); ?>"> |
|
| 41 | 41 | <select name="city"> |
| 42 | 42 | <?php foreach ($cities as $city) { ?> |
| 43 | - <option value="<?php echo Functions::encryptToSafeBase64($city); ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?php echo $city;?></option> |
|
| 43 | + <option value="<?php echo Functions::encryptToSafeBase64($city); ?>" <?php if (trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?php echo $city; ?></option> |
|
| 44 | 44 | <?php } ?> |
| 45 | 45 | </select> |
| 46 | - <input type="submit" value="<?php echo I18N::translate('Show');?>" /> |
|
| 46 | + <input type="submit" value="<?php echo I18N::translate('Show'); ?>" /> |
|
| 47 | 47 | </form> |
| 48 | 48 | |
| 49 | - <?php if($this->data->get('has_list', false)) { ?> |
|
| 49 | + <?php if ($this->data->get('has_list', false)) { ?> |
|
| 50 | 50 | <div class="loading-image"> </div> |
| 51 | 51 | <div class="certificate-list"> |
| 52 | - <table id="<?php echo $this->data->get('table_id');?>"> |
|
| 52 | + <table id="<?php echo $this->data->get('table_id'); ?>"> |
|
| 53 | 53 | <thead> |
| 54 | 54 | <tr> |
| 55 | 55 | <th><?php echo I18N::translate('Date'); ?></th> |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ?> |
| 66 | 66 | <tr> |
| 67 | 67 | <!-- Certificate date --> |
| 68 | - <?php if($date = $certificate->getCertificateDate()) { ?> |
|
| 68 | + <?php if ($date = $certificate->getCertificateDate()) { ?> |
|
| 69 | 69 | <td><?php echo $date->display(); ?></td> |
| 70 | 70 | <td><?php echo $date->julianDay(); ?></td> |
| 71 | 71 | <?php } else { ?> |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | <td>0</td> |
| 74 | 74 | <?php } ?> |
| 75 | 75 | <!-- Certificate Type --> |
| 76 | - <td><?php echo Filter::escapeHtml($certificate->getCertificateType() ?: ''); ?></td> |
|
| 76 | + <td><?php echo Filter::escapeHtml($certificate->getCertificateType() ?: ''); ?></td> |
|
| 77 | 77 | <!-- Certificate Name --> |
| 78 | 78 | <?php |
| 79 | 79 | $name = $certificate->getCertificateDetails() ?: ''; |
| 80 | 80 | $sortname = ""; |
| 81 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 82 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 81 | + $ct_names = preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 82 | + if ($ct_names > 0) $sortname = $match[1].'_'; |
|
| 83 | 83 | $sortname .= $name; |
| 84 | 84 | ?> |
| 85 | 85 | <td><?php echo Filter::escapeHtml($sortname); ?></td> |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function getMenu(fw\Tree $tree, $reference) {
|
| 49 | 49 | $tree_url = $tree ? $tree->getNameUrl() : ''; |
| 50 | 50 | $surname = $reference && is_string($reference) ? $reference : ''; |
| 51 | - return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 51 | + return new fw\Menu($this->getTitle(), 'module.php?mod='.$this->getName().'&mod_action=Lineage&ged='.$tree_url.'&surname='.$surname, 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | * @param string $period |
| 31 | 31 | * @param (null|int) Number of visits |
| 32 | 32 | */ |
| 33 | - private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
| 33 | + private function getNumberOfVisitsPiwik($block_id, $period = 'year') { |
|
| 34 | 34 | |
| 35 | 35 | $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
| 36 | 36 | $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
| 37 | 37 | $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
| 38 | 38 | |
| 39 | - if($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | - $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 39 | + if ($piwik_url && strlen($piwik_url) > 0 && |
|
| 40 | + $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
| 41 | 41 | $piwik_token && strlen($piwik_token) |
| 42 | 42 | ) |
| 43 | 43 | { |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $url .= '&format=PHP'; |
| 49 | 49 | $url .= '&token_auth='.$piwik_token; |
| 50 | 50 | |
| 51 | - if($fetched = File::fetchUrl($url)) { |
|
| 51 | + if ($fetched = File::fetchUrl($url)) { |
|
| 52 | 52 | $content = @unserialize($fetched); |
| 53 | - if(is_numeric($content)) return $content; |
|
| 53 | + if (is_numeric($content)) return $content; |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | $data->set('has_stats', false); |
| 73 | 73 | |
| 74 | 74 | $block_id = Filter::get('block_id'); |
| 75 | - if($block_id){ |
|
| 76 | - if(Cache::isCached('piwikCountYear', $this->module)) { |
|
| 75 | + if ($block_id) { |
|
| 76 | + if (Cache::isCached('piwikCountYear', $this->module)) { |
|
| 77 | 77 | $visitCountYear = Cache::get('piwikCountYear', $this->module); |
| 78 | 78 | } |
| 79 | - else{ |
|
| 79 | + else { |
|
| 80 | 80 | $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
| 81 | 81 | Cache::save('piwikCountYear', $visitCountYear, $this->module); |
| 82 | 82 | } |
| 83 | - if($visitCountYear){ |
|
| 83 | + if ($visitCountYear) { |
|
| 84 | 84 | $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
| 85 | - $visitCountYear = max( 0, $visitCountYear); |
|
| 85 | + $visitCountYear = max(0, $visitCountYear); |
|
| 86 | 86 | |
| 87 | 87 | $data->set('has_stats', true); |
| 88 | 88 | $data->set('visits_today', $visitCountToday); |
@@ -36,20 +36,20 @@ discard block |
||
| 36 | 36 | '<table> |
| 37 | 37 | <tr> |
| 38 | 38 | <td> |
| 39 | - <a href="pedigree.php?rootid=' . $indi->getXref() . '&ged=' . $tree->getNameUrl() . '"> |
|
| 40 | - <i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . ' |
|
| 39 | + <a href="pedigree.php?rootid=' . $indi->getXref().'&ged='.$tree->getNameUrl().'"> |
|
| 40 | + <i class="icon-pedigree"></i><br>' . I18N::translate('Default chart').' |
|
| 41 | 41 | </a> |
| 42 | 42 | </td> |
| 43 | 43 | <td> |
| 44 | - <a href="individual.php?pid=' . $indi->getXref() . '&ged=' . $tree->getNameUrl() . '"> |
|
| 45 | - <i class="icon-indis"></i><br>' . I18N::translate('Default individual') . ' |
|
| 44 | + <a href="individual.php?pid=' . $indi->getXref().'&ged='.$tree->getNameUrl().'"> |
|
| 45 | + <i class="icon-indis"></i><br>' . I18N::translate('Default individual').' |
|
| 46 | 46 | </a> |
| 47 | 47 | </td>'; |
| 48 | 48 | |
| 49 | 49 | if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) { |
| 50 | 50 | $content .= ' |
| 51 | 51 | <td> |
| 52 | - <a href="' . WT_LOGIN_URL . '?action=register"> |
|
| 52 | + <a href="' . WT_LOGIN_URL.'?action=register"> |
|
| 53 | 53 | <i class="icon-user_add"></i><br>'.I18N::translate('Request new user account').' |
| 54 | 54 | </a> |
| 55 | 55 | </td>'; |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | </table>'; |
| 60 | 60 | |
| 61 | 61 | // Piwik Statistics |
| 62 | - if ($this->data->get('piwik_enabled', false)){ |
|
| 62 | + if ($this->data->get('piwik_enabled', false)) { |
|
| 63 | 63 | $content .= ' |
| 64 | 64 | <div class="center"> |
| 65 | 65 | <div id="piwik_stats"> |
| 66 | - <i class="icon-loading-small"></i> ' . I18N::translate('Retrieving Piwik statistics...') . ' |
|
| 66 | + <i class="icon-loading-small"></i> ' . I18N::translate('Retrieving Piwik statistics...').' |
|
| 67 | 67 | </div> |
| 68 | 68 | </div>'; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $content .= '<hr />'; |
|
| 71 | + $content .= '<hr />'; |
|
| 72 | 72 | |
| 73 | 73 | // Login section - based on login_block |
| 74 | 74 | if (Auth::check()) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | <div class="center"> |
| 77 | 77 | <form method="post" action="logout.php" name="logoutform" onsubmit="return true;"> |
| 78 | 78 | <br> |
| 79 | - <a href="edituser.php" class="name2">' . I18N::translate('Logged in as ') . ' ' . Auth::user()->getRealNameHtml() . '</a> |
|
| 79 | + <a href="edituser.php" class="name2">' . I18N::translate('Logged in as ').' '.Auth::user()->getRealNameHtml().'</a> |
|
| 80 | 80 | <br><br> |
| 81 | 81 | <input type="submit" value="'.I18N::translate('Logout').'"> |
| 82 | 82 | <br><br> |
@@ -98,34 +98,34 @@ discard block |
||
| 98 | 98 | </label> |
| 99 | 99 | </div> |
| 100 | 100 | <div> |
| 101 | - <input type="submit" value="'. I18N::translate('Login'). '"> |
|
| 101 | + <input type="submit" value="'. I18N::translate('Login').'"> |
|
| 102 | 102 | </div> |
| 103 | 103 | <div> |
| 104 | 104 | <a href="#" id="maj-passwd_click">'. I18N::translate('Request new password').'</a> |
| 105 | 105 | </div>'; |
| 106 | 106 | if (Site::getPreference('USE_REGISTRATION_MODULE')) { |
| 107 | - $content.= ' |
|
| 107 | + $content .= ' |
|
| 108 | 108 | <div> |
| 109 | - <a href="'.WT_LOGIN_URL.'?action=register">'. I18N::translate('Request new user account').'</a> |
|
| 109 | + <a href="'.WT_LOGIN_URL.'?action=register">'.I18N::translate('Request new user account').'</a> |
|
| 110 | 110 | </div>'; |
| 111 | 111 | } |
| 112 | - $content.= ' |
|
| 112 | + $content .= ' |
|
| 113 | 113 | </form>'; // close "login-form" |
| 114 | 114 | |
| 115 | 115 | // hidden New Password block |
| 116 | - $content.= ' |
|
| 116 | + $content .= ' |
|
| 117 | 117 | <div id="maj-new_passwd"> |
| 118 | 118 | <form id="maj-new_passwd_form" name="new_passwd_form" action="'.WT_LOGIN_URL.'" method="post"> |
| 119 | 119 | <input type="hidden" name="time" value=""> |
| 120 | 120 | <input type="hidden" name="action" value="requestpw"> |
| 121 | 121 | <h4>'. I18N::translate('Lost password request').'</h4> |
| 122 | 122 | <div> |
| 123 | - <label for="maj-new_passwd_username">'. I18N::translate('Username or email address') . ' |
|
| 123 | + <label for="maj-new_passwd_username">'. I18N::translate('Username or email address').' |
|
| 124 | 124 | <input type="text" id="maj-new_passwd_username" name="new_passwd_username" value=""> |
| 125 | 125 | </label> |
| 126 | 126 | </div> |
| 127 | 127 | <div> |
| 128 | - <input type="submit" value="'. I18N::translate('Continue'). '"> |
|
| 128 | + <input type="submit" value="'. I18N::translate('Continue').'"> |
|
| 129 | 129 | </div> |
| 130 | 130 | </form> |
| 131 | 131 | </div> |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 24 | 24 | */ |
| 25 | 25 | protected function renderContent() { |
| 26 | - if($this->data->get('has_stats', false)) { |
|
| 27 | - $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)' , |
|
| 28 | - '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', |
|
| 26 | + if ($this->data->get('has_stats', false)) { |
|
| 27 | + $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)', |
|
| 28 | + '<span class="odometer">'.I18N::number($this->data->get('visits_year')).'</span>', |
|
| 29 | 29 | date('Y'), |
| 30 | - '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
|
| 30 | + '<span class="odometer">'.I18N::number($this->data->get('visits_today')).'</span>' |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | else { |