@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | * @return string Encryption key |
| 130 | 130 | */ |
| 131 | 131 | protected static function getBase64EncryptionKey() { |
| 132 | - $key = 'STANDARDKEYIFNOSERVER'; |
|
| 133 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
| 134 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 132 | + $key = 'STANDARDKEYIFNOSERVER'; |
|
| 133 | + if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
| 134 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 135 | 135 | |
| 136 | - return $key; |
|
| 136 | + return $key; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -172,20 +172,20 @@ discard block |
||
| 172 | 172 | throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
| 173 | 173 | |
| 174 | 174 | if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) |
| 175 | - throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 175 | + throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 176 | 176 | |
| 177 | - $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); |
|
| 178 | - $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); |
|
| 177 | + $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); |
|
| 178 | + $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); |
|
| 179 | 179 | |
| 180 | - $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey()); |
|
| 180 | + $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey()); |
|
| 181 | 181 | |
| 182 | - if($decrypted === false) { |
|
| 183 | - throw new \InvalidArgumentException('The message has been tampered with in transit.'); |
|
| 184 | - } |
|
| 182 | + if($decrypted === false) { |
|
| 183 | + throw new \InvalidArgumentException('The message has been tampered with in transit.'); |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - //sodium_memzero($encrypted); // Requires PHP 7.2 |
|
| 186 | + //sodium_memzero($encrypted); // Requires PHP 7.2 |
|
| 187 | 187 | |
| 188 | - return $decrypted; |
|
| 188 | + return $decrypted; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public static function encodeFileSystemToUtf8($string){ |
| 198 | 198 | if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
| 199 | - return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
| 199 | + return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
| 200 | 200 | } |
| 201 | 201 | return $string; |
| 202 | 202 | } |
@@ -261,20 +261,20 @@ discard block |
||
| 261 | 261 | * @return boolean|string Is supported? |
| 262 | 262 | */ |
| 263 | 263 | public static function isImageTypeSupported($reqtype) { |
| 264 | - $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
|
| 265 | - $reqtype = strtolower($reqtype); |
|
| 264 | + $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
|
| 265 | + $reqtype = strtolower($reqtype); |
|
| 266 | 266 | |
| 267 | - if (empty($supportByGD[$reqtype])) { |
|
| 268 | - return false; |
|
| 269 | - } |
|
| 267 | + if (empty($supportByGD[$reqtype])) { |
|
| 268 | + return false; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - $type = $supportByGD[$reqtype]; |
|
| 271 | + $type = $supportByGD[$reqtype]; |
|
| 272 | 272 | |
| 273 | - if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) { |
|
| 274 | - return $type; |
|
| 275 | - } |
|
| 273 | + if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) { |
|
| 274 | + return $type; |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - return false; |
|
| 277 | + return false; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | } |
@@ -31,147 +31,147 @@ discard block |
||
| 31 | 31 | * Certificates Module. |
| 32 | 32 | */ |
| 33 | 33 | class CertificatesModule |
| 34 | - extends AbstractModule |
|
| 35 | - implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface, DependentInterface |
|
| 34 | + extends AbstractModule |
|
| 35 | + implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface, DependentInterface |
|
| 36 | 36 | { |
| 37 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 38 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 37 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 38 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Provider for Certificates |
|
| 42 | - * @var CertificateProviderInterface $provider |
|
| 43 | - */ |
|
| 44 | - protected $provider; |
|
| 40 | + /** |
|
| 41 | + * Provider for Certificates |
|
| 42 | + * @var CertificateProviderInterface $provider |
|
| 43 | + */ |
|
| 44 | + protected $provider; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * {@inhericDoc} |
|
| 48 | - */ |
|
| 49 | - public function getTitle() { |
|
| 50 | - return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
| 51 | - } |
|
| 46 | + /** |
|
| 47 | + * {@inhericDoc} |
|
| 48 | + */ |
|
| 49 | + public function getTitle() { |
|
| 50 | + return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * {@inhericDoc} |
|
| 55 | - */ |
|
| 56 | - public function getDescription() { |
|
| 57 | - return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
| 58 | - } |
|
| 53 | + /** |
|
| 54 | + * {@inhericDoc} |
|
| 55 | + */ |
|
| 56 | + public function getDescription() { |
|
| 57 | + return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * {@inhericDoc} |
|
| 62 | - */ |
|
| 63 | - public function modAction($mod_action) { |
|
| 64 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 65 | - } |
|
| 60 | + /** |
|
| 61 | + * {@inhericDoc} |
|
| 62 | + */ |
|
| 63 | + public function modAction($mod_action) { |
|
| 64 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * {@inheritDoc} |
|
| 69 | - * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
| 70 | - */ |
|
| 71 | - public function validatePrerequisites() { |
|
| 72 | - } |
|
| 67 | + /** |
|
| 68 | + * {@inheritDoc} |
|
| 69 | + * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
| 70 | + */ |
|
| 71 | + public function validatePrerequisites() { |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * {@inhericDoc} |
|
| 76 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 77 | - */ |
|
| 78 | - public function getConfigLink() { |
|
| 79 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 80 | - } |
|
| 74 | + /** |
|
| 75 | + * {@inhericDoc} |
|
| 76 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 77 | + */ |
|
| 78 | + public function getConfigLink() { |
|
| 79 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * {@inhericDoc} |
|
| 84 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 85 | - */ |
|
| 86 | - public function getSubscribedHooks() { |
|
| 87 | - return array( |
|
| 88 | - 'hFactSourcePrepend' => 50, |
|
| 89 | - 'hGetExpectedTags' => 50, |
|
| 90 | - 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
| 91 | - 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
| 92 | - 'hAddSimpleTag#SOUR' => 50, |
|
| 93 | - 'hHasHelpTextTag#_ACT' => 50, |
|
| 94 | - 'hGetHelpTextTag#_ACT' => 50 |
|
| 95 | - ); |
|
| 96 | - } |
|
| 82 | + /** |
|
| 83 | + * {@inhericDoc} |
|
| 84 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 85 | + */ |
|
| 86 | + public function getSubscribedHooks() { |
|
| 87 | + return array( |
|
| 88 | + 'hFactSourcePrepend' => 50, |
|
| 89 | + 'hGetExpectedTags' => 50, |
|
| 90 | + 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
| 91 | + 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
| 92 | + 'hAddSimpleTag#SOUR' => 50, |
|
| 93 | + 'hHasHelpTextTag#_ACT' => 50, |
|
| 94 | + 'hGetHelpTextTag#_ACT' => 50 |
|
| 95 | + ); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * {@inhericDoc} |
|
| 100 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 101 | - */ |
|
| 102 | - public function getMenu(Tree $tree, $reference = null) { |
|
| 103 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 104 | - return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
| 105 | - } |
|
| 98 | + /** |
|
| 99 | + * {@inhericDoc} |
|
| 100 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 101 | + */ |
|
| 102 | + public function getMenu(Tree $tree, $reference = null) { |
|
| 103 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 104 | + return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * {@inhericDoc} |
|
| 109 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
| 110 | - */ |
|
| 111 | - public function hFactSourcePrepend($srec) { |
|
| 112 | - $wt_tree = Globals::getTree(); |
|
| 113 | - $html=''; |
|
| 114 | - $sid=null; |
|
| 107 | + /** |
|
| 108 | + * {@inhericDoc} |
|
| 109 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
| 110 | + */ |
|
| 111 | + public function hFactSourcePrepend($srec) { |
|
| 112 | + $wt_tree = Globals::getTree(); |
|
| 113 | + $html=''; |
|
| 114 | + $sid=null; |
|
| 115 | 115 | |
| 116 | - if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)){ |
|
| 117 | - if (!$srec || strlen($srec) == 0) return $html; |
|
| 116 | + if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)){ |
|
| 117 | + if (!$srec || strlen($srec) == 0) return $html; |
|
| 118 | 118 | |
| 119 | - $certificate = null; |
|
| 120 | - $subrecords = explode("\n", $srec); |
|
| 121 | - $levelSOUR = substr($subrecords[0], 0, 1); |
|
| 122 | - $match = null; |
|
| 123 | - if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
| 124 | - $sid=$match[1]; |
|
| 125 | - }; |
|
| 126 | - $nb_subrecords = count($subrecords); |
|
| 127 | - for ($i=0; $i < $nb_subrecords; $i++) { |
|
| 128 | - $subrecords[$i] = trim($subrecords[$i]); |
|
| 129 | - $tag = substr($subrecords[$i], 2, 4); |
|
| 130 | - $text = substr($subrecords[$i], 7); |
|
| 131 | - if($tag == '_ACT') $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
| 132 | - } |
|
| 119 | + $certificate = null; |
|
| 120 | + $subrecords = explode("\n", $srec); |
|
| 121 | + $levelSOUR = substr($subrecords[0], 0, 1); |
|
| 122 | + $match = null; |
|
| 123 | + if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
| 124 | + $sid=$match[1]; |
|
| 125 | + }; |
|
| 126 | + $nb_subrecords = count($subrecords); |
|
| 127 | + for ($i=0; $i < $nb_subrecords; $i++) { |
|
| 128 | + $subrecords[$i] = trim($subrecords[$i]); |
|
| 129 | + $tag = substr($subrecords[$i], 2, 4); |
|
| 130 | + $text = substr($subrecords[$i], 7); |
|
| 131 | + if($tag == '_ACT') $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - if($certificate && $certificate->canShow()) |
|
| 135 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 134 | + if($certificate && $certificate->canShow()) |
|
| 135 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 136 | 136 | |
| 137 | - } |
|
| 138 | - return $html; |
|
| 139 | - } |
|
| 137 | + } |
|
| 138 | + return $html; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * {@inhericDoc} |
|
| 143 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
| 144 | - */ |
|
| 145 | - public function hFactSourceAppend($srec) { } |
|
| 141 | + /** |
|
| 142 | + * {@inhericDoc} |
|
| 143 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
| 144 | + */ |
|
| 145 | + public function hFactSourceAppend($srec) { } |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * {@inhericDoc} |
|
| 149 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
| 150 | - */ |
|
| 151 | - public function hGetExpectedTags() { |
|
| 152 | - return array('SOUR' => '_ACT'); |
|
| 153 | - } |
|
| 147 | + /** |
|
| 148 | + * {@inhericDoc} |
|
| 149 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
| 150 | + */ |
|
| 151 | + public function hGetExpectedTags() { |
|
| 152 | + return array('SOUR' => '_ACT'); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * {@inhericDoc} |
|
| 157 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
| 158 | - */ |
|
| 159 | - public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
| 160 | - $html = ''; |
|
| 161 | - switch($tag){ |
|
| 162 | - case '_ACT': |
|
| 163 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 164 | - break; |
|
| 165 | - } |
|
| 166 | - return $html; |
|
| 167 | - } |
|
| 155 | + /** |
|
| 156 | + * {@inhericDoc} |
|
| 157 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
| 158 | + */ |
|
| 159 | + public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
| 160 | + $html = ''; |
|
| 161 | + switch($tag){ |
|
| 162 | + case '_ACT': |
|
| 163 | + if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 164 | + break; |
|
| 165 | + } |
|
| 166 | + return $html; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * {@inhericDoc} |
|
| 171 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
| 172 | - */ |
|
| 173 | - public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
| 174 | - $html = ''; |
|
| 169 | + /** |
|
| 170 | + * {@inhericDoc} |
|
| 171 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
| 172 | + */ |
|
| 173 | + public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
| 174 | + $html = ''; |
|
| 175 | 175 | |
| 176 | 176 | switch($tag){ |
| 177 | 177 | case '_ACT': |
@@ -199,75 +199,75 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return $html; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * {@inhericDoc} |
|
| 206 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
| 207 | - */ |
|
| 208 | - public function hAddSimpleTag($context, $level) { |
|
| 209 | - switch($context){ |
|
| 210 | - case 'SOUR': |
|
| 211 | - FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
| 212 | - break; |
|
| 213 | - } |
|
| 214 | - } |
|
| 204 | + /** |
|
| 205 | + * {@inhericDoc} |
|
| 206 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
| 207 | + */ |
|
| 208 | + public function hAddSimpleTag($context, $level) { |
|
| 209 | + switch($context){ |
|
| 210 | + case 'SOUR': |
|
| 211 | + FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
| 212 | + break; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * {@inhericDoc} |
|
| 218 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
| 219 | - */ |
|
| 220 | - public function hHasHelpTextTag($tag) { |
|
| 221 | - switch($tag){ |
|
| 216 | + /** |
|
| 217 | + * {@inhericDoc} |
|
| 218 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
| 219 | + */ |
|
| 220 | + public function hHasHelpTextTag($tag) { |
|
| 221 | + switch($tag){ |
|
| 222 | 222 | case '_ACT': |
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | return false; |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * {@inhericDoc} |
|
| 230 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
| 231 | - */ |
|
| 232 | - public function hGetHelpTextTag($tag) { |
|
| 233 | - switch($tag){ |
|
| 234 | - case '_ACT': |
|
| 235 | - return array( |
|
| 236 | - I18N::translate('Certificate'), |
|
| 237 | - '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
| 238 | - default: |
|
| 239 | - return null; |
|
| 240 | - } |
|
| 241 | - } |
|
| 228 | + /** |
|
| 229 | + * {@inhericDoc} |
|
| 230 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
| 231 | + */ |
|
| 232 | + public function hGetHelpTextTag($tag) { |
|
| 233 | + switch($tag){ |
|
| 234 | + case '_ACT': |
|
| 235 | + return array( |
|
| 236 | + I18N::translate('Certificate'), |
|
| 237 | + '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
| 238 | + default: |
|
| 239 | + return null; |
|
| 240 | + } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Returns the default Certificate File Provider, as configured in the module |
|
| 245 | - * |
|
| 246 | - * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
| 247 | - */ |
|
| 248 | - public function getProvider() { |
|
| 249 | - if(!$this->provider) { |
|
| 250 | - $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
| 251 | - $this->provider = new CertificateFileProvider($root_path, Globals::getTree()); |
|
| 252 | - } |
|
| 253 | - return $this->provider; |
|
| 254 | - } |
|
| 243 | + /** |
|
| 244 | + * Returns the default Certificate File Provider, as configured in the module |
|
| 245 | + * |
|
| 246 | + * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
| 247 | + */ |
|
| 248 | + public function getProvider() { |
|
| 249 | + if(!$this->provider) { |
|
| 250 | + $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
| 251 | + $this->provider = new CertificateFileProvider($root_path, Globals::getTree()); |
|
| 252 | + } |
|
| 253 | + return $this->provider; |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | 256 | |
| 257 | - /** |
|
| 258 | - * Return the HTML code for custom simple tag _ACT |
|
| 259 | - * |
|
| 260 | - * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
| 261 | - * @param string|null $sid Linked Source ID, if it exists |
|
| 262 | - */ |
|
| 263 | - protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
| 264 | - $html = ''; |
|
| 265 | - if($certificate){ |
|
| 266 | - $certificate->setSource($sid); |
|
| 267 | - $html = $certificate->displayImage('icon'); |
|
| 268 | - } |
|
| 269 | - return $html; |
|
| 270 | - } |
|
| 257 | + /** |
|
| 258 | + * Return the HTML code for custom simple tag _ACT |
|
| 259 | + * |
|
| 260 | + * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
| 261 | + * @param string|null $sid Linked Source ID, if it exists |
|
| 262 | + */ |
|
| 263 | + protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
| 264 | + $html = ''; |
|
| 265 | + if($certificate){ |
|
| 266 | + $certificate->setSource($sid); |
|
| 267 | + $html = $certificate->displayImage('icon'); |
|
| 268 | + } |
|
| 269 | + return $html; |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | } |