[impressum] Add addon config

- Update mentions to .htconfig.php
This commit is contained in:
Hypolite Petovan 2018-06-27 23:13:20 -04:00
parent 990b5bf231
commit 723625f95f
3 changed files with 52 additions and 15 deletions

View file

@ -22,17 +22,13 @@ in the source of the page to make in harder for harvesting tools.
Manual Configuration Manual Configuration
-------------------- --------------------
If you for any reason prefer to use a configuration file instead, you can set the following variables in the .htconfig file If you for any reason you prefer to use a configuration file instead, you can set the following variables in the config/local.ini.php file
$a->config['impressum']['owner'] this is the Name of the Operator [impressum]
$a->config['impressum']['ownerprofile'] this is an optional Friendica account owner = this is the Name of the Operator
where the above owner name will link to ownerprofile = this is an optional Friendica account where the above owner name will link to
$a->config['impressum']['email'] a contact email address (optional) email = a contact email address (optional)
will be displayed slightly obfuscated will be displayed slightly obfuscated as name(at)example(dot)com
as name(at)example(dot)com postal = should contain a postal address where you can be reached at (optional)
$a->config['impressum']['postal'] should contain a postal address where notes = additional informations that should be displayed in the Impressum block
you can be reached at (optional) footer_text = Text that will be displayed at the bottom of the pages.
$a->config['impressum']['notes'] additional informations that should
be displayed in the Impressum block
$a->config['impressum']['footer_text'] Text that will be displayed at
the bottom of the pages.

View file

@ -0,0 +1,33 @@
<?php return <<<INI
; Warning: Don't change this file! It only holds the default config values for this addon.
; Instead overwrite these config values in config/local.ini.php in your Friendica directory
[impressum]
; owner (String)
; This is the Name of the Operator
owner =
; ownerprofile (String)
; This is an optional Friendica account where the above owner name will link to
ownerprofile =
; email (String)
; A contact email address (optional)
; Will be displayed slightly obfuscated as name(at)example(dot)com
email =
; postal (String)
; Should contain a postal address where you can be reached at (optional)
postal =
; notes (String)
; Additional informations that should be displayed in the Impressum block
notes =
; footer_text (String)
; Text that will be displayed at the bottom of the pages.
footer_text =
INI;
//Keep this line

View file

@ -15,12 +15,14 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
function impressum_install() { function impressum_install() {
Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("installed impressum Addon"); logger("installed impressum Addon");
} }
function impressum_uninstall() { function impressum_uninstall() {
Addon::unregisterHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
logger("uninstalled impressum Addon"); logger("uninstalled impressum Addon");
@ -46,6 +48,12 @@ function impressum_footer($a, &$b) {
$b .= '<div id="impressum_footer">'.$text.'</div>'; $b .= '<div id="impressum_footer">'.$text.'</div>';
} }
} }
function impressum_load_config(\Friendica\App $a)
{
$a->loadConfigFile(__DIR__. '/config/impressum.ini.php');
}
function impressum_show($a,&$b) { function impressum_show($a,&$b) {
$b .= '<h3>'.L10n::t('Impressum').'</h3>'; $b .= '<h3>'.L10n::t('Impressum').'</h3>';
$owner = Config::get('impressum', 'owner'); $owner = Config::get('impressum', 'owner');