From: Hypolite Petovan Date: Sat, 20 Nov 2021 09:29:09 +0000 (-0500) Subject: [various] Use __DIR__ constant in all Page registerStylesheet and registerFooterScrip... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f0522a998b1ab1be173bb6353e43f738a40f4205;p=friendica-addons.git [various] Use __DIR__ constant in all Page registerStylesheet and registerFooterScript calls --- diff --git a/cookienotice/cookienotice.php b/cookienotice/cookienotice.php index bec98184..f3529973 100644 --- a/cookienotice/cookienotice.php +++ b/cookienotice/cookienotice.php @@ -85,11 +85,8 @@ function cookienotice_addon_admin_post(App $a) */ function cookienotice_page_content_top(App $a, &$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'); } /** diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index e47f03b1..7b747bef 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -93,7 +93,7 @@ function diaspora_settings(App $a, &$s) } } - DI::page()->registerStylesheet('addon/diaspora/diaspora.css'); + DI::page()->registerStylesheet(__DIR__ . '/diaspora.css'); $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/diaspora/'); $s .= Renderer::replaceMacros($t, [ diff --git a/geonames/geonames.php b/geonames/geonames.php index eb12728f..5fdf65ef 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -129,9 +129,7 @@ function geonames_addon_settings(App $a, &$s) return; } - /* Add our stylesheet to the page so we can make our settings look nice */ - $stylesheetPath = __DIR__ . '/geonames.css'; - DI::page()->registerStylesheet($stylesheetPath); + DI::page()->registerStylesheet(__DIR__ . '/geonames.css'); /* Get the current state of our config variable */ $enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable')); diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index e67d2ff0..72653d55 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -29,8 +29,8 @@ function js_upload_form(App $a, array &$b) { $b['default_upload'] = false; - DI::page()->registerStylesheet('addon/js_upload/file-uploader/client/fileuploader.css'); - DI::page()->registerFooterScript('addon/js_upload/file-uploader/client/fileuploader.js'); + DI::page()->registerStylesheet(__DIR__ . '/file-uploader/client/fileuploader.css'); + DI::page()->registerFooterScript(__DIR__ . '/file-uploader/client/fileuploader.js'); $tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload'); $b['addon_text'] .= Renderer::replaceMacros($tpl, [ diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 9f81b29d..1cbcf7c8 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -54,9 +54,8 @@ function nsfw_addon_settings(&$a, &$s) return; } - /* Add our stylesheet to the page so we can make our settings look nice */ + DI::page()->registerStylesheet(__DIR__ . '/nsfw.css', 'all'); - DI::page()['htmlhead'] .= '' . "\r\n"; $enable_checked = (intval(DI::pConfig()->get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" '); $words = DI::pConfig()->get(local_user(), 'nsfw', 'words'); diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index ce3b2684..9dfe3c02 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -23,9 +23,7 @@ function pageheader_addon_admin(App &$a, &$s) return; } - /* Add our stylesheet to the page so we can make our settings look nice */ - $stylesheetPath = __DIR__ . '/pageheader.css'; - DI::page()->registerStylesheet($stylesheetPath); + DI::page()->registerStylesheet(__DIR__ . '/pageheader.css'); $words = DI::config()->get('pageheader','text'); if(! $words) @@ -62,8 +60,7 @@ function pageheader_fetch(App $a, &$b) $s = DI::config()->get('pageheader', 'text'); } - $stylesheetPath = __DIR__ .'/pageheader.css'; - DI::page()->registerStylesheet($stylesheetPath); + DI::page()->registerStylesheet(__DIR__ .'/pageheader.css'); if ($s) { $b .= ''; diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index ed110f66..f662aecc 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -30,7 +30,7 @@ function qcomment_install() function qcomment_footer(\Friendica\App $a, &$b) { - DI::page()->registerFooterScript(__DIR__ . '/qcomment.js'); + DI::page()->registerFooterScript('addon/qcomment/qcomment.js'); } function qcomment_addon_settings(&$a, &$s) diff --git a/showmore/showmore.php b/showmore/showmore.php index dd6d4773..574be70f 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -24,9 +24,7 @@ function showmore_addon_settings(&$a, &$s) return; } - /* Add our stylesheet to the page so we can make our settings look nice */ - - DI::page()['htmlhead'] .= ''."\r\n"; + DI::page()->registerStylesheet(__DIR__ . '/showmore.css', 'all'); $enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"'); $chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100); diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index f01a6201..1a1f1d63 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -97,9 +97,9 @@ function smileybutton_jot_tool(Friendica\App $a, &$b) $s .= ''; //Add css to header - $css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css'; + $css_file = __DIR__ . '/view/' . $a->getCurrentTheme() . '.css'; if (!file_exists($css_file)) { - $css_file = 'addon/smileybutton/view/default.css'; + $css_file = __DIR__ . '/view/default.css'; } DI::page()->registerStylesheet($css_file); diff --git a/superblock/superblock.php b/superblock/superblock.php index 7bf2bc4c..d3186087 100644 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -25,9 +25,8 @@ function superblock_addon_settings(&$a, &$s) return; } - /* Add our stylesheet to the page so we can make our settings look nice */ + DI::page()->registerStylesheet(__DIR__ . '/superblock.css', 'all'); - DI::page()['htmlhead'] .= '' . "\r\n"; $words = DI::pConfig()->get(local_user(), 'system', 'blocked'); if (!$words) {