use url handler for css

This commit is contained in:
Jean-Christian Denis 2021-10-30 22:05:31 +02:00
parent e462baba87
commit b2b7484206
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 23 additions and 7 deletions

View file

@ -19,4 +19,11 @@ $d = dirname(__FILE__) . '/inc/';
$__autoload['libEPC'] = $d . 'lib.epc.php';
$__autoload['epcRecords'] = $d . 'lib.epc.records.php';
$__autoload['adminEpcList'] = $d . 'lib.epc.pager.php';
$__autoload['adminEpcList'] = $d . 'lib.epc.pager.php';
$core->url->register(
'epccss',
'epc.css',
'^epc\.css',
['publicEnhancePostContent', 'css']
);

View file

@ -45,12 +45,16 @@ class publicEnhancePostContent
*/
public static function publicHeadContent(dcCore $core)
{
echo dcUtils::cssLoad($core->blog->url . $core->url->getURLFor('epccss'));
}
public static function css($args)
{
$css = [];
$filters = libEPC::blogFilters();
foreach($filters as $name => $filter) {
if (empty($filter['class'])
|| empty($filter['style'])) {
if (empty($filter['class']) || empty($filter['style'])) {
continue;
}
@ -63,11 +67,16 @@ class publicEnhancePostContent
}
if (!empty($res)) {
echo
"\n<!-- CSS for enhancePostContent " . $name . " --> \n" .
"<style type=\"text/css\"> " . $res . "</style> \n";
$css[] =
"/* CSS for enhancePostContent " . $name . " */ \n" . $res . "\n";
}
}
header('Content-Type: text/css; charset=UTF-8');
echo implode("\n", $css);
exit;
}
/**