fixed assets path

main
Robert 3 years ago
parent d18c7f112f
commit 8ea3221fdc
  1. 6
      src/bootstrap/site_helper.php
  2. 2
      src/classes/assets.php
  3. 28
      src/classes/html_document.php

@ -208,15 +208,11 @@ final class site_helper {
$up_one = dirname(self::$ROOT, 1);
$project = self::$PRJ;
/**
* @todo Remove once DONE: TTS_BASE_REF
*/
define('TTS_BASE_REF', ''); // REmove once DONE
if (!empty(self::get_route())) {
define('TTS_SITE_URL', self::tts_site_url());
define('TTS_PROJECT_BASE_REF', TTS_SITE_URL . $project);
define("TTS_BROWSER", \tts\safer_io::get_clean_server_var('HTTP_USER_AGENT'));
define('PROJECT_ASSETS_BASE_REF', '/assets');
define('PROJECT_ASSETS_BASE_REF', "/assets/" . $project);
define("PROJECT_ASSETS_DIR", $up_one . "/public/assets/" . $project);
} else {
// Web Server URI not found

@ -14,7 +14,7 @@ final class assets {
public static function get_ajax_files(string $ajax_folder): string {
$safe_folder = \tts\security::filter_uri($ajax_folder);
$ret = "var assets_files = [];" . PHP_EOL;
$js = glob($safe_folder . "*.{js,css}", GLOB_BRACE);
foreach($js as $file) {

@ -32,15 +32,35 @@ class html_document {
$css = \tts\main\configure::get('html', 'css');
if (\tts\common::get_count($css) > 0) {
foreach($css as $file=>$path) {
if (is_array($file) || is_array($path)) continue;
$this->add_css($file, $path);
if (is_array($file)) continue;
if (is_array($path)) {
if (isset($path['path'])) {
$path_type = $path['path'];
unset($path['path']);
} else {
$path_type = "project";
}
$this->add_css($file, $path_type, $path);
} else {
$this->add_css($file, $path);
}
}
}
$js = \tts\main\configure::get('html', 'javascript');
if (\tts\common::get_count($js) >0) {
foreach($js as $file=>$path) {
if (is_array($file) || is_array($path)) continue;
$this->add_js($file, $path);
if (is_array($file)) continue;
if (is_array($path)) {
if (isset($path['path'])) {
$path_type = $path['path'];
unset($path['path']);
} else {
$path_type = "project";
}
$this->add_js($file, $path_type, $path);
} else {
$this->add_js($file, $path);
}
}
}
}

Loading…
Cancel
Save