2019-08-30 19:30:19 +02:00
|
|
|
<?php
|
2021-11-29 01:25:11 +01:00
|
|
|
require_once('global.php');
|
|
|
|
require_once(CRAYON_RESOURCE_PHP);
|
2019-08-30 19:30:19 +02:00
|
|
|
|
|
|
|
/* Manages fonts once they are loaded. */
|
|
|
|
|
2021-11-29 01:25:11 +01:00
|
|
|
class CrayonFonts extends CrayonUserResourceCollection
|
|
|
|
{
|
|
|
|
// Properties and Constants ===============================================
|
2019-08-30 19:30:19 +02:00
|
|
|
|
2021-11-29 01:25:11 +01:00
|
|
|
const DEFAULT_FONT = 'monaco';
|
|
|
|
const DEFAULT_FONT_NAME = 'Monaco';
|
2019-08-30 19:30:19 +02:00
|
|
|
|
2021-11-29 01:25:11 +01:00
|
|
|
// Methods ================================================================
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
$this->set_default(self::DEFAULT_FONT, self::DEFAULT_FONT_NAME);
|
2019-08-30 19:30:19 +02:00
|
|
|
$this->directory(CRAYON_FONT_PATH);
|
|
|
|
$this->relative_directory(CRAYON_FONT_DIR);
|
|
|
|
$this->extension('css');
|
|
|
|
|
|
|
|
CrayonLog::debug("Setting font directories");
|
|
|
|
$upload = CrayonGlobalSettings::upload_path();
|
|
|
|
if ($upload) {
|
|
|
|
$this->user_directory($upload . CRAYON_FONT_DIR);
|
|
|
|
if (!is_dir($this->user_directory())) {
|
|
|
|
CrayonGlobalSettings::mkdir($this->user_directory());
|
|
|
|
CrayonLog::debug($this->user_directory(), "FONT USER DIR");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
CrayonLog::syslog("Upload directory is empty: " . $upload . " cannot load fonts.");
|
|
|
|
}
|
|
|
|
CrayonLog::debug($this->directory());
|
|
|
|
CrayonLog::debug($this->user_directory());
|
2021-11-29 01:25:11 +01:00
|
|
|
}
|
2019-08-30 19:30:19 +02:00
|
|
|
|
|
|
|
}
|