]> git.mxchange.org Git - friendica-addons.git/blobdiff - cookienotice/cookienotice.php
translations updates for 2023.03
[friendica-addons.git] / cookienotice / cookienotice.php
index a5df0d2d6110179ea730050966bbbb105954fe87..2bd6f9b1baf3ee0891c245e4bfa911652a2a11a8 100644 (file)
@@ -28,14 +28,13 @@ function cookienotice_install()
  * cookienotice_addon_admin
  * creates the admins config panel
  *
- * @param App    $a
  * @param string $s The existing config panel html so far
  *
  * @return void
  */
-function cookienotice_addon_admin(App $a, &$s)
+function cookienotice_addon_admin(&$s)
 {
-       if (!is_site_admin()) {
+       if (!DI::userSession()->isSiteAdmin()) {
                return;
        }
 
@@ -57,20 +56,17 @@ function cookienotice_addon_admin(App $a, &$s)
  * cookienotice_addon_admin_post
  * handles the post request from the admin panel
  *
- * @param App    $a
- *
  * @return void
  */
-function cookienotice_addon_admin_post(App $a)
+function cookienotice_addon_admin_post()
 {
-       if (!is_site_admin()) {
+       if (!DI::userSession()->isSiteAdmin()) {
                return;
        }
 
        if ($_POST['cookienotice-submit']) {
                DI::config()->set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text'])));
                DI::config()->set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext'])));
-               info(DI::l10n()->t('cookienotice Settings saved.'));
        }
 }
 
@@ -79,18 +75,14 @@ function cookienotice_addon_admin_post(App $a)
  * page_content_top hook
  * adds css and scripts to the <head> section of the html
  *
- * @param App    $a
  * @param string $b unused - the header html incl. nav
  *
  * @return void
  */
-function cookienotice_page_content_top(App $a, &$b)
+function cookienotice_page_content_top(string &$b)
 {
-       $stylesheetPath = __DIR__ . '/cookienotice.css';
-       $footerscriptPath = __DIR__ . '/cookienotice.js';
-
-       DI::page()->registerStylesheet($stylesheetPath);
-       DI::page()->registerFooterScript($footerscriptPath);
+       DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css');
+       DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js');
 }
 
 /**
@@ -98,12 +90,11 @@ function cookienotice_page_content_top(App $a, &$b)
  * page_end hook
  * ads our cookienotice box to the end of the html
  *
- * @param App    $a
  * @param string $b the page html
  *
  * @return void
  */
-function cookienotice_page_end(App $a, &$b)
+function cookienotice_page_end(string &$b)
 {
        $text = (string)DI::config()->get('cookienotice', 'text', DI::l10n()->t('This website uses cookies to recognize revisiting and logged in users. You accept the usage of these cookies by continue browsing this website.'));
        $oktext = (string)DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));