/** * Preview changes to the custom css/less * */ public function PreviewCSS() { global $langmessage; $layout_info = \gp\tool::LayoutInfo($this->curr_layout, false); $this->page->theme_color = $layout_info['theme_color']; $this->page->theme_rel = dirname($this->page->theme_rel) . '/' . $this->page->theme_color; $this->page->theme_path = dirname($this->page->theme_path) . '/' . $this->page->theme_color; $dir = $this->page->theme_dir . '/' . $this->page->theme_color; $style_type = \gp\tool\Output::StyleType($dir); $style_files = array(); if ($style_type == 'scss') { $this->PreviewScss($dir); return; } // which css files if ($style_type == 'css') { $this->page->css_user[] = rawurldecode($this->page->theme_path) . '/style.css'; } else { $style_files[] = $dir . '/style.less'; } // variables.less $var_file = $dir . '/variables.less'; if (file_exists($var_file)) { $style_files[] = $var_file; } $temp = trim($_REQUEST['css']); if (!empty($temp)) { $style_files[] = $_REQUEST['css'] . "\n"; //make sure this is seen as code and not a filename } if (count($style_files)) { $compiled = \gp\tool\Output\Css::ParseLess($style_files); if ($compiled === false) { message($langmessage['OOPS'] . ' (Invalid LESS)'); return false; } $this->page->head .= '<style>' . $compiled . '</style>'; } $this->page->get_theme_css = false; }