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

pull/1210/head
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)
{
$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');
}
/**

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/');
$s .= Renderer::replaceMacros($t, [

View File

@ -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'));

View File

@ -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, [

View File

@ -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'] .= '<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" ');
$words = DI::pConfig()->get(local_user(), 'nsfw', 'words');

View File

@ -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 .= '<div class="pageheader">' . $s . '</div>';

View File

@ -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)

View File

@ -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'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/showmore/showmore.css'.'" media="all"/>'."\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);

View File

@ -97,9 +97,9 @@ function smileybutton_jot_tool(Friendica\App $a, &$b)
$s .= '</tr></table>';
//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);

View File

@ -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'] .= '<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');
if (!$words) {