lunarPhase/_prepend.php

51 lines
1.4 KiB
PHP
Raw Normal View History

2015-04-23 16:45:00 +00:00
<?php
2022-12-15 21:26:10 +00:00
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke and Contributors
*
* @copyright Jean-Crhistian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
2015-04-23 16:45:00 +00:00
2022-12-15 21:26:10 +00:00
Clearbricks::lib()->autoload(['lunarPhase' => __DIR__ . '/inc/class.lunarphase.php']);
2015-04-23 16:45:00 +00:00
2022-12-15 21:26:10 +00:00
// Register lunarphase CSS URL
dcCore::app()->url->register(
'lunarphase',
'lunarphase.css',
'^lunarphase\.css',
function ($args) {
$phases = [
'new_moon' => 'nm',
'waxing_crescent_moon' => 'wcm1',
'first_quarter_moon' => 'fqm',
'waxing_gibbous_moon' => 'wgm1',
'full_moon' => 'fm',
'waning_gibbous_moon' => 'wgm2',
'last_quarter_moon' => 'tqm',
'waning_crescent_moon' => 'wcm2',
];
header('Content-Type: text/css; charset=UTF-8');
echo "/* lunarphase widget style */\n";
foreach ($phases as $phase => $image) {
echo
sprintf(
'#sidebar .lunarphase ul li.%s{background:transparent url(%s) no-repeat left 0.2em;padding-left:2em;}',
$phase,
dcCore::app()->blog->getPF(basename(__dir__) . '/img/' . $image . '.png')
) . "\n";
}
exit;
}
);