/** * @param string $path * @return bool|null */ private function less($path) { $inputfile = HOME_DIR . '/templates/' . \App::get('template') . '/less/' . str_replace('.css', '.less', $path); $this->cache->sendHeaders($inputfile); $cget = $this->cache->get($inputfile); if (false != $cget) { $this->response->setMIME('text/css')->out($cget); return true; } $file = new \File($inputfile); if ($file->exists()) { $less = new \LessC(); $less->setFormatter('LessJS'); $output = $this->compress($this->optimize($less->compileFile($inputfile))); $this->cache->set($inputfile, $output); $this->cache->sendHeaders($output); $this->response->setMIME('text/css')->out($output); return true; } else { return false; } }
protected function to($what, &$out, $until = false, $allowNewline = false) { if (is_string($allowNewline)) { $validChars = $allowNewline; } else { $validChars = $allowNewline ? "." : "[^\n]"; } if (!$this->match('(' . $validChars . '*?)' . lessc::preg_quote($what), $m, !$until)) { return false; } if ($until) { $this->count -= strlen($what); } // give back $what $out = $m[1]; return true; }