/** * Add a css file to the page * @since gpEasy 4.0 * @param string $file The path of the css file relative to the addon folder * @param bool $combine Set to false to keep the file from being combined with other css files */ static function css($file, $combine = true) { global $page; $file = common::WinPath($file); if ($combine) { $page->css_admin[] = self::$current['code_folder_part'] . '/' . ltrim($file, '/'); return self::$current['code_folder_part'] . '/' . ltrim($file, '/'); } //less file if (substr($file, -5) === '.less') { $full_path = self::$current['code_folder_full'] . '/' . ltrim($file, '/'); $path = gpOutput::CacheLess($full_path); } else { $path = self::$current['code_folder_part'] . '/' . ltrim($file, '/'); } $page->head .= "\n" . '<link rel="stylesheet" type="text/css" href="' . common::GetDir($path) . '"/>'; return $path; }
/** * Return a list of css files used by the current layout * */ static function LayoutStyleFiles() { global $page, $dataDir; $files = array(); $custom_file = $dataDir . '/data/_layouts/' . $page->gpLayout . '/custom.css'; //css file if (file_exists($page->theme_dir . '/' . $page->theme_color . '/style.css')) { $files[] = rawurldecode($page->theme_path) . '/style.css'; if ($page->gpLayout && file_exists($custom_file)) { $files[] = gpOutput::CacheLess($custom_file); } return $files; } //less file $files[] = $page->theme_dir . '/' . $page->theme_color . '/style.less'; //variables.less $var_file = $page->theme_dir . '/' . $page->theme_color . '/variables.less'; if (file_exists($var_file)) { $files[] = $var_file; } if ($page->gpLayout && file_exists($custom_file)) { $files[] = $custom_file; } $files = array(gpOutput::CacheLess($files)); return $files; }
static function PrepareLess() { global $dataDir; $less_files = $dataDir . '/include/css/admin.less'; gpOutput::CacheLess($less_files); }