Ejemplo n.º 1
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend()
  */
 public function hFactSourcePrepend($srec)
 {
     global $WT_TREE;
     $html = '';
     $sid = null;
     if ($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)) {
         if (!$srec || strlen($srec) == 0) {
             return $html;
         }
         $certificate = null;
         $subrecords = explode("\n", $srec);
         $levelSOUR = substr($subrecords[0], 0, 1);
         $match = null;
         if (preg_match('~^' . $levelSOUR . ' SOUR @(' . WT_REGEX_XREF . ')@$~', $subrecords[0], $match)) {
             $sid = $match[1];
         }
         $nb_subrecords = count($subrecords);
         for ($i = 0; $i < $nb_subrecords; $i++) {
             $subrecords[$i] = trim($subrecords[$i]);
             $tag = substr($subrecords[$i], 2, 4);
             $text = substr($subrecords[$i], 7);
             if ($tag == '_ACT') {
                 $certificate = new Certificate($text, $WT_TREE, $this->getProvider());
             }
         }
         if ($certificate && $certificate->canShow()) {
             $html = $this->getDisplay_ACT($certificate, $sid);
         }
     }
     return $html;
 }