[various] Use __DIR__ constant in all Page registerStylesheet and registerFooterScript calls

This commit is contained in:
Hypolite Petovan 2021-11-20 04:29:09 -05:00
parent 5c0b20b21f
commit f0522a998b
10 changed files with 14 additions and 26 deletions

View File

@ -85,11 +85,8 @@ function cookienotice_addon_admin_post(App $a)
*/ */
function cookienotice_page_content_top(App $a, &$b) function cookienotice_page_content_top(App $a, &$b)
{ {
$stylesheetPath = __DIR__ . '/cookienotice.css'; DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css');
$footerscriptPath = __DIR__ . '/cookienotice.js'; DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js');
DI::page()->registerStylesheet($stylesheetPath);
DI::page()->registerFooterScript($footerscriptPath);
} }
/** /**

View File

@ -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/'); $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/diaspora/');
$s .= Renderer::replaceMacros($t, [ $s .= Renderer::replaceMacros($t, [

View File

@ -129,9 +129,7 @@ function geonames_addon_settings(App $a, &$s)
return; return;
} }
/* Add our stylesheet to the page so we can make our settings look nice */ DI::page()->registerStylesheet(__DIR__ . '/geonames.css');
$stylesheetPath = __DIR__ . '/geonames.css';
DI::page()->registerStylesheet($stylesheetPath);
/* Get the current state of our config variable */ /* Get the current state of our config variable */
$enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable')); $enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));

View File

@ -29,8 +29,8 @@ function js_upload_form(App $a, array &$b)
{ {
$b['default_upload'] = false; $b['default_upload'] = false;
DI::page()->registerStylesheet('addon/js_upload/file-uploader/client/fileuploader.css'); DI::page()->registerStylesheet(__DIR__ . '/file-uploader/client/fileuploader.css');
DI::page()->registerFooterScript('addon/js_upload/file-uploader/client/fileuploader.js'); DI::page()->registerFooterScript(__DIR__ . '/file-uploader/client/fileuploader.js');
$tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload'); $tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload');
$b['addon_text'] .= Renderer::replaceMacros($tpl, [ $b['addon_text'] .= Renderer::replaceMacros($tpl, [

View File

@ -54,9 +54,8 @@ function nsfw_addon_settings(&$a, &$s)
return; 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'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/nsfw/nsfw.css' . '" media="all" />' . "\r\n";
$enable_checked = (intval(DI::pConfig()->get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" '); $enable_checked = (intval(DI::pConfig()->get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" ');
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words'); $words = DI::pConfig()->get(local_user(), 'nsfw', 'words');

View File

@ -23,9 +23,7 @@ function pageheader_addon_admin(App &$a, &$s)
return; return;
} }
/* Add our stylesheet to the page so we can make our settings look nice */ DI::page()->registerStylesheet(__DIR__ . '/pageheader.css');
$stylesheetPath = __DIR__ . '/pageheader.css';
DI::page()->registerStylesheet($stylesheetPath);
$words = DI::config()->get('pageheader','text'); $words = DI::config()->get('pageheader','text');
if(! $words) if(! $words)
@ -62,8 +60,7 @@ function pageheader_fetch(App $a, &$b)
$s = DI::config()->get('pageheader', 'text'); $s = DI::config()->get('pageheader', 'text');
} }
$stylesheetPath = __DIR__ .'/pageheader.css'; DI::page()->registerStylesheet(__DIR__ .'/pageheader.css');
DI::page()->registerStylesheet($stylesheetPath);
if ($s) { if ($s) {
$b .= '<div class="pageheader">' . $s . '</div>'; $b .= '<div class="pageheader">' . $s . '</div>';

View File

@ -30,7 +30,7 @@ function qcomment_install()
function qcomment_footer(\Friendica\App $a, &$b) 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) function qcomment_addon_settings(&$a, &$s)

View File

@ -24,9 +24,7 @@ function showmore_addon_settings(&$a, &$s)
return; return;
} }
/* Add our stylesheet to the page so we can make our settings look nice */ DI::page()->registerStylesheet(__DIR__ . '/showmore.css', 'all');
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/showmore/showmore.css'.'" media="all"/>'."\r\n";
$enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"'); $enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"');
$chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100); $chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);

View File

@ -97,9 +97,9 @@ function smileybutton_jot_tool(Friendica\App $a, &$b)
$s .= '</tr></table>'; $s .= '</tr></table>';
//Add css to header //Add css to header
$css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css'; $css_file = __DIR__ . '/view/' . $a->getCurrentTheme() . '.css';
if (!file_exists($css_file)) { if (!file_exists($css_file)) {
$css_file = 'addon/smileybutton/view/default.css'; $css_file = __DIR__ . '/view/default.css';
} }
DI::page()->registerStylesheet($css_file); DI::page()->registerStylesheet($css_file);

View File

@ -25,9 +25,8 @@ function superblock_addon_settings(&$a, &$s)
return; 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'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/superblock/superblock.css' . '" media="all" />' . "\r\n";
$words = DI::pConfig()->get(local_user(), 'system', 'blocked'); $words = DI::pConfig()->get(local_user(), 'system', 'blocked');
if (!$words) { if (!$words) {